commit cd008984e8ca02197d579ed58f65fcba4e69dfcf
parent d86fa0e855da2b986cdf7350e9847d2114d699e4
Author: triesap <tyson@radroots.org>
Date: Wed, 29 Jul 2026 10:15:09 +0000
event: quarantine superseded package surface
- remove redundant prefixed native event names and retired module paths
- quarantine lossy post and profile projections in the private codec
- migrate lib and SDK consumers to canonical event and identity types
- refresh API contract and SourceMaintenance evidence under full gates
Diffstat:
339 files changed, 15373 insertions(+), 17025 deletions(-)
diff --git a/contracts/conformance/vectors/social/upgraded_boundaries.v1.json b/contracts/conformance/vectors/social/upgraded_boundaries.v1.json
@@ -66,7 +66,7 @@
},
"expected": {
"result": "ok",
- "model": "RadrootsList"
+ "model": "List"
}
},
{
diff --git a/contracts/conformance/vectors/trade/build_mutation_event.v1.json b/contracts/conformance/vectors/trade/build_mutation_event.v1.json
@@ -28,7 +28,7 @@
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
]
],
- "content_shape": "RadrootsTradeMutationEnvelopeV1"
+ "content_shape": "TradeMutationEnvelopeV1"
}
}
}
diff --git a/contracts/conformance/vectors/trade/parse_mutation_event.v1.json b/contracts/conformance/vectors/trade/parse_mutation_event.v1.json
@@ -10,11 +10,11 @@
"kind": 3470,
"contract_tag": "radroots.trade.proposal.v1",
"trade_id_tag": "11111111111111111111111111111111",
- "content_shape": "RadrootsTradeMutationEnvelopeV1"
+ "content_shape": "TradeMutationEnvelopeV1"
}
},
"expected": {
- "envelope_shape": "RadrootsTradeMutationEnvelopeV1",
+ "envelope_shape": "TradeMutationEnvelopeV1",
"rejects": [
"kind_contract_mismatch",
"contract_tag_mismatch",
diff --git a/contracts/event_boundary_matrix.md b/contracts/event_boundary_matrix.md
@@ -49,7 +49,7 @@ reference existence or relay availability.
Calendar kinds `31922` through `31925` expose separate authored,
baseline-parsed, and strict-admitted types. A structural
-`RadrootsEventEnvelope` is not cryptographic verification, and neither the
+`EventEnvelope` is not cryptographic verification, and neither the
NIP-52 parser nor Radroots admission verifies the declared event id or Schnorr
signature. A read-side runtime must keep the parsed or admitted value bound to
an envelope whose id and signature it has independently verified and whose kind
@@ -59,8 +59,8 @@ wire parts and require runtime signing and transport.
## Classified-listing profile boundary rule
Kind `30402` is the standard NIP-99 classified-listing kind and
-`RadrootsClassifiedListingAddress` is the exact coordinate authority for that
-kind. `RadrootsOperationalListing` is the richer
+`ClassifiedListingAddress` is the exact coordinate authority for that
+kind. `OperationalListing` is the richer
`radroots.operational_listing.published.v1` profile accepted at the same kind;
its typed codec, tags, and publication operations are exposed under the
`operational_listing` domain. The standard kind identity does not by itself
@@ -132,7 +132,7 @@ thread-excluded candidates in distinct public variants. Exact subtype registry
contracts are admission-only and cannot be selected by unsigned kind/tag
matching. New root publication uses the strict authored types and a sealed
Nostr builder with no raw tag/content mutation; generic builder publication
-rejects every kind `1` event before signing. The legacy mutable `RadrootsPost`
+rejects every kind `1` event before signing. The legacy mutable `Post`
decoder is compatibility-only and has no authored encoder or tag-builder
implementation.
@@ -152,7 +152,7 @@ enrichment, and a Reply carrying Ask or media metadata cannot be promoted as a
root card.
Authored and projected NIP-10 Reply and NIP-22 Comment relay hints share the
-portable `RadrootsNostrRelayHint` profile:
+portable `NostrRelayHint` profile:
exact lowercase `ws://` or `wss://`, visible ASCII, canonical lowercase DNS or
four-octet IPv4 or bracketed pure-hex RFC 5952 IPv6, optional canonical port
`1..65535`, and RFC 3986 path-abempty/query syntax with uppercase `%HH`
@@ -179,7 +179,7 @@ root-author authority. Supported root kinds are only classified listings
External `I`/`i` roots and parents and ordinary kind-`1` roots are outside this
profile.
-Strict authoring exposes `RadrootsAuthoredNip22Comment` for top-level event,
+Strict authoring exposes `AuthoredNip22Comment` for top-level event,
top-level address, and nested Comment positions. It emits exact ordered
`E,K,P,e,k,p` for a top-level event, `A,K,P,a,e,k,p` for a top-level
address, and `E,K,P,e,k,p` or `A,K,P,e,k,p` for a nested event or address
@@ -272,50 +272,50 @@ not weaken or add effect fields to the request corpus.
| Domain | Kind | Radroots Type | RPC Methods | Notes |
| --- | --- | --- | --- | --- |
-| profile | 0 | RadrootsAuthoredProfile / RadrootsInboundProfileMetadata | events.profile.publish, events.profile.list, events.profile.get | publish must use `profile.build_authored_draft`; inbound projection must use `profile.parse_inbound_metadata`; authored output is deterministic JSON with no marker tag |
-| follow | 3 | RadrootsFollow | events.follow.publish, events.follow.list, events.follow.get | replaceable event |
-| post | 1 | RadrootsAuthoredUpdate / RadrootsAuthoredPhotoUpdate / RadrootsAuthoredAsk / RadrootsInboundPostProjection | events.post.publish, events.post.list, events.post.get | ordinary kind-1 reads remain generic; exact root-card subtypes require verified admission; any `e` tag produces a thread-excluded candidate without a Reply claim |
-| reply | 1 | RadrootsAuthoredNip10Reply / RadrootsInboundNip10ReplyProjection / RadrootsAdmittedNip10ReplyEvent / RadrootsNostrNip10ReplyEventBuilder | social.reply.build_authored_draft, social.reply.project_verified_event, social.reply.verify_and_admit_event | strict marked direct/nested NIP-10 authoring; verified marked or positional inbound admission with advisory-metadata diagnostics; never a root card; target existence, kind, author, and relay availability are not proven |
-| comment | 1111 | RadrootsAuthoredNip22Comment / RadrootsInboundNip22CommentProjection / RadrootsAdmittedNip22CommentEvent / RadrootsNostrNip22CommentEventBuilder | social.comment.build_authored_draft, social.comment.project_verified_event, social.comment.verify_and_admit_event | strict NIP-22 event/address roots limited to kinds `30402`, `31922`, and `31923`; tolerant verified projection; registry-v7 typed-only authoring and admission-only matching |
-| deletion_request | 5 | RadrootsAuthoredNip09DeletionRequest / RadrootsInboundNip09DeletionProjection / RadrootsAdmittedNip09DeletionRequestEvent / RadrootsNip09SuppressionDecision / RadrootsNostrNip09DeletionRequestEventBuilder | social.deletion_request.build_authored_draft, social.deletion_request.project_verified_event, social.deletion_request.verify_and_admit_event, social.deletion_request.evaluate_suppression | effect-free NIP-09 request authoring and verified projection plus pure immutable suppression evaluation; same-author direct event targets and inclusive address cutoffs; kind-5 immunity; advisory kinds ignored; registry-v7 typed-only authoring and admission-only matching |
-| reaction | 7 | RadrootsReaction | events.reaction.publish, events.reaction.list, events.reaction.get | requires event, pubkey, or address tags |
-| repost | 6 | RadrootsRepost | events.repost.publish, events.repost.list, events.repost.get | NIP-18 kind-1 repost surface |
-| generic_repost | 16 | RadrootsGenericRepost | events.generic_repost.publish, events.generic_repost.list, events.generic_repost.get | NIP-18 generic repost surface |
-| seal | 13 | RadrootsSeal | events.seal.encode, events.seal.decode | tags must be empty; used for NIP-59 transport |
-| message | 14 | RadrootsMessage | events.message.publish, events.message.list, events.message.get | rumor event; unsigned before wrapping |
-| message_file | 15 | RadrootsMessageFile | events.message_file.publish, events.message_file.list, events.message_file.get | rumor event with file tags |
-| gift_wrap | 1059 | RadrootsGiftWrap | events.gift_wrap.publish, events.gift_wrap.list, events.gift_wrap.get | requires `p` tag; optional expiration |
-| public_file_metadata | 1063 | RadrootsFileMetadata | events.public_file_metadata.publish, events.public_file_metadata.list, events.public_file_metadata.get | public NIP-94 file metadata, distinct from private farm file metadata |
-| report | 1984 | RadrootsReport | events.report.publish, events.report.list, events.report.get | NIP-56 report with required reported pubkey |
-| list | 10000..10102 | RadrootsList | events.list.publish, events.list.list, events.list.get | replaceable NIP-51 list kinds excluding kind 3 |
-| relay_list | 10002 | RadrootsList | events.relay_list.publish, events.relay_list.list, events.relay_list.get | NIP-65 relay list entries with `read` or `write` markers |
-| list_set | 30000..30007, 30015, 30030, 30063, 30267, 39089, 39092 | RadrootsListSet | events.list_set.publish, events.list_set.list, events.list_set.get | enumerated addressable NIP-51 list sets with `d` tag; NIP-52 kind `31924` is exclusively the calendar surface |
-| article | 30023 | RadrootsArticle | events.article.publish, events.article.list, events.article.get | NIP-23 long-form content |
+| profile | 0 | AuthoredProfile / RadrootsInboundProfileMetadata | events.profile.publish, events.profile.list, events.profile.get | publish must use `profile.build_authored_draft`; inbound projection must use `profile.parse_inbound_metadata`; authored output is deterministic JSON with no marker tag |
+| follow | 3 | Follow | events.follow.publish, events.follow.list, events.follow.get | replaceable event |
+| post | 1 | AuthoredUpdate / AuthoredPhotoUpdate / AuthoredAsk / RadrootsInboundPostProjection | events.post.publish, events.post.list, events.post.get | ordinary kind-1 reads remain generic; exact root-card subtypes require verified admission; any `e` tag produces a thread-excluded candidate without a Reply claim |
+| reply | 1 | AuthoredNip10Reply / RadrootsInboundNip10ReplyProjection / RadrootsAdmittedNip10ReplyEvent / RadrootsNostrNip10ReplyEventBuilder | social.reply.build_authored_draft, social.reply.project_verified_event, social.reply.verify_and_admit_event | strict marked direct/nested NIP-10 authoring; verified marked or positional inbound admission with advisory-metadata diagnostics; never a root card; target existence, kind, author, and relay availability are not proven |
+| comment | 1111 | AuthoredNip22Comment / RadrootsInboundNip22CommentProjection / RadrootsAdmittedNip22CommentEvent / RadrootsNostrNip22CommentEventBuilder | social.comment.build_authored_draft, social.comment.project_verified_event, social.comment.verify_and_admit_event | strict NIP-22 event/address roots limited to kinds `30402`, `31922`, and `31923`; tolerant verified projection; registry-v7 typed-only authoring and admission-only matching |
+| deletion_request | 5 | AuthoredNip09DeletionRequest / RadrootsInboundNip09DeletionProjection / RadrootsAdmittedNip09DeletionRequestEvent / RadrootsNip09SuppressionDecision / RadrootsNostrNip09DeletionRequestEventBuilder | social.deletion_request.build_authored_draft, social.deletion_request.project_verified_event, social.deletion_request.verify_and_admit_event, social.deletion_request.evaluate_suppression | effect-free NIP-09 request authoring and verified projection plus pure immutable suppression evaluation; same-author direct event targets and inclusive address cutoffs; kind-5 immunity; advisory kinds ignored; registry-v7 typed-only authoring and admission-only matching |
+| reaction | 7 | Reaction | events.reaction.publish, events.reaction.list, events.reaction.get | requires event, pubkey, or address tags |
+| repost | 6 | Repost | events.repost.publish, events.repost.list, events.repost.get | NIP-18 kind-1 repost surface |
+| generic_repost | 16 | GenericRepost | events.generic_repost.publish, events.generic_repost.list, events.generic_repost.get | NIP-18 generic repost surface |
+| seal | 13 | Seal | events.seal.encode, events.seal.decode | tags must be empty; used for NIP-59 transport |
+| message | 14 | Message | events.message.publish, events.message.list, events.message.get | rumor event; unsigned before wrapping |
+| message_file | 15 | MessageFile | events.message_file.publish, events.message_file.list, events.message_file.get | rumor event with file tags |
+| gift_wrap | 1059 | GiftWrap | events.gift_wrap.publish, events.gift_wrap.list, events.gift_wrap.get | requires `p` tag; optional expiration |
+| public_file_metadata | 1063 | FileMetadata | events.public_file_metadata.publish, events.public_file_metadata.list, events.public_file_metadata.get | public NIP-94 file metadata, distinct from private farm file metadata |
+| report | 1984 | Report | events.report.publish, events.report.list, events.report.get | NIP-56 report with required reported pubkey |
+| list | 10000..10102 | List | events.list.publish, events.list.list, events.list.get | replaceable NIP-51 list kinds excluding kind 3 |
+| relay_list | 10002 | List | events.relay_list.publish, events.relay_list.list, events.relay_list.get | NIP-65 relay list entries with `read` or `write` markers |
+| list_set | 30000..30007, 30015, 30030, 30063, 30267, 39089, 39092 | ListSet | events.list_set.publish, events.list_set.list, events.list_set.get | enumerated addressable NIP-51 list sets with `d` tag; NIP-52 kind `31924` is exclusively the calendar surface |
+| article | 30023 | Article | events.article.publish, events.article.list, events.article.get | NIP-23 long-form content |
| knowledge | 818, 3460..3465, 30450..30451, 30818..30819 | RadrootsKnowledgeEvent | events.knowledge.publish, events.knowledge.list, events.knowledge.get | NIP-54 wiki plus Radroots knowledge source, claim, relation, review, field-report, bounty, proposal, and contribution contracts |
-| app_data | 30078 | RadrootsAppData | events.app_data.publish, events.app_data.list, events.app_data.get | addressable app data with `d` tag |
+| app_data | 30078 | AppData | events.app_data.publish, events.app_data.list, events.app_data.get | addressable app data with `d` tag |
| app_handler | 31990 | KIND_APPLICATION_HANDLER | events.app_handler.publish, events.app_handler.list, events.app_handler.get | optional discoverability |
-| calendar_date | 31922 | RadrootsAuthoredCalendarDateEvent / RadrootsParsedNip52CalendarDateEvent / RadrootsAdmittedCalendarDateEvent | events.calendar_date.publish, events.calendar_date.list, events.calendar_date.get | NIP-52 date event; baseline retains uppercase-`D` extensions, strict admission rejects them |
-| calendar_time | 31923 | RadrootsAuthoredCalendarTimeEvent / RadrootsParsedNip52CalendarTimeEvent / RadrootsAdmittedCalendarTimeEvent | events.calendar_time.publish, events.calendar_time.list, events.calendar_time.get | NIP-52 time event; baseline applies required day anchoring, strict admission requires exact bounded UTC-day coverage |
-| calendar | 31924 | RadrootsAuthoredCalendar / RadrootsParsedNip52Calendar / RadrootsAdmittedCalendar | events.calendar.publish, events.calendar.list, events.calendar.get | NIP-52 calendar collection with separate authored, baseline parse, and strict Radroots admission boundaries |
-| calendar_rsvp | 31925 | RadrootsAuthoredCalendarEventRsvp / RadrootsParsedNip52CalendarEventRsvp / RadrootsAdmittedCalendarEventRsvp | events.calendar_rsvp.publish, events.calendar_rsvp.list, events.calendar_rsvp.get | NIP-52 calendar RSVP with separate authored, baseline parse, and strict Radroots admission boundaries |
-| farm | 30340 | RadrootsFarm | events.farm.publish, events.farm.list, events.farm.get | addressable; canonical JSON; `g` tag only when a geohash exists |
-| plot | 30350 | RadrootsPlot | events.plot.publish, events.plot.list, events.plot.get | requires address and pubkey tags; preserve self-tag |
-| coop | 30360 | RadrootsCoop | events.coop.publish, events.coop.list, events.coop.get | addressable; canonical JSON; `g` tag from geohash |
-| document | 30361 | RadrootsDocument | events.document.publish, events.document.list, events.document.get | requires `d` and pubkey tags; optional address tag |
-| resource_area | 30370 | RadrootsResourceArea | events.resource_area.publish, events.resource_area.list, events.resource_area.get | addressable; GCS location and `g` tag required |
-| resource_cap | 30371 | RadrootsResourceHarvestCap | events.resource_cap.publish, events.resource_cap.list, events.resource_cap.get | addressable; required address, pubkey, key, start, and end tags |
-| food_availability | 30402 | RadrootsFoodAvailabilityDetails / RadrootsInboundFoodAvailabilityProjection / RadrootsAdmittedFoodAvailabilityEvent / RadrootsNostrFoodAvailabilityEventBuilder | food_availability.build_authored_draft, food_availability.project_verified_event, food_availability.verify_and_admit_event, food_availability.validate_revision | focused `radroots.food.availability.v1` profile; strict deterministic authoring, verified projection/admission, stable-coordinate revision validation, sealed Nostr signing/publication, generic-authoring reservation, and raw-head-first partitioning only behind the non-default `legacy-ingest` replica feature; BUD-02 upload evidence remains a runtime prerequisite |
-| operational_listing | 30402 | RadrootsOperationalListing | events.operational_listing.publish, events.operational_listing.list, events.operational_listing.get | NIP-99 classified-listing kind with the richer Radroots operational profile; canonical Markdown content and tags; farm author required |
-| dvm_request | 5000-5999 | RadrootsJobRequest | events.dvm_request.publish, events.dvm_request.list, events.dvm_request.get | generic DVM request surface |
-| dvm_result | 6000-6999 | RadrootsJobResult | events.dvm_result.publish, events.dvm_result.list, events.dvm_result.get | generic DVM result surface |
-| dvm_feedback | 7000 | RadrootsJobFeedback | events.dvm_feedback.publish, events.dvm_feedback.list, events.dvm_feedback.get | generic DVM feedback surface |
-| trade:proposal | 3470 | RadrootsTradeMutationEnvelopeV1 | trade.get_trade, trade.list_trades, trade.submit_proposal | buyer-authored initial complete candidate mutation with canonical semantic identity |
-| trade:decision | 3471 | RadrootsTradeMutationEnvelopeV1 | trade.decide_candidate, trade.get_trade, trade.list_trades | exact accept or decline mutation for a referenced candidate and proposal mutation |
-| trade:revision_proposal | 3472 | RadrootsTradeMutationEnvelopeV1 | trade.get_trade, trade.list_trades, trade.propose_revision | buyer- or seller-authored complete replacement candidate referencing bounded parent heads |
-| trade:revision_decision | 3473 | RadrootsTradeMutationEnvelopeV1 | trade.decide_candidate, trade.get_trade, trade.list_trades | exact accept or decline mutation for a referenced revision candidate and proposal mutation |
-| trade:cancellation | 3474 | RadrootsTradeMutationEnvelopeV1 | trade.cancel_trade, trade.get_trade, trade.list_trades | policy-authorized cancellation mutation referencing the relevant candidate or current claim |
+| calendar_date | 31922 | AuthoredCalendarDateEvent / ParsedNip52CalendarDateEvent / AdmittedCalendarDateEvent | events.calendar_date.publish, events.calendar_date.list, events.calendar_date.get | NIP-52 date event; baseline retains uppercase-`D` extensions, strict admission rejects them |
+| calendar_time | 31923 | AuthoredCalendarTimeEvent / ParsedNip52CalendarTimeEvent / AdmittedCalendarTimeEvent | events.calendar_time.publish, events.calendar_time.list, events.calendar_time.get | NIP-52 time event; baseline applies required day anchoring, strict admission requires exact bounded UTC-day coverage |
+| calendar | 31924 | AuthoredCalendar / ParsedNip52Calendar / AdmittedCalendar | events.calendar.publish, events.calendar.list, events.calendar.get | NIP-52 calendar collection with separate authored, baseline parse, and strict Radroots admission boundaries |
+| calendar_rsvp | 31925 | AuthoredCalendarEventRsvp / ParsedNip52CalendarEventRsvp / AdmittedCalendarEventRsvp | events.calendar_rsvp.publish, events.calendar_rsvp.list, events.calendar_rsvp.get | NIP-52 calendar RSVP with separate authored, baseline parse, and strict Radroots admission boundaries |
+| farm | 30340 | Farm | events.farm.publish, events.farm.list, events.farm.get | addressable; canonical JSON; `g` tag only when a geohash exists |
+| plot | 30350 | Plot | events.plot.publish, events.plot.list, events.plot.get | requires address and pubkey tags; preserve self-tag |
+| coop | 30360 | Coop | events.coop.publish, events.coop.list, events.coop.get | addressable; canonical JSON; `g` tag from geohash |
+| document | 30361 | Document | events.document.publish, events.document.list, events.document.get | requires `d` and pubkey tags; optional address tag |
+| resource_area | 30370 | ResourceArea | events.resource_area.publish, events.resource_area.list, events.resource_area.get | addressable; GCS location and `g` tag required |
+| resource_cap | 30371 | ResourceHarvestCap | events.resource_cap.publish, events.resource_cap.list, events.resource_cap.get | addressable; required address, pubkey, key, start, and end tags |
+| food_availability | 30402 | FoodAvailabilityDetails / RadrootsInboundFoodAvailabilityProjection / RadrootsAdmittedFoodAvailabilityEvent / RadrootsNostrFoodAvailabilityEventBuilder | food_availability.build_authored_draft, food_availability.project_verified_event, food_availability.verify_and_admit_event, food_availability.validate_revision | focused `radroots.food.availability.v1` profile; strict deterministic authoring, verified projection/admission, stable-coordinate revision validation, sealed Nostr signing/publication, generic-authoring reservation, and raw-head-first partitioning only behind the non-default `legacy-ingest` replica feature; BUD-02 upload evidence remains a runtime prerequisite |
+| operational_listing | 30402 | OperationalListing | events.operational_listing.publish, events.operational_listing.list, events.operational_listing.get | NIP-99 classified-listing kind with the richer Radroots operational profile; canonical Markdown content and tags; farm author required |
+| dvm_request | 5000-5999 | JobRequest | events.dvm_request.publish, events.dvm_request.list, events.dvm_request.get | generic DVM request surface |
+| dvm_result | 6000-6999 | JobResult | events.dvm_result.publish, events.dvm_result.list, events.dvm_result.get | generic DVM result surface |
+| dvm_feedback | 7000 | JobFeedback | events.dvm_feedback.publish, events.dvm_feedback.list, events.dvm_feedback.get | generic DVM feedback surface |
+| trade:proposal | 3470 | TradeMutationEnvelopeV1 | trade.get_trade, trade.list_trades, trade.submit_proposal | buyer-authored initial complete candidate mutation with canonical semantic identity |
+| trade:decision | 3471 | TradeMutationEnvelopeV1 | trade.decide_candidate, trade.get_trade, trade.list_trades | exact accept or decline mutation for a referenced candidate and proposal mutation |
+| trade:revision_proposal | 3472 | TradeMutationEnvelopeV1 | trade.get_trade, trade.list_trades, trade.propose_revision | buyer- or seller-authored complete replacement candidate referencing bounded parent heads |
+| trade:revision_decision | 3473 | TradeMutationEnvelopeV1 | trade.decide_candidate, trade.get_trade, trade.list_trades | exact accept or decline mutation for a referenced revision candidate and proposal mutation |
+| trade:cancellation | 3474 | TradeMutationEnvelopeV1 | trade.cancel_trade, trade.get_trade, trade.list_trades | policy-authorized cancellation mutation referencing the relevant candidate or current claim |
| trade:validation_receipt | 3440 | RadrootsTradeValidationReceipt | domains.trade.validation_receipt.get, domains.trade.validation_receipt.list, domains.trade.validation_receipt.verify | proof and inspection artifact around canonical signed trade events and deterministic reducer output; not buyer receipt state, payment state, order mutation, or trade authority |
-| relay_doc | N/A | RadrootsRelayDocument | system.relay_doc.get | HTTP NIP-11 info via relay fetch helper |
+| relay_doc | N/A | RelayDocument | system.relay_doc.get | HTTP NIP-11 info via relay fetch helper |
## Membership list sets and claims
diff --git a/contracts/events/profile-metadata.md b/contracts/events/profile-metadata.md
@@ -34,7 +34,7 @@ key; a canonical-length hex value that is not a curve point returns
decoding are a later optional stage and cannot be substituted for general event
verification.
-The direct legacy `RadrootsProfile` codec, Profile-specific Nostr/network
+The direct legacy `Profile` codec, Profile-specific Nostr/network
publish helpers, and replica Profile draft emission were removed in the
`1.0.0-alpha.1` breaking contract. A replica Profile row is a lossy inbound
projection and cannot prove author intent for a complete kind-`0` replacement.
@@ -59,12 +59,12 @@ establish verified event admission, and must not be used as its substitute.
## Strict authored boundary
-`RadrootsAuthoredProfile` has private fields and requires a non-whitespace,
+`AuthoredProfile` has private fields and requires a non-whitespace,
control-free `name`, consistent with the NIP-24 recommendation that `name`
remain present when `display_name` is used. The scoped optional fields are
`display_name`, `about`, `nip05`, `bot`, `picture`, and `banner`; `bot` is a
-Boolean. NIP-05 values enter only through `RadrootsNip05Identifier`. Picture and
-banner values enter through the shared `RadrootsAuthoredImage`, which can wrap
+Boolean. NIP-05 values enter only through `Nip05Identifier`. Picture and
+banner values enter through the shared `AuthoredImage`, which can wrap
only an `image/*` `ByteVerifiedDescriptor`. There is no raw-string
media setter or unchecked deserialization path. Generic `website`, `lud06`, and
`lud16` strings remain outside this strict authored operation.
@@ -126,7 +126,7 @@ through the raw content view.
## NIP-05 boundary
-`RadrootsNip05Identifier` requires exactly one `@`, a non-empty local part using
+`Nip05Identifier` requires exactly one `@`, a non-empty local part using
only lowercase `a-z`, digits, `-`, `_`, or `.`, and an ASCII DNS domain.
Domain matching is case-insensitive, so accepted domains are canonicalized to
lowercase. Parsing is syntax-only. It performs no HTTPS lookup and never
diff --git a/contracts/events/social-events.md b/contracts/events/social-events.md
@@ -37,8 +37,8 @@ The repository implements strict authored and verified-projected kind `1` root-p
separate strict-authored and tolerant-inbound kind `1` NIP-10 Reply profile, a strict-authored and
tolerant verified-inbound kind `1111` NIP-22 Comment profile, a strict-authored and tolerant
verified-inbound kind `5` NIP-09 deletion-request profile with pure deterministic suppression
-evaluation, kind `7` `RadrootsReaction`, generic `RadrootsList` entries, operational listing
-records through `RadrootsOperationalListing`, the raw kind-`30402` profile partition and validated
+evaluation, kind `7` `Reaction`, generic `List` entries, operational listing
+records through `OperationalListing`, the raw kind-`30402` profile partition and validated
FoodAvailability authored, verified-admission, and revision contract, articles, generic public
file metadata, calendar date events, calendar time events, reposts, generic reposts, calendar
collections, RSVP events, and reports.
@@ -49,68 +49,68 @@ The closeout contract requires:
- kind and tag constants for the approved NIP surface
- ordinary kind-1 compatibility reads plus strict Update, PhotoUpdate, and Ask authoring
- strict marked direct and nested NIP-10 Reply authoring plus tolerant positional inbound admission
-- strict NIP-22 `RadrootsAuthoredNip22Comment`,
+- strict NIP-22 `AuthoredNip22Comment`,
`RadrootsInboundNip22CommentProjection`, and
`RadrootsAdmittedNip22CommentEvent` behavior without legacy `e_root` or
`e_prev` authority
-- strict NIP-09 `RadrootsAuthoredNip09DeletionRequest`,
+- strict NIP-09 `AuthoredNip09DeletionRequest`,
`RadrootsInboundNip09DeletionProjection`, and
`RadrootsAdmittedNip09DeletionRequestEvent` request behavior plus a separate
pure `RadrootsNip09SuppressionDecision` evaluator without storage authority
-- strict NIP-25 `RadrootsReaction` behavior where empty content is a valid like
+- strict NIP-25 `Reaction` behavior where empty content is a valid like
- explicit optional `published_at` support for NIP-99 classified-listing parity
-- NIP-65 relay-list validation evidence through `RadrootsList`
+- NIP-65 relay-list validation evidence through `List`
- conformance vectors and canonical-event witnesses for every new or upgraded social event family
## Approved Event Families
The MVP public social substrate includes:
-- strict `RadrootsAuthoredUpdate`, `RadrootsAuthoredPhotoUpdate`, and
- `RadrootsAuthoredAsk` publication types plus verified tolerant projection for
+- strict `AuthoredUpdate`, `AuthoredPhotoUpdate`, and
+ `AuthoredAsk` publication types plus verified tolerant projection for
ordinary NIP-01 kind `1` events
-- strict `RadrootsAuthoredNip10Reply` direct and nested publication plus
+- strict `AuthoredNip10Reply` direct and nested publication plus
`RadrootsInboundNip10ReplyProjection` for marked and deprecated positional
inbound NIP-10 replies
-- strict `RadrootsAuthoredNip22Comment` publication plus
+- strict `AuthoredNip22Comment` publication plus
`RadrootsInboundNip22CommentProjection` and
`RadrootsAdmittedNip22CommentEvent` for kind-`1111` NIP-22 Comments rooted
only in kind `30402`, `31922`, or `31923`
-- strict `RadrootsAuthoredNip09DeletionRequest` publication plus
+- strict `AuthoredNip09DeletionRequest` publication plus
`RadrootsInboundNip09DeletionProjection` and
`RadrootsAdmittedNip09DeletionRequestEvent` for effect-free kind-`5` NIP-09
event and address deletion requests, followed by pure deterministic
suppression evaluation over verified targets and admitted requests
-- `RadrootsArticle` for NIP-23 kind `30023` long-form content
-- generic public `RadrootsFileMetadata` for NIP-94 kind `1063`
-- strict authored `RadrootsAuthoredCalendarDateEvent`, tolerant
- `RadrootsParsedNip52CalendarDateEvent`, and strict admitted
- `RadrootsAdmittedCalendarDateEvent` models for NIP-52 kind `31922`
-- strict authored `RadrootsAuthoredCalendarTimeEvent`, tolerant
- `RadrootsParsedNip52CalendarTimeEvent`, and strict admitted
- `RadrootsAdmittedCalendarTimeEvent` models for NIP-52 kind `31923`
+- `Article` for NIP-23 kind `30023` long-form content
+- generic public `FileMetadata` for NIP-94 kind `1063`
+- strict authored `AuthoredCalendarDateEvent`, tolerant
+ `ParsedNip52CalendarDateEvent`, and strict admitted
+ `AdmittedCalendarDateEvent` models for NIP-52 kind `31922`
+- strict authored `AuthoredCalendarTimeEvent`, tolerant
+ `ParsedNip52CalendarTimeEvent`, and strict admitted
+ `AdmittedCalendarTimeEvent` models for NIP-52 kind `31923`
The production-v1 public social substrate includes:
-- `RadrootsRepost` for NIP-18 kind `6`
-- `RadrootsGenericRepost` for NIP-18 kind `16`
-- strict authored `RadrootsAuthoredCalendar`, tolerant
- `RadrootsParsedNip52Calendar`, and strict admitted `RadrootsAdmittedCalendar`
+- `Repost` for NIP-18 kind `6`
+- `GenericRepost` for NIP-18 kind `16`
+- strict authored `AuthoredCalendar`, tolerant
+ `ParsedNip52Calendar`, and strict admitted `AdmittedCalendar`
models for NIP-52 kind `31924`
-- strict authored `RadrootsAuthoredCalendarEventRsvp`, tolerant
- `RadrootsParsedNip52CalendarEventRsvp`, and strict admitted
- `RadrootsAdmittedCalendarEventRsvp` models for NIP-52 kind `31925`
-- `RadrootsReport` for NIP-56 kind `1984`
-- operational-listing profile validation through `RadrootsOperationalListing` at NIP-99
+- strict authored `AuthoredCalendarEventRsvp`, tolerant
+ `ParsedNip52CalendarEventRsvp`, and strict admitted
+ `AdmittedCalendarEventRsvp` models for NIP-52 kind `31925`
+- `Report` for NIP-56 kind `1984`
+- operational-listing profile validation through `OperationalListing` at NIP-99
classified-listing kind `30402`
- strict FoodAvailability details, deterministic unsigned authoring, verified tolerant projection,
NIP-01 admission, and strict revision validation for focused kind-`30402` inputs, with explicit
exclusion of Operational Listing and marker-free generic NIP-99 candidates
-- relay-list kind `10002` validation through `RadrootsList`
+- relay-list kind `10002` validation through `List`
## Contract Decisions
-`RadrootsPost` remains a compatibility read projection for ordinary kind `1`
+`Post` remains a compatibility read projection for ordinary kind `1`
text notes and older optional social metadata. It is not an authored boundary.
The public raw `imeta` encoder and its generic tag-builder implementation are
removed so callers cannot turn mutable strings into purported strict media.
@@ -135,7 +135,7 @@ event limit after exact JSON escaping, tag-array punctuation, and a worst-case
20-digit NIP-01 timestamp are counted; decoded content and tag limits do not
operate as independent escape hatches around that wire budget.
-Every authored primary image is a `RadrootsAuthoredImage` backed by an approved,
+Every authored primary image is a `AuthoredImage` backed by an approved,
byte-verified Blossom descriptor. Every authored fallback is an approved
Blossom hash-path URL with the same digest. This typestate proves local
descriptor-to-byte agreement only. Successful BUD-02 upload completion remains
@@ -174,7 +174,7 @@ contract. Strict Profile, Update, PhotoUpdate, Ask, NIP-10 Reply, NIP-22
Comment, and NIP-09 Deletion Request contracts are `TypedOnly`;
`radroots.social.post.v1` is `ReadOnly`; ordinary generic-draft contracts
remain `GenericDraft`.
-`RadrootsEventDraft::new` therefore rejects the strict Profile contract and
+`EventDraft::new` therefore rejects the strict Profile contract and
every governed kind-1, kind-5, or kind-1111 contract with
`contract_not_draft_authorable`. Serialized drafts record registry version `7`
and are accepted only after deserialization revalidates the registry version,
@@ -190,11 +190,11 @@ a signer is consulted.
### NIP-10 Reply Trust Layers
-`RadrootsAuthoredNip10Reply` is an opaque, bounded authoring state. Direct
+`AuthoredNip10Reply` is an opaque, bounded authoring state. Direct
Replies contain one root reference; nested Replies contain one root and one
distinct parent reference. Each reference carries a validated 64-character
lowercase event id, a referenced-author pubkey, and an optional
-`RadrootsNostrRelayHint`. The relay hint profile accepts only byte-stable ASCII
+`NostrRelayHint`. The relay hint profile accepts only byte-stable ASCII
WebSocket URLs: an exact lowercase `ws://` or `wss://` scheme; a canonical
lowercase DNS, four-octet IPv4, or bracketed pure-hex RFC 5952 IPv6 authority;
an optional canonical decimal port from `1` through `65535`; and an RFC 3986
@@ -235,7 +235,7 @@ participant propagation, relay hints, and referenced-author hints advisory,
blank content or absent `p` tags do not erase an otherwise unambiguous inbound
Reply. Malformed optional relay, author-hint, citation, and participant metadata is
retained in the verified envelope and exposed as ordered typed diagnostics;
-valid relay hints are projected through the same `RadrootsNostrRelayHint`
+valid relay hints are projected through the same `NostrRelayHint`
profile used for authoring, and rejected hints remain verbatim in the ordered
diagnostic's raw tag. This tolerant read-side behavior never weakens strict
authored output.
@@ -279,7 +279,7 @@ kind `1` is deliberately excluded because text-note threads use the separate
NIP-10 Reply boundary. Legacy `e_root` and `e_prev` tags have no authority in
this contract.
-`RadrootsAuthoredNip22Comment` is an opaque, non-Serde authoring state. Canonical
+`AuthoredNip22Comment` is an opaque, non-Serde authoring state. Canonical
tag order is `E,K,P,e,k,p` for a top-level event root,
`A,K,P,a,e,k,p` for a top-level address root, and
`E,K,P,e,k,p` or `A,K,P,e,k,p` for a nested event or address root,
@@ -311,7 +311,7 @@ revision, or parent or prove that the referenced event exists, carries the
asserted kind, was signed by the asserted author, or is available at a relay.
NIP-10 Reply and NIP-22 Comment references share
-`RadrootsNostrRelayHint`. Relay syntax is independent of the Comment resource
+`NostrRelayHint`. Relay syntax is independent of the Comment resource
profile: content is limited to 131072 UTF-8 bytes, a Comment to 1024 tags, all
tags to 4096 elements including tag names, each element to 4096 UTF-8 bytes,
aggregate tag-element bytes to 131072, and the compact signed event to 262144
@@ -336,7 +336,7 @@ diagnostics, resource boundaries, error precedence, and NIP-01 admission.
The strict Radroots
[NIP-09](https://github.com/nostr-protocol/nips/blob/bdfa7e62ef87fcfcb992b1a27aee49d36b0b4f91/09.md)
-profile is kind `5`. `RadrootsAuthoredNip09DeletionRequest` is an opaque,
+profile is kind `5`. `AuthoredNip09DeletionRequest` is an opaque,
non-Serde authoring state that requires at least one valid `e` event-id target
or `a` NIP-01 replaceable/addressable coordinate. Each event target has a
caller-asserted kind advisory in `0..=65535`. Replaceable coordinates of kind
@@ -606,13 +606,13 @@ a trusted escape hatch outside the supported mutation guarantees. A caller that
authority for any resulting state; only a governed migration, rebuild, or conformance path that
invokes the exhaustive validator can re-establish integrity evidence for that state.
-`RadrootsReaction` uses strict NIP-25 semantics. Empty content, `+`, `-`, emoji, and custom reaction
+`Reaction` uses strict NIP-25 semantics. Empty content, `+`, `-`, emoji, and custom reaction
content are valid when the target tags are valid. Missing targets remain invalid.
-`RadrootsReport` intentionally tightens NIP-56 for the Radroots type: a reported pubkey `p` tag is
+`Report` intentionally tightens NIP-56 for the Radroots type: a reported pubkey `p` tag is
required for a valid report, including event and file or blob reports.
-Generic public `RadrootsFileMetadata` remains separate from private `RadrootsFarmFileMetadata` even
+Generic public `FileMetadata` remains separate from private `FarmFileMetadata` even
though both use kind `1063`. The public generic model must cover the current simple NIP-94 tags,
including URL, MIME type, SHA-256 hash, original hash, size, dimensions, blurhash, thumbnail, image,
summary, alt text, fallback, `magnet`, `i`, and `service`.
@@ -624,12 +624,12 @@ exactly `radroots:price_unit` and `radroots:quantity`; the Operational Listing m
`radroots:primary_bin`, `radroots:bin`, and `radroots:price`. Focused-only, operational-only,
marker-free generic NIP-99, and mixed-marker inputs are distinct partition results. This happens
before profile tag-shape validation, so a malformed one-element marker still counts. Matching is
-exact and case-sensitive. `RadrootsClassifiedListingPartition` names those results
+exact and case-sensitive. `ClassifiedListingPartition` names those results
`FocusedFoodAvailability`, `OperationalListing`, `GenericNip99`, and `Ambiguous`. The partition is
allocation-free, does not inspect the event kind, marker values, or tag arity, and does not establish
that either profile is valid.
-`RadrootsFoodAvailabilityDetails` and its focused domain values are checked before construction.
+`FoodAvailabilityDetails` and its focused domain values are checked before construction.
The identifier is 1 through 512 UTF-8 bytes, contains no whitespace, and contains no Unicode
control or format character. Content must contain at least one scalar outside Unicode whitespace
and the information-separator range U+001C through U+001F, and is bounded to
@@ -646,7 +646,7 @@ Status is exactly `active` or `sold`.
Image dimensions are two nonzero canonical `u32` decimal components in `WIDTHxHEIGHT` form.
Validated details accept no more than 64 images, reject duplicate URLs or Blossom digests, and
-accept only `RadrootsAuthoredImage` values backed by an approved, byte-verified image descriptor.
+accept only `AuthoredImage` values backed by an approved, byte-verified image descriptor.
That proof establishes local descriptor-to-byte agreement only. It does not establish BUD-02 upload
completion, decoded raster dimensions, content safety, retrieval, reachability, or network
availability.
@@ -736,9 +736,9 @@ performs cryptographic verification. An admitted model is therefore valid only w
bound to the already id- and signature-verified envelope from which it was parsed.
Strict authoring is the outbound counterpart, not a fourth inbound verification state.
-`RadrootsAuthoredCalendarDateEvent`, `RadrootsAuthoredCalendarTimeEvent`,
-`RadrootsAuthoredCalendar`, and `RadrootsAuthoredCalendarEventRsvp` have private checked fields and
-encode deterministic `RadrootsNip01EventWireParts`. Wire parts contain only `kind`, `content`, and
+`AuthoredCalendarDateEvent`, `AuthoredCalendarTimeEvent`,
+`AuthoredCalendar`, and `AuthoredCalendarEventRsvp` have private checked fields and
+encode deterministic `Nip01EventWireParts`. Wire parts contain only `kind`, `content`, and
`tags`; the owning runtime still supplies `created_at` and author identity, computes the event id,
signs the event, and publishes it.
@@ -837,7 +837,7 @@ event, or that the RSVP author is authorized to answer for another party.
Calendar images have an explicit progression of trust. Tolerant inbound parsing accepts any
absolute image URI. Strict inbound admission requires a structural Blossom hash-path URL, but does
not prove approved-reference policy, byte agreement, upload completion, reachability, or image
-safety. Strict authored models accept only `RadrootsAuthoredImage`, which wraps an approved,
+safety. Strict authored models accept only `AuthoredImage`, which wraps an approved,
byte-verified Blossom descriptor declared as `image/*`. That typestate proves local
descriptor-to-byte agreement only.
@@ -857,8 +857,8 @@ farm-ops candidate sets. Private farm operations candidates include the farm wor
farm CRDT change envelope, farm file metadata, and the supported NIP-29 group event subset.
`RadrootsRelayList` is not a separate model type in the target contract. Operational listing records
-are represented through `RadrootsOperationalListing`, and NIP-51 standard and list-set entries,
-including NIP-65 relay metadata kind `10002`, are represented through `RadrootsList`. NIP-51
+are represented through `OperationalListing`, and NIP-51 standard and list-set entries,
+including NIP-65 relay metadata kind `10002`, are represented through `List`. NIP-51
taxonomy may classify kind `31924` as a calendar list, but generic list and list-set decoding or
authoring must reject that kind; only the calendar-specific model and codec may parse or publish it.
diff --git a/contracts/operations.toml b/contracts/operations.toml
@@ -42,40 +42,40 @@ public = [
"RadrootsNostrSignedBlossomAuthorization",
"RadrootsNostrBlossomAuthorizationHeader",
"RadrootsNostrVerifiedBlossomAuthorization",
- "RadrootsNip01EventWireParts",
- "RadrootsEventDraft",
- "RadrootsSignedEvent",
- "RadrootsEventEnvelope",
+ "Nip01EventWireParts",
+ "EventDraft",
+ "SignedEvent",
+ "EventEnvelope",
"RadrootsIdVerifiedEvent",
"RadrootsSignatureVerifiedEvent",
"RadrootsNip01VerificationError",
"RadrootsContractValidatedEvent",
"RadrootsAdmittedEvent",
"RadrootsEventAdmissionError",
- "RadrootsEventHeadCoordinate",
- "RadrootsEventHeadCandidate",
- "RadrootsCurrentEventHead",
- "RadrootsEventHeadDecision",
- "RadrootsEventRef",
- "RadrootsEventPtr",
- "RadrootsClassifiedListingAddress",
- "RadrootsClassifiedListingPartition",
- "RadrootsAuthoredImage",
- "RadrootsAuthoredImageError",
- "RadrootsFoodAvailabilityError",
- "RadrootsFoodContent",
- "RadrootsFoodIdentifier",
- "RadrootsFoodText",
- "RadrootsFoodPublishedAt",
- "RadrootsFoodCurrency",
- "RadrootsFoodUnit",
- "RadrootsFoodPrice",
- "RadrootsFoodQuantity",
- "RadrootsFoodAvailabilityStatus",
- "RadrootsFoodImageDimensions",
- "RadrootsFoodAvailabilityImage",
- "RadrootsFoodAvailabilityDetailsParts",
- "RadrootsFoodAvailabilityDetails",
+ "EventHeadCoordinate",
+ "EventHeadCandidate",
+ "CurrentEventHead",
+ "EventHeadDecision",
+ "EventRef",
+ "EventPtr",
+ "ClassifiedListingAddress",
+ "ClassifiedListingPartition",
+ "AuthoredImage",
+ "AuthoredImageError",
+ "FoodAvailabilityError",
+ "FoodContent",
+ "FoodIdentifier",
+ "FoodText",
+ "FoodPublishedAt",
+ "FoodCurrency",
+ "FoodUnit",
+ "FoodPrice",
+ "FoodQuantity",
+ "FoodAvailabilityStatus",
+ "FoodImageDimensions",
+ "FoodAvailabilityImage",
+ "FoodAvailabilityDetailsParts",
+ "FoodAvailabilityDetails",
"RadrootsFoodAvailabilityEncodeError",
"RadrootsFoodAvailabilityImageDiagnostic",
"RadrootsInboundFoodAvailabilityImage",
@@ -87,10 +87,10 @@ public = [
"RadrootsFoodAvailabilityAdmissionOutcome",
"RadrootsFoodAvailabilityAdmissionError",
"RadrootsFoodAvailabilityRevisionError",
- "RadrootsNip05Identifier",
- "RadrootsNip05IdentifierError",
- "RadrootsAuthoredProfile",
- "RadrootsAuthoredProfileError",
+ "Nip05Identifier",
+ "Nip05IdentifierError",
+ "AuthoredProfile",
+ "AuthoredProfileError",
"RadrootsAuthoredProfileEncodeError",
"RadrootsInboundProfileMetadata",
"RadrootsProfileMetadataParseError",
@@ -98,19 +98,19 @@ public = [
"RadrootsProfileAdmissionError",
"RadrootsNip05IdentityVerification",
"RadrootsUnverifiedProfileMediaReference",
- "RadrootsFarm",
- "RadrootsOperationalListing",
- "RadrootsPost",
- "RadrootsAuthoredPostError",
- "RadrootsPostImageDimensions",
- "RadrootsAuthoredPostImage",
- "RadrootsAuthoredUpdate",
- "RadrootsAuthoredPhotoUpdate",
- "RadrootsAuthoredAsk",
- "RadrootsNip10ReplyError",
- "RadrootsNostrRelayHint",
- "RadrootsNip10ReplyReference",
- "RadrootsAuthoredNip10Reply",
+ "Farm",
+ "OperationalListing",
+ "Post",
+ "AuthoredPostError",
+ "PostImageDimensions",
+ "AuthoredPostImage",
+ "AuthoredUpdate",
+ "AuthoredPhotoUpdate",
+ "AuthoredAsk",
+ "Nip10ReplyError",
+ "NostrRelayHint",
+ "Nip10ReplyReference",
+ "AuthoredNip10Reply",
"RadrootsPostDiagnostic",
"RadrootsPostClassification",
"RadrootsInboundPostImeta",
@@ -128,14 +128,14 @@ public = [
"RadrootsNip10ReplyProjectionError",
"RadrootsAdmittedNip10ReplyEvent",
"RadrootsNip10ReplyAdmissionError",
- "RadrootsNip22CommentError",
- "RadrootsNip22CommentRootKind",
- "RadrootsNip22EventRootReference",
- "RadrootsNip22AddressRootReference",
- "RadrootsNip22CommentParentReference",
- "RadrootsNip22CommentRoot",
- "RadrootsNip22CommentPosition",
- "RadrootsAuthoredNip22Comment",
+ "Nip22CommentError",
+ "Nip22CommentRootKind",
+ "Nip22EventRootReference",
+ "Nip22AddressRootReference",
+ "Nip22CommentParentReference",
+ "Nip22CommentRoot",
+ "Nip22CommentPosition",
+ "AuthoredNip22Comment",
"RadrootsNip22CommentDiagnostic",
"RadrootsInboundNip22Participant",
"RadrootsInboundNip22EventRoot",
@@ -150,13 +150,13 @@ public = [
"RadrootsNip22CommentProjectionError",
"RadrootsAdmittedNip22CommentEvent",
"RadrootsNip22CommentAdmissionError",
- "RadrootsNip01Coordinate",
- "RadrootsNip01CoordinateParts",
- "RadrootsNip01CoordinateParseError",
- "RadrootsNip09DeletionError",
- "RadrootsNip09DeletionEventTarget",
- "RadrootsNip09DeletionAddressTarget",
- "RadrootsAuthoredNip09DeletionRequest",
+ "Nip01Coordinate",
+ "Nip01CoordinateParts",
+ "Nip01CoordinateParseError",
+ "Nip09DeletionError",
+ "Nip09DeletionEventTarget",
+ "Nip09DeletionAddressTarget",
+ "AuthoredNip09DeletionRequest",
"RadrootsNip09DeletionDiagnostic",
"RadrootsInboundNip09DeletionEventTarget",
"RadrootsInboundNip09DeletionAddressTarget",
@@ -170,57 +170,57 @@ public = [
"RadrootsNip09EventReferenceEvidence",
"RadrootsNip09AddressReferenceEvidence",
"RadrootsNip09SuppressionDecision",
- "RadrootsReaction",
- "RadrootsArticle",
- "RadrootsFileMetadata",
- "RadrootsIanaTimeZoneId",
- "RadrootsCalendarUri",
- "RadrootsCalendarRequest",
- "RadrootsCalendarParticipant",
- "RadrootsCalendarEventError",
- "RadrootsCalendarDate",
- "RadrootsAuthoredCalendarDateEvent",
- "RadrootsAuthoredCalendarTimeEvent",
- "RadrootsParsedNip52CalendarCommon",
- "RadrootsParsedNip52CalendarCommonParts",
- "RadrootsParsedNip52CalendarDateEvent",
- "RadrootsObservedUtcDay",
- "RadrootsParsedNip52CalendarTimeEvent",
- "RadrootsCalendarAdmissionError",
- "RadrootsAdmittedCalendarDateEvent",
- "RadrootsAdmittedCalendarTimeEvent",
- "RadrootsCalendarUid",
- "RadrootsCalendarEventReference",
- "RadrootsCalendarEventRevisionReference",
- "RadrootsCalendarEventAuthorReference",
- "RadrootsAuthoredCalendar",
- "RadrootsParsedNip52CalendarParts",
- "RadrootsParsedNip52Calendar",
- "RadrootsAdmittedCalendar",
- "RadrootsCalendarEventRsvpStatus",
- "RadrootsCalendarEventFreeBusy",
- "RadrootsAuthoredCalendarEventRsvp",
- "RadrootsParsedNip52CalendarEventRsvpParts",
- "RadrootsParsedNip52CalendarEventRsvp",
- "RadrootsAdmittedCalendarEventRsvp",
- "RadrootsTradeId",
- "RadrootsTradeCandidateId",
- "RadrootsTradeMutationId",
- "RadrootsTradeMutationKindV1",
- "RadrootsTradeMutationEnvelopeV1",
- "RadrootsTradeMutationBodyV1",
- "RadrootsTradeCandidateTermsV1",
- "RadrootsTradeCandidateLineV1",
- "RadrootsTradeLineTombstoneV1",
- "RadrootsTradeEconomicsProfileV1",
- "RadrootsTradeEconomicAdjustmentV1",
- "RadrootsFulfillmentProfileV1",
- "RadrootsTradeCancellationProfileV1",
- "RadrootsTradePrivateTermsRefV1",
- "RadrootsSellerReservationAssertionV1",
- "RadrootsSellerReservationLineV1",
- "RadrootsTradeDecisionV1",
- "RadrootsTradeCanonicalMutationV1",
+ "Reaction",
+ "Article",
+ "FileMetadata",
+ "IanaTimeZoneId",
+ "CalendarUri",
+ "CalendarRequest",
+ "CalendarParticipant",
+ "CalendarEventError",
+ "CalendarDate",
+ "AuthoredCalendarDateEvent",
+ "AuthoredCalendarTimeEvent",
+ "ParsedNip52CalendarCommon",
+ "ParsedNip52CalendarCommonParts",
+ "ParsedNip52CalendarDateEvent",
+ "ObservedUtcDay",
+ "ParsedNip52CalendarTimeEvent",
+ "CalendarAdmissionError",
+ "AdmittedCalendarDateEvent",
+ "AdmittedCalendarTimeEvent",
+ "CalendarUid",
+ "CalendarEventReference",
+ "CalendarEventRevisionReference",
+ "CalendarEventAuthorReference",
+ "AuthoredCalendar",
+ "ParsedNip52CalendarParts",
+ "ParsedNip52Calendar",
+ "AdmittedCalendar",
+ "CalendarEventRsvpStatus",
+ "CalendarEventFreeBusy",
+ "AuthoredCalendarEventRsvp",
+ "ParsedNip52CalendarEventRsvpParts",
+ "ParsedNip52CalendarEventRsvp",
+ "AdmittedCalendarEventRsvp",
+ "TradeId",
+ "TradeCandidateId",
+ "TradeMutationId",
+ "TradeMutationKindV1",
+ "TradeMutationEnvelopeV1",
+ "TradeMutationBodyV1",
+ "TradeCandidateTermsV1",
+ "TradeCandidateLineV1",
+ "TradeLineTombstoneV1",
+ "TradeEconomicsProfileV1",
+ "TradeEconomicAdjustmentV1",
+ "FulfillmentProfileV1",
+ "TradeCancellationProfileV1",
+ "TradePrivateTermsRefV1",
+ "SellerReservationAssertionV1",
+ "SellerReservationLineV1",
+ "TradeDecisionV1",
+ "TradeCanonicalMutationV1",
"RadrootsTradeReductionInputV1",
"RadrootsTradeMutationRecordV1",
"RadrootsTradePrivateTermsEvidenceV1",
@@ -237,17 +237,17 @@ public = [
"RadrootsTradeAttestationStateV1",
"RadrootsTradeFulfillmentStateV1",
"RadrootsTradePaymentStateV1",
- "RadrootsWikiArticle",
- "RadrootsWikiRedirect",
- "RadrootsWikiMergeRequest",
- "RadrootsKnowledgeSource",
- "RadrootsKnowledgeClaim",
- "RadrootsKnowledgeRelation",
- "RadrootsKnowledgeReview",
- "RadrootsKnowledgeFieldReport",
- "RadrootsEvidenceBounty",
- "RadrootsKnowledgeChangeProposal",
- "RadrootsContributionAttestation",
+ "WikiArticle",
+ "WikiRedirect",
+ "WikiMergeRequest",
+ "KnowledgeSource",
+ "KnowledgeClaim",
+ "KnowledgeRelation",
+ "KnowledgeReview",
+ "KnowledgeFieldReport",
+ "EvidenceBounty",
+ "KnowledgeChangeProposal",
+ "ContributionAttestation",
"RadrootsKnowledgeContractManifest",
"RadrootsDecodedEvent",
]
@@ -451,7 +451,7 @@ vector = "contracts/conformance/vectors/blossom/bud11_nostr_adapter.v1.json"
domain = "event"
id = "event.verify_nip01"
stability = "beta"
-inputs = ["RadrootsEventEnvelope"]
+inputs = ["EventEnvelope"]
outputs = ["RadrootsSignatureVerifiedEvent"]
error_class = "verification_error"
deterministic = true
@@ -464,7 +464,7 @@ rust_modules = [
"crates/event_codec/src/verification.rs",
]
rust_types = [
- "radroots_event::envelope::RadrootsEventEnvelope",
+ "radroots_event::envelope::EventEnvelope",
"radroots_event_codec::verification::RadrootsIdVerifiedEvent",
"radroots_event_codec::verification::RadrootsNip01VerificationError",
"radroots_event_codec::verification::RadrootsSignatureVerifiedEvent",
@@ -504,8 +504,8 @@ case_kinds = ["event.admit_verified.valid", "event.admit_verified.invalid"]
domain = "event"
id = "event.select_head"
stability = "beta"
-inputs = ["RadrootsEventHeadCandidate", "RadrootsCurrentEventHead?"]
-outputs = ["RadrootsEventHeadDecision"]
+inputs = ["EventHeadCandidate", "CurrentEventHead?"]
+outputs = ["EventHeadDecision"]
error_class = "validation_error"
deterministic = true
signing = "none"
@@ -514,9 +514,9 @@ transport = "none"
[operations.event_select_head.implementation]
rust_modules = ["crates/event/src/event_head.rs"]
rust_types = [
- "radroots_event::envelope::event_head::RadrootsCurrentEventHead",
- "radroots_event::envelope::event_head::RadrootsEventHeadCandidate",
- "radroots_event::envelope::event_head::RadrootsEventHeadDecision",
+ "radroots_event::envelope::event_head::CurrentEventHead",
+ "radroots_event::envelope::event_head::EventHeadCandidate",
+ "radroots_event::envelope::event_head::EventHeadDecision",
]
[operations.event_select_head.conformance]
@@ -526,8 +526,8 @@ vector = "contracts/conformance/vectors/profile/verified_event.v1.json"
domain = "food_availability"
id = "food_availability.build_authored_draft"
stability = "beta"
-inputs = ["RadrootsFoodAvailabilityDetails", "u64"]
-outputs = ["RadrootsNip01EventWireParts"]
+inputs = ["FoodAvailabilityDetails", "u64"]
+outputs = ["Nip01EventWireParts"]
error_class = "encode_error"
deterministic = true
signing = "none"
@@ -540,12 +540,12 @@ rust_modules = [
]
rust_types = [
"radroots_blossom::ByteVerifiedDescriptor",
- "radroots_event::food::availability::RadrootsFoodAvailabilityDetails",
- "radroots_event::food::availability::RadrootsFoodAvailabilityDetailsParts",
- "radroots_event::food::availability::RadrootsFoodAvailabilityError",
- "radroots_event::food::availability::RadrootsFoodAvailabilityImage",
- "radroots_event::media::RadrootsAuthoredImage",
- "radroots_event::wire::RadrootsNip01EventWireParts",
+ "radroots_event::food::availability::FoodAvailabilityDetails",
+ "radroots_event::food::availability::FoodAvailabilityDetailsParts",
+ "radroots_event::food::availability::FoodAvailabilityError",
+ "radroots_event::food::availability::FoodAvailabilityImage",
+ "radroots_event::media::AuthoredImage",
+ "radroots_event::wire::Nip01EventWireParts",
"radroots_event_codec::food_availability::authored::RadrootsFoodAvailabilityEncodeError",
]
@@ -574,8 +574,8 @@ rust_modules = [
"crates/event_codec/src/food_availability/inbound.rs",
]
rust_types = [
- "radroots_event::listing::classified::RadrootsClassifiedListingPartition",
- "radroots_event::food::availability::RadrootsFoodAvailabilityError",
+ "radroots_event::listing::classified::ClassifiedListingPartition",
+ "radroots_event::food::availability::FoodAvailabilityError",
"radroots_event_codec::food_availability::inbound::RadrootsFoodAvailabilityImageDiagnostic",
"radroots_event_codec::food_availability::inbound::RadrootsFoodAvailabilityProjectionError",
"radroots_event_codec::food_availability::inbound::RadrootsFoodAvailabilityProjectionOutcome",
@@ -595,7 +595,7 @@ case_kinds = [
domain = "food_availability"
id = "food_availability.verify_and_admit_event"
stability = "beta"
-inputs = ["RadrootsEventEnvelope"]
+inputs = ["EventEnvelope"]
outputs = ["RadrootsFoodAvailabilityAdmissionOutcome"]
error_class = "admission_error"
deterministic = true
@@ -609,7 +609,7 @@ rust_modules = [
"crates/event_codec/src/verification.rs",
]
rust_types = [
- "radroots_event::envelope::RadrootsEventEnvelope",
+ "radroots_event::envelope::EventEnvelope",
"radroots_event_codec::food_availability::admission::RadrootsAdmittedFoodAvailabilityEvent",
"radroots_event_codec::food_availability::admission::RadrootsExcludedClassifiedListingCandidate",
"radroots_event_codec::food_availability::admission::RadrootsFoodAvailabilityAdmissionError",
@@ -658,8 +658,8 @@ case_kinds = [
domain = "profile"
id = "profile.build_authored_draft"
stability = "beta"
-inputs = ["RadrootsAuthoredProfile"]
-outputs = ["RadrootsNip01EventWireParts"]
+inputs = ["AuthoredProfile"]
+outputs = ["Nip01EventWireParts"]
error_class = "encode_error"
deterministic = true
signing = "none"
@@ -672,12 +672,12 @@ rust_modules = [
]
rust_types = [
"radroots_blossom::ByteVerifiedDescriptor",
- "radroots_event::media::RadrootsAuthoredImage",
- "radroots_event::media::RadrootsAuthoredImageError",
- "radroots_event::profile::RadrootsAuthoredProfile",
- "radroots_event::profile::RadrootsAuthoredProfileError",
- "radroots_event::profile::RadrootsNip05Identifier",
- "radroots_event::profile::RadrootsNip05IdentifierError",
+ "radroots_event::media::AuthoredImage",
+ "radroots_event::media::AuthoredImageError",
+ "radroots_event::profile::AuthoredProfile",
+ "radroots_event::profile::AuthoredProfileError",
+ "radroots_event::profile::Nip05Identifier",
+ "radroots_event::profile::Nip05IdentifierError",
"radroots_event_codec::profile::authored::RadrootsAuthoredProfileEncodeError",
]
@@ -701,7 +701,7 @@ rust_modules = [
"crates/event_codec/src/profile/inbound.rs",
]
rust_types = [
- "radroots_event::profile::RadrootsNip05Identifier",
+ "radroots_event::profile::Nip05Identifier",
"radroots_event_codec::profile::inbound::RadrootsInboundProfileMetadata",
"radroots_event_codec::profile::inbound::RadrootsNip05IdentityVerification",
"radroots_event_codec::profile::inbound::RadrootsProfileMetadataParseError",
@@ -715,7 +715,7 @@ vector = "contracts/conformance/vectors/profile/metadata.v1.json"
domain = "profile"
id = "profile.verify_and_admit_event"
stability = "beta"
-inputs = ["RadrootsEventEnvelope"]
+inputs = ["EventEnvelope"]
outputs = ["RadrootsAdmittedProfileEvent"]
error_class = "admission_error"
deterministic = true
@@ -729,7 +729,7 @@ rust_modules = [
"crates/event_codec/src/verification.rs",
]
rust_types = [
- "radroots_event::envelope::RadrootsEventEnvelope",
+ "radroots_event::envelope::EventEnvelope",
"radroots_event_codec::profile::admission::RadrootsAdmittedProfileEvent",
"radroots_event_codec::profile::admission::RadrootsProfileAdmissionError",
"radroots_event_codec::profile::inbound::RadrootsInboundProfileMetadata",
@@ -743,8 +743,8 @@ vector = "contracts/conformance/vectors/profile/verified_event.v1.json"
domain = "farm"
id = "farm.build_draft"
stability = "beta"
-inputs = ["RadrootsFarm"]
-outputs = ["RadrootsNip01EventWireParts"]
+inputs = ["Farm"]
+outputs = ["Nip01EventWireParts"]
error_class = "encode_error"
deterministic = true
signing = "native"
@@ -752,7 +752,7 @@ transport = "native"
[operations.farm_build_draft.implementation]
rust_modules = ["crates/event_codec/src/farm/encode.rs"]
-rust_types = ["radroots_event::farm::RadrootsFarm"]
+rust_types = ["radroots_event::farm::Farm"]
[operations.farm_build_draft.conformance]
vector = "contracts/conformance/vectors/farm/build_draft.v1.json"
@@ -761,7 +761,7 @@ vector = "contracts/conformance/vectors/farm/build_draft.v1.json"
domain = "operational_listing"
id = "operational_listing.build_tags"
stability = "beta"
-inputs = ["RadrootsOperationalListing"]
+inputs = ["OperationalListing"]
outputs = ["NostrTags"]
error_class = "encode_error"
deterministic = true
@@ -773,7 +773,7 @@ rust_modules = [
"crates/event_codec/src/operational_listing/encode.rs",
"crates/event_codec/src/operational_listing/tags.rs",
]
-rust_types = ["radroots_event::listing::operational::RadrootsOperationalListing"]
+rust_types = ["radroots_event::listing::operational::OperationalListing"]
[operations.operational_listing_build_tags.conformance]
vector = "contracts/conformance/vectors/operational_listing/build_tags.v1.json"
@@ -782,8 +782,8 @@ vector = "contracts/conformance/vectors/operational_listing/build_tags.v1.json"
domain = "operational_listing"
id = "operational_listing.build_draft"
stability = "beta"
-inputs = ["RadrootsOperationalListing"]
-outputs = ["RadrootsNip01EventWireParts"]
+inputs = ["OperationalListing"]
+outputs = ["Nip01EventWireParts"]
error_class = "encode_error"
deterministic = true
signing = "native"
@@ -794,7 +794,7 @@ rust_modules = [
"crates/event_codec/src/operational_listing/encode.rs",
"crates/event_codec/src/wire.rs",
]
-rust_types = ["radroots_event::listing::operational::RadrootsOperationalListing"]
+rust_types = ["radroots_event::listing::operational::OperationalListing"]
[operations.operational_listing_build_draft.conformance]
vector = "contracts/conformance/vectors/operational_listing/build_draft.v1.json"
@@ -803,8 +803,8 @@ vector = "contracts/conformance/vectors/operational_listing/build_draft.v1.json"
domain = "operational_listing"
id = "operational_listing.parse_event"
stability = "beta"
-inputs = ["RadrootsEventEnvelope"]
-outputs = ["RadrootsOperationalListing"]
+inputs = ["EventEnvelope"]
+outputs = ["OperationalListing"]
error_class = "parse_error"
deterministic = true
signing = "native"
@@ -813,9 +813,9 @@ transport = "native"
[operations.operational_listing_parse_event.implementation]
rust_modules = ["crates/event_codec/src/operational_listing/decode.rs"]
rust_types = [
- "radroots_event::envelope::RadrootsEventEnvelope",
- "radroots_event::listing::operational::RadrootsOperationalListingParseError",
- "radroots_event::listing::operational::RadrootsOperationalListing",
+ "radroots_event::envelope::EventEnvelope",
+ "radroots_event::listing::operational::OperationalListingParseError",
+ "radroots_event::listing::operational::OperationalListing",
]
[operations.operational_listing_parse_event.conformance]
@@ -825,8 +825,8 @@ vector = "contracts/conformance/vectors/operational_listing/parse_event.v1.json"
domain = "social"
id = "social.update.build_authored_draft"
stability = "beta"
-inputs = ["RadrootsAuthoredUpdate"]
-outputs = ["RadrootsNip01EventWireParts"]
+inputs = ["AuthoredUpdate"]
+outputs = ["Nip01EventWireParts"]
error_class = "encode_error"
deterministic = true
signing = "none"
@@ -838,8 +838,8 @@ rust_modules = [
"crates/event_codec/src/post/authored.rs",
]
rust_types = [
- "radroots_event::post::RadrootsAuthoredPostError",
- "radroots_event::post::RadrootsAuthoredUpdate",
+ "radroots_event::post::AuthoredPostError",
+ "radroots_event::post::AuthoredUpdate",
]
[operations.social_update_build_authored_draft.conformance]
@@ -853,8 +853,8 @@ case_kinds = [
domain = "social"
id = "social.photo_update.build_authored_draft"
stability = "beta"
-inputs = ["RadrootsAuthoredPhotoUpdate"]
-outputs = ["RadrootsNip01EventWireParts"]
+inputs = ["AuthoredPhotoUpdate"]
+outputs = ["Nip01EventWireParts"]
error_class = "encode_error"
deterministic = true
signing = "none"
@@ -868,11 +868,11 @@ rust_modules = [
rust_types = [
"radroots_blossom::ApprovedBlobUrl",
"radroots_blossom::ByteVerifiedDescriptor",
- "radroots_event::media::RadrootsAuthoredImage",
- "radroots_event::post::RadrootsAuthoredPhotoUpdate",
- "radroots_event::post::RadrootsAuthoredPostError",
- "radroots_event::post::RadrootsAuthoredPostImage",
- "radroots_event::post::RadrootsPostImageDimensions",
+ "radroots_event::media::AuthoredImage",
+ "radroots_event::post::AuthoredPhotoUpdate",
+ "radroots_event::post::AuthoredPostError",
+ "radroots_event::post::AuthoredPostImage",
+ "radroots_event::post::PostImageDimensions",
]
[operations.social_photo_update_build_authored_draft.conformance]
@@ -886,8 +886,8 @@ case_kinds = [
domain = "social"
id = "social.ask.build_authored_draft"
stability = "beta"
-inputs = ["RadrootsAuthoredAsk"]
-outputs = ["RadrootsNip01EventWireParts"]
+inputs = ["AuthoredAsk"]
+outputs = ["Nip01EventWireParts"]
error_class = "encode_error"
deterministic = true
signing = "none"
@@ -899,9 +899,9 @@ rust_modules = [
"crates/event_codec/src/post/authored.rs",
]
rust_types = [
- "radroots_event::post::RadrootsAuthoredAsk",
- "radroots_event::post::RadrootsAuthoredPostError",
- "radroots_event::post::RadrootsAuthoredPostImage",
+ "radroots_event::post::AuthoredAsk",
+ "radroots_event::post::AuthoredPostError",
+ "radroots_event::post::AuthoredPostImage",
]
[operations.social_ask_build_authored_draft.conformance]
@@ -915,8 +915,8 @@ case_kinds = [
domain = "social"
id = "social.reply.build_authored_draft"
stability = "beta"
-inputs = ["RadrootsAuthoredNip10Reply"]
-outputs = ["RadrootsNip01EventWireParts"]
+inputs = ["AuthoredNip10Reply"]
+outputs = ["Nip01EventWireParts"]
error_class = "encode_error"
deterministic = true
signing = "none"
@@ -929,10 +929,10 @@ rust_modules = [
"crates/event_codec/src/reply/authored.rs",
]
rust_types = [
- "radroots_event::post::reply::RadrootsAuthoredNip10Reply",
- "radroots_event::post::reply::RadrootsNip10ReplyError",
- "radroots_event::tag::relay_hint::RadrootsNostrRelayHint",
- "radroots_event::post::reply::RadrootsNip10ReplyReference",
+ "radroots_event::post::reply::AuthoredNip10Reply",
+ "radroots_event::post::reply::Nip10ReplyError",
+ "radroots_event::tag::relay_hint::NostrRelayHint",
+ "radroots_event::post::reply::Nip10ReplyReference",
]
[operations.social_reply_build_authored_draft.conformance]
@@ -959,7 +959,7 @@ rust_modules = [
"crates/event_codec/src/reply/inbound.rs",
]
rust_types = [
- "radroots_event::tag::relay_hint::RadrootsNostrRelayHint",
+ "radroots_event::tag::relay_hint::NostrRelayHint",
"radroots_event_codec::reply::inbound::RadrootsInboundNip10EventReference",
"radroots_event_codec::reply::inbound::RadrootsInboundNip10Participant",
"radroots_event_codec::reply::inbound::RadrootsInboundNip10ReplyProjection",
@@ -980,7 +980,7 @@ case_kinds = [
domain = "social"
id = "social.reply.verify_and_admit_event"
stability = "beta"
-inputs = ["RadrootsEventEnvelope"]
+inputs = ["EventEnvelope"]
outputs = ["RadrootsAdmittedNip10ReplyEvent"]
error_class = "admission_error"
deterministic = true
@@ -994,7 +994,7 @@ rust_modules = [
"crates/event_codec/src/verification.rs",
]
rust_types = [
- "radroots_event::envelope::RadrootsEventEnvelope",
+ "radroots_event::envelope::EventEnvelope",
"radroots_event_codec::reply::admission::RadrootsAdmittedNip10ReplyEvent",
"radroots_event_codec::reply::admission::RadrootsNip10ReplyAdmissionError",
"radroots_event_codec::reply::inbound::RadrootsInboundNip10ReplyProjection",
@@ -1041,7 +1041,7 @@ case_kinds = [
domain = "social"
id = "social.post.verify_and_admit_event"
stability = "beta"
-inputs = ["RadrootsEventEnvelope"]
+inputs = ["EventEnvelope"]
outputs = ["RadrootsPostAdmissionOutcome"]
error_class = "admission_error"
deterministic = true
@@ -1055,7 +1055,7 @@ rust_modules = [
"crates/event_codec/src/verification.rs",
]
rust_types = [
- "radroots_event::envelope::RadrootsEventEnvelope",
+ "radroots_event::envelope::EventEnvelope",
"radroots_event_codec::post::admission::RadrootsAdmittedRootPostEvent",
"radroots_event_codec::post::admission::RadrootsPostAdmissionError",
"radroots_event_codec::post::admission::RadrootsPostAdmissionOutcome",
@@ -1075,8 +1075,8 @@ case_kinds = [
domain = "social"
id = "social.comment.build_authored_draft"
stability = "beta"
-inputs = ["RadrootsAuthoredNip22Comment"]
-outputs = ["RadrootsNip01EventWireParts"]
+inputs = ["AuthoredNip22Comment"]
+outputs = ["Nip01EventWireParts"]
error_class = "encode_error"
deterministic = true
signing = "none"
@@ -1089,16 +1089,16 @@ rust_modules = [
"crates/event_codec/src/comment/authored.rs",
]
rust_types = [
- "radroots_event::post::comment::RadrootsAuthoredNip22Comment",
- "radroots_event::post::comment::RadrootsNip22AddressRootReference",
- "radroots_event::post::comment::RadrootsNip22CommentError",
- "radroots_event::post::comment::RadrootsNip22CommentParentReference",
- "radroots_event::post::comment::RadrootsNip22CommentPosition",
- "radroots_event::post::comment::RadrootsNip22CommentRoot",
- "radroots_event::post::comment::RadrootsNip22CommentRootKind",
- "radroots_event::post::comment::RadrootsNip22EventRootReference",
- "radroots_event::tag::relay_hint::RadrootsNostrRelayHint",
- "radroots_event::wire::RadrootsNip01EventWireParts",
+ "radroots_event::post::comment::AuthoredNip22Comment",
+ "radroots_event::post::comment::Nip22AddressRootReference",
+ "radroots_event::post::comment::Nip22CommentError",
+ "radroots_event::post::comment::Nip22CommentParentReference",
+ "radroots_event::post::comment::Nip22CommentPosition",
+ "radroots_event::post::comment::Nip22CommentRoot",
+ "radroots_event::post::comment::Nip22CommentRootKind",
+ "radroots_event::post::comment::Nip22EventRootReference",
+ "radroots_event::tag::relay_hint::NostrRelayHint",
+ "radroots_event::wire::Nip01EventWireParts",
]
[operations.social_comment_build_authored_draft.conformance]
@@ -1151,7 +1151,7 @@ case_kinds = [
domain = "social"
id = "social.comment.verify_and_admit_event"
stability = "beta"
-inputs = ["RadrootsEventEnvelope"]
+inputs = ["EventEnvelope"]
outputs = ["RadrootsAdmittedNip22CommentEvent"]
error_class = "admission_error"
deterministic = true
@@ -1165,7 +1165,7 @@ rust_modules = [
"crates/event_codec/src/verification.rs",
]
rust_types = [
- "radroots_event::envelope::RadrootsEventEnvelope",
+ "radroots_event::envelope::EventEnvelope",
"radroots_event_codec::comment::admission::RadrootsAdmittedNip22CommentEvent",
"radroots_event_codec::comment::admission::RadrootsNip22CommentAdmissionError",
"radroots_event_codec::comment::inbound::RadrootsInboundNip22CommentProjection",
@@ -1184,8 +1184,8 @@ case_kinds = [
domain = "social"
id = "social.deletion_request.build_authored_draft"
stability = "beta"
-inputs = ["RadrootsAuthoredNip09DeletionRequest"]
-outputs = ["RadrootsNip01EventWireParts"]
+inputs = ["AuthoredNip09DeletionRequest"]
+outputs = ["Nip01EventWireParts"]
error_class = "encode_error"
deterministic = true
signing = "none"
@@ -1197,12 +1197,12 @@ rust_modules = [
"crates/event_codec/src/deletion/authored.rs",
]
rust_types = [
- "radroots_event::post::deletion::RadrootsAuthoredNip09DeletionRequest",
- "radroots_event::post::deletion::RadrootsNip09DeletionAddressTarget",
- "radroots_event::post::deletion::RadrootsNip09DeletionError",
- "radroots_event::post::deletion::RadrootsNip09DeletionEventTarget",
- "radroots_event::id::RadrootsNip01Coordinate",
- "radroots_event::wire::RadrootsNip01EventWireParts",
+ "radroots_event::post::deletion::AuthoredNip09DeletionRequest",
+ "radroots_event::post::deletion::Nip09DeletionAddressTarget",
+ "radroots_event::post::deletion::Nip09DeletionError",
+ "radroots_event::post::deletion::Nip09DeletionEventTarget",
+ "radroots_event::id::Nip01Coordinate",
+ "radroots_event::wire::Nip01EventWireParts",
]
[operations.social_deletion_request_build_authored_draft.conformance]
@@ -1249,7 +1249,7 @@ case_kinds = [
domain = "social"
id = "social.deletion_request.verify_and_admit_event"
stability = "beta"
-inputs = ["RadrootsEventEnvelope"]
+inputs = ["EventEnvelope"]
outputs = ["RadrootsAdmittedNip09DeletionRequestEvent"]
error_class = "admission_error"
deterministic = true
@@ -1263,7 +1263,7 @@ rust_modules = [
"crates/event_codec/src/verification.rs",
]
rust_types = [
- "radroots_event::envelope::RadrootsEventEnvelope",
+ "radroots_event::envelope::EventEnvelope",
"radroots_event_codec::deletion::admission::RadrootsAdmittedNip09DeletionRequestEvent",
"radroots_event_codec::deletion::admission::RadrootsNip09DeletionAdmissionError",
"radroots_event_codec::deletion::inbound::RadrootsInboundNip09DeletionProjection",
@@ -1312,7 +1312,7 @@ case_kinds = ["social.deletion_request.evaluate_suppression.valid"]
domain = "social"
id = "social.reaction.build_tags"
stability = "beta"
-inputs = ["RadrootsReaction"]
+inputs = ["Reaction"]
outputs = ["NostrTags"]
error_class = "encode_error"
deterministic = true
@@ -1321,7 +1321,7 @@ transport = "native"
[operations.social_reaction_build_tags.implementation]
rust_modules = ["crates/event_codec/src/reaction/encode.rs"]
-rust_types = ["radroots_event::post::reaction::RadrootsReaction"]
+rust_types = ["radroots_event::post::reaction::Reaction"]
[operations.social_reaction_build_tags.conformance]
vector = "contracts/conformance/vectors/social/mvp.v1.json"
@@ -1330,7 +1330,7 @@ vector = "contracts/conformance/vectors/social/mvp.v1.json"
domain = "social"
id = "social.article.build_tags"
stability = "beta"
-inputs = ["RadrootsArticle"]
+inputs = ["Article"]
outputs = ["NostrTags"]
error_class = "encode_error"
deterministic = true
@@ -1339,7 +1339,7 @@ transport = "native"
[operations.social_article_build_tags.implementation]
rust_modules = ["crates/event_codec/src/article/encode.rs"]
-rust_types = ["radroots_event::post::article::RadrootsArticle"]
+rust_types = ["radroots_event::post::article::Article"]
[operations.social_article_build_tags.conformance]
vector = "contracts/conformance/vectors/social/mvp.v1.json"
@@ -1348,7 +1348,7 @@ vector = "contracts/conformance/vectors/social/mvp.v1.json"
domain = "social"
id = "social.file_metadata.build_tags"
stability = "beta"
-inputs = ["RadrootsFileMetadata"]
+inputs = ["FileMetadata"]
outputs = ["NostrTags"]
error_class = "encode_error"
deterministic = true
@@ -1357,7 +1357,7 @@ transport = "native"
[operations.social_file_metadata_build_tags.implementation]
rust_modules = ["crates/event_codec/src/file_metadata/encode.rs"]
-rust_types = ["radroots_event::media::file_metadata::RadrootsFileMetadata"]
+rust_types = ["radroots_event::media::file_metadata::FileMetadata"]
[operations.social_file_metadata_build_tags.conformance]
vector = "contracts/conformance/vectors/social/mvp.v1.json"
@@ -1366,8 +1366,8 @@ vector = "contracts/conformance/vectors/social/mvp.v1.json"
domain = "social"
id = "social.calendar_date_event.build_authored_draft"
stability = "beta"
-inputs = ["RadrootsAuthoredCalendarDateEvent"]
-outputs = ["RadrootsNip01EventWireParts"]
+inputs = ["AuthoredCalendarDateEvent"]
+outputs = ["Nip01EventWireParts"]
error_class = "encode_error"
deterministic = true
signing = "none"
@@ -1380,11 +1380,11 @@ rust_modules = [
"crates/event_codec/src/calendar/encode.rs",
]
rust_types = [
- "radroots_event::calendar::RadrootsAuthoredCalendarDateEvent",
- "radroots_event::calendar::RadrootsCalendarDate",
- "radroots_event::calendar::RadrootsCalendarEventError",
- "radroots_event::media::RadrootsAuthoredImage",
- "radroots_event::wire::RadrootsNip01EventWireParts",
+ "radroots_event::calendar::AuthoredCalendarDateEvent",
+ "radroots_event::calendar::CalendarDate",
+ "radroots_event::calendar::CalendarEventError",
+ "radroots_event::media::AuthoredImage",
+ "radroots_event::wire::Nip01EventWireParts",
"radroots_event_codec::error::EventEncodeError",
]
@@ -1396,7 +1396,7 @@ domain = "social"
id = "social.calendar_date_event.parse_nip52"
stability = "beta"
inputs = ["u32", "NostrTags", "String"]
-outputs = ["RadrootsParsedNip52CalendarDateEvent"]
+outputs = ["ParsedNip52CalendarDateEvent"]
error_class = "parse_error"
deterministic = true
signing = "none"
@@ -1408,12 +1408,12 @@ rust_modules = [
"crates/event_codec/src/calendar/decode.rs",
]
rust_types = [
- "radroots_event::calendar::RadrootsCalendarDate",
- "radroots_event::calendar::RadrootsCalendarRequest",
- "radroots_event::calendar::RadrootsCalendarUri",
- "radroots_event::calendar::RadrootsParsedNip52CalendarCommon",
- "radroots_event::calendar::RadrootsParsedNip52CalendarCommonParts",
- "radroots_event::calendar::RadrootsParsedNip52CalendarDateEvent",
+ "radroots_event::calendar::CalendarDate",
+ "radroots_event::calendar::CalendarRequest",
+ "radroots_event::calendar::CalendarUri",
+ "radroots_event::calendar::ParsedNip52CalendarCommon",
+ "radroots_event::calendar::ParsedNip52CalendarCommonParts",
+ "radroots_event::calendar::ParsedNip52CalendarDateEvent",
"radroots_event_codec::error::EventParseError",
]
@@ -1424,8 +1424,8 @@ vector = "contracts/conformance/vectors/calendar/nip52_baseline.v1.json"
domain = "social"
id = "social.calendar_date_event.admit_radroots_profile"
stability = "beta"
-inputs = ["RadrootsParsedNip52CalendarDateEvent"]
-outputs = ["RadrootsAdmittedCalendarDateEvent"]
+inputs = ["ParsedNip52CalendarDateEvent"]
+outputs = ["AdmittedCalendarDateEvent"]
error_class = "admission_error"
deterministic = true
signing = "none"
@@ -1437,9 +1437,9 @@ rust_modules = [
"crates/event_codec/src/calendar/decode.rs",
]
rust_types = [
- "radroots_event::calendar::RadrootsAdmittedCalendarDateEvent",
- "radroots_event::calendar::RadrootsCalendarAdmissionError",
- "radroots_event::calendar::RadrootsParsedNip52CalendarDateEvent",
+ "radroots_event::calendar::AdmittedCalendarDateEvent",
+ "radroots_event::calendar::CalendarAdmissionError",
+ "radroots_event::calendar::ParsedNip52CalendarDateEvent",
]
[operations.social_calendar_date_event_admit_radroots_profile.conformance]
@@ -1449,8 +1449,8 @@ vector = "contracts/conformance/vectors/calendar/radroots_profile.v1.json"
domain = "social"
id = "social.calendar_time_event.build_authored_draft"
stability = "beta"
-inputs = ["RadrootsAuthoredCalendarTimeEvent"]
-outputs = ["RadrootsNip01EventWireParts"]
+inputs = ["AuthoredCalendarTimeEvent"]
+outputs = ["Nip01EventWireParts"]
error_class = "encode_error"
deterministic = true
signing = "none"
@@ -1463,11 +1463,11 @@ rust_modules = [
"crates/event_codec/src/calendar/encode.rs",
]
rust_types = [
- "radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent",
- "radroots_event::calendar::RadrootsCalendarEventError",
- "radroots_event::calendar::RadrootsIanaTimeZoneId",
- "radroots_event::media::RadrootsAuthoredImage",
- "radroots_event::wire::RadrootsNip01EventWireParts",
+ "radroots_event::calendar::AuthoredCalendarTimeEvent",
+ "radroots_event::calendar::CalendarEventError",
+ "radroots_event::calendar::IanaTimeZoneId",
+ "radroots_event::media::AuthoredImage",
+ "radroots_event::wire::Nip01EventWireParts",
"radroots_event_codec::error::EventEncodeError",
]
@@ -1479,7 +1479,7 @@ domain = "social"
id = "social.calendar_time_event.parse_nip52"
stability = "beta"
inputs = ["u32", "NostrTags", "String"]
-outputs = ["RadrootsParsedNip52CalendarTimeEvent"]
+outputs = ["ParsedNip52CalendarTimeEvent"]
error_class = "parse_error"
deterministic = true
signing = "none"
@@ -1491,13 +1491,13 @@ rust_modules = [
"crates/event_codec/src/calendar/decode.rs",
]
rust_types = [
- "radroots_event::calendar::RadrootsCalendarRequest",
- "radroots_event::calendar::RadrootsCalendarUri",
- "radroots_event::calendar::RadrootsIanaTimeZoneId",
- "radroots_event::calendar::RadrootsObservedUtcDay",
- "radroots_event::calendar::RadrootsParsedNip52CalendarCommon",
- "radroots_event::calendar::RadrootsParsedNip52CalendarCommonParts",
- "radroots_event::calendar::RadrootsParsedNip52CalendarTimeEvent",
+ "radroots_event::calendar::CalendarRequest",
+ "radroots_event::calendar::CalendarUri",
+ "radroots_event::calendar::IanaTimeZoneId",
+ "radroots_event::calendar::ObservedUtcDay",
+ "radroots_event::calendar::ParsedNip52CalendarCommon",
+ "radroots_event::calendar::ParsedNip52CalendarCommonParts",
+ "radroots_event::calendar::ParsedNip52CalendarTimeEvent",
"radroots_event_codec::error::EventParseError",
]
@@ -1508,8 +1508,8 @@ vector = "contracts/conformance/vectors/calendar/nip52_baseline.v1.json"
domain = "social"
id = "social.calendar_time_event.admit_radroots_profile"
stability = "beta"
-inputs = ["RadrootsParsedNip52CalendarTimeEvent"]
-outputs = ["RadrootsAdmittedCalendarTimeEvent"]
+inputs = ["ParsedNip52CalendarTimeEvent"]
+outputs = ["AdmittedCalendarTimeEvent"]
error_class = "admission_error"
deterministic = true
signing = "none"
@@ -1521,9 +1521,9 @@ rust_modules = [
"crates/event_codec/src/calendar/decode.rs",
]
rust_types = [
- "radroots_event::calendar::RadrootsAdmittedCalendarTimeEvent",
- "radroots_event::calendar::RadrootsCalendarAdmissionError",
- "radroots_event::calendar::RadrootsParsedNip52CalendarTimeEvent",
+ "radroots_event::calendar::AdmittedCalendarTimeEvent",
+ "radroots_event::calendar::CalendarAdmissionError",
+ "radroots_event::calendar::ParsedNip52CalendarTimeEvent",
]
[operations.social_calendar_time_event_admit_radroots_profile.conformance]
@@ -1533,8 +1533,8 @@ vector = "contracts/conformance/vectors/calendar/radroots_profile.v1.json"
domain = "social"
id = "social.calendar.build_authored_draft"
stability = "beta"
-inputs = ["RadrootsAuthoredCalendar"]
-outputs = ["RadrootsNip01EventWireParts"]
+inputs = ["AuthoredCalendar"]
+outputs = ["Nip01EventWireParts"]
error_class = "encode_error"
deterministic = true
signing = "none"
@@ -1547,12 +1547,12 @@ rust_modules = [
"crates/event_codec/src/calendar/encode.rs",
]
rust_types = [
- "radroots_event::calendar::RadrootsAuthoredCalendar",
- "radroots_event::calendar::RadrootsCalendarEventError",
- "radroots_event::calendar::RadrootsCalendarEventReference",
- "radroots_event::calendar::RadrootsCalendarUid",
- "radroots_event::media::RadrootsAuthoredImage",
- "radroots_event::wire::RadrootsNip01EventWireParts",
+ "radroots_event::calendar::AuthoredCalendar",
+ "radroots_event::calendar::CalendarEventError",
+ "radroots_event::calendar::CalendarEventReference",
+ "radroots_event::calendar::CalendarUid",
+ "radroots_event::media::AuthoredImage",
+ "radroots_event::wire::Nip01EventWireParts",
"radroots_event_codec::error::EventEncodeError",
]
@@ -1564,7 +1564,7 @@ domain = "social"
id = "social.calendar.parse_nip52"
stability = "beta"
inputs = ["u32", "NostrTags", "String"]
-outputs = ["RadrootsParsedNip52Calendar"]
+outputs = ["ParsedNip52Calendar"]
error_class = "parse_error"
deterministic = true
signing = "none"
@@ -1576,11 +1576,11 @@ rust_modules = [
"crates/event_codec/src/calendar/decode.rs",
]
rust_types = [
- "radroots_event::calendar::RadrootsCalendarEventError",
- "radroots_event::calendar::RadrootsCalendarEventReference",
- "radroots_event::calendar::RadrootsCalendarUri",
- "radroots_event::calendar::RadrootsParsedNip52Calendar",
- "radroots_event::calendar::RadrootsParsedNip52CalendarParts",
+ "radroots_event::calendar::CalendarEventError",
+ "radroots_event::calendar::CalendarEventReference",
+ "radroots_event::calendar::CalendarUri",
+ "radroots_event::calendar::ParsedNip52Calendar",
+ "radroots_event::calendar::ParsedNip52CalendarParts",
"radroots_event_codec::error::EventParseError",
]
@@ -1591,8 +1591,8 @@ vector = "contracts/conformance/vectors/calendar/nip52_baseline.v1.json"
domain = "social"
id = "social.calendar.admit_radroots_profile"
stability = "beta"
-inputs = ["RadrootsParsedNip52Calendar"]
-outputs = ["RadrootsAdmittedCalendar"]
+inputs = ["ParsedNip52Calendar"]
+outputs = ["AdmittedCalendar"]
error_class = "admission_error"
deterministic = true
signing = "none"
@@ -1605,11 +1605,11 @@ rust_modules = [
]
rust_types = [
"radroots_blossom::BlobUrl",
- "radroots_event::calendar::RadrootsAdmittedCalendar",
- "radroots_event::calendar::RadrootsCalendarAdmissionError",
- "radroots_event::calendar::RadrootsCalendarEventReference",
- "radroots_event::calendar::RadrootsCalendarUid",
- "radroots_event::calendar::RadrootsParsedNip52Calendar",
+ "radroots_event::calendar::AdmittedCalendar",
+ "radroots_event::calendar::CalendarAdmissionError",
+ "radroots_event::calendar::CalendarEventReference",
+ "radroots_event::calendar::CalendarUid",
+ "radroots_event::calendar::ParsedNip52Calendar",
]
[operations.social_calendar_admit_radroots_profile.conformance]
@@ -1619,8 +1619,8 @@ vector = "contracts/conformance/vectors/calendar/radroots_profile.v1.json"
domain = "social"
id = "social.calendar_rsvp.build_authored_draft"
stability = "beta"
-inputs = ["RadrootsAuthoredCalendarEventRsvp"]
-outputs = ["RadrootsNip01EventWireParts"]
+inputs = ["AuthoredCalendarEventRsvp"]
+outputs = ["Nip01EventWireParts"]
error_class = "encode_error"
deterministic = true
signing = "none"
@@ -1632,15 +1632,15 @@ rust_modules = [
"crates/event_codec/src/calendar/encode.rs",
]
rust_types = [
- "radroots_event::calendar::RadrootsAuthoredCalendarEventRsvp",
- "radroots_event::calendar::RadrootsCalendarEventAuthorReference",
- "radroots_event::calendar::RadrootsCalendarEventError",
- "radroots_event::calendar::RadrootsCalendarEventReference",
- "radroots_event::calendar::RadrootsCalendarEventRevisionReference",
- "radroots_event::calendar::RadrootsCalendarUid",
- "radroots_event::calendar::RadrootsCalendarEventFreeBusy",
- "radroots_event::calendar::RadrootsCalendarEventRsvpStatus",
- "radroots_event::wire::RadrootsNip01EventWireParts",
+ "radroots_event::calendar::AuthoredCalendarEventRsvp",
+ "radroots_event::calendar::CalendarEventAuthorReference",
+ "radroots_event::calendar::CalendarEventError",
+ "radroots_event::calendar::CalendarEventReference",
+ "radroots_event::calendar::CalendarEventRevisionReference",
+ "radroots_event::calendar::CalendarUid",
+ "radroots_event::calendar::CalendarEventFreeBusy",
+ "radroots_event::calendar::CalendarEventRsvpStatus",
+ "radroots_event::wire::Nip01EventWireParts",
"radroots_event_codec::error::EventEncodeError",
]
@@ -1652,7 +1652,7 @@ domain = "social"
id = "social.calendar_rsvp.parse_nip52"
stability = "beta"
inputs = ["u32", "NostrTags", "String"]
-outputs = ["RadrootsParsedNip52CalendarEventRsvp"]
+outputs = ["ParsedNip52CalendarEventRsvp"]
error_class = "parse_error"
deterministic = true
signing = "none"
@@ -1664,14 +1664,14 @@ rust_modules = [
"crates/event_codec/src/calendar/decode.rs",
]
rust_types = [
- "radroots_event::calendar::RadrootsCalendarEventAuthorReference",
- "radroots_event::calendar::RadrootsCalendarEventError",
- "radroots_event::calendar::RadrootsCalendarEventReference",
- "radroots_event::calendar::RadrootsCalendarEventRevisionReference",
- "radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvp",
- "radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvpParts",
- "radroots_event::calendar::RadrootsCalendarEventFreeBusy",
- "radroots_event::calendar::RadrootsCalendarEventRsvpStatus",
+ "radroots_event::calendar::CalendarEventAuthorReference",
+ "radroots_event::calendar::CalendarEventError",
+ "radroots_event::calendar::CalendarEventReference",
+ "radroots_event::calendar::CalendarEventRevisionReference",
+ "radroots_event::calendar::ParsedNip52CalendarEventRsvp",
+ "radroots_event::calendar::ParsedNip52CalendarEventRsvpParts",
+ "radroots_event::calendar::CalendarEventFreeBusy",
+ "radroots_event::calendar::CalendarEventRsvpStatus",
"radroots_event_codec::error::EventParseError",
]
@@ -1682,8 +1682,8 @@ vector = "contracts/conformance/vectors/calendar/nip52_baseline.v1.json"
domain = "social"
id = "social.calendar_rsvp.admit_radroots_profile"
stability = "beta"
-inputs = ["RadrootsParsedNip52CalendarEventRsvp"]
-outputs = ["RadrootsAdmittedCalendarEventRsvp"]
+inputs = ["ParsedNip52CalendarEventRsvp"]
+outputs = ["AdmittedCalendarEventRsvp"]
error_class = "admission_error"
deterministic = true
signing = "none"
@@ -1695,15 +1695,15 @@ rust_modules = [
"crates/event_codec/src/calendar/decode.rs",
]
rust_types = [
- "radroots_event::calendar::RadrootsAdmittedCalendarEventRsvp",
- "radroots_event::calendar::RadrootsCalendarAdmissionError",
- "radroots_event::calendar::RadrootsCalendarEventAuthorReference",
- "radroots_event::calendar::RadrootsCalendarEventReference",
- "radroots_event::calendar::RadrootsCalendarEventRevisionReference",
- "radroots_event::calendar::RadrootsCalendarUid",
- "radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvp",
- "radroots_event::calendar::RadrootsCalendarEventFreeBusy",
- "radroots_event::calendar::RadrootsCalendarEventRsvpStatus",
+ "radroots_event::calendar::AdmittedCalendarEventRsvp",
+ "radroots_event::calendar::CalendarAdmissionError",
+ "radroots_event::calendar::CalendarEventAuthorReference",
+ "radroots_event::calendar::CalendarEventReference",
+ "radroots_event::calendar::CalendarEventRevisionReference",
+ "radroots_event::calendar::CalendarUid",
+ "radroots_event::calendar::ParsedNip52CalendarEventRsvp",
+ "radroots_event::calendar::CalendarEventFreeBusy",
+ "radroots_event::calendar::CalendarEventRsvpStatus",
]
[operations.social_calendar_rsvp_admit_radroots_profile.conformance]
@@ -1713,8 +1713,8 @@ vector = "contracts/conformance/vectors/calendar/radroots_profile.v1.json"
domain = "trade"
id = "trade.canonicalize_mutation"
stability = "beta"
-inputs = ["RadrootsTradeMutationEnvelopeV1"]
-outputs = ["RadrootsTradeCanonicalMutationV1"]
+inputs = ["TradeMutationEnvelopeV1"]
+outputs = ["TradeCanonicalMutationV1"]
error_class = "encode_error"
deterministic = true
signing = "native"
@@ -1723,8 +1723,8 @@ transport = "native"
[operations.trade_canonicalize_mutation.implementation]
rust_modules = ["crates/event/src/trade.rs"]
rust_types = [
- "radroots_event::trade::RadrootsTradeCanonicalMutationV1",
- "radroots_event::trade::RadrootsTradeMutationEnvelopeV1",
+ "radroots_event::trade::TradeCanonicalMutationV1",
+ "radroots_event::trade::TradeMutationEnvelopeV1",
]
[operations.trade_canonicalize_mutation.conformance]
@@ -1734,8 +1734,8 @@ vector = "contracts/conformance/vectors/trade/canonicalize_mutation.v1.json"
domain = "trade"
id = "trade.build_mutation_event"
stability = "beta"
-inputs = ["RadrootsTradeMutationEnvelopeV1"]
-outputs = ["RadrootsNip01EventWireParts"]
+inputs = ["TradeMutationEnvelopeV1"]
+outputs = ["Nip01EventWireParts"]
error_class = "encode_error"
deterministic = true
signing = "native"
@@ -1743,7 +1743,7 @@ transport = "native"
[operations.trade_build_mutation_event.implementation]
rust_modules = ["crates/event_codec/src/trade/mod.rs"]
-rust_types = ["radroots_event::trade::RadrootsTradeMutationEnvelopeV1"]
+rust_types = ["radroots_event::trade::TradeMutationEnvelopeV1"]
[operations.trade_build_mutation_event.conformance]
vector = "contracts/conformance/vectors/trade/build_mutation_event.v1.json"
@@ -1752,8 +1752,8 @@ vector = "contracts/conformance/vectors/trade/build_mutation_event.v1.json"
domain = "trade"
id = "trade.parse_mutation_event"
stability = "beta"
-inputs = ["RadrootsEventEnvelope"]
-outputs = ["RadrootsTradeMutationEnvelopeV1"]
+inputs = ["EventEnvelope"]
+outputs = ["TradeMutationEnvelopeV1"]
error_class = "parse_error"
deterministic = true
signing = "native"
@@ -1762,8 +1762,8 @@ transport = "native"
[operations.trade_parse_mutation_event.implementation]
rust_modules = ["crates/event_codec/src/trade/mod.rs"]
rust_types = [
- "radroots_event::envelope::RadrootsEventEnvelope",
- "radroots_event::trade::RadrootsTradeMutationEnvelopeV1",
+ "radroots_event::envelope::EventEnvelope",
+ "radroots_event::trade::TradeMutationEnvelopeV1",
]
[operations.trade_parse_mutation_event.conformance]
@@ -1786,8 +1786,8 @@ rust_modules = [
"crates/trade/src/operational_listing/mod.rs",
]
rust_types = [
- "radroots_event::id::RadrootsClassifiedListingAddress",
- "radroots_event::id::RadrootsIdParseError",
+ "radroots_event::id::ClassifiedListingAddress",
+ "radroots_event::id::IdParseError",
"radroots_trade::operational_listing::RadrootsClassifiedListingAddressParts",
]
@@ -1837,7 +1837,7 @@ rust_modules = [
]
rust_types = [
"radroots_event_codec::verification::RadrootsSignatureVerifiedEvent",
- "radroots_event::trade::validation::RadrootsOperationalListingValidationError",
+ "radroots_event::trade::validation::OperationalListingValidationError",
"radroots_trade::operational_listing::validation::RadrootsOperationalListingTradeProjection",
]
@@ -1872,7 +1872,7 @@ vector = "contracts/conformance/vectors/knowledge/manifest_and_decode.v1.json"
domain = "knowledge"
id = "knowledge.verify_and_decode_event"
stability = "beta"
-inputs = ["RadrootsEventEnvelope"]
+inputs = ["EventEnvelope"]
outputs = ["RadrootsDecodedEvent"]
error_class = "decode_error"
deterministic = true
@@ -1886,7 +1886,7 @@ rust_modules = [
"crates/event_codec/src/knowledge/decode.rs",
]
rust_types = [
- "radroots_event::envelope::RadrootsEventEnvelope",
+ "radroots_event::envelope::EventEnvelope",
"radroots_event_codec::verification::RadrootsDecodedEvent",
]
diff --git a/contracts/releases/1.0.0-alpha.1.toml b/contracts/releases/1.0.0-alpha.1.toml
@@ -252,7 +252,7 @@ semver_impacts = [
"change_exported_function_signature",
"change_exported_algorithm_behavior",
]
-summary = "Replace the Reply-owned RadrootsNip10RelayHint with the shared RadrootsNostrRelayHint protocol primitive and migrate NIP-10 Reply and NIP-22 Comment references to that canonical byte-stable profile."
+summary = "Replace the Reply-owned RadrootsNip10RelayHint with the shared NostrRelayHint protocol primitive and migrate NIP-10 Reply and NIP-22 Comment references to that canonical byte-stable profile."
[[changes]]
id = "strict-nip09-deletion-request-contract"
diff --git a/crates/authority/src/authorization.rs b/crates/authority/src/authorization.rs
@@ -1,13 +1,12 @@
#![forbid(unsafe_code)]
use crate::{RadrootsActorContext, RadrootsAuthorityError, RadrootsEventSigner};
-use radroots_event::contract::{RadrootsEventContract, event_contract};
+use radroots_event::contract::{EventContract, event_contract};
use radroots_event::draft::{
- RadrootsDraftError, RadrootsEventDraft, RadrootsSignedEvent,
- validate_signed_nostr_event_matches_draft,
+ DraftError, EventDraft, SignedEvent, validate_signed_nostr_event_matches_draft,
};
#[cfg(test)]
-use radroots_event::wire::RadrootsNip01EventWire;
+use radroots_event::wire::Nip01EventWire;
#[cfg(not(feature = "std"))]
use alloc::{borrow::ToOwned, string::ToString};
@@ -16,7 +15,7 @@ use std::{borrow::ToOwned, string::ToString};
pub fn authorize_actor_for_contract(
actor: &RadrootsActorContext,
- contract: &RadrootsEventContract,
+ contract: &EventContract,
) -> Result<(), RadrootsAuthorityError> {
if actor.satisfies(contract.required_author_role()) {
Ok(())
@@ -30,8 +29,8 @@ pub fn authorize_actor_for_contract(
pub fn authorize_actor_for_draft(
actor: &RadrootsActorContext,
- draft: &RadrootsEventDraft,
-) -> Result<&'static RadrootsEventContract, RadrootsAuthorityError> {
+ draft: &EventDraft,
+) -> Result<&'static EventContract, RadrootsAuthorityError> {
let contract = event_contract(draft.contract_id()).ok_or_else(|| {
RadrootsAuthorityError::UnknownContract {
contract_id: draft.contract_id().to_owned(),
@@ -56,7 +55,7 @@ pub fn authorize_actor_for_draft(
pub fn authorize_signer_for_draft<S>(
signer: &S,
- draft: &RadrootsEventDraft,
+ draft: &EventDraft,
) -> Result<(), RadrootsAuthorityError>
where
S: RadrootsEventSigner + ?Sized,
@@ -74,8 +73,8 @@ where
pub fn sign_authorized_draft<S>(
actor: &RadrootsActorContext,
signer: &S,
- draft: &RadrootsEventDraft,
-) -> Result<RadrootsSignedEvent, RadrootsAuthorityError>
+ draft: &EventDraft,
+) -> Result<SignedEvent, RadrootsAuthorityError>
where
S: RadrootsEventSigner + ?Sized,
{
@@ -85,12 +84,12 @@ where
fn sign_authorized_draft_with_validator<S, V>(
actor: &RadrootsActorContext,
signer: &S,
- draft: &RadrootsEventDraft,
+ draft: &EventDraft,
validate_draft: V,
-) -> Result<RadrootsSignedEvent, RadrootsAuthorityError>
+) -> Result<SignedEvent, RadrootsAuthorityError>
where
S: RadrootsEventSigner + ?Sized,
- V: FnOnce(&RadrootsEventDraft) -> Result<(), RadrootsDraftError>,
+ V: FnOnce(&EventDraft) -> Result<(), DraftError>,
{
validate_draft(draft).map_err(RadrootsAuthorityError::DraftValidation)?;
authorize_actor_for_draft(actor, draft)?;
@@ -101,58 +100,58 @@ where
}
pub fn validate_signed_event_matches_draft(
- signed_event: &RadrootsSignedEvent,
- draft: &RadrootsEventDraft,
+ signed_event: &SignedEvent,
+ draft: &EventDraft,
) -> Result<(), RadrootsAuthorityError> {
validate_signed_nostr_event_matches_draft(signed_event, draft)
.map_err(authority_error_from_draft_validation)
}
-fn authority_error_from_draft_validation(error: RadrootsDraftError) -> RadrootsAuthorityError {
+fn authority_error_from_draft_validation(error: DraftError) -> RadrootsAuthorityError {
match error {
- RadrootsDraftError::SignedEventPubkeyMismatch {
+ DraftError::SignedEventPubkeyMismatch {
expected_pubkey,
actual_pubkey,
} => RadrootsAuthorityError::SignedEventPubkeyMismatch {
expected_pubkey,
actual_pubkey,
},
- RadrootsDraftError::SignedEventIdMismatch {
+ DraftError::SignedEventIdMismatch {
expected_event_id,
actual_event_id,
} => RadrootsAuthorityError::SignedEventIdMismatch {
expected_event_id,
actual_event_id,
},
- RadrootsDraftError::SignedEventCreatedAtMismatch {
+ DraftError::SignedEventCreatedAtMismatch {
expected_created_at,
actual_created_at,
} => RadrootsAuthorityError::SignedEventCreatedAtMismatch {
expected_created_at,
actual_created_at,
},
- RadrootsDraftError::SignedEventKindMismatch {
+ DraftError::SignedEventKindMismatch {
expected_kind,
actual_kind,
} => RadrootsAuthorityError::SignedEventKindMismatch {
expected_kind,
actual_kind,
},
- RadrootsDraftError::SignedEventTagsMismatch {
+ DraftError::SignedEventTagsMismatch {
expected_len,
actual_len,
} => RadrootsAuthorityError::SignedEventTagsMismatch {
expected_len,
actual_len,
},
- RadrootsDraftError::SignedEventContentMismatch {
+ DraftError::SignedEventContentMismatch {
expected_len,
actual_len,
} => RadrootsAuthorityError::SignedEventContentMismatch {
expected_len,
actual_len,
},
- RadrootsDraftError::SignedEventComputedIdMismatch {
+ DraftError::SignedEventComputedIdMismatch {
expected_event_id,
computed_event_id,
} => RadrootsAuthorityError::SignedEventComputedIdMismatch {
@@ -195,8 +194,8 @@ mod tests {
RadrootsActorContext::explicit_pubkey(pubkey, [AuthorRole::Buyer]).expect("buyer")
}
- fn operational_listing_event_draft(pubkey: &str) -> RadrootsEventDraft {
- RadrootsEventDraft::new(
+ fn operational_listing_event_draft(pubkey: &str) -> EventDraft {
+ EventDraft::new(
"radroots.operational_listing.published.v1",
KIND_CLASSIFIED_LISTING,
1_700_000_000,
@@ -276,9 +275,9 @@ mod tests {
fn sign_frozen_draft(
&self,
- draft: &RadrootsEventDraft,
- ) -> Result<RadrootsSignedEvent, RadrootsSignerError> {
- let wire = RadrootsNip01EventWire {
+ draft: &EventDraft,
+ ) -> Result<SignedEvent, RadrootsSignerError> {
+ let wire = Nip01EventWire {
id: self
.overrides
.event_id
@@ -310,7 +309,7 @@ mod tests {
.into_string();
}
let raw_json = raw_json_for_wire(&wire);
- RadrootsSignedEvent::from_wire_verified_id(wire, raw_json).map_err(|error| {
+ SignedEvent::from_wire_verified_id(wire, raw_json).map_err(|error| {
RadrootsSignerError::SigningFailed {
message: error.to_string(),
}
@@ -343,15 +342,15 @@ mod tests {
fn sign_frozen_draft(
&self,
- _draft: &RadrootsEventDraft,
- ) -> Result<RadrootsSignedEvent, RadrootsSignerError> {
+ _draft: &EventDraft,
+ ) -> Result<SignedEvent, RadrootsSignerError> {
self.sign_invocations
.set(self.sign_invocations.get().saturating_add(1));
Err(RadrootsSignerError::Rejected)
}
}
- fn signed_event_from_draft(draft: &RadrootsEventDraft) -> RadrootsSignedEvent {
+ fn signed_event_from_draft(draft: &EventDraft) -> SignedEvent {
signed_event_from_parts(
draft.expected_pubkey().to_hex().to_owned(),
draft.created_at_u64(),
@@ -367,8 +366,8 @@ mod tests {
kind: u32,
tags: Vec<Vec<String>>,
content: String,
- ) -> RadrootsSignedEvent {
- let mut wire = RadrootsNip01EventWire {
+ ) -> SignedEvent {
+ let mut wire = Nip01EventWire {
id: String::new(),
pubkey,
created_at,
@@ -380,10 +379,10 @@ mod tests {
};
wire.id = wire.computed_event_id().expect("event id").into_string();
let raw_json = raw_json_for_wire(&wire);
- RadrootsSignedEvent::from_wire_verified_id(wire, raw_json).expect("signed event")
+ SignedEvent::from_wire_verified_id(wire, raw_json).expect("signed event")
}
- fn raw_json_for_wire(wire: &RadrootsNip01EventWire) -> String {
+ fn raw_json_for_wire(wire: &Nip01EventWire) -> String {
serde_json::json!({
"id": wire.id,
"pubkey": wire.pubkey,
@@ -467,7 +466,7 @@ mod tests {
let rejected_contract = event_contract(contract_id).expect("rejected contract");
assert!(!rejected_contract.authoring_policy().permits_generic_draft());
let error = sign_authorized_draft_with_validator(&actor, &signer, &draft, |_| {
- Err(RadrootsDraftError::ContractNotDraftAuthorable {
+ Err(DraftError::ContractNotDraftAuthorable {
contract_id: contract_id.to_owned(),
})
})
@@ -475,11 +474,9 @@ mod tests {
assert_eq!(
error,
- RadrootsAuthorityError::DraftValidation(
- RadrootsDraftError::ContractNotDraftAuthorable {
- contract_id: contract_id.to_owned(),
- }
- )
+ RadrootsAuthorityError::DraftValidation(DraftError::ContractNotDraftAuthorable {
+ contract_id: contract_id.to_owned(),
+ })
);
}
assert_eq!(signer.identity_invocations.get(), 0);
@@ -495,7 +492,7 @@ mod tests {
for actual in 1..RADROOTS_EVENT_CONTRACT_REGISTRY_VERSION {
let error = sign_authorized_draft_with_validator(&actor, &signer, &draft, |_| {
- Err(RadrootsDraftError::ContractRegistryVersionMismatch {
+ Err(DraftError::ContractRegistryVersionMismatch {
expected: RADROOTS_EVENT_CONTRACT_REGISTRY_VERSION,
actual,
})
@@ -505,7 +502,7 @@ mod tests {
assert_eq!(
error,
RadrootsAuthorityError::DraftValidation(
- RadrootsDraftError::ContractRegistryVersionMismatch {
+ DraftError::ContractRegistryVersionMismatch {
expected: RADROOTS_EVENT_CONTRACT_REGISTRY_VERSION,
actual,
}
@@ -653,7 +650,7 @@ mod tests {
#[test]
fn draft_validation_fallback_errors_map_to_computed_id_invalid() {
- let error = authority_error_from_draft_validation(RadrootsDraftError::UnknownContract(
+ let error = authority_error_from_draft_validation(DraftError::UnknownContract(
"radroots.unknown.v1".to_owned(),
));
@@ -692,7 +689,7 @@ mod tests {
#[test]
fn trade_proposal_draft_requires_buyer_role() {
let pubkey = hex_64('a');
- let draft = RadrootsEventDraft::new(
+ let draft = EventDraft::new(
"radroots.trade.proposal.v1",
KIND_TRADE_PROPOSAL,
1_700_000_000,
diff --git a/crates/authority/src/error.rs b/crates/authority/src/error.rs
@@ -48,7 +48,7 @@ pub enum RadrootsAuthorityError {
signer_pubkey: String,
},
- DraftValidation(radroots_event::draft::RadrootsDraftError),
+ DraftValidation(radroots_event::draft::DraftError),
SignedEventPubkeyMismatch {
expected_pubkey: String,
@@ -443,7 +443,7 @@ mod tests {
for (actual, expected_authority, expected_source) in cases {
let authority_error = RadrootsAuthorityError::DraftValidation(
- radroots_event::draft::RadrootsDraftError::ContractRegistryVersionMismatch {
+ radroots_event::draft::DraftError::ContractRegistryVersionMismatch {
expected: 7,
actual,
},
diff --git a/crates/authority/src/local_signer.rs b/crates/authority/src/local_signer.rs
@@ -1,7 +1,7 @@
#![forbid(unsafe_code)]
use crate::{RadrootsAuthorityError, RadrootsEventSigner, RadrootsSignerError};
-use radroots_event::draft::{RadrootsEventDraft, RadrootsSignedEvent};
+use radroots_event::draft::{EventDraft, SignedEvent};
use radroots_identity::PublicKey;
use radroots_nostr::prelude::{RadrootsNostrKeys, radroots_nostr_sign_frozen_draft};
@@ -23,10 +23,7 @@ impl RadrootsEventSigner for RadrootsLocalEventSigner {
&self.pubkey
}
- fn sign_frozen_draft(
- &self,
- draft: &RadrootsEventDraft,
- ) -> Result<RadrootsSignedEvent, RadrootsSignerError> {
+ fn sign_frozen_draft(&self, draft: &EventDraft) -> Result<SignedEvent, RadrootsSignerError> {
radroots_nostr_sign_frozen_draft(&self.keys, draft).map_err(|error| {
RadrootsSignerError::SigningFailed {
message: error.to_string(),
@@ -38,7 +35,7 @@ impl RadrootsEventSigner for RadrootsLocalEventSigner {
#[cfg(test)]
mod tests {
use super::*;
- use radroots_event::envelope::RadrootsEventEnvelope;
+ use radroots_event::envelope::EventEnvelope;
use radroots_event::envelope::kind::KIND_GEOCHAT;
use radroots_nostr::prelude::{
RadrootsNostrEventVerification, RadrootsNostrSecretKey, radroots_nostr_verify_event,
@@ -55,8 +52,8 @@ mod tests {
RadrootsNostrKeys::new(secret_key)
}
- fn generic_draft() -> RadrootsEventDraft {
- RadrootsEventDraft::new(
+ fn generic_draft() -> EventDraft {
+ EventDraft::new(
"radroots.social.geochat.v1",
KIND_GEOCHAT,
1_700_000_000,
@@ -67,7 +64,7 @@ mod tests {
.expect("draft")
}
- fn verification_event(signed: &RadrootsSignedEvent) -> RadrootsEventEnvelope {
+ fn verification_event(signed: &SignedEvent) -> EventEnvelope {
signed.envelope().clone()
}
diff --git a/crates/authority/src/signer.rs b/crates/authority/src/signer.rs
@@ -1,9 +1,9 @@
#![forbid(unsafe_code)]
use crate::{RadrootsAuthorityError, RadrootsSignerError};
-use radroots_event::draft::{RadrootsEventDraft, RadrootsSignedEvent};
+use radroots_event::draft::{EventDraft, SignedEvent};
#[cfg(test)]
-use radroots_event::wire::RadrootsNip01EventWire;
+use radroots_event::wire::Nip01EventWire;
use radroots_identity::PublicKey;
#[derive(Clone, Debug, PartialEq, Eq)]
@@ -26,10 +26,7 @@ impl RadrootsSignerIdentity {
pub trait RadrootsEventSigner {
fn pubkey(&self) -> &PublicKey;
- fn sign_frozen_draft(
- &self,
- draft: &RadrootsEventDraft,
- ) -> Result<RadrootsSignedEvent, RadrootsSignerError>;
+ fn sign_frozen_draft(&self, draft: &EventDraft) -> Result<SignedEvent, RadrootsSignerError>;
}
#[cfg(test)]
@@ -45,8 +42,8 @@ mod tests {
std::iter::repeat_n(character, 128).collect()
}
- fn draft_for(pubkey: &str) -> RadrootsEventDraft {
- RadrootsEventDraft::new(
+ fn draft_for(pubkey: &str) -> EventDraft {
+ EventDraft::new(
"radroots.social.geochat.v1",
KIND_GEOCHAT,
1_700_000_000,
@@ -96,8 +93,8 @@ mod tests {
fn sign_frozen_draft(
&self,
- draft: &RadrootsEventDraft,
- ) -> Result<RadrootsSignedEvent, RadrootsSignerError> {
+ draft: &EventDraft,
+ ) -> Result<SignedEvent, RadrootsSignerError> {
if let Some(failure) = &self.failure {
return Err(match failure {
RadrootsSignerError::Unavailable => RadrootsSignerError::Unavailable,
@@ -113,7 +110,7 @@ mod tests {
.event_id
.clone()
.unwrap_or_else(|| draft.expected_event_id_hex());
- let wire = RadrootsNip01EventWire {
+ let wire = Nip01EventWire {
id,
pubkey: self.pubkey.to_string(),
created_at: draft.created_at_u64(),
@@ -124,7 +121,7 @@ mod tests {
extra: Default::default(),
};
let raw_json = raw_json_for_wire(&wire);
- RadrootsSignedEvent::from_wire_verified_id(wire, raw_json).map_err(|error| {
+ SignedEvent::from_wire_verified_id(wire, raw_json).map_err(|error| {
RadrootsSignerError::SigningFailed {
message: error.to_string(),
}
@@ -132,7 +129,7 @@ mod tests {
}
}
- fn raw_json_for_wire(wire: &RadrootsNip01EventWire) -> String {
+ fn raw_json_for_wire(wire: &Nip01EventWire) -> String {
serde_json::json!({
"id": wire.id,
"pubkey": wire.pubkey,
diff --git a/crates/event/README.md b/crates/event/README.md
@@ -32,23 +32,24 @@ Cryptographic verification implementations belong to `radroots_event_codec`
or signing crates and enter this crate only through the explicit
`admission::SignatureVerifier` host SPI.
-The Profile module exposes the exclusive strict authored model. It requires a
+The Profile module exposes only the strict authored and native profile values. It requires a
non-whitespace, control-free name; its media fields accept only image-typed,
byte-verified Blossom descriptors; and its NIP-05 identifier type validates
-syntax without making a network identity claim. The legacy read projection is
-not serializable or exported as a DTO. Tolerant reads use
-`RadrootsInboundProfileMetadata` from `radroots_event_codec`.
-
-The post module keeps the legacy mutable `RadrootsPost` model as a compatibility
-read projection only. New root kind-1 publication uses private-field
-`RadrootsAuthoredUpdate`, `RadrootsAuthoredPhotoUpdate`, and
-`RadrootsAuthoredAsk` types. Photo and optional Ask media require nonzero
+syntax without making a network identity claim. Tolerant reads use
+`RadrootsInboundProfileMetadata` from `radroots_event_codec`; the lossy legacy
+projection is quarantined there as `LegacyProfile` until its mandatory removal
+in Step 087 and is not part of this crate's public surface.
+
+The post module exposes only native authored values. New root kind-1 publication uses private-field
+`AuthoredUpdate`, `AuthoredPhotoUpdate`, and
+`AuthoredAsk` types. Photo and optional Ask media require nonzero
dimensions, bounded alt text, approved same-digest fallbacks, and an
image-typed byte-verified Blossom descriptor. That descriptor state is not an
upload receipt; BUD-02 completion remains a runtime prerequisite before
-signing.
+signing. The mutable legacy read projection is quarantined in
+`radroots_event_codec` as `LegacyPost` until its mandatory removal in Step 087.
-The shared `tag::relay_hint` module exposes `RadrootsNostrRelayHint` for NIP-10 Reply
+The shared `tag::relay_hint` module exposes `NostrRelayHint` for NIP-10 Reply
and NIP-22 Comment references. It is a byte-stable subset of WebSocket URLs:
exact lowercase `ws://` or `wss://`, visible ASCII, canonical lowercase DNS or
four-octet IPv4 or bracketed pure-hex RFC 5952 IPv6, canonical optional port
@@ -56,8 +57,8 @@ four-octet IPv4 or bracketed pure-hex RFC 5952 IPv6, canonical optional port
escapes. It rejects IDNA and percent-encoded hosts, legacy IPv4, userinfo,
fragments, controls, backslashes, and normalization-dependent spellings.
-The `post::reply` module exposes opaque `RadrootsNip10ReplyReference` and
-`RadrootsAuthoredNip10Reply` types for strict direct and nested kind-1
+The `post::reply` module exposes opaque `Nip10ReplyReference` and
+`AuthoredNip10Reply` types for strict direct and nested kind-1
authoring. References carry a validated event id, referenced author, and
optional shared relay hint; construction emits either one marked root or
distinct marked root and parent references. Relay-hint syntax is not a
@@ -67,7 +68,7 @@ existence, target kind, signature, author, or relay availability.
The `post::comment` module implements the strict Radroots
[NIP-22](https://github.com/nostr-protocol/nips/blob/bdfa7e62ef87fcfcb992b1a27aee49d36b0b4f91/22.md)
-kind-`1111` profile. `RadrootsAuthoredNip22Comment` and its opaque event-root,
+kind-`1111` profile. `AuthoredNip22Comment` and its opaque event-root,
address-root, parent, position, and root-kind values admit only kind-`30402`,
kind-`31922`, or kind-`31923` event or address roots. External `I`/`i`
references and kind-`1` roots are unsupported. The authored model has no Serde
@@ -98,7 +99,7 @@ admission. The three governed Comment operations are
The `post::deletion` module implements the effect-free request layer of
[NIP-09](https://github.com/nostr-protocol/nips/blob/bdfa7e62ef87fcfcb992b1a27aee49d36b0b4f91/09.md).
-`RadrootsAuthoredNip09DeletionRequest` requires at least one validated event-id
+`AuthoredNip09DeletionRequest` requires at least one validated event-id
or replaceable/addressable coordinate target. Event targets carry a
caller-asserted kind advisory in `0..=65535`; this is metadata rather than
proof of the target event. Address coordinates accept NIP-01 replaceable kinds
@@ -126,13 +127,13 @@ the focused FoodAvailability marker family; presence of
`radroots:primary_bin`, `radroots:bin`, or `radroots:price` selects the richer
Operational Listing marker family. Focused-only, operational-only, marker-free
generic NIP-99, and mixed-marker events produce
-`RadrootsClassifiedListingPartition::{FocusedFoodAvailability,
+`ClassifiedListingPartition::{FocusedFoodAvailability,
OperationalListing, GenericNip99, Ambiguous}` respectively. A malformed
one-element tag still contributes its raw first name, and marker matching is
case-sensitive. `classify_classified_listing_tags` and the borrowed-slice
variant inspect neither kind, tag values, nor tag arity.
-The `food::availability` module provides `RadrootsFoodAvailabilityDetails` and
+The `food::availability` module provides `FoodAvailabilityDetails` and
checked identifier, text, publication timestamp, price, currency, unit,
quantity, status, image-dimension, and image values. Content contains at least
one scalar outside Unicode whitespace and U+001C through U+001F, and is bounded
@@ -143,7 +144,7 @@ control-free text bounded to 4096 UTF-8 bytes. Food units are closed to `g`,
Price permits zero; quantity is strictly positive and uses the price unit.
Image dimensions use two nonzero canonical `u32` decimal values in
`WIDTHxHEIGHT` form. Details accept at most 64 images, require unique image URLs
-and Blossom digests, and accept only `RadrootsAuthoredImage` values that already
+and Blossom digests, and accept only `AuthoredImage` values that already
prove local descriptor-to-byte agreement. Details retain nonzero `published_at`
and can validate that it is not later than a supplied `created_at`.
@@ -163,10 +164,10 @@ module nor the registry signs, publishes, replicates, or retrieves an event.
The calendar module keeps three different states explicit for NIP-52 kinds
`31922`, `31923`, `31924`, and `31925`: the complete structural event envelope,
a tolerant baseline NIP-52 projection, and a strict Radroots-admitted
-projection. The authored types are `RadrootsAuthoredCalendarDateEvent`,
-`RadrootsAuthoredCalendarTimeEvent`, `RadrootsAuthoredCalendar`, and
-`RadrootsAuthoredCalendarEventRsvp`; their inbound counterparts use matching
-`RadrootsParsedNip52*` and `RadrootsAdmitted*` types. Envelope construction
+projection. The authored types are `AuthoredCalendarDateEvent`,
+`AuthoredCalendarTimeEvent`, `AuthoredCalendar`, and
+`AuthoredCalendarEventRsvp`; their inbound counterparts use matching
+`ParsedNip52*` and `Admitted*` types. Envelope construction
validates structure, not a matching event id or Schnorr signature. Callers must
perform those cryptographic checks independently and keep any parsed or
admitted value bound to the verified envelope and expected kind.
@@ -241,7 +242,7 @@ state are not part of this crate's current group event subset.
Task records, work sessions, harvest records, approvals, and similar Field
business objects are CRDT document semantics carried by
-`RadrootsFarmCrdtChange`. They are not separate `rr-rs` event families and this
+`FarmCrdtChange`. They are not separate `rr-rs` event families and this
crate does not enforce private Field workflow authorization.
## Copyright
diff --git a/crates/event/src/account.rs b/crates/event/src/account.rs
@@ -12,7 +12,7 @@ pub const KIND_ACCOUNT_CLAIM: u32 = KIND_ACCOUNT_CLAIM_EVENT;
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsAccountClaim {
+pub struct AccountClaim {
pub username: String,
pub pubkey: String,
pub nip05: Option<String>,
diff --git a/crates/event/src/admission.rs b/crates/event/src/admission.rs
@@ -5,7 +5,7 @@ pub use crate::verification::{
SignatureVerifier,
};
-use crate::envelope::RadrootsEventEnvelope;
+use crate::envelope::EventEnvelope;
/// **Host SPI:** authorizes a contract-validated event for admission.
///
@@ -79,7 +79,7 @@ impl AdmittedEvent {
}
#[must_use]
- pub const fn event(&self) -> &RadrootsEventEnvelope {
+ pub const fn event(&self) -> &EventEnvelope {
self.event.event()
}
@@ -128,7 +128,7 @@ impl VisibleEvent {
}
#[must_use]
- pub const fn event(&self) -> &RadrootsEventEnvelope {
+ pub const fn event(&self) -> &EventEnvelope {
self.event.event()
}
@@ -146,12 +146,12 @@ impl VisibleEvent {
#[cfg(test)]
mod tests {
use super::*;
- use crate::envelope::{RadrootsEventEnvelope, RadrootsEventEnvelopeParts};
+ use crate::envelope::{EventEnvelope, EventEnvelopeParts};
struct Allow;
impl SignatureVerifier for Allow {
- fn verify_signature(&self, _event: &RadrootsEventEnvelope) -> Result<(), Error> {
+ fn verify_signature(&self, _event: &EventEnvelope) -> Result<(), Error> {
Ok(())
}
}
@@ -184,7 +184,7 @@ mod tests {
fn positive_vector_traverses_the_complete_transition_graph() {
let admission_policy: &dyn AdmissionPolicy<Error = core::convert::Infallible> = &Allow;
let visibility_policy: &dyn VisibilityPolicy<Error = core::convert::Infallible> = &Allow;
- let envelope = RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ let envelope = EventEnvelope::new(EventEnvelopeParts {
id: "762bee187e9e645b81ec26ade05a69b5e8398caf527be8de0d9a45311ed0c7a0"
.to_owned(),
author: "585591529da0bab31b3b1b1f986611cf5f435dca84f978c89ee8a40cca7103df"
diff --git a/crates/event/src/app_data.rs b/crates/event/src/app_data.rs
@@ -14,7 +14,7 @@ pub const KIND_APP_DATA: u32 = KIND_APP_DATA_EVENT;
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsAppData {
+pub struct AppData {
pub d_tag: String,
pub content: String,
}
diff --git a/crates/event/src/article.rs b/crates/event/src/article.rs
@@ -1,14 +1,14 @@
#[cfg(not(feature = "std"))]
use alloc::{string::String, vec::Vec};
-use crate::social::{RadrootsSocialFarmAnchor, RadrootsSocialLocation};
+use crate::social::{SocialFarmAnchor, SocialLocation};
#[cfg_attr(
any(feature = "serde", test),
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsArticle {
+pub struct Article {
pub d_tag: String,
pub title: String,
pub content: String,
@@ -31,12 +31,12 @@ pub struct RadrootsArticle {
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
- pub farm: Option<RadrootsSocialFarmAnchor>,
+ pub farm: Option<SocialFarmAnchor>,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
- pub location: Option<RadrootsSocialLocation>,
+ pub location: Option<SocialLocation>,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
@@ -50,7 +50,7 @@ mod tests {
#[test]
fn article_represents_required_nip23_fields() {
- let article = RadrootsArticle {
+ let article = Article {
d_tag: "soil-notes".to_string(),
title: "soil notes".to_string(),
content: "# soil notes".to_string(),
@@ -58,7 +58,7 @@ mod tests {
image: None,
published_at: Some(1_700_000_000),
farm: None,
- location: Some(RadrootsSocialLocation {
+ location: Some(SocialLocation {
name: Some("field edge".to_string()),
geohash: Some("c23nb62w20st".to_string()),
}),
diff --git a/crates/event/src/calendar.rs b/crates/event/src/calendar.rs
@@ -8,10 +8,9 @@ use alloc::{
use core::{fmt, ops::RangeInclusive, str::FromStr};
use crate::id::{
- RadrootsAddressableCoordinate, RadrootsAddressableCoordinateParts, RadrootsDTag,
- RadrootsEventId, RadrootsRelayUrl, parse_public_key,
+ AddressableCoordinate, AddressableCoordinateParts, DTag, EventId, RelayUrl, parse_public_key,
};
-use crate::media::RadrootsAuthoredImage;
+use crate::media::AuthoredImage;
use crate::wire::v1::{
DEFAULT_CONTENT_MAX_BYTES, DEFAULT_TAG_ELEMENT_MAX_BYTES, DEFAULT_TAG_MAX_COUNT,
DEFAULT_TAG_TOTAL_MAX_BYTES,
@@ -29,7 +28,7 @@ pub const RADROOTS_CALENDAR_MAX_PARTICIPANTS: usize = DEFAULT_TAG_MAX_COUNT - 16
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
-pub struct RadrootsCalendarParticipant {
+pub struct CalendarParticipant {
pub pubkey: String,
pub relay: Option<String>,
pub role: Option<String>,
@@ -41,7 +40,7 @@ pub struct RadrootsCalendarParticipant {
)]
#[cfg_attr(any(feature = "serde", test), serde(rename_all = "snake_case"))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsCalendarEventRsvpStatus {
+pub enum CalendarEventRsvpStatus {
Accepted,
Declined,
Tentative,
@@ -53,14 +52,14 @@ pub enum RadrootsCalendarEventRsvpStatus {
)]
#[cfg_attr(any(feature = "serde", test), serde(rename_all = "snake_case"))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsCalendarEventFreeBusy {
+pub enum CalendarEventFreeBusy {
Free,
Busy,
}
#[non_exhaustive]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsCalendarEventError {
+pub enum CalendarEventError {
InvalidIdentifier,
InvalidCalendarUid,
InvalidEventReference,
@@ -106,7 +105,7 @@ pub enum RadrootsCalendarEventError {
},
}
-impl RadrootsCalendarEventError {
+impl CalendarEventError {
pub const fn code(&self) -> &'static str {
match self {
Self::InvalidIdentifier => "invalid_identifier",
@@ -135,7 +134,7 @@ impl RadrootsCalendarEventError {
}
}
-impl fmt::Display for RadrootsCalendarEventError {
+impl fmt::Display for CalendarEventError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::InvalidIdentifier => f.write_str("calendar identifier is invalid"),
@@ -196,7 +195,7 @@ impl fmt::Display for RadrootsCalendarEventError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsCalendarEventError {}
+impl std::error::Error for CalendarEventError {}
/// A syntax-valid 128-bit calendar identifier encoded as unpadded base64url.
///
@@ -204,10 +203,10 @@ impl std::error::Error for RadrootsCalendarEventError {}
/// authoring runtime must still generate a fresh value for every calendar or
/// RSVP identity it creates.
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct RadrootsCalendarUid(String);
+pub struct CalendarUid(String);
-impl RadrootsCalendarUid {
- pub fn parse(value: impl AsRef<str>) -> Result<Self, RadrootsCalendarEventError> {
+impl CalendarUid {
+ pub fn parse(value: impl AsRef<str>) -> Result<Self, CalendarEventError> {
let value = value.as_ref();
let valid_alphabet = value
.bytes()
@@ -217,7 +216,7 @@ impl RadrootsCalendarUid {
.last()
.is_some_and(|byte| matches!(byte, b'A' | b'Q' | b'g' | b'w'));
if value.len() != 22 || !valid_alphabet || !valid_final_quantum {
- return Err(RadrootsCalendarEventError::InvalidCalendarUid);
+ return Err(CalendarEventError::InvalidCalendarUid);
}
Ok(Self(value.to_string()))
}
@@ -231,36 +230,36 @@ impl RadrootsCalendarUid {
}
}
-impl fmt::Display for RadrootsCalendarUid {
+impl fmt::Display for CalendarUid {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.as_str())
}
}
-impl AsRef<str> for RadrootsCalendarUid {
+impl AsRef<str> for CalendarUid {
fn as_ref(&self) -> &str {
self.as_str()
}
}
-impl FromStr for RadrootsCalendarUid {
- type Err = RadrootsCalendarEventError;
+impl FromStr for CalendarUid {
+ type Err = CalendarEventError;
fn from_str(value: &str) -> Result<Self, Self::Err> {
Self::parse(value)
}
}
-impl TryFrom<&str> for RadrootsCalendarUid {
- type Error = RadrootsCalendarEventError;
+impl TryFrom<&str> for CalendarUid {
+ type Error = CalendarEventError;
fn try_from(value: &str) -> Result<Self, Self::Error> {
Self::parse(value)
}
}
-impl TryFrom<String> for RadrootsCalendarUid {
- type Error = RadrootsCalendarEventError;
+impl TryFrom<String> for CalendarUid {
+ type Error = CalendarEventError;
fn try_from(value: String) -> Result<Self, Self::Error> {
Self::parse(value)
@@ -268,7 +267,7 @@ impl TryFrom<String> for RadrootsCalendarUid {
}
#[cfg(any(feature = "serde", test))]
-impl serde::Serialize for RadrootsCalendarUid {
+impl serde::Serialize for CalendarUid {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
@@ -279,34 +278,32 @@ impl serde::Serialize for RadrootsCalendarUid {
/// A raw-preserving NIP-52 address reference to a kind-31922 or kind-31923 event.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsCalendarEventReference {
- coordinate: RadrootsAddressableCoordinate,
+pub struct CalendarEventReference {
+ coordinate: AddressableCoordinate,
kind: u32,
author: PublicKey,
- d_tag: RadrootsDTag,
+ d_tag: DTag,
relay: Option<String>,
}
-impl RadrootsCalendarEventReference {
+impl CalendarEventReference {
pub fn parse(
coordinate: impl AsRef<str>,
relay: Option<&str>,
- ) -> Result<Self, RadrootsCalendarEventError> {
- let coordinate = RadrootsAddressableCoordinate::parse(coordinate.as_ref())
- .map_err(|_| RadrootsCalendarEventError::InvalidEventReference)?;
- let parts = RadrootsAddressableCoordinateParts::parse(coordinate.as_str())
- .map_err(|_| RadrootsCalendarEventError::InvalidEventReference)?;
+ ) -> Result<Self, CalendarEventError> {
+ let coordinate = AddressableCoordinate::parse(coordinate.as_ref())
+ .map_err(|_| CalendarEventError::InvalidEventReference)?;
+ let parts = AddressableCoordinateParts::parse(coordinate.as_str())
+ .map_err(|_| CalendarEventError::InvalidEventReference)?;
if !matches!(
parts.kind,
crate::envelope::kind::KIND_CALENDAR_DATE_EVENT
| crate::envelope::kind::KIND_CALENDAR_TIME_EVENT
) {
- return Err(RadrootsCalendarEventError::InvalidEventReference);
+ return Err(CalendarEventError::InvalidEventReference);
}
- let relay = parse_calendar_reference_relay(
- relay,
- RadrootsCalendarEventError::InvalidEventReference,
- )?;
+ let relay =
+ parse_calendar_reference_relay(relay, CalendarEventError::InvalidEventReference)?;
Ok(Self {
coordinate,
kind: parts.kind,
@@ -316,7 +313,7 @@ impl RadrootsCalendarEventReference {
})
}
- pub fn coordinate(&self) -> &RadrootsAddressableCoordinate {
+ pub fn coordinate(&self) -> &AddressableCoordinate {
&self.coordinate
}
@@ -328,7 +325,7 @@ impl RadrootsCalendarEventReference {
&self.author
}
- pub fn d_tag(&self) -> &RadrootsDTag {
+ pub fn d_tag(&self) -> &DTag {
&self.d_tag
}
@@ -342,7 +339,7 @@ impl RadrootsCalendarEventReference {
self.coordinate.as_str() == format!("{}:{}:{}", self.kind, self.author, self.d_tag)
&& self
.relay()
- .is_none_or(|relay| RadrootsRelayUrl::parse(relay).is_ok())
+ .is_none_or(|relay| RelayUrl::parse(relay).is_ok())
}
fn has_same_coordinate(&self, other: &Self) -> bool {
@@ -352,24 +349,22 @@ impl RadrootsCalendarEventReference {
/// A raw-preserving event-id reference to a specific NIP-52 event revision.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsCalendarEventRevisionReference {
+pub struct CalendarEventRevisionReference {
raw_event_id: String,
- event_id: RadrootsEventId,
+ event_id: EventId,
relay: Option<String>,
}
-impl RadrootsCalendarEventRevisionReference {
+impl CalendarEventRevisionReference {
pub fn parse(
event_id: impl AsRef<str>,
relay: Option<&str>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ ) -> Result<Self, CalendarEventError> {
let raw_event_id = event_id.as_ref();
- let event_id = RadrootsEventId::parse(raw_event_id)
- .map_err(|_| RadrootsCalendarEventError::InvalidRevisionReference)?;
- let relay = parse_calendar_reference_relay(
- relay,
- RadrootsCalendarEventError::InvalidRevisionReference,
- )?;
+ let event_id = EventId::parse(raw_event_id)
+ .map_err(|_| CalendarEventError::InvalidRevisionReference)?;
+ let relay =
+ parse_calendar_reference_relay(relay, CalendarEventError::InvalidRevisionReference)?;
Ok(Self {
raw_event_id: raw_event_id.to_string(),
event_id,
@@ -381,7 +376,7 @@ impl RadrootsCalendarEventRevisionReference {
&self.raw_event_id
}
- pub fn event_id(&self) -> &RadrootsEventId {
+ pub fn event_id(&self) -> &EventId {
&self.event_id
}
@@ -394,30 +389,25 @@ impl RadrootsCalendarEventRevisionReference {
self.raw_event_id == self.event_id.to_hex()
&& self
.relay()
- .is_none_or(|relay| RadrootsRelayUrl::parse(relay).is_ok())
+ .is_none_or(|relay| RelayUrl::parse(relay).is_ok())
}
}
/// A raw-preserving optional RSVP author hint. This reference has no role field.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsCalendarEventAuthorReference {
+pub struct CalendarEventAuthorReference {
raw_pubkey: String,
pubkey: PublicKey,
relay: Option<String>,
}
-impl RadrootsCalendarEventAuthorReference {
- pub fn parse(
- pubkey: impl AsRef<str>,
- relay: Option<&str>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+impl CalendarEventAuthorReference {
+ pub fn parse(pubkey: impl AsRef<str>, relay: Option<&str>) -> Result<Self, CalendarEventError> {
let raw_pubkey = pubkey.as_ref();
- let pubkey = parse_public_key(raw_pubkey)
- .map_err(|_| RadrootsCalendarEventError::InvalidAuthorReference)?;
- let relay = parse_calendar_reference_relay(
- relay,
- RadrootsCalendarEventError::InvalidAuthorReference,
- )?;
+ let pubkey =
+ parse_public_key(raw_pubkey).map_err(|_| CalendarEventError::InvalidAuthorReference)?;
+ let relay =
+ parse_calendar_reference_relay(relay, CalendarEventError::InvalidAuthorReference)?;
Ok(Self {
raw_pubkey: raw_pubkey.to_string(),
pubkey,
@@ -442,22 +432,22 @@ impl RadrootsCalendarEventAuthorReference {
self.raw_pubkey == self.pubkey.to_hex()
&& self
.relay()
- .is_none_or(|relay| RadrootsRelayUrl::parse(relay).is_ok())
+ .is_none_or(|relay| RelayUrl::parse(relay).is_ok())
}
}
/// A canonical IANA Time Zone Database identifier.
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct RadrootsIanaTimeZoneId(String);
+pub struct IanaTimeZoneId(String);
-impl RadrootsIanaTimeZoneId {
- pub fn parse(value: impl AsRef<str>) -> Result<Self, RadrootsCalendarEventError> {
+impl IanaTimeZoneId {
+ pub fn parse(value: impl AsRef<str>) -> Result<Self, CalendarEventError> {
let value = value.as_ref();
let Some((canonical, _)) = jiff_tzdb::get(value) else {
- return Err(RadrootsCalendarEventError::InvalidTimeZone);
+ return Err(CalendarEventError::InvalidTimeZone);
};
if canonical != value || !canonical_calendar_tag_text_is_valid(value) {
- return Err(RadrootsCalendarEventError::InvalidTimeZone);
+ return Err(CalendarEventError::InvalidTimeZone);
}
Ok(Self(value.into()))
}
@@ -467,20 +457,20 @@ impl RadrootsIanaTimeZoneId {
}
}
-impl fmt::Display for RadrootsIanaTimeZoneId {
+impl fmt::Display for IanaTimeZoneId {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.as_str())
}
}
-impl AsRef<str> for RadrootsIanaTimeZoneId {
+impl AsRef<str> for IanaTimeZoneId {
fn as_ref(&self) -> &str {
self.as_str()
}
}
-impl FromStr for RadrootsIanaTimeZoneId {
- type Err = RadrootsCalendarEventError;
+impl FromStr for IanaTimeZoneId {
+ type Err = CalendarEventError;
fn from_str(value: &str) -> Result<Self, Self::Err> {
Self::parse(value)
@@ -488,7 +478,7 @@ impl FromStr for RadrootsIanaTimeZoneId {
}
#[cfg(any(feature = "serde", test))]
-impl serde::Serialize for RadrootsIanaTimeZoneId {
+impl serde::Serialize for IanaTimeZoneId {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
@@ -498,7 +488,7 @@ impl serde::Serialize for RadrootsIanaTimeZoneId {
}
#[cfg(any(feature = "serde", test))]
-impl<'de> serde::Deserialize<'de> for RadrootsIanaTimeZoneId {
+impl<'de> serde::Deserialize<'de> for IanaTimeZoneId {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
@@ -510,10 +500,10 @@ impl<'de> serde::Deserialize<'de> for RadrootsIanaTimeZoneId {
/// A structurally valid absolute URI preserved exactly as it appeared on wire.
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct RadrootsCalendarUri(String);
+pub struct CalendarUri(String);
-impl RadrootsCalendarUri {
- pub fn parse(value: impl AsRef<str>) -> Result<Self, RadrootsCalendarEventError> {
+impl CalendarUri {
+ pub fn parse(value: impl AsRef<str>) -> Result<Self, CalendarEventError> {
let value = value.as_ref();
if value.trim() != value
|| value
@@ -522,7 +512,7 @@ impl RadrootsCalendarUri {
|| value.len() > DEFAULT_TAG_ELEMENT_MAX_BYTES
|| Url::parse(value).is_err()
{
- return Err(RadrootsCalendarEventError::InvalidUrl("URI"));
+ return Err(CalendarEventError::InvalidUrl("URI"));
}
Ok(Self(value.into()))
}
@@ -532,28 +522,28 @@ impl RadrootsCalendarUri {
}
}
-impl AsRef<str> for RadrootsCalendarUri {
+impl AsRef<str> for CalendarUri {
fn as_ref(&self) -> &str {
self.as_str()
}
}
-impl FromStr for RadrootsCalendarUri {
- type Err = RadrootsCalendarEventError;
+impl FromStr for CalendarUri {
+ type Err = CalendarEventError;
fn from_str(value: &str) -> Result<Self, Self::Err> {
Self::parse(value)
}
}
-impl fmt::Display for RadrootsCalendarUri {
+impl fmt::Display for CalendarUri {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(any(feature = "serde", test))]
-impl serde::Serialize for RadrootsCalendarUri {
+impl serde::Serialize for CalendarUri {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
@@ -563,7 +553,7 @@ impl serde::Serialize for RadrootsCalendarUri {
}
#[cfg(any(feature = "serde", test))]
-impl<'de> serde::Deserialize<'de> for RadrootsCalendarUri {
+impl<'de> serde::Deserialize<'de> for CalendarUri {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
@@ -575,22 +565,22 @@ impl<'de> serde::Deserialize<'de> for RadrootsCalendarUri {
/// Strict authored representation of a NIP-52 kind-31924 calendar collection.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsAuthoredCalendar {
- uid: RadrootsCalendarUid,
+pub struct AuthoredCalendar {
+ uid: CalendarUid,
title: String,
content: String,
- event_references: Vec<RadrootsCalendarEventReference>,
+ event_references: Vec<CalendarEventReference>,
list_description: Option<String>,
- image: Option<RadrootsAuthoredImage>,
+ image: Option<AuthoredImage>,
}
-impl RadrootsAuthoredCalendar {
+impl AuthoredCalendar {
pub fn new(
- uid: RadrootsCalendarUid,
+ uid: CalendarUid,
title: impl Into<String>,
content: impl Into<String>,
- event_references: Vec<RadrootsCalendarEventReference>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ event_references: Vec<CalendarEventReference>,
+ ) -> Result<Self, CalendarEventError> {
let title = validated_title(title.into())?;
let content = content.into();
validate_calendar_content(&content)?;
@@ -610,7 +600,7 @@ impl RadrootsAuthoredCalendar {
pub fn with_list_description(
mut self,
value: impl Into<String>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ ) -> Result<Self, CalendarEventError> {
let value = value.into();
validate_canonical_calendar_tag_text(&value, "description")?;
self.list_description = Some(value);
@@ -618,16 +608,13 @@ impl RadrootsAuthoredCalendar {
Ok(self)
}
- pub fn with_image(
- mut self,
- image: RadrootsAuthoredImage,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ pub fn with_image(mut self, image: AuthoredImage) -> Result<Self, CalendarEventError> {
self.image = Some(image);
self.validate_budget()?;
Ok(self)
}
- pub fn uid(&self) -> &RadrootsCalendarUid {
+ pub fn uid(&self) -> &CalendarUid {
&self.uid
}
@@ -639,7 +626,7 @@ impl RadrootsAuthoredCalendar {
&self.content
}
- pub fn event_references(&self) -> &[RadrootsCalendarEventReference] {
+ pub fn event_references(&self) -> &[CalendarEventReference] {
&self.event_references
}
@@ -647,11 +634,11 @@ impl RadrootsAuthoredCalendar {
self.list_description.as_deref()
}
- pub fn image(&self) -> Option<&RadrootsAuthoredImage> {
+ pub fn image(&self) -> Option<&AuthoredImage> {
self.image.as_ref()
}
- fn validate_budget(&self) -> Result<(), RadrootsCalendarEventError> {
+ fn validate_budget(&self) -> Result<(), CalendarEventError> {
validate_calendar_collection_budget(
self.uid.as_str(),
&self.title,
@@ -667,30 +654,28 @@ impl RadrootsAuthoredCalendar {
/// Constructor input for the tolerant, raw-preserving kind-31924 parse layer.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsParsedNip52CalendarParts {
+pub struct ParsedNip52CalendarParts {
pub d_tag: String,
pub title: String,
pub content: String,
- pub event_references: Vec<RadrootsCalendarEventReference>,
+ pub event_references: Vec<CalendarEventReference>,
pub list_description: Option<String>,
- pub image: Option<RadrootsCalendarUri>,
+ pub image: Option<CalendarUri>,
}
/// Structurally valid kind-31924 data. Canonical admission is a separate step.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsParsedNip52Calendar {
+pub struct ParsedNip52Calendar {
d_tag: String,
title: String,
content: String,
- event_references: Vec<RadrootsCalendarEventReference>,
+ event_references: Vec<CalendarEventReference>,
list_description: Option<String>,
- image: Option<RadrootsCalendarUri>,
+ image: Option<CalendarUri>,
}
-impl RadrootsParsedNip52Calendar {
- pub fn try_new(
- parts: RadrootsParsedNip52CalendarParts,
- ) -> Result<Self, RadrootsCalendarEventError> {
+impl ParsedNip52Calendar {
+ pub fn try_new(parts: ParsedNip52CalendarParts) -> Result<Self, CalendarEventError> {
validate_calendar_tag_text(&parts.d_tag, "d")?;
validate_calendar_tag_text(&parts.title, "title")?;
validate_calendar_content(&parts.content)?;
@@ -703,7 +688,7 @@ impl RadrootsParsedNip52Calendar {
&parts.content,
&parts.event_references,
parts.list_description.as_deref(),
- parts.image.as_ref().map(RadrootsCalendarUri::as_str),
+ parts.image.as_ref().map(CalendarUri::as_str),
)?;
Ok(Self {
d_tag: parts.d_tag,
@@ -727,7 +712,7 @@ impl RadrootsParsedNip52Calendar {
&self.content
}
- pub fn event_references(&self) -> &[RadrootsCalendarEventReference] {
+ pub fn event_references(&self) -> &[CalendarEventReference] {
&self.event_references
}
@@ -735,53 +720,46 @@ impl RadrootsParsedNip52Calendar {
self.list_description.as_deref()
}
- pub fn image(&self) -> Option<&RadrootsCalendarUri> {
+ pub fn image(&self) -> Option<&CalendarUri> {
self.image.as_ref()
}
}
/// Canonical Radroots admission of a parsed kind-31924 calendar collection.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsAdmittedCalendar {
- parsed: RadrootsParsedNip52Calendar,
- uid: RadrootsCalendarUid,
+pub struct AdmittedCalendar {
+ parsed: ParsedNip52Calendar,
+ uid: CalendarUid,
blossom_image: Option<BlobUrl>,
}
-impl RadrootsAdmittedCalendar {
- pub fn try_from_parsed(
- parsed: RadrootsParsedNip52Calendar,
- ) -> Result<Self, RadrootsCalendarAdmissionError> {
- let uid = RadrootsCalendarUid::parse(parsed.d_tag())
- .map_err(|_| RadrootsCalendarAdmissionError::NonCanonicalField("d"))?;
+impl AdmittedCalendar {
+ pub fn try_from_parsed(parsed: ParsedNip52Calendar) -> Result<Self, CalendarAdmissionError> {
+ let uid = CalendarUid::parse(parsed.d_tag())
+ .map_err(|_| CalendarAdmissionError::NonCanonicalField("d"))?;
if !canonical_calendar_tag_text_is_valid(parsed.title()) {
- return Err(RadrootsCalendarAdmissionError::NonCanonicalField("title"));
+ return Err(CalendarAdmissionError::NonCanonicalField("title"));
}
if parsed
.list_description()
.is_some_and(|description| !canonical_calendar_tag_text_is_valid(description))
{
- return Err(RadrootsCalendarAdmissionError::NonCanonicalField(
- "description",
- ));
+ return Err(CalendarAdmissionError::NonCanonicalField("description"));
}
if parsed
.event_references()
.iter()
.any(|reference| !reference.is_canonical())
{
- return Err(RadrootsCalendarAdmissionError::NonCanonicalField(
- "event_reference",
- ));
+ return Err(CalendarAdmissionError::NonCanonicalField("event_reference"));
}
if calendar_event_references_have_duplicates(parsed.event_references()) {
- return Err(RadrootsCalendarAdmissionError::DuplicateEventReference);
+ return Err(CalendarAdmissionError::DuplicateEventReference);
}
let blossom_image = parsed
.image()
.map(|image| {
- BlobUrl::parse(image.as_str())
- .map_err(|_| RadrootsCalendarAdmissionError::NonBlossomImage)
+ BlobUrl::parse(image.as_str()).map_err(|_| CalendarAdmissionError::NonBlossomImage)
})
.transpose()?;
Ok(Self {
@@ -791,11 +769,11 @@ impl RadrootsAdmittedCalendar {
})
}
- pub fn parsed(&self) -> &RadrootsParsedNip52Calendar {
+ pub fn parsed(&self) -> &ParsedNip52Calendar {
&self.parsed
}
- pub fn uid(&self) -> &RadrootsCalendarUid {
+ pub fn uid(&self) -> &CalendarUid {
&self.uid
}
@@ -807,7 +785,7 @@ impl RadrootsAdmittedCalendar {
self.parsed.content()
}
- pub fn event_references(&self) -> &[RadrootsCalendarEventReference] {
+ pub fn event_references(&self) -> &[CalendarEventReference] {
self.parsed.event_references()
}
@@ -822,38 +800,33 @@ impl RadrootsAdmittedCalendar {
#[cfg_attr(any(feature = "serde", test), derive(serde::Serialize))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsCalendarRequest {
- calendar: RadrootsAddressableCoordinate,
+pub struct CalendarRequest {
+ calendar: AddressableCoordinate,
relay: Option<String>,
}
-impl RadrootsCalendarRequest {
- pub fn new(
- calendar: impl AsRef<str>,
- relay: Option<&str>,
- ) -> Result<Self, RadrootsCalendarEventError> {
- let calendar = RadrootsAddressableCoordinate::parse(calendar.as_ref())
- .map_err(|_| RadrootsCalendarEventError::InvalidUrl("calendar request"))?;
- let parts = crate::id::RadrootsAddressableCoordinateParts::parse(calendar.as_str())
- .map_err(|_| RadrootsCalendarEventError::InvalidUrl("calendar request"))?;
+impl CalendarRequest {
+ pub fn new(calendar: impl AsRef<str>, relay: Option<&str>) -> Result<Self, CalendarEventError> {
+ let calendar = AddressableCoordinate::parse(calendar.as_ref())
+ .map_err(|_| CalendarEventError::InvalidUrl("calendar request"))?;
+ let parts = crate::id::AddressableCoordinateParts::parse(calendar.as_str())
+ .map_err(|_| CalendarEventError::InvalidUrl("calendar request"))?;
if parts.kind != crate::envelope::kind::KIND_CALENDAR {
- return Err(RadrootsCalendarEventError::InvalidUrl("calendar request"));
+ return Err(CalendarEventError::InvalidUrl("calendar request"));
}
let relay = relay
.map(|value| {
if calendar_relay_url_is_valid(value) {
Ok(value.to_string())
} else {
- Err(RadrootsCalendarEventError::InvalidUrl(
- "calendar request relay",
- ))
+ Err(CalendarEventError::InvalidUrl("calendar request relay"))
}
})
.transpose()?;
Ok(Self { calendar, relay })
}
- pub fn calendar(&self) -> &RadrootsAddressableCoordinate {
+ pub fn calendar(&self) -> &AddressableCoordinate {
&self.calendar
}
@@ -862,34 +835,32 @@ impl RadrootsCalendarRequest {
}
pub fn is_canonical(&self) -> bool {
- let Ok(parts) =
- crate::id::RadrootsAddressableCoordinateParts::parse(self.calendar.as_str())
- else {
+ let Ok(parts) = crate::id::AddressableCoordinateParts::parse(self.calendar.as_str()) else {
return false;
};
self.calendar.as_str() == format!("{}:{}:{}", parts.kind, parts.pubkey, parts.d_tag)
&& self
.relay
.as_deref()
- .is_none_or(|relay| RadrootsRelayUrl::parse(relay).is_ok())
+ .is_none_or(|relay| RelayUrl::parse(relay).is_ok())
}
}
/// A canonical Gregorian calendar date in `YYYY-MM-DD` form.
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct RadrootsCalendarDate(String);
+pub struct CalendarDate(String);
-impl RadrootsCalendarDate {
- pub fn parse(value: &str) -> Result<Self, RadrootsCalendarEventError> {
+impl CalendarDate {
+ pub fn parse(value: &str) -> Result<Self, CalendarEventError> {
let bytes = value.as_bytes();
if bytes.len() != 10 || bytes[4] != b'-' || bytes[7] != b'-' {
- return Err(RadrootsCalendarEventError::InvalidDate);
+ return Err(CalendarEventError::InvalidDate);
}
let year = parse_date_digits(&bytes[0..4])?;
let month = parse_date_digits(&bytes[5..7])?;
let day = parse_date_digits(&bytes[8..10])?;
if year == 0 || month == 0 || month > 12 || day == 0 || day > days_in_month(year, month) {
- return Err(RadrootsCalendarEventError::InvalidDate);
+ return Err(CalendarEventError::InvalidDate);
}
Ok(Self(value.into()))
}
@@ -899,20 +870,20 @@ impl RadrootsCalendarDate {
}
}
-impl fmt::Display for RadrootsCalendarDate {
+impl fmt::Display for CalendarDate {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.as_str())
}
}
-impl AsRef<str> for RadrootsCalendarDate {
+impl AsRef<str> for CalendarDate {
fn as_ref(&self) -> &str {
self.as_str()
}
}
-impl FromStr for RadrootsCalendarDate {
- type Err = RadrootsCalendarEventError;
+impl FromStr for CalendarDate {
+ type Err = CalendarEventError;
fn from_str(value: &str) -> Result<Self, Self::Err> {
Self::parse(value)
@@ -920,7 +891,7 @@ impl FromStr for RadrootsCalendarDate {
}
#[cfg(any(feature = "serde", test))]
-impl serde::Serialize for RadrootsCalendarDate {
+impl serde::Serialize for CalendarDate {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
@@ -930,7 +901,7 @@ impl serde::Serialize for RadrootsCalendarDate {
}
#[cfg(any(feature = "serde", test))]
-impl<'de> serde::Deserialize<'de> for RadrootsCalendarDate {
+impl<'de> serde::Deserialize<'de> for CalendarDate {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
@@ -945,30 +916,30 @@ impl<'de> serde::Deserialize<'de> for RadrootsCalendarDate {
/// Authored images can only enter through a byte-verified image descriptor.
/// The model cannot represent the obsolete uppercase-`D` date list.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsAuthoredCalendarDateEvent {
- d_tag: RadrootsDTag,
+pub struct AuthoredCalendarDateEvent {
+ d_tag: DTag,
title: String,
- start: RadrootsCalendarDate,
+ start: CalendarDate,
description: Option<String>,
- end: Option<RadrootsCalendarDate>,
+ end: Option<CalendarDate>,
locations: Vec<String>,
geohash: Option<String>,
summary: Option<String>,
- image: Option<RadrootsAuthoredImage>,
- participants: Option<Vec<RadrootsCalendarParticipant>>,
+ image: Option<AuthoredImage>,
+ participants: Option<Vec<CalendarParticipant>>,
categories: Vec<String>,
- references: Vec<RadrootsCalendarUri>,
- calendar_requests: Vec<RadrootsCalendarRequest>,
+ references: Vec<CalendarUri>,
+ calendar_requests: Vec<CalendarRequest>,
}
-impl RadrootsAuthoredCalendarDateEvent {
+impl AuthoredCalendarDateEvent {
pub fn new(
d_tag: impl AsRef<str>,
title: impl Into<String>,
- start: RadrootsCalendarDate,
- ) -> Result<Self, RadrootsCalendarEventError> {
- let d_tag = RadrootsDTag::parse(d_tag.as_ref())
- .map_err(|_| RadrootsCalendarEventError::InvalidIdentifier)?;
+ start: CalendarDate,
+ ) -> Result<Self, CalendarEventError> {
+ let d_tag =
+ DTag::parse(d_tag.as_ref()).map_err(|_| CalendarEventError::InvalidIdentifier)?;
let title = validated_title(title.into())?;
Ok(Self {
d_tag,
@@ -987,12 +958,9 @@ impl RadrootsAuthoredCalendarDateEvent {
})
}
- pub fn with_end(
- mut self,
- end: RadrootsCalendarDate,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ pub fn with_end(mut self, end: CalendarDate) -> Result<Self, CalendarEventError> {
if end <= self.start {
- return Err(RadrootsCalendarEventError::InvalidRange);
+ return Err(CalendarEventError::InvalidRange);
}
self.end = Some(end);
self.validate_budget()?;
@@ -1002,7 +970,7 @@ impl RadrootsAuthoredCalendarDateEvent {
pub fn with_description(
mut self,
value: impl Into<String>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ ) -> Result<Self, CalendarEventError> {
let value = value.into();
validate_calendar_content(&value)?;
self.description = Some(value);
@@ -1010,33 +978,24 @@ impl RadrootsAuthoredCalendarDateEvent {
Ok(self)
}
- pub fn with_locations(
- mut self,
- value: Vec<String>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ pub fn with_locations(mut self, value: Vec<String>) -> Result<Self, CalendarEventError> {
validate_authored_calendar_locations(&value)?;
self.locations = value;
self.validate_budget()?;
Ok(self)
}
- pub fn with_geohash(
- mut self,
- value: impl Into<String>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ pub fn with_geohash(mut self, value: impl Into<String>) -> Result<Self, CalendarEventError> {
let value = value.into();
if !canonical_calendar_geohash_is_valid(&value) {
- return Err(RadrootsCalendarEventError::InvalidGeohash);
+ return Err(CalendarEventError::InvalidGeohash);
}
self.geohash = Some(value);
self.validate_budget()?;
Ok(self)
}
- pub fn with_summary(
- mut self,
- value: impl Into<String>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ pub fn with_summary(mut self, value: impl Into<String>) -> Result<Self, CalendarEventError> {
let value = value.into();
validate_canonical_calendar_tag_text(&value, "summary")?;
self.summary = Some(value);
@@ -1044,10 +1003,7 @@ impl RadrootsAuthoredCalendarDateEvent {
Ok(self)
}
- pub fn with_image(
- mut self,
- value: RadrootsAuthoredImage,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ pub fn with_image(mut self, value: AuthoredImage) -> Result<Self, CalendarEventError> {
self.image = Some(value);
self.validate_budget()?;
Ok(self)
@@ -1055,28 +1011,22 @@ impl RadrootsAuthoredCalendarDateEvent {
pub fn with_participants(
mut self,
- value: Vec<RadrootsCalendarParticipant>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ value: Vec<CalendarParticipant>,
+ ) -> Result<Self, CalendarEventError> {
validate_authored_calendar_participants(&value)?;
self.participants = Some(value);
self.validate_budget()?;
Ok(self)
}
- pub fn with_categories(
- mut self,
- value: Vec<String>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ pub fn with_categories(mut self, value: Vec<String>) -> Result<Self, CalendarEventError> {
validate_authored_calendar_categories(&value)?;
self.categories = value;
self.validate_budget()?;
Ok(self)
}
- pub fn with_references(
- mut self,
- value: Vec<RadrootsCalendarUri>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ pub fn with_references(mut self, value: Vec<CalendarUri>) -> Result<Self, CalendarEventError> {
self.references = value;
self.validate_budget()?;
Ok(self)
@@ -1084,15 +1034,15 @@ impl RadrootsAuthoredCalendarDateEvent {
pub fn with_calendar_requests(
mut self,
- value: Vec<RadrootsCalendarRequest>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ value: Vec<CalendarRequest>,
+ ) -> Result<Self, CalendarEventError> {
validate_authored_calendar_requests(&value)?;
self.calendar_requests = value;
self.validate_budget()?;
Ok(self)
}
- pub fn d_tag(&self) -> &RadrootsDTag {
+ pub fn d_tag(&self) -> &DTag {
&self.d_tag
}
@@ -1100,7 +1050,7 @@ impl RadrootsAuthoredCalendarDateEvent {
&self.title
}
- pub fn start(&self) -> &RadrootsCalendarDate {
+ pub fn start(&self) -> &CalendarDate {
&self.start
}
@@ -1108,7 +1058,7 @@ impl RadrootsAuthoredCalendarDateEvent {
self.description.as_deref()
}
- pub fn end(&self) -> Option<&RadrootsCalendarDate> {
+ pub fn end(&self) -> Option<&CalendarDate> {
self.end.as_ref()
}
@@ -1124,11 +1074,11 @@ impl RadrootsAuthoredCalendarDateEvent {
self.summary.as_deref()
}
- pub fn image(&self) -> Option<&RadrootsAuthoredImage> {
+ pub fn image(&self) -> Option<&AuthoredImage> {
self.image.as_ref()
}
- pub fn participants(&self) -> Option<&Vec<RadrootsCalendarParticipant>> {
+ pub fn participants(&self) -> Option<&Vec<CalendarParticipant>> {
self.participants.as_ref()
}
@@ -1136,15 +1086,15 @@ impl RadrootsAuthoredCalendarDateEvent {
&self.categories
}
- pub fn references(&self) -> &[RadrootsCalendarUri] {
+ pub fn references(&self) -> &[CalendarUri] {
&self.references
}
- pub fn calendar_requests(&self) -> &[RadrootsCalendarRequest] {
+ pub fn calendar_requests(&self) -> &[CalendarRequest] {
&self.calendar_requests
}
- fn validate_budget(&self) -> Result<(), RadrootsCalendarEventError> {
+ fn validate_budget(&self) -> Result<(), CalendarEventError> {
validate_authored_calendar_budget(self.description(), authored_date_tags_for_budget(self))
}
}
@@ -1154,32 +1104,32 @@ impl RadrootsAuthoredCalendarDateEvent {
/// Covered uppercase-`D` values are derived from the timestamp range and are
/// never accepted from callers.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsAuthoredCalendarTimeEvent {
- d_tag: RadrootsDTag,
+pub struct AuthoredCalendarTimeEvent {
+ d_tag: DTag,
title: String,
start: u64,
description: Option<String>,
end: Option<u64>,
- start_tzid: Option<RadrootsIanaTimeZoneId>,
- end_tzid: Option<RadrootsIanaTimeZoneId>,
+ start_tzid: Option<IanaTimeZoneId>,
+ end_tzid: Option<IanaTimeZoneId>,
locations: Vec<String>,
geohash: Option<String>,
summary: Option<String>,
- image: Option<RadrootsAuthoredImage>,
- participants: Option<Vec<RadrootsCalendarParticipant>>,
+ image: Option<AuthoredImage>,
+ participants: Option<Vec<CalendarParticipant>>,
categories: Vec<String>,
- references: Vec<RadrootsCalendarUri>,
- calendar_requests: Vec<RadrootsCalendarRequest>,
+ references: Vec<CalendarUri>,
+ calendar_requests: Vec<CalendarRequest>,
}
-impl RadrootsAuthoredCalendarTimeEvent {
+impl AuthoredCalendarTimeEvent {
pub fn new(
d_tag: impl AsRef<str>,
title: impl Into<String>,
start: u64,
- ) -> Result<Self, RadrootsCalendarEventError> {
- let d_tag = RadrootsDTag::parse(d_tag.as_ref())
- .map_err(|_| RadrootsCalendarEventError::InvalidIdentifier)?;
+ ) -> Result<Self, CalendarEventError> {
+ let d_tag =
+ DTag::parse(d_tag.as_ref()).map_err(|_| CalendarEventError::InvalidIdentifier)?;
let title = validated_title(title.into())?;
covered_utc_days(start, None)?;
Ok(Self {
@@ -1201,7 +1151,7 @@ impl RadrootsAuthoredCalendarTimeEvent {
})
}
- pub fn with_end(mut self, end: u64) -> Result<Self, RadrootsCalendarEventError> {
+ pub fn with_end(mut self, end: u64) -> Result<Self, CalendarEventError> {
covered_utc_days(self.start, Some(end))?;
self.end = Some(end);
self.validate_budget()?;
@@ -1211,7 +1161,7 @@ impl RadrootsAuthoredCalendarTimeEvent {
pub fn with_description(
mut self,
value: impl Into<String>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ ) -> Result<Self, CalendarEventError> {
let value = value.into();
validate_calendar_content(&value)?;
self.description = Some(value);
@@ -1219,51 +1169,36 @@ impl RadrootsAuthoredCalendarTimeEvent {
Ok(self)
}
- pub fn with_start_tzid(
- mut self,
- value: impl AsRef<str>,
- ) -> Result<Self, RadrootsCalendarEventError> {
- self.start_tzid = Some(RadrootsIanaTimeZoneId::parse(value)?);
+ pub fn with_start_tzid(mut self, value: impl AsRef<str>) -> Result<Self, CalendarEventError> {
+ self.start_tzid = Some(IanaTimeZoneId::parse(value)?);
self.validate_budget()?;
Ok(self)
}
- pub fn with_end_tzid(
- mut self,
- value: impl AsRef<str>,
- ) -> Result<Self, RadrootsCalendarEventError> {
- self.end_tzid = Some(RadrootsIanaTimeZoneId::parse(value)?);
+ pub fn with_end_tzid(mut self, value: impl AsRef<str>) -> Result<Self, CalendarEventError> {
+ self.end_tzid = Some(IanaTimeZoneId::parse(value)?);
self.validate_budget()?;
Ok(self)
}
- pub fn with_locations(
- mut self,
- value: Vec<String>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ pub fn with_locations(mut self, value: Vec<String>) -> Result<Self, CalendarEventError> {
validate_authored_calendar_locations(&value)?;
self.locations = value;
self.validate_budget()?;
Ok(self)
}
- pub fn with_geohash(
- mut self,
- value: impl Into<String>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ pub fn with_geohash(mut self, value: impl Into<String>) -> Result<Self, CalendarEventError> {
let value = value.into();
if !canonical_calendar_geohash_is_valid(&value) {
- return Err(RadrootsCalendarEventError::InvalidGeohash);
+ return Err(CalendarEventError::InvalidGeohash);
}
self.geohash = Some(value);
self.validate_budget()?;
Ok(self)
}
- pub fn with_summary(
- mut self,
- value: impl Into<String>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ pub fn with_summary(mut self, value: impl Into<String>) -> Result<Self, CalendarEventError> {
let value = value.into();
validate_canonical_calendar_tag_text(&value, "summary")?;
self.summary = Some(value);
@@ -1271,10 +1206,7 @@ impl RadrootsAuthoredCalendarTimeEvent {
Ok(self)
}
- pub fn with_image(
- mut self,
- value: RadrootsAuthoredImage,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ pub fn with_image(mut self, value: AuthoredImage) -> Result<Self, CalendarEventError> {
self.image = Some(value);
self.validate_budget()?;
Ok(self)
@@ -1282,28 +1214,22 @@ impl RadrootsAuthoredCalendarTimeEvent {
pub fn with_participants(
mut self,
- value: Vec<RadrootsCalendarParticipant>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ value: Vec<CalendarParticipant>,
+ ) -> Result<Self, CalendarEventError> {
validate_authored_calendar_participants(&value)?;
self.participants = Some(value);
self.validate_budget()?;
Ok(self)
}
- pub fn with_categories(
- mut self,
- value: Vec<String>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ pub fn with_categories(mut self, value: Vec<String>) -> Result<Self, CalendarEventError> {
validate_authored_calendar_categories(&value)?;
self.categories = value;
self.validate_budget()?;
Ok(self)
}
- pub fn with_references(
- mut self,
- value: Vec<RadrootsCalendarUri>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ pub fn with_references(mut self, value: Vec<CalendarUri>) -> Result<Self, CalendarEventError> {
self.references = value;
self.validate_budget()?;
Ok(self)
@@ -1311,15 +1237,15 @@ impl RadrootsAuthoredCalendarTimeEvent {
pub fn with_calendar_requests(
mut self,
- value: Vec<RadrootsCalendarRequest>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ value: Vec<CalendarRequest>,
+ ) -> Result<Self, CalendarEventError> {
validate_authored_calendar_requests(&value)?;
self.calendar_requests = value;
self.validate_budget()?;
Ok(self)
}
- pub fn d_tag(&self) -> &RadrootsDTag {
+ pub fn d_tag(&self) -> &DTag {
&self.d_tag
}
@@ -1339,15 +1265,15 @@ impl RadrootsAuthoredCalendarTimeEvent {
self.end
}
- pub fn start_tzid(&self) -> Option<&RadrootsIanaTimeZoneId> {
+ pub fn start_tzid(&self) -> Option<&IanaTimeZoneId> {
self.start_tzid.as_ref()
}
- pub fn end_tzid(&self) -> Option<&RadrootsIanaTimeZoneId> {
+ pub fn end_tzid(&self) -> Option<&IanaTimeZoneId> {
self.end_tzid.as_ref()
}
- pub fn effective_end_tzid(&self) -> Option<&RadrootsIanaTimeZoneId> {
+ pub fn effective_end_tzid(&self) -> Option<&IanaTimeZoneId> {
self.end_tzid.as_ref().or(self.start_tzid.as_ref())
}
@@ -1363,11 +1289,11 @@ impl RadrootsAuthoredCalendarTimeEvent {
self.summary.as_deref()
}
- pub fn image(&self) -> Option<&RadrootsAuthoredImage> {
+ pub fn image(&self) -> Option<&AuthoredImage> {
self.image.as_ref()
}
- pub fn participants(&self) -> Option<&Vec<RadrootsCalendarParticipant>> {
+ pub fn participants(&self) -> Option<&Vec<CalendarParticipant>> {
self.participants.as_ref()
}
@@ -1375,56 +1301,54 @@ impl RadrootsAuthoredCalendarTimeEvent {
&self.categories
}
- pub fn references(&self) -> &[RadrootsCalendarUri] {
+ pub fn references(&self) -> &[CalendarUri] {
&self.references
}
- pub fn calendar_requests(&self) -> &[RadrootsCalendarRequest] {
+ pub fn calendar_requests(&self) -> &[CalendarRequest] {
&self.calendar_requests
}
- fn validate_budget(&self) -> Result<(), RadrootsCalendarEventError> {
+ fn validate_budget(&self) -> Result<(), CalendarEventError> {
validate_authored_calendar_budget(self.description(), authored_time_tags_for_budget(self)?)
}
}
#[cfg_attr(any(feature = "serde", test), derive(serde::Serialize))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsParsedNip52CalendarCommon {
+pub struct ParsedNip52CalendarCommon {
d_tag: String,
title: String,
description: Option<String>,
locations: Vec<String>,
geohash: Option<String>,
summary: Option<String>,
- image: Option<RadrootsCalendarUri>,
- participants: Vec<RadrootsCalendarParticipant>,
+ image: Option<CalendarUri>,
+ participants: Vec<CalendarParticipant>,
categories: Vec<String>,
- references: Vec<RadrootsCalendarUri>,
- calendar_requests: Vec<RadrootsCalendarRequest>,
+ references: Vec<CalendarUri>,
+ calendar_requests: Vec<CalendarRequest>,
legacy_name: Option<String>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsParsedNip52CalendarCommonParts {
+pub struct ParsedNip52CalendarCommonParts {
pub d_tag: String,
pub title: String,
pub description: Option<String>,
pub locations: Vec<String>,
pub geohash: Option<String>,
pub summary: Option<String>,
- pub image: Option<RadrootsCalendarUri>,
- pub participants: Vec<RadrootsCalendarParticipant>,
+ pub image: Option<CalendarUri>,
+ pub participants: Vec<CalendarParticipant>,
pub categories: Vec<String>,
- pub references: Vec<RadrootsCalendarUri>,
- pub calendar_requests: Vec<RadrootsCalendarRequest>,
+ pub references: Vec<CalendarUri>,
+ pub calendar_requests: Vec<CalendarRequest>,
pub legacy_name: Option<String>,
}
-impl RadrootsParsedNip52CalendarCommon {
- pub fn try_new(
- parts: RadrootsParsedNip52CalendarCommonParts,
- ) -> Result<Self, RadrootsCalendarEventError> {
+impl ParsedNip52CalendarCommon {
+ pub fn try_new(parts: ParsedNip52CalendarCommonParts) -> Result<Self, CalendarEventError> {
validate_calendar_tag_text(&parts.d_tag, "d")?;
validate_calendar_tag_text(&parts.title, "title")?;
if let Some(description) = parts.description.as_deref() {
@@ -1436,7 +1360,7 @@ impl RadrootsParsedNip52CalendarCommon {
if let Some(geohash) = parts.geohash.as_deref()
&& !calendar_geohash_is_valid(geohash)
{
- return Err(RadrootsCalendarEventError::InvalidGeohash);
+ return Err(CalendarEventError::InvalidGeohash);
}
if let Some(summary) = parts.summary.as_deref() {
validate_calendar_tag_text(summary, "summary")?;
@@ -1488,11 +1412,11 @@ impl RadrootsParsedNip52CalendarCommon {
self.summary.as_deref()
}
- pub fn image(&self) -> Option<&RadrootsCalendarUri> {
+ pub fn image(&self) -> Option<&CalendarUri> {
self.image.as_ref()
}
- pub fn participants(&self) -> &[RadrootsCalendarParticipant] {
+ pub fn participants(&self) -> &[CalendarParticipant] {
&self.participants
}
@@ -1500,11 +1424,11 @@ impl RadrootsParsedNip52CalendarCommon {
&self.categories
}
- pub fn references(&self) -> &[RadrootsCalendarUri] {
+ pub fn references(&self) -> &[CalendarUri] {
&self.references
}
- pub fn calendar_requests(&self) -> &[RadrootsCalendarRequest] {
+ pub fn calendar_requests(&self) -> &[CalendarRequest] {
&self.calendar_requests
}
@@ -1515,22 +1439,22 @@ impl RadrootsParsedNip52CalendarCommon {
#[cfg_attr(any(feature = "serde", test), derive(serde::Serialize))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsParsedNip52CalendarDateEvent {
- common: RadrootsParsedNip52CalendarCommon,
- start: RadrootsCalendarDate,
- end: Option<RadrootsCalendarDate>,
+pub struct ParsedNip52CalendarDateEvent {
+ common: ParsedNip52CalendarCommon,
+ start: CalendarDate,
+ end: Option<CalendarDate>,
extension_day_tags: Vec<Vec<String>>,
}
-impl RadrootsParsedNip52CalendarDateEvent {
+impl ParsedNip52CalendarDateEvent {
pub fn try_new(
- common: RadrootsParsedNip52CalendarCommon,
- start: RadrootsCalendarDate,
- end: Option<RadrootsCalendarDate>,
+ common: ParsedNip52CalendarCommon,
+ start: CalendarDate,
+ end: Option<CalendarDate>,
extension_day_tags: Vec<Vec<String>>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ ) -> Result<Self, CalendarEventError> {
if end.as_ref().is_some_and(|end| end <= &start) {
- return Err(RadrootsCalendarEventError::InvalidRange);
+ return Err(CalendarEventError::InvalidRange);
}
Ok(Self {
common,
@@ -1540,15 +1464,15 @@ impl RadrootsParsedNip52CalendarDateEvent {
})
}
- pub fn common(&self) -> &RadrootsParsedNip52CalendarCommon {
+ pub fn common(&self) -> &ParsedNip52CalendarCommon {
&self.common
}
- pub fn start(&self) -> &RadrootsCalendarDate {
+ pub fn start(&self) -> &CalendarDate {
&self.start
}
- pub fn end(&self) -> Option<&RadrootsCalendarDate> {
+ pub fn end(&self) -> Option<&CalendarDate> {
self.end.as_ref()
}
@@ -1559,20 +1483,20 @@ impl RadrootsParsedNip52CalendarDateEvent {
#[cfg_attr(any(feature = "serde", test), derive(serde::Serialize))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsObservedUtcDay {
+pub struct ObservedUtcDay {
wire_value: String,
index: u64,
}
-impl RadrootsObservedUtcDay {
- pub fn parse(value: impl Into<String>) -> Result<Self, RadrootsCalendarEventError> {
+impl ObservedUtcDay {
+ pub fn parse(value: impl Into<String>) -> Result<Self, CalendarEventError> {
let wire_value = value.into();
if wire_value.is_empty() || !wire_value.bytes().all(|byte| byte.is_ascii_digit()) {
- return Err(RadrootsCalendarEventError::InvalidText("D"));
+ return Err(CalendarEventError::InvalidText("D"));
}
let index = wire_value
.parse()
- .map_err(|_| RadrootsCalendarEventError::InvalidText("D"))?;
+ .map_err(|_| CalendarEventError::InvalidText("D"))?;
Ok(Self { wire_value, index })
}
@@ -1591,29 +1515,29 @@ impl RadrootsObservedUtcDay {
#[cfg_attr(any(feature = "serde", test), derive(serde::Serialize))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsParsedNip52CalendarTimeEvent {
- common: RadrootsParsedNip52CalendarCommon,
+pub struct ParsedNip52CalendarTimeEvent {
+ common: ParsedNip52CalendarCommon,
start_wire: String,
start: u64,
end_wire: Option<String>,
end: Option<u64>,
- observed_day_indices: Vec<RadrootsObservedUtcDay>,
- start_tzid: Option<RadrootsIanaTimeZoneId>,
- end_tzid: Option<RadrootsIanaTimeZoneId>,
+ observed_day_indices: Vec<ObservedUtcDay>,
+ start_tzid: Option<IanaTimeZoneId>,
+ end_tzid: Option<IanaTimeZoneId>,
}
-impl RadrootsParsedNip52CalendarTimeEvent {
+impl ParsedNip52CalendarTimeEvent {
#[allow(clippy::too_many_arguments)]
pub fn try_new(
- common: RadrootsParsedNip52CalendarCommon,
+ common: ParsedNip52CalendarCommon,
start_wire: String,
start: u64,
end_wire: Option<String>,
end: Option<u64>,
- observed_day_indices: Vec<RadrootsObservedUtcDay>,
- start_tzid: Option<RadrootsIanaTimeZoneId>,
- end_tzid: Option<RadrootsIanaTimeZoneId>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ observed_day_indices: Vec<ObservedUtcDay>,
+ start_tzid: Option<IanaTimeZoneId>,
+ end_tzid: Option<IanaTimeZoneId>,
+ ) -> Result<Self, CalendarEventError> {
if parse_calendar_decimal(&start_wire) != Some(start)
|| end_wire
.as_deref()
@@ -1621,10 +1545,10 @@ impl RadrootsParsedNip52CalendarTimeEvent {
.is_some_and(|(wire, end)| parse_calendar_decimal(wire) != Some(end))
|| end_wire.is_some() != end.is_some()
{
- return Err(RadrootsCalendarEventError::InvalidRange);
+ return Err(CalendarEventError::InvalidRange);
}
if end.is_some_and(|end| end <= start) {
- return Err(RadrootsCalendarEventError::InvalidRange);
+ return Err(CalendarEventError::InvalidRange);
}
let first = start / RADROOTS_CALENDAR_SECONDS_PER_DAY;
let last = end
@@ -1635,7 +1559,7 @@ impl RadrootsParsedNip52CalendarTimeEvent {
.iter()
.any(|day| !(first..=last).contains(&day.index))
{
- return Err(RadrootsCalendarEventError::InvalidRange);
+ return Err(CalendarEventError::InvalidRange);
}
Ok(Self {
common,
@@ -1649,7 +1573,7 @@ impl RadrootsParsedNip52CalendarTimeEvent {
})
}
- pub fn common(&self) -> &RadrootsParsedNip52CalendarCommon {
+ pub fn common(&self) -> &ParsedNip52CalendarCommon {
&self.common
}
@@ -1669,26 +1593,26 @@ impl RadrootsParsedNip52CalendarTimeEvent {
self.end
}
- pub fn observed_day_indices(&self) -> &[RadrootsObservedUtcDay] {
+ pub fn observed_day_indices(&self) -> &[ObservedUtcDay] {
&self.observed_day_indices
}
- pub fn start_tzid(&self) -> Option<&RadrootsIanaTimeZoneId> {
+ pub fn start_tzid(&self) -> Option<&IanaTimeZoneId> {
self.start_tzid.as_ref()
}
- pub fn end_tzid(&self) -> Option<&RadrootsIanaTimeZoneId> {
+ pub fn end_tzid(&self) -> Option<&IanaTimeZoneId> {
self.end_tzid.as_ref()
}
- pub fn effective_end_tzid(&self) -> Option<&RadrootsIanaTimeZoneId> {
+ pub fn effective_end_tzid(&self) -> Option<&IanaTimeZoneId> {
self.end_tzid.as_ref().or(self.start_tzid.as_ref())
}
}
#[non_exhaustive]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsCalendarAdmissionError {
+pub enum CalendarAdmissionError {
NonCanonicalField(&'static str),
DuplicateEventReference,
AuthorHintMismatch,
@@ -1698,7 +1622,7 @@ pub enum RadrootsCalendarAdmissionError {
NonBlossomImage,
}
-impl RadrootsCalendarAdmissionError {
+impl CalendarAdmissionError {
pub const fn code(&self) -> &'static str {
match self {
Self::NonCanonicalField(_) => "non_canonical_field",
@@ -1712,7 +1636,7 @@ impl RadrootsCalendarAdmissionError {
}
}
-impl fmt::Display for RadrootsCalendarAdmissionError {
+impl fmt::Display for CalendarAdmissionError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::NonCanonicalField(field) => write!(f, "calendar {field} is not canonical"),
@@ -1740,21 +1664,21 @@ impl fmt::Display for RadrootsCalendarAdmissionError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsCalendarAdmissionError {}
+impl std::error::Error for CalendarAdmissionError {}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsAdmittedCalendarDateEvent {
- parsed: RadrootsParsedNip52CalendarDateEvent,
- d_tag: RadrootsDTag,
+pub struct AdmittedCalendarDateEvent {
+ parsed: ParsedNip52CalendarDateEvent,
+ d_tag: DTag,
blossom_image: Option<BlobUrl>,
}
-impl RadrootsAdmittedCalendarDateEvent {
+impl AdmittedCalendarDateEvent {
pub fn try_from_parsed(
- parsed: RadrootsParsedNip52CalendarDateEvent,
- ) -> Result<Self, RadrootsCalendarAdmissionError> {
+ parsed: ParsedNip52CalendarDateEvent,
+ ) -> Result<Self, CalendarAdmissionError> {
if !parsed.extension_day_tags.is_empty() {
- return Err(RadrootsCalendarAdmissionError::ForbiddenDateDayIndex);
+ return Err(CalendarAdmissionError::ForbiddenDateDayIndex);
}
validate_admitted_calendar_common(&parsed.common)?;
let d_tag = admitted_d_tag(&parsed.common)?;
@@ -1766,11 +1690,11 @@ impl RadrootsAdmittedCalendarDateEvent {
})
}
- pub fn parsed(&self) -> &RadrootsParsedNip52CalendarDateEvent {
+ pub fn parsed(&self) -> &ParsedNip52CalendarDateEvent {
&self.parsed
}
- pub fn d_tag(&self) -> &RadrootsDTag {
+ pub fn d_tag(&self) -> &DTag {
&self.d_tag
}
@@ -1780,17 +1704,17 @@ impl RadrootsAdmittedCalendarDateEvent {
}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsAdmittedCalendarTimeEvent {
- parsed: RadrootsParsedNip52CalendarTimeEvent,
- d_tag: RadrootsDTag,
+pub struct AdmittedCalendarTimeEvent {
+ parsed: ParsedNip52CalendarTimeEvent,
+ d_tag: DTag,
covered_utc_days: Vec<u64>,
blossom_image: Option<BlobUrl>,
}
-impl RadrootsAdmittedCalendarTimeEvent {
+impl AdmittedCalendarTimeEvent {
pub fn try_from_parsed(
- parsed: RadrootsParsedNip52CalendarTimeEvent,
- ) -> Result<Self, RadrootsCalendarAdmissionError> {
+ parsed: ParsedNip52CalendarTimeEvent,
+ ) -> Result<Self, CalendarAdmissionError> {
validate_admitted_calendar_common(&parsed.common)?;
let d_tag = admitted_d_tag(&parsed.common)?;
if parsed.start_wire != parsed.start.to_string()
@@ -1800,15 +1724,13 @@ impl RadrootsAdmittedCalendarTimeEvent {
.zip(parsed.end)
.is_some_and(|(wire, end)| wire != end.to_string())
{
- return Err(RadrootsCalendarAdmissionError::NonCanonicalField(
- "timestamp",
- ));
+ return Err(CalendarAdmissionError::NonCanonicalField("timestamp"));
}
let expected = covered_utc_days(parsed.start, parsed.end).map_err(|error| match error {
- RadrootsCalendarEventError::CoveredDayLimitExceeded { max, actual } => {
- RadrootsCalendarAdmissionError::CoveredDayLimitExceeded { max, actual }
+ CalendarEventError::CoveredDayLimitExceeded { max, actual } => {
+ CalendarAdmissionError::CoveredDayLimitExceeded { max, actual }
}
- _ => RadrootsCalendarAdmissionError::IncompleteDayCoverage,
+ _ => CalendarAdmissionError::IncompleteDayCoverage,
})?;
let covered_utc_days = expected.clone().collect::<Vec<_>>();
if parsed.observed_day_indices.len() != covered_utc_days.len()
@@ -1818,7 +1740,7 @@ impl RadrootsAdmittedCalendarTimeEvent {
.zip(&covered_utc_days)
.any(|(observed, expected)| !observed.is_canonical() || observed.index != *expected)
{
- return Err(RadrootsCalendarAdmissionError::IncompleteDayCoverage);
+ return Err(CalendarAdmissionError::IncompleteDayCoverage);
}
let blossom_image = admitted_blossom_image(&parsed.common)?;
Ok(Self {
@@ -1829,11 +1751,11 @@ impl RadrootsAdmittedCalendarTimeEvent {
})
}
- pub fn parsed(&self) -> &RadrootsParsedNip52CalendarTimeEvent {
+ pub fn parsed(&self) -> &ParsedNip52CalendarTimeEvent {
&self.parsed
}
- pub fn d_tag(&self) -> &RadrootsDTag {
+ pub fn d_tag(&self) -> &DTag {
&self.d_tag
}
@@ -1849,9 +1771,9 @@ impl RadrootsAdmittedCalendarTimeEvent {
pub fn covered_utc_days(
start: u64,
end: Option<u64>,
-) -> Result<RangeInclusive<u64>, RadrootsCalendarEventError> {
+) -> Result<RangeInclusive<u64>, CalendarEventError> {
if end.is_some_and(|end| end <= start) {
- return Err(RadrootsCalendarEventError::InvalidRange);
+ return Err(CalendarEventError::InvalidRange);
}
let first = start / RADROOTS_CALENDAR_SECONDS_PER_DAY;
let last = end
@@ -1859,7 +1781,7 @@ pub fn covered_utc_days(
.unwrap_or(first);
let actual = last - first + 1;
if actual > RADROOTS_CALENDAR_MAX_COVERED_UTC_DAYS {
- return Err(RadrootsCalendarEventError::CoveredDayLimitExceeded {
+ return Err(CalendarEventError::CoveredDayLimitExceeded {
max: RADROOTS_CALENDAR_MAX_COVERED_UTC_DAYS,
actual,
});
@@ -1867,9 +1789,9 @@ pub fn covered_utc_days(
Ok(first..=last)
}
-fn validated_title(value: String) -> Result<String, RadrootsCalendarEventError> {
+fn validated_title(value: String) -> Result<String, CalendarEventError> {
if !canonical_calendar_tag_text_is_valid(&value) {
- return Err(RadrootsCalendarEventError::InvalidTitle);
+ return Err(CalendarEventError::InvalidTitle);
}
Ok(value)
}
@@ -1957,8 +1879,8 @@ pub fn calendar_relay_url_is_valid(value: &str) -> bool {
fn parse_calendar_reference_relay(
relay: Option<&str>,
- error: RadrootsCalendarEventError,
-) -> Result<Option<String>, RadrootsCalendarEventError> {
+ error: CalendarEventError,
+) -> Result<Option<String>, CalendarEventError> {
relay
.map(|relay| {
if calendar_relay_url_is_valid(relay) {
@@ -1970,9 +1892,7 @@ fn parse_calendar_reference_relay(
.transpose()
}
-fn calendar_event_references_have_duplicates(
- references: &[RadrootsCalendarEventReference],
-) -> bool {
+fn calendar_event_references_have_duplicates(references: &[CalendarEventReference]) -> bool {
references.iter().enumerate().any(|(index, reference)| {
references
.iter()
@@ -1982,43 +1902,40 @@ fn calendar_event_references_have_duplicates(
}
fn validate_strict_calendar_event_references(
- references: &[RadrootsCalendarEventReference],
-) -> Result<(), RadrootsCalendarEventError> {
+ references: &[CalendarEventReference],
+) -> Result<(), CalendarEventError> {
if references.iter().any(|reference| !reference.is_canonical()) {
- return Err(RadrootsCalendarEventError::InvalidEventReference);
+ return Err(CalendarEventError::InvalidEventReference);
}
if calendar_event_references_have_duplicates(references) {
- return Err(RadrootsCalendarEventError::DuplicateEventReference);
+ return Err(CalendarEventError::DuplicateEventReference);
}
Ok(())
}
fn validate_strict_calendar_author_hint(
- event_reference: &RadrootsCalendarEventReference,
- author_hint: &RadrootsCalendarEventAuthorReference,
-) -> Result<(), RadrootsCalendarEventError> {
+ event_reference: &CalendarEventReference,
+ author_hint: &CalendarEventAuthorReference,
+) -> Result<(), CalendarEventError> {
if !author_hint.is_canonical() {
- return Err(RadrootsCalendarEventError::InvalidAuthorReference);
+ return Err(CalendarEventError::InvalidAuthorReference);
}
if author_hint.pubkey() != event_reference.author() {
- return Err(RadrootsCalendarEventError::AuthorHintMismatch);
+ return Err(CalendarEventError::AuthorHintMismatch);
}
Ok(())
}
-fn validate_calendar_tag_text(
- value: &str,
- field: &'static str,
-) -> Result<(), RadrootsCalendarEventError> {
+fn validate_calendar_tag_text(value: &str, field: &'static str) -> Result<(), CalendarEventError> {
if !calendar_tag_text_is_valid(value) {
return Err(if value.len() > DEFAULT_TAG_ELEMENT_MAX_BYTES {
- RadrootsCalendarEventError::TagElementTooLarge {
+ CalendarEventError::TagElementTooLarge {
field,
max: DEFAULT_TAG_ELEMENT_MAX_BYTES,
actual: value.len(),
}
} else {
- RadrootsCalendarEventError::InvalidText(field)
+ CalendarEventError::InvalidText(field)
});
}
Ok(())
@@ -2027,17 +1944,17 @@ fn validate_calendar_tag_text(
fn validate_canonical_calendar_tag_text(
value: &str,
field: &'static str,
-) -> Result<(), RadrootsCalendarEventError> {
+) -> Result<(), CalendarEventError> {
validate_calendar_tag_text(value, field)?;
if value.trim() != value {
- return Err(RadrootsCalendarEventError::InvalidText(field));
+ return Err(CalendarEventError::InvalidText(field));
}
Ok(())
}
-fn validate_calendar_content(value: &str) -> Result<(), RadrootsCalendarEventError> {
+fn validate_calendar_content(value: &str) -> Result<(), CalendarEventError> {
if value.len() > DEFAULT_CONTENT_MAX_BYTES {
- return Err(RadrootsCalendarEventError::ContentTooLarge {
+ return Err(CalendarEventError::ContentTooLarge {
max: DEFAULT_CONTENT_MAX_BYTES,
actual: value.len(),
});
@@ -2045,9 +1962,7 @@ fn validate_calendar_content(value: &str) -> Result<(), RadrootsCalendarEventErr
Ok(())
}
-fn validate_authored_calendar_locations(
- locations: &[String],
-) -> Result<(), RadrootsCalendarEventError> {
+fn validate_authored_calendar_locations(locations: &[String]) -> Result<(), CalendarEventError> {
for location in locations {
validate_canonical_calendar_tag_text(location, "location")?;
}
@@ -2055,17 +1970,17 @@ fn validate_authored_calendar_locations(
}
fn validate_authored_calendar_requests(
- requests: &[RadrootsCalendarRequest],
-) -> Result<(), RadrootsCalendarEventError> {
+ requests: &[CalendarRequest],
+) -> Result<(), CalendarEventError> {
if requests.iter().any(|request| !request.is_canonical()) {
- return Err(RadrootsCalendarEventError::InvalidUrl("calendar request"));
+ return Err(CalendarEventError::InvalidUrl("calendar request"));
}
Ok(())
}
fn validate_inbound_calendar_participants(
- participants: &[RadrootsCalendarParticipant],
-) -> Result<(), RadrootsCalendarEventError> {
+ participants: &[CalendarParticipant],
+) -> Result<(), CalendarEventError> {
for (index, participant) in participants.iter().enumerate() {
if parse_public_key(&participant.pubkey).is_err()
|| participant
@@ -2077,17 +1992,17 @@ fn validate_inbound_calendar_participants(
.as_deref()
.is_some_and(|role| !calendar_tag_text_is_valid(role))
{
- return Err(RadrootsCalendarEventError::InvalidParticipant { index });
+ return Err(CalendarEventError::InvalidParticipant { index });
}
}
Ok(())
}
fn validate_authored_calendar_participants(
- participants: &[RadrootsCalendarParticipant],
-) -> Result<(), RadrootsCalendarEventError> {
+ participants: &[CalendarParticipant],
+) -> Result<(), CalendarEventError> {
if participants.len() > RADROOTS_CALENDAR_MAX_PARTICIPANTS {
- return Err(RadrootsCalendarEventError::TooManyParticipants {
+ return Err(CalendarEventError::TooManyParticipants {
max: RADROOTS_CALENDAR_MAX_PARTICIPANTS,
actual: participants.len(),
});
@@ -2095,26 +2010,24 @@ fn validate_authored_calendar_participants(
validate_inbound_calendar_participants(participants)?;
for (index, participant) in participants.iter().enumerate() {
let pubkey = parse_public_key(&participant.pubkey)
- .map_err(|_| RadrootsCalendarEventError::InvalidParticipant { index })?;
+ .map_err(|_| CalendarEventError::InvalidParticipant { index })?;
if pubkey.to_hex() != participant.pubkey
|| participant
.relay
.as_deref()
- .is_some_and(|relay| RadrootsRelayUrl::parse(relay).is_err())
+ .is_some_and(|relay| RelayUrl::parse(relay).is_err())
|| participant
.role
.as_deref()
.is_some_and(|role| !canonical_calendar_tag_text_is_valid(role))
{
- return Err(RadrootsCalendarEventError::InvalidParticipant { index });
+ return Err(CalendarEventError::InvalidParticipant { index });
}
}
Ok(())
}
-fn validate_authored_calendar_categories(
- categories: &[String],
-) -> Result<(), RadrootsCalendarEventError> {
+fn validate_authored_calendar_categories(categories: &[String]) -> Result<(), CalendarEventError> {
for category in categories {
validate_canonical_calendar_tag_text(category, "category")?;
}
@@ -2122,8 +2035,8 @@ fn validate_authored_calendar_categories(
}
fn validate_admitted_calendar_common(
- common: &RadrootsParsedNip52CalendarCommon,
-) -> Result<(), RadrootsCalendarAdmissionError> {
+ common: &ParsedNip52CalendarCommon,
+) -> Result<(), CalendarAdmissionError> {
let canonical = canonical_calendar_tag_text_is_valid(&common.title)
&& common
.locations
@@ -2148,42 +2061,37 @@ fn validate_admitted_calendar_common(
&& common
.calendar_requests
.iter()
- .all(RadrootsCalendarRequest::is_canonical);
+ .all(CalendarRequest::is_canonical);
if !canonical {
- return Err(RadrootsCalendarAdmissionError::NonCanonicalField(
- "metadata",
- ));
+ return Err(CalendarAdmissionError::NonCanonicalField("metadata"));
}
validate_authored_calendar_participants(&common.participants)
- .map_err(|_| RadrootsCalendarAdmissionError::NonCanonicalField("participant"))?;
+ .map_err(|_| CalendarAdmissionError::NonCanonicalField("participant"))?;
Ok(())
}
fn admitted_blossom_image(
- common: &RadrootsParsedNip52CalendarCommon,
-) -> Result<Option<BlobUrl>, RadrootsCalendarAdmissionError> {
+ common: &ParsedNip52CalendarCommon,
+) -> Result<Option<BlobUrl>, CalendarAdmissionError> {
common
.image
.as_ref()
.map(|image| {
- BlobUrl::parse(image.as_str())
- .map_err(|_| RadrootsCalendarAdmissionError::NonBlossomImage)
+ BlobUrl::parse(image.as_str()).map_err(|_| CalendarAdmissionError::NonBlossomImage)
})
.transpose()
}
-fn admitted_d_tag(
- common: &RadrootsParsedNip52CalendarCommon,
-) -> Result<RadrootsDTag, RadrootsCalendarAdmissionError> {
- let d_tag = RadrootsDTag::parse(&common.d_tag)
- .map_err(|_| RadrootsCalendarAdmissionError::NonCanonicalField("d"))?;
+fn admitted_d_tag(common: &ParsedNip52CalendarCommon) -> Result<DTag, CalendarAdmissionError> {
+ let d_tag =
+ DTag::parse(&common.d_tag).map_err(|_| CalendarAdmissionError::NonCanonicalField("d"))?;
if d_tag.as_str() != common.d_tag {
- return Err(RadrootsCalendarAdmissionError::NonCanonicalField("d"));
+ return Err(CalendarAdmissionError::NonCanonicalField("d"));
}
Ok(d_tag)
}
-fn authored_date_tags_for_budget(event: &RadrootsAuthoredCalendarDateEvent) -> Vec<Vec<String>> {
+fn authored_date_tags_for_budget(event: &AuthoredCalendarDateEvent) -> Vec<Vec<String>> {
let mut tags = vec![
budget_tag("d", event.d_tag().as_str()),
budget_tag("title", event.title()),
@@ -2207,8 +2115,8 @@ fn authored_date_tags_for_budget(event: &RadrootsAuthoredCalendarDateEvent) -> V
}
fn authored_time_tags_for_budget(
- event: &RadrootsAuthoredCalendarTimeEvent,
-) -> Result<Vec<Vec<String>>, RadrootsCalendarEventError> {
+ event: &AuthoredCalendarTimeEvent,
+) -> Result<Vec<Vec<String>>, CalendarEventError> {
let mut tags = vec![
budget_tag("d", event.d_tag().as_str()),
budget_tag("title", event.title()),
@@ -2246,11 +2154,11 @@ fn append_authored_common_tags_for_budget(
locations: &[String],
geohash: Option<&str>,
summary: Option<&str>,
- image: Option<&RadrootsAuthoredImage>,
- participants: Option<&Vec<RadrootsCalendarParticipant>>,
+ image: Option<&AuthoredImage>,
+ participants: Option<&Vec<CalendarParticipant>>,
categories: &[String],
- references: &[RadrootsCalendarUri],
- calendar_requests: &[RadrootsCalendarRequest],
+ references: &[CalendarUri],
+ calendar_requests: &[CalendarRequest],
) {
tags.extend(
locations
@@ -2301,10 +2209,10 @@ fn validate_calendar_collection_budget(
d_tag: &str,
title: &str,
content: &str,
- event_references: &[RadrootsCalendarEventReference],
+ event_references: &[CalendarEventReference],
list_description: Option<&str>,
image: Option<&str>,
-) -> Result<(), RadrootsCalendarEventError> {
+) -> Result<(), CalendarEventError> {
let mut tags = vec![budget_tag("d", d_tag), budget_tag("title", title)];
for reference in event_references {
let mut tag = budget_tag("a", reference.coordinate().as_str());
@@ -2325,13 +2233,13 @@ fn validate_calendar_collection_budget(
#[allow(clippy::too_many_arguments)]
fn validate_calendar_rsvp_budget(
d_tag: &str,
- event_reference: &RadrootsCalendarEventReference,
- revision_reference: Option<&RadrootsCalendarEventRevisionReference>,
- status: &RadrootsCalendarEventRsvpStatus,
- free_busy: Option<&RadrootsCalendarEventFreeBusy>,
- author_hint: Option<&RadrootsCalendarEventAuthorReference>,
+ event_reference: &CalendarEventReference,
+ revision_reference: Option<&CalendarEventRevisionReference>,
+ status: &CalendarEventRsvpStatus,
+ free_busy: Option<&CalendarEventFreeBusy>,
+ author_hint: Option<&CalendarEventAuthorReference>,
note: Option<&str>,
-) -> Result<(), RadrootsCalendarEventError> {
+) -> Result<(), CalendarEventError> {
let mut event_tag = budget_tag("a", event_reference.coordinate().as_str());
if let Some(relay) = event_reference.relay() {
event_tag.push(relay.to_string());
@@ -2361,30 +2269,30 @@ fn validate_calendar_rsvp_budget(
validate_authored_calendar_budget(note, tags)
}
-fn calendar_rsvp_status_wire_value(status: &RadrootsCalendarEventRsvpStatus) -> &'static str {
+fn calendar_rsvp_status_wire_value(status: &CalendarEventRsvpStatus) -> &'static str {
match status {
- RadrootsCalendarEventRsvpStatus::Accepted => "accepted",
- RadrootsCalendarEventRsvpStatus::Declined => "declined",
- RadrootsCalendarEventRsvpStatus::Tentative => "tentative",
+ CalendarEventRsvpStatus::Accepted => "accepted",
+ CalendarEventRsvpStatus::Declined => "declined",
+ CalendarEventRsvpStatus::Tentative => "tentative",
}
}
-fn calendar_free_busy_wire_value(free_busy: &RadrootsCalendarEventFreeBusy) -> &'static str {
+fn calendar_free_busy_wire_value(free_busy: &CalendarEventFreeBusy) -> &'static str {
match free_busy {
- RadrootsCalendarEventFreeBusy::Free => "free",
- RadrootsCalendarEventFreeBusy::Busy => "busy",
+ CalendarEventFreeBusy::Free => "free",
+ CalendarEventFreeBusy::Busy => "busy",
}
}
fn validate_authored_calendar_budget(
description: Option<&str>,
tags: Vec<Vec<String>>,
-) -> Result<(), RadrootsCalendarEventError> {
+) -> Result<(), CalendarEventError> {
if let Some(description) = description {
validate_calendar_content(description)?;
}
if tags.len() > DEFAULT_TAG_MAX_COUNT {
- return Err(RadrootsCalendarEventError::TagCountExceeded {
+ return Err(CalendarEventError::TagCountExceeded {
max: DEFAULT_TAG_MAX_COUNT,
actual: tags.len(),
});
@@ -2393,7 +2301,7 @@ fn validate_authored_calendar_budget(
for tag in &tags {
for value in tag {
if value.len() > DEFAULT_TAG_ELEMENT_MAX_BYTES {
- return Err(RadrootsCalendarEventError::TagElementTooLarge {
+ return Err(CalendarEventError::TagElementTooLarge {
field: "tag",
max: DEFAULT_TAG_ELEMENT_MAX_BYTES,
actual: value.len(),
@@ -2403,7 +2311,7 @@ fn validate_authored_calendar_budget(
}
}
if total > DEFAULT_TAG_TOTAL_MAX_BYTES {
- return Err(RadrootsCalendarEventError::TagBytesExceeded {
+ return Err(CalendarEventError::TagBytesExceeded {
max: DEFAULT_TAG_TOTAL_MAX_BYTES,
actual: total,
});
@@ -2411,12 +2319,12 @@ fn validate_authored_calendar_budget(
Ok(())
}
-fn parse_date_digits(bytes: &[u8]) -> Result<u16, RadrootsCalendarEventError> {
+fn parse_date_digits(bytes: &[u8]) -> Result<u16, CalendarEventError> {
bytes.iter().try_fold(0_u16, |value, byte| {
if byte.is_ascii_digit() {
Ok(value * 10 + u16::from(byte - b'0'))
} else {
- Err(RadrootsCalendarEventError::InvalidDate)
+ Err(CalendarEventError::InvalidDate)
}
})
}
@@ -2437,24 +2345,24 @@ const fn is_leap_year(year: u16) -> bool {
/// Strict authored representation of a NIP-52 kind-31925 RSVP.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsAuthoredCalendarEventRsvp {
- uid: RadrootsCalendarUid,
- event_reference: RadrootsCalendarEventReference,
- revision_reference: Option<RadrootsCalendarEventRevisionReference>,
- status: RadrootsCalendarEventRsvpStatus,
- free_busy: Option<RadrootsCalendarEventFreeBusy>,
- author_hint: Option<RadrootsCalendarEventAuthorReference>,
+pub struct AuthoredCalendarEventRsvp {
+ uid: CalendarUid,
+ event_reference: CalendarEventReference,
+ revision_reference: Option<CalendarEventRevisionReference>,
+ status: CalendarEventRsvpStatus,
+ free_busy: Option<CalendarEventFreeBusy>,
+ author_hint: Option<CalendarEventAuthorReference>,
note: Option<String>,
}
-impl RadrootsAuthoredCalendarEventRsvp {
+impl AuthoredCalendarEventRsvp {
pub fn new(
- uid: RadrootsCalendarUid,
- event_reference: RadrootsCalendarEventReference,
- status: RadrootsCalendarEventRsvpStatus,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ uid: CalendarUid,
+ event_reference: CalendarEventReference,
+ status: CalendarEventRsvpStatus,
+ ) -> Result<Self, CalendarEventError> {
if !event_reference.is_canonical() {
- return Err(RadrootsCalendarEventError::InvalidEventReference);
+ return Err(CalendarEventError::InvalidEventReference);
}
let authored = Self {
uid,
@@ -2471,10 +2379,10 @@ impl RadrootsAuthoredCalendarEventRsvp {
pub fn with_revision_reference(
mut self,
- revision_reference: RadrootsCalendarEventRevisionReference,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ revision_reference: CalendarEventRevisionReference,
+ ) -> Result<Self, CalendarEventError> {
if !revision_reference.is_canonical() {
- return Err(RadrootsCalendarEventError::InvalidRevisionReference);
+ return Err(CalendarEventError::InvalidRevisionReference);
}
self.revision_reference = Some(revision_reference);
self.validate_budget()?;
@@ -2483,10 +2391,10 @@ impl RadrootsAuthoredCalendarEventRsvp {
pub fn with_free_busy(
mut self,
- free_busy: RadrootsCalendarEventFreeBusy,
- ) -> Result<Self, RadrootsCalendarEventError> {
- if self.status == RadrootsCalendarEventRsvpStatus::Declined {
- return Err(RadrootsCalendarEventError::DeclinedFreeBusyForbidden);
+ free_busy: CalendarEventFreeBusy,
+ ) -> Result<Self, CalendarEventError> {
+ if self.status == CalendarEventRsvpStatus::Declined {
+ return Err(CalendarEventError::DeclinedFreeBusyForbidden);
}
self.free_busy = Some(free_busy);
self.validate_budget()?;
@@ -2495,18 +2403,15 @@ impl RadrootsAuthoredCalendarEventRsvp {
pub fn with_author_hint(
mut self,
- author_hint: RadrootsCalendarEventAuthorReference,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ author_hint: CalendarEventAuthorReference,
+ ) -> Result<Self, CalendarEventError> {
validate_strict_calendar_author_hint(&self.event_reference, &author_hint)?;
self.author_hint = Some(author_hint);
self.validate_budget()?;
Ok(self)
}
- pub fn with_note(
- mut self,
- note: impl Into<String>,
- ) -> Result<Self, RadrootsCalendarEventError> {
+ pub fn with_note(mut self, note: impl Into<String>) -> Result<Self, CalendarEventError> {
let note = note.into();
validate_calendar_content(¬e)?;
self.note = (!note.is_empty()).then_some(note);
@@ -2514,31 +2419,31 @@ impl RadrootsAuthoredCalendarEventRsvp {
Ok(self)
}
- pub fn uid(&self) -> &RadrootsCalendarUid {
+ pub fn uid(&self) -> &CalendarUid {
&self.uid
}
- pub fn event_reference(&self) -> &RadrootsCalendarEventReference {
+ pub fn event_reference(&self) -> &CalendarEventReference {
&self.event_reference
}
- pub fn revision_reference(&self) -> Option<&RadrootsCalendarEventRevisionReference> {
+ pub fn revision_reference(&self) -> Option<&CalendarEventRevisionReference> {
self.revision_reference.as_ref()
}
- pub fn status(&self) -> &RadrootsCalendarEventRsvpStatus {
+ pub fn status(&self) -> &CalendarEventRsvpStatus {
&self.status
}
- pub fn observed_free_busy(&self) -> Option<&RadrootsCalendarEventFreeBusy> {
+ pub fn observed_free_busy(&self) -> Option<&CalendarEventFreeBusy> {
self.free_busy.as_ref()
}
- pub fn effective_free_busy(&self) -> Option<&RadrootsCalendarEventFreeBusy> {
+ pub fn effective_free_busy(&self) -> Option<&CalendarEventFreeBusy> {
self.free_busy.as_ref()
}
- pub fn author_hint(&self) -> Option<&RadrootsCalendarEventAuthorReference> {
+ pub fn author_hint(&self) -> Option<&CalendarEventAuthorReference> {
self.author_hint.as_ref()
}
@@ -2546,7 +2451,7 @@ impl RadrootsAuthoredCalendarEventRsvp {
self.note.as_deref()
}
- fn validate_budget(&self) -> Result<(), RadrootsCalendarEventError> {
+ fn validate_budget(&self) -> Result<(), CalendarEventError> {
validate_calendar_rsvp_budget(
self.uid.as_str(),
&self.event_reference,
@@ -2561,32 +2466,30 @@ impl RadrootsAuthoredCalendarEventRsvp {
/// Constructor input for the tolerant, raw-preserving kind-31925 parse layer.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsParsedNip52CalendarEventRsvpParts {
+pub struct ParsedNip52CalendarEventRsvpParts {
pub d_tag: String,
- pub event_reference: RadrootsCalendarEventReference,
- pub revision_reference: Option<RadrootsCalendarEventRevisionReference>,
- pub status: RadrootsCalendarEventRsvpStatus,
- pub observed_free_busy: Option<RadrootsCalendarEventFreeBusy>,
- pub author_hint: Option<RadrootsCalendarEventAuthorReference>,
+ pub event_reference: CalendarEventReference,
+ pub revision_reference: Option<CalendarEventRevisionReference>,
+ pub status: CalendarEventRsvpStatus,
+ pub observed_free_busy: Option<CalendarEventFreeBusy>,
+ pub author_hint: Option<CalendarEventAuthorReference>,
pub note: Option<String>,
}
/// Structurally valid kind-31925 data. Canonical admission is a separate step.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsParsedNip52CalendarEventRsvp {
+pub struct ParsedNip52CalendarEventRsvp {
d_tag: String,
- event_reference: RadrootsCalendarEventReference,
- revision_reference: Option<RadrootsCalendarEventRevisionReference>,
- status: RadrootsCalendarEventRsvpStatus,
- observed_free_busy: Option<RadrootsCalendarEventFreeBusy>,
- author_hint: Option<RadrootsCalendarEventAuthorReference>,
+ event_reference: CalendarEventReference,
+ revision_reference: Option<CalendarEventRevisionReference>,
+ status: CalendarEventRsvpStatus,
+ observed_free_busy: Option<CalendarEventFreeBusy>,
+ author_hint: Option<CalendarEventAuthorReference>,
note: Option<String>,
}
-impl RadrootsParsedNip52CalendarEventRsvp {
- pub fn try_new(
- parts: RadrootsParsedNip52CalendarEventRsvpParts,
- ) -> Result<Self, RadrootsCalendarEventError> {
+impl ParsedNip52CalendarEventRsvp {
+ pub fn try_new(parts: ParsedNip52CalendarEventRsvpParts) -> Result<Self, CalendarEventError> {
validate_calendar_tag_text(&parts.d_tag, "d")?;
if let Some(note) = parts.note.as_deref() {
validate_calendar_content(note)?;
@@ -2615,31 +2518,31 @@ impl RadrootsParsedNip52CalendarEventRsvp {
&self.d_tag
}
- pub fn event_reference(&self) -> &RadrootsCalendarEventReference {
+ pub fn event_reference(&self) -> &CalendarEventReference {
&self.event_reference
}
- pub fn revision_reference(&self) -> Option<&RadrootsCalendarEventRevisionReference> {
+ pub fn revision_reference(&self) -> Option<&CalendarEventRevisionReference> {
self.revision_reference.as_ref()
}
- pub fn status(&self) -> &RadrootsCalendarEventRsvpStatus {
+ pub fn status(&self) -> &CalendarEventRsvpStatus {
&self.status
}
- pub fn observed_free_busy(&self) -> Option<&RadrootsCalendarEventFreeBusy> {
+ pub fn observed_free_busy(&self) -> Option<&CalendarEventFreeBusy> {
self.observed_free_busy.as_ref()
}
- pub fn effective_free_busy(&self) -> Option<&RadrootsCalendarEventFreeBusy> {
- if self.status == RadrootsCalendarEventRsvpStatus::Declined {
+ pub fn effective_free_busy(&self) -> Option<&CalendarEventFreeBusy> {
+ if self.status == CalendarEventRsvpStatus::Declined {
None
} else {
self.observed_free_busy.as_ref()
}
}
- pub fn author_hint(&self) -> Option<&RadrootsCalendarEventAuthorReference> {
+ pub fn author_hint(&self) -> Option<&CalendarEventAuthorReference> {
self.author_hint.as_ref()
}
@@ -2650,72 +2553,68 @@ impl RadrootsParsedNip52CalendarEventRsvp {
/// Canonical Radroots admission of a parsed kind-31925 RSVP.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsAdmittedCalendarEventRsvp {
- parsed: RadrootsParsedNip52CalendarEventRsvp,
- uid: RadrootsCalendarUid,
+pub struct AdmittedCalendarEventRsvp {
+ parsed: ParsedNip52CalendarEventRsvp,
+ uid: CalendarUid,
}
-impl RadrootsAdmittedCalendarEventRsvp {
+impl AdmittedCalendarEventRsvp {
pub fn try_from_parsed(
- parsed: RadrootsParsedNip52CalendarEventRsvp,
- ) -> Result<Self, RadrootsCalendarAdmissionError> {
- let uid = RadrootsCalendarUid::parse(parsed.d_tag())
- .map_err(|_| RadrootsCalendarAdmissionError::NonCanonicalField("d"))?;
+ parsed: ParsedNip52CalendarEventRsvp,
+ ) -> Result<Self, CalendarAdmissionError> {
+ let uid = CalendarUid::parse(parsed.d_tag())
+ .map_err(|_| CalendarAdmissionError::NonCanonicalField("d"))?;
if !parsed.event_reference().is_canonical() {
- return Err(RadrootsCalendarAdmissionError::NonCanonicalField(
- "event_reference",
- ));
+ return Err(CalendarAdmissionError::NonCanonicalField("event_reference"));
}
if parsed
.revision_reference()
.is_some_and(|reference| !reference.is_canonical())
{
- return Err(RadrootsCalendarAdmissionError::NonCanonicalField(
+ return Err(CalendarAdmissionError::NonCanonicalField(
"revision_reference",
));
}
if let Some(author_hint) = parsed.author_hint() {
if !author_hint.is_canonical() {
- return Err(RadrootsCalendarAdmissionError::NonCanonicalField(
- "author_hint",
- ));
+ return Err(CalendarAdmissionError::NonCanonicalField("author_hint"));
}
if author_hint.pubkey() != parsed.event_reference().author() {
- return Err(RadrootsCalendarAdmissionError::AuthorHintMismatch);
+ return Err(CalendarAdmissionError::AuthorHintMismatch);
}
}
Ok(Self { parsed, uid })
}
- pub fn parsed(&self) -> &RadrootsParsedNip52CalendarEventRsvp {
+ pub fn parsed(&self) -> &ParsedNip52CalendarEventRsvp {
&self.parsed
}
- pub fn uid(&self) -> &RadrootsCalendarUid {
+ pub fn uid(&self) -> &CalendarUid {
&self.uid
}
- pub fn event_reference(&self) -> &RadrootsCalendarEventReference {
+ pub fn event_reference(&self) -> &CalendarEventReference {
self.parsed.event_reference()
}
- pub fn revision_reference(&self) -> Option<&RadrootsCalendarEventRevisionReference> {
+ pub fn revision_reference(&self) -> Option<&CalendarEventRevisionReference> {
self.parsed.revision_reference()
}
- pub fn status(&self) -> &RadrootsCalendarEventRsvpStatus {
+ pub fn status(&self) -> &CalendarEventRsvpStatus {
self.parsed.status()
}
- pub fn observed_free_busy(&self) -> Option<&RadrootsCalendarEventFreeBusy> {
+ pub fn observed_free_busy(&self) -> Option<&CalendarEventFreeBusy> {
self.parsed.observed_free_busy()
}
- pub fn effective_free_busy(&self) -> Option<&RadrootsCalendarEventFreeBusy> {
+ pub fn effective_free_busy(&self) -> Option<&CalendarEventFreeBusy> {
self.parsed.effective_free_busy()
}
- pub fn author_hint(&self) -> Option<&RadrootsCalendarEventAuthorReference> {
+ pub fn author_hint(&self) -> Option<&CalendarEventAuthorReference> {
self.parsed.author_hint()
}
@@ -2730,10 +2629,10 @@ mod tests {
#[test]
fn authored_date_event_validates_each_optional_field_at_construction() {
- let event = RadrootsAuthoredCalendarDateEvent::new(
+ let event = AuthoredCalendarDateEvent::new(
"market-day",
"Market day",
- RadrootsCalendarDate::parse("2026-06-20").unwrap(),
+ CalendarDate::parse("2026-06-20").unwrap(),
)
.unwrap()
.with_description("Farm stand pickup window.")
@@ -2752,64 +2651,61 @@ mod tests {
assert_eq!(event.summary(), Some("Weekly pickup"));
assert_eq!(event.categories(), ["farmers-market", "vegetables"]);
- let error = RadrootsAuthoredCalendarDateEvent::new(
+ let error = AuthoredCalendarDateEvent::new(
"market-day",
" Market day ",
- RadrootsCalendarDate::parse("2026-06-20").unwrap(),
+ CalendarDate::parse("2026-06-20").unwrap(),
)
.unwrap_err();
- assert_eq!(error, RadrootsCalendarEventError::InvalidTitle);
+ assert_eq!(error, CalendarEventError::InvalidTitle);
- let error = RadrootsAuthoredCalendarDateEvent::new(
+ let error = AuthoredCalendarDateEvent::new(
"market-day",
"Market day",
- RadrootsCalendarDate::parse("2026-06-20").unwrap(),
+ CalendarDate::parse("2026-06-20").unwrap(),
)
.unwrap()
.with_geohash("C23NB62W20ST")
.unwrap_err();
- assert_eq!(error, RadrootsCalendarEventError::InvalidGeohash);
+ assert_eq!(error, CalendarEventError::InvalidGeohash);
}
#[test]
fn authored_time_event_uses_exact_iana_ids_and_end_timezone_fallback() {
assert_eq!(jiff_tzdb::VERSION, Some("2026c"));
- let event =
- RadrootsAuthoredCalendarTimeEvent::new("wash-pack", "Wash pack shift", 1_781_895_600)
- .unwrap()
- .with_end(1_781_899_200)
- .unwrap()
- .with_description("Pack CSA shares before pickup.")
- .unwrap()
- .with_start_tzid("America/Vancouver")
- .unwrap()
- .with_participants(vec![RadrootsCalendarParticipant {
- pubkey: "a".repeat(64),
- relay: None,
- role: Some("host".to_string()),
- }])
- .unwrap();
+ let event = AuthoredCalendarTimeEvent::new("wash-pack", "Wash pack shift", 1_781_895_600)
+ .unwrap()
+ .with_end(1_781_899_200)
+ .unwrap()
+ .with_description("Pack CSA shares before pickup.")
+ .unwrap()
+ .with_start_tzid("America/Vancouver")
+ .unwrap()
+ .with_participants(vec![CalendarParticipant {
+ pubkey: "a".repeat(64),
+ relay: None,
+ role: Some("host".to_string()),
+ }])
+ .unwrap();
assert_eq!(event.start(), 1_781_895_600);
assert_eq!(event.end(), Some(1_781_899_200));
assert_eq!(
- event.start_tzid().map(RadrootsIanaTimeZoneId::as_str),
+ event.start_tzid().map(IanaTimeZoneId::as_str),
Some("America/Vancouver")
);
assert_eq!(event.end_tzid(), None);
assert_eq!(
- event
- .effective_end_tzid()
- .map(RadrootsIanaTimeZoneId::as_str),
+ event.effective_end_tzid().map(IanaTimeZoneId::as_str),
Some("America/Vancouver")
);
assert_eq!(event.participants().map(Vec::len), Some(1));
for invalid in ["america/vancouver", "America/Imaginary", " UTC ", ""] {
assert_eq!(
- RadrootsIanaTimeZoneId::parse(invalid),
- Err(RadrootsCalendarEventError::InvalidTimeZone),
+ IanaTimeZoneId::parse(invalid),
+ Err(CalendarEventError::InvalidTimeZone),
"{invalid}"
);
}
@@ -2818,7 +2714,7 @@ mod tests {
#[test]
fn calendar_dates_validate_gregorian_semantics_and_strict_ranges() {
for valid in ["0001-01-01", "2000-02-29", "2024-02-29", "9999-12-31"] {
- assert_eq!(RadrootsCalendarDate::parse(valid).unwrap().as_str(), valid);
+ assert_eq!(CalendarDate::parse(valid).unwrap().as_str(), valid);
}
for invalid in [
"0000-01-01",
@@ -2832,24 +2728,23 @@ mod tests {
"+2026-06-20",
] {
assert_eq!(
- RadrootsCalendarDate::parse(invalid),
- Err(RadrootsCalendarEventError::InvalidDate),
+ CalendarDate::parse(invalid),
+ Err(CalendarEventError::InvalidDate),
"{invalid}"
);
}
- let start = RadrootsCalendarDate::parse("2026-06-20").unwrap();
- let event =
- RadrootsAuthoredCalendarDateEvent::new("market-day", "Market", start.clone()).unwrap();
+ let start = CalendarDate::parse("2026-06-20").unwrap();
+ let event = AuthoredCalendarDateEvent::new("market-day", "Market", start.clone()).unwrap();
assert_eq!(
event
.clone()
- .with_end(RadrootsCalendarDate::parse("2026-06-20").unwrap()),
- Err(RadrootsCalendarEventError::InvalidRange)
+ .with_end(CalendarDate::parse("2026-06-20").unwrap()),
+ Err(CalendarEventError::InvalidRange)
);
assert_eq!(
- event.with_end(RadrootsCalendarDate::parse("2026-06-19").unwrap()),
- Err(RadrootsCalendarEventError::InvalidRange)
+ event.with_end(CalendarDate::parse("2026-06-19").unwrap()),
+ Err(CalendarEventError::InvalidRange)
);
}
@@ -2873,15 +2768,15 @@ mod tests {
);
assert_eq!(
covered_utc_days(10, Some(10)),
- Err(RadrootsCalendarEventError::InvalidRange)
+ Err(CalendarEventError::InvalidRange)
);
assert_eq!(
covered_utc_days(10, Some(9)),
- Err(RadrootsCalendarEventError::InvalidRange)
+ Err(CalendarEventError::InvalidRange)
);
assert_eq!(
covered_utc_days(0, Some(367 * RADROOTS_CALENDAR_SECONDS_PER_DAY)),
- Err(RadrootsCalendarEventError::CoveredDayLimitExceeded {
+ Err(CalendarEventError::CoveredDayLimitExceeded {
max: RADROOTS_CALENDAR_MAX_COVERED_UTC_DAYS,
actual: 367,
})
@@ -2890,49 +2785,49 @@ mod tests {
#[test]
fn baseline_wire_types_preserve_noncanonical_but_structural_values() {
- let uri = RadrootsCalendarUri::parse("ipfs://bafybeigdyrzt/calendar.webp").unwrap();
+ let uri = CalendarUri::parse("ipfs://bafybeigdyrzt/calendar.webp").unwrap();
assert_eq!(uri.as_str(), "ipfs://bafybeigdyrzt/calendar.webp");
- let observed = RadrootsObservedUtcDay::parse("00042").unwrap();
+ let observed = ObservedUtcDay::parse("00042").unwrap();
assert_eq!(observed.wire_value(), "00042");
assert_eq!(observed.index(), 42);
assert!(!observed.is_canonical());
assert_eq!(
- RadrootsCalendarUri::parse("not an absolute URI"),
- Err(RadrootsCalendarEventError::InvalidUrl("URI"))
+ CalendarUri::parse("not an absolute URI"),
+ Err(CalendarEventError::InvalidUrl("URI"))
);
assert_eq!(
- RadrootsObservedUtcDay::parse("+42"),
- Err(RadrootsCalendarEventError::InvalidText("D"))
+ ObservedUtcDay::parse("+42"),
+ Err(CalendarEventError::InvalidText("D"))
);
}
#[test]
fn authored_models_enforce_content_and_participant_limits() {
- let event = RadrootsAuthoredCalendarDateEvent::new(
+ let event = AuthoredCalendarDateEvent::new(
"market-day",
"Market day",
- RadrootsCalendarDate::parse("2026-06-20").unwrap(),
+ CalendarDate::parse("2026-06-20").unwrap(),
)
.unwrap();
let oversized = "x".repeat(DEFAULT_CONTENT_MAX_BYTES + 1);
assert_eq!(
event.clone().with_description(oversized),
- Err(RadrootsCalendarEventError::ContentTooLarge {
+ Err(CalendarEventError::ContentTooLarge {
max: DEFAULT_CONTENT_MAX_BYTES,
actual: DEFAULT_CONTENT_MAX_BYTES + 1,
})
);
- let participant = RadrootsCalendarParticipant {
+ let participant = CalendarParticipant {
pubkey: "a".repeat(64),
relay: None,
role: None,
};
assert_eq!(
event.with_participants(vec![participant; RADROOTS_CALENDAR_MAX_PARTICIPANTS + 1]),
- Err(RadrootsCalendarEventError::TooManyParticipants {
+ Err(CalendarEventError::TooManyParticipants {
max: RADROOTS_CALENDAR_MAX_PARTICIPANTS,
actual: RADROOTS_CALENDAR_MAX_PARTICIPANTS + 1,
})
@@ -2946,7 +2841,7 @@ mod tests {
"AAAAAAAAAAAAAAAAAAAAAQ",
"_____________________w",
] {
- assert_eq!(RadrootsCalendarUid::parse(valid).unwrap().as_str(), valid);
+ assert_eq!(CalendarUid::parse(valid).unwrap().as_str(), valid);
}
for invalid in [
"AAAAAAAAAAAAAAAAAAAAA",
@@ -2956,8 +2851,8 @@ mod tests {
"AAAAAAAAAAAAAAAAAAAAAB",
] {
assert_eq!(
- RadrootsCalendarUid::parse(invalid),
- Err(RadrootsCalendarEventError::InvalidCalendarUid),
+ CalendarUid::parse(invalid),
+ Err(CalendarEventError::InvalidCalendarUid),
"{invalid}"
);
}
@@ -2966,7 +2861,7 @@ mod tests {
#[test]
fn calendar_references_preserve_structural_wire_values_and_expose_canonicality() {
let uppercase_author = "A".repeat(64);
- let event = RadrootsCalendarEventReference::parse(
+ let event = CalendarEventReference::parse(
format!("031923:{uppercase_author}:wash-pack"),
Some("WSS://Relay.Example/events"),
)
@@ -2979,16 +2874,14 @@ mod tests {
assert_eq!(event.relay(), Some("WSS://Relay.Example/events"));
assert!(!event.is_canonical());
- let revision = RadrootsCalendarEventRevisionReference::parse(
- "B".repeat(64),
- Some("WSS://revision.example"),
- )
- .unwrap();
+ let revision =
+ CalendarEventRevisionReference::parse("B".repeat(64), Some("WSS://revision.example"))
+ .unwrap();
assert_eq!(revision.raw_event_id(), "B".repeat(64));
assert_eq!(revision.event_id().to_hex(), "b".repeat(64));
assert!(!revision.is_canonical());
- let author = RadrootsCalendarEventAuthorReference::parse(
+ let author = CalendarEventAuthorReference::parse(
uppercase_author.clone(),
Some("WSS://author.example"),
)
@@ -2998,20 +2891,17 @@ mod tests {
assert!(!author.is_canonical());
assert_eq!(
- RadrootsCalendarEventReference::parse(
- format!("31924:{}:not-an-event", "a".repeat(64)),
- None,
- ),
- Err(RadrootsCalendarEventError::InvalidEventReference)
+ CalendarEventReference::parse(format!("31924:{}:not-an-event", "a".repeat(64)), None,),
+ Err(CalendarEventError::InvalidEventReference)
);
}
#[test]
fn calendar_collection_layers_keep_baseline_tolerance_out_of_strict_states() {
- let uid = RadrootsCalendarUid::parse("AAAAAAAAAAAAAAAAAAAAAA").unwrap();
+ let uid = CalendarUid::parse("AAAAAAAAAAAAAAAAAAAAAA").unwrap();
let event = canonical_event_reference("wash-pack");
- let empty = RadrootsAuthoredCalendar::new(
+ let empty = AuthoredCalendar::new(
uid.clone(),
"Farm calendar",
"Shared farm operations schedule.",
@@ -3021,26 +2911,24 @@ mod tests {
assert!(empty.event_references().is_empty());
assert_eq!(
- RadrootsAuthoredCalendar::new(
+ AuthoredCalendar::new(
uid.clone(),
"Farm calendar",
"",
vec![event.clone(), event.clone()],
),
- Err(RadrootsCalendarEventError::DuplicateEventReference)
+ Err(CalendarEventError::DuplicateEventReference)
);
- let noncanonical = RadrootsCalendarEventReference::parse(
- format!("031923:{}:wash-pack", "A".repeat(64)),
- None,
- )
- .unwrap();
+ let noncanonical =
+ CalendarEventReference::parse(format!("031923:{}:wash-pack", "A".repeat(64)), None)
+ .unwrap();
assert_eq!(
- RadrootsAuthoredCalendar::new(uid.clone(), "Farm calendar", "", vec![noncanonical],),
- Err(RadrootsCalendarEventError::InvalidEventReference)
+ AuthoredCalendar::new(uid.clone(), "Farm calendar", "", vec![noncanonical],),
+ Err(CalendarEventError::InvalidEventReference)
);
- let parsed = RadrootsParsedNip52Calendar::try_new(RadrootsParsedNip52CalendarParts {
+ let parsed = ParsedNip52Calendar::try_new(ParsedNip52CalendarParts {
d_tag: uid.to_string(),
title: " Farm calendar ".to_string(),
content: "Shared farm operations schedule.".to_string(),
@@ -3051,11 +2939,11 @@ mod tests {
.unwrap();
assert_eq!(parsed.event_references().len(), 2);
assert_eq!(
- RadrootsAdmittedCalendar::try_from_parsed(parsed),
- Err(RadrootsCalendarAdmissionError::NonCanonicalField("title"))
+ AdmittedCalendar::try_from_parsed(parsed),
+ Err(CalendarAdmissionError::NonCanonicalField("title"))
);
- let parsed = RadrootsParsedNip52Calendar::try_new(RadrootsParsedNip52CalendarParts {
+ let parsed = ParsedNip52Calendar::try_new(ParsedNip52CalendarParts {
d_tag: uid.to_string(),
title: "Farm calendar".to_string(),
content: String::new(),
@@ -3065,7 +2953,7 @@ mod tests {
})
.unwrap();
assert!(
- RadrootsAdmittedCalendar::try_from_parsed(parsed)
+ AdmittedCalendar::try_from_parsed(parsed)
.unwrap()
.event_references()
.is_empty()
@@ -3076,7 +2964,7 @@ mod tests {
fn calendar_admission_requires_unique_refs_and_structural_blossom_images() {
let uid = "AAAAAAAAAAAAAAAAAAAAAA";
let event = canonical_event_reference("market-day");
- let duplicate = RadrootsParsedNip52Calendar::try_new(RadrootsParsedNip52CalendarParts {
+ let duplicate = ParsedNip52Calendar::try_new(ParsedNip52CalendarParts {
d_tag: uid.to_string(),
title: "Market calendar".to_string(),
content: String::new(),
@@ -3085,42 +2973,36 @@ mod tests {
image: None,
})
.unwrap();
- let error = RadrootsAdmittedCalendar::try_from_parsed(duplicate).unwrap_err();
- assert_eq!(
- error,
- RadrootsCalendarAdmissionError::DuplicateEventReference
- );
+ let error = AdmittedCalendar::try_from_parsed(duplicate).unwrap_err();
+ assert_eq!(error, CalendarAdmissionError::DuplicateEventReference);
assert_eq!(error.code(), "duplicate_event_reference");
- let ordinary_image =
- RadrootsParsedNip52Calendar::try_new(RadrootsParsedNip52CalendarParts {
- d_tag: uid.to_string(),
- title: "Market calendar".to_string(),
- content: String::new(),
- event_references: vec![event.clone()],
- list_description: None,
- image: Some(
- RadrootsCalendarUri::parse("https://media.example/market.webp").unwrap(),
- ),
- })
- .unwrap();
+ let ordinary_image = ParsedNip52Calendar::try_new(ParsedNip52CalendarParts {
+ d_tag: uid.to_string(),
+ title: "Market calendar".to_string(),
+ content: String::new(),
+ event_references: vec![event.clone()],
+ list_description: None,
+ image: Some(CalendarUri::parse("https://media.example/market.webp").unwrap()),
+ })
+ .unwrap();
assert_eq!(
- RadrootsAdmittedCalendar::try_from_parsed(ordinary_image),
- Err(RadrootsCalendarAdmissionError::NonBlossomImage)
+ AdmittedCalendar::try_from_parsed(ordinary_image),
+ Err(CalendarAdmissionError::NonBlossomImage)
);
let blossom_url = format!("https://media.example/{}.webp", "c".repeat(64));
- let blossom = RadrootsParsedNip52Calendar::try_new(RadrootsParsedNip52CalendarParts {
+ let blossom = ParsedNip52Calendar::try_new(ParsedNip52CalendarParts {
d_tag: uid.to_string(),
title: "Market calendar".to_string(),
content: String::new(),
event_references: vec![event],
list_description: Some("Victoria farm markets".to_string()),
- image: Some(RadrootsCalendarUri::parse(&blossom_url).unwrap()),
+ image: Some(CalendarUri::parse(&blossom_url).unwrap()),
})
.unwrap();
assert_eq!(
- RadrootsAdmittedCalendar::try_from_parsed(blossom)
+ AdmittedCalendar::try_from_parsed(blossom)
.unwrap()
.blossom_image()
.unwrap()
@@ -3135,13 +3017,13 @@ mod tests {
.map(|index| canonical_event_reference(&format!("event-{index}")))
.collect::<Vec<_>>();
assert_eq!(
- RadrootsAuthoredCalendar::new(
- RadrootsCalendarUid::parse("AAAAAAAAAAAAAAAAAAAAAA").unwrap(),
+ AuthoredCalendar::new(
+ CalendarUid::parse("AAAAAAAAAAAAAAAAAAAAAA").unwrap(),
"Farm calendar",
"",
references,
),
- Err(RadrootsCalendarEventError::TagCountExceeded {
+ Err(CalendarEventError::TagCountExceeded {
max: DEFAULT_TAG_MAX_COUNT,
actual: DEFAULT_TAG_MAX_COUNT + 2,
})
@@ -3150,53 +3032,48 @@ mod tests {
#[test]
fn declined_rsvp_retains_observed_fb_only_in_parsed_and_admitted_layers() {
- let uid = RadrootsCalendarUid::parse("AAAAAAAAAAAAAAAAAAAAAQ").unwrap();
+ let uid = CalendarUid::parse("AAAAAAAAAAAAAAAAAAAAAQ").unwrap();
let event = canonical_event_reference("wash-pack");
assert_eq!(
- RadrootsAuthoredCalendarEventRsvp::new(
+ AuthoredCalendarEventRsvp::new(
uid.clone(),
event.clone(),
- RadrootsCalendarEventRsvpStatus::Declined,
+ CalendarEventRsvpStatus::Declined,
)
.unwrap()
- .with_free_busy(RadrootsCalendarEventFreeBusy::Busy),
- Err(RadrootsCalendarEventError::DeclinedFreeBusyForbidden)
+ .with_free_busy(CalendarEventFreeBusy::Busy),
+ Err(CalendarEventError::DeclinedFreeBusyForbidden)
);
- let parsed = RadrootsParsedNip52CalendarEventRsvp::try_new(
- RadrootsParsedNip52CalendarEventRsvpParts {
- d_tag: uid.to_string(),
- event_reference: event,
- revision_reference: Some(
- RadrootsCalendarEventRevisionReference::parse(
- "b".repeat(64),
- Some("wss://revision.example"),
- )
- .unwrap(),
- ),
- status: RadrootsCalendarEventRsvpStatus::Declined,
- observed_free_busy: Some(RadrootsCalendarEventFreeBusy::Busy),
- author_hint: Some(
- RadrootsCalendarEventAuthorReference::parse(
- "a".repeat(64),
- Some("wss://author.example"),
- )
+ let parsed = ParsedNip52CalendarEventRsvp::try_new(ParsedNip52CalendarEventRsvpParts {
+ d_tag: uid.to_string(),
+ event_reference: event,
+ revision_reference: Some(
+ CalendarEventRevisionReference::parse(
+ "b".repeat(64),
+ Some("wss://revision.example"),
+ )
+ .unwrap(),
+ ),
+ status: CalendarEventRsvpStatus::Declined,
+ observed_free_busy: Some(CalendarEventFreeBusy::Busy),
+ author_hint: Some(
+ CalendarEventAuthorReference::parse("a".repeat(64), Some("wss://author.example"))
.unwrap(),
- ),
- note: Some("Unable to attend".to_string()),
- },
- )
+ ),
+ note: Some("Unable to attend".to_string()),
+ })
.unwrap();
assert_eq!(
parsed.observed_free_busy(),
- Some(&RadrootsCalendarEventFreeBusy::Busy)
+ Some(&CalendarEventFreeBusy::Busy)
);
assert_eq!(parsed.effective_free_busy(), None);
- let admitted = RadrootsAdmittedCalendarEventRsvp::try_from_parsed(parsed).unwrap();
+ let admitted = AdmittedCalendarEventRsvp::try_from_parsed(parsed).unwrap();
assert_eq!(
admitted.observed_free_busy(),
- Some(&RadrootsCalendarEventFreeBusy::Busy)
+ Some(&CalendarEventFreeBusy::Busy)
);
assert_eq!(admitted.effective_free_busy(), None);
assert_eq!(
@@ -3211,41 +3088,38 @@ mod tests {
#[test]
fn rsvp_author_hint_must_match_event_coordinate_in_strict_layers() {
- let uid = RadrootsCalendarUid::parse("AAAAAAAAAAAAAAAAAAAAAQ").unwrap();
+ let uid = CalendarUid::parse("AAAAAAAAAAAAAAAAAAAAAQ").unwrap();
let event = canonical_event_reference("wash-pack");
let mismatched =
- RadrootsCalendarEventAuthorReference::parse(crate::test_valid_hex_64('b'), None)
- .unwrap();
+ CalendarEventAuthorReference::parse(crate::test_valid_hex_64('b'), None).unwrap();
assert_eq!(
- RadrootsAuthoredCalendarEventRsvp::new(
+ AuthoredCalendarEventRsvp::new(
uid.clone(),
event.clone(),
- RadrootsCalendarEventRsvpStatus::Accepted,
+ CalendarEventRsvpStatus::Accepted,
)
.unwrap()
.with_author_hint(mismatched.clone()),
- Err(RadrootsCalendarEventError::AuthorHintMismatch)
+ Err(CalendarEventError::AuthorHintMismatch)
);
- let parsed = RadrootsParsedNip52CalendarEventRsvp::try_new(
- RadrootsParsedNip52CalendarEventRsvpParts {
- d_tag: uid.to_string(),
- event_reference: event,
- revision_reference: None,
- status: RadrootsCalendarEventRsvpStatus::Accepted,
- observed_free_busy: None,
- author_hint: Some(mismatched),
- note: None,
- },
- )
+ let parsed = ParsedNip52CalendarEventRsvp::try_new(ParsedNip52CalendarEventRsvpParts {
+ d_tag: uid.to_string(),
+ event_reference: event,
+ revision_reference: None,
+ status: CalendarEventRsvpStatus::Accepted,
+ observed_free_busy: None,
+ author_hint: Some(mismatched),
+ note: None,
+ })
.unwrap();
- let error = RadrootsAdmittedCalendarEventRsvp::try_from_parsed(parsed).unwrap_err();
- assert_eq!(error, RadrootsCalendarAdmissionError::AuthorHintMismatch);
+ let error = AdmittedCalendarEventRsvp::try_from_parsed(parsed).unwrap_err();
+ assert_eq!(error, CalendarAdmissionError::AuthorHintMismatch);
assert_eq!(error.code(), "author_hint_mismatch");
}
- fn canonical_event_reference(d_tag: &str) -> RadrootsCalendarEventReference {
- RadrootsCalendarEventReference::parse(
+ fn canonical_event_reference(d_tag: &str) -> CalendarEventReference {
+ CalendarEventReference::parse(
format!("31923:{}:{d_tag}", "a".repeat(64)),
Some("wss://relay.example"),
)
diff --git a/crates/event/src/classified_listing.rs b/crates/event/src/classified_listing.rs
@@ -3,7 +3,7 @@ use alloc::string::String;
#[cfg(feature = "std")]
use std::string::String;
-use crate::envelope::{RadrootsEventTag, RadrootsEventTags};
+use crate::envelope::{EventTag, EventTags};
pub const TAG_RADROOTS_PRICE_UNIT: &str = "radroots:price_unit";
pub const TAG_RADROOTS_QUANTITY: &str = "radroots:quantity";
@@ -13,7 +13,7 @@ pub const TAG_RADROOTS_PRICE: &str = "radroots:price";
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
/// The marker-selected profile partition for a NIP-99 classified listing.
-pub enum RadrootsClassifiedListingPartition {
+pub enum ClassifiedListingPartition {
FocusedFoodAvailability,
OperationalListing,
GenericNip99,
@@ -25,9 +25,7 @@ pub enum RadrootsClassifiedListingPartition {
///
/// The caller owns kind checks and profile validation. Tag values and arity do
/// not affect this partition, so malformed one-element marker tags still count.
-pub fn classify_classified_listing_tags(
- tags: &RadrootsEventTags,
-) -> RadrootsClassifiedListingPartition {
+pub fn classify_classified_listing_tags(tags: &EventTags) -> ClassifiedListingPartition {
classify_classified_listing_tag_slice(tags.as_slice())
}
@@ -35,9 +33,7 @@ pub fn classify_classified_listing_tags(
///
/// The caller owns kind checks and profile validation. Tag values and arity do
/// not affect this partition, so malformed one-element marker tags still count.
-pub fn classify_classified_listing_tag_slice(
- tags: &[RadrootsEventTag],
-) -> RadrootsClassifiedListingPartition {
+pub fn classify_classified_listing_tag_slice(tags: &[EventTag]) -> ClassifiedListingPartition {
classify_classified_listing_marker_names(
tags.iter()
.map(|tag| tag.as_slice().first().map(String::as_str)),
@@ -47,7 +43,7 @@ pub fn classify_classified_listing_tag_slice(
/// Partitions borrowed raw tag names without allocating or validating tag arity.
pub fn classify_classified_listing_marker_names<'a>(
names: impl IntoIterator<Item = Option<&'a str>>,
-) -> RadrootsClassifiedListingPartition {
+) -> ClassifiedListingPartition {
let mut has_focused_marker = false;
let mut has_operational_marker = false;
@@ -65,15 +61,15 @@ pub fn classify_classified_listing_marker_names<'a>(
}
if has_focused_marker && has_operational_marker {
- return RadrootsClassifiedListingPartition::Ambiguous;
+ return ClassifiedListingPartition::Ambiguous;
}
}
match (has_focused_marker, has_operational_marker) {
- (true, false) => RadrootsClassifiedListingPartition::FocusedFoodAvailability,
- (false, true) => RadrootsClassifiedListingPartition::OperationalListing,
- (false, false) => RadrootsClassifiedListingPartition::GenericNip99,
- (true, true) => RadrootsClassifiedListingPartition::Ambiguous,
+ (true, false) => ClassifiedListingPartition::FocusedFoodAvailability,
+ (false, true) => ClassifiedListingPartition::OperationalListing,
+ (false, false) => ClassifiedListingPartition::GenericNip99,
+ (true, true) => ClassifiedListingPartition::Ambiguous,
}
}
@@ -88,8 +84,8 @@ mod tests {
TAG_RADROOTS_PRICE,
];
- fn tags(values: &[&[&str]]) -> RadrootsEventTags {
- RadrootsEventTags::new(
+ fn tags(values: &[&[&str]]) -> EventTags {
+ EventTags::new(
values
.iter()
.map(|tag| tag.iter().map(|value| (*value).to_owned()).collect())
@@ -98,7 +94,7 @@ mod tests {
.expect("valid test tags")
}
- fn classify(values: &[&[&str]]) -> RadrootsClassifiedListingPartition {
+ fn classify(values: &[&[&str]]) -> ClassifiedListingPartition {
classify_classified_listing_tags(&tags(values))
}
@@ -116,7 +112,7 @@ mod tests {
for marker in FOCUSED_MARKERS {
assert_eq!(
classify(&[&[marker, "value"]]),
- RadrootsClassifiedListingPartition::FocusedFoodAvailability,
+ ClassifiedListingPartition::FocusedFoodAvailability,
"focused marker {marker}"
);
}
@@ -127,7 +123,7 @@ mod tests {
for marker in OPERATIONAL_MARKERS {
assert_eq!(
classify(&[&[marker, "value"]]),
- RadrootsClassifiedListingPartition::OperationalListing,
+ ClassifiedListingPartition::OperationalListing,
"operational marker {marker}"
);
}
@@ -138,7 +134,7 @@ mod tests {
for marker in FOCUSED_MARKERS {
assert_eq!(
classify(&[&[marker]]),
- RadrootsClassifiedListingPartition::FocusedFoodAvailability,
+ ClassifiedListingPartition::FocusedFoodAvailability,
"malformed focused marker {marker}"
);
}
@@ -146,7 +142,7 @@ mod tests {
for marker in OPERATIONAL_MARKERS {
assert_eq!(
classify(&[&[marker]]),
- RadrootsClassifiedListingPartition::OperationalListing,
+ ClassifiedListingPartition::OperationalListing,
"malformed operational marker {marker}"
);
}
@@ -158,12 +154,12 @@ mod tests {
for operational in OPERATIONAL_MARKERS {
assert_eq!(
classify(&[&[focused], &[operational]]),
- RadrootsClassifiedListingPartition::Ambiguous,
+ ClassifiedListingPartition::Ambiguous,
"focused {focused} before operational {operational}"
);
assert_eq!(
classify(&[&[operational], &[focused]]),
- RadrootsClassifiedListingPartition::Ambiguous,
+ ClassifiedListingPartition::Ambiguous,
"operational {operational} before focused {focused}"
);
}
@@ -178,7 +174,7 @@ mod tests {
&[TAG_RADROOTS_PRICE_UNIT, "lb"],
&[TAG_RADROOTS_QUANTITY, "20", "lb"],
]),
- RadrootsClassifiedListingPartition::FocusedFoodAvailability
+ ClassifiedListingPartition::FocusedFoodAvailability
);
assert_eq!(
classify(&[
@@ -186,7 +182,7 @@ mod tests {
&[TAG_RADROOTS_BIN, "bin-1"],
&[TAG_RADROOTS_PRICE, "bin-1", "3", "CAD", "1", "lb"],
]),
- RadrootsClassifiedListingPartition::OperationalListing
+ ClassifiedListingPartition::OperationalListing
);
}
@@ -207,7 +203,7 @@ mod tests {
] {
assert_eq!(
classify(&[&[near_match, "value"]]),
- RadrootsClassifiedListingPartition::GenericNip99,
+ ClassifiedListingPartition::GenericNip99,
"near match {near_match}"
);
}
@@ -223,23 +219,20 @@ mod tests {
&["alt", TAG_RADROOTS_PRICE][..],
];
- assert_eq!(
- classify(&values),
- RadrootsClassifiedListingPartition::GenericNip99
- );
+ assert_eq!(classify(&values), ClassifiedListingPartition::GenericNip99);
}
#[test]
fn empty_tags_are_generic_nip99() {
- let tags = RadrootsEventTags::new(Vec::new()).expect("empty tag list is valid");
+ let tags = EventTags::new(Vec::new()).expect("empty tag list is valid");
assert_eq!(
classify_classified_listing_tags(&tags),
- RadrootsClassifiedListingPartition::GenericNip99
+ ClassifiedListingPartition::GenericNip99
);
assert_eq!(
classify_classified_listing_tag_slice(tags.as_slice()),
- RadrootsClassifiedListingPartition::GenericNip99
+ ClassifiedListingPartition::GenericNip99
);
}
}
diff --git a/crates/event/src/comment.rs b/crates/event/src/comment.rs
@@ -10,10 +10,9 @@ use crate::{
KIND_CALENDAR_DATE_EVENT, KIND_CALENDAR_TIME_EVENT, KIND_CLASSIFIED_LISTING, KIND_COMMENT,
},
id::{
- RadrootsAddressableCoordinate, RadrootsAddressableCoordinateParts, RadrootsEventId,
- RadrootsIdParseError, parse_public_key,
+ AddressableCoordinate, AddressableCoordinateParts, EventId, ParseError, parse_public_key,
},
- tag::relay_hint::RadrootsNostrRelayHint,
+ tag::relay_hint::NostrRelayHint,
wire::{
DEFAULT_CONTENT_MAX_BYTES, DEFAULT_RAW_JSON_MAX_BYTES, DEFAULT_TAG_ELEMENT_MAX_BYTES,
DEFAULT_TAG_MAX_COUNT, DEFAULT_TAG_TOTAL_ELEMENT_MAX_COUNT, DEFAULT_TAG_TOTAL_MAX_BYTES,
@@ -43,17 +42,17 @@ const RADROOTS_NIP22_COMMENT_SIGNED_EVENT_FIXED_MAX_BYTES: usize = "{\"id\":\"".
#[non_exhaustive]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsNip22CommentError {
+pub enum Nip22CommentError {
ContentMissing,
ContentTooLarge { max: usize, actual: usize },
- RootEventIdInvalid(RadrootsIdParseError),
- RootAuthorInvalid(RadrootsIdParseError),
- RootCoordinateInvalid(RadrootsIdParseError),
- ParentEventIdInvalid(RadrootsIdParseError),
- ParentAuthorInvalid(RadrootsIdParseError),
- RevisionEventIdInvalid(RadrootsIdParseError),
+ RootEventIdInvalid(ParseError),
+ RootAuthorInvalid(ParseError),
+ RootCoordinateInvalid(ParseError),
+ ParentEventIdInvalid(ParseError),
+ ParentAuthorInvalid(ParseError),
+ RevisionEventIdInvalid(ParseError),
RootKindUnsupported { actual: u32 },
- RelayInvalid(RadrootsIdParseError),
+ RelayInvalid(ParseError),
ParentReferenceMismatch,
TagCountExceeded { max: usize, actual: usize },
TagElementCountExceeded { max: usize, actual: usize },
@@ -62,7 +61,7 @@ pub enum RadrootsNip22CommentError {
EventWireTooLarge { max: usize, actual: usize },
}
-impl RadrootsNip22CommentError {
+impl Nip22CommentError {
pub const fn code(&self) -> &'static str {
match self {
Self::ContentMissing => "comment_content_missing",
@@ -85,7 +84,7 @@ impl RadrootsNip22CommentError {
}
}
-impl fmt::Display for RadrootsNip22CommentError {
+impl fmt::Display for Nip22CommentError {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::ContentMissing => {
@@ -163,7 +162,7 @@ impl fmt::Display for RadrootsNip22CommentError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsNip22CommentError {
+impl std::error::Error for Nip22CommentError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
Self::RootEventIdInvalid(error)
@@ -180,13 +179,13 @@ impl std::error::Error for RadrootsNip22CommentError {
/// Root event kinds supported by the strict Radroots NIP-22 profile.
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub enum RadrootsNip22CommentRootKind {
+pub enum Nip22CommentRootKind {
ClassifiedListing,
CalendarDateEvent,
CalendarTimeEvent,
}
-impl RadrootsNip22CommentRootKind {
+impl Nip22CommentRootKind {
pub const fn as_u32(self) -> u32 {
match self {
Self::ClassifiedListing => KIND_CLASSIFIED_LISTING,
@@ -195,24 +194,24 @@ impl RadrootsNip22CommentRootKind {
}
}
- pub const fn parse(kind: u32) -> Result<Self, RadrootsNip22CommentError> {
+ pub const fn parse(kind: u32) -> Result<Self, Nip22CommentError> {
match kind {
KIND_CLASSIFIED_LISTING => Ok(Self::ClassifiedListing),
KIND_CALENDAR_DATE_EVENT => Ok(Self::CalendarDateEvent),
KIND_CALENDAR_TIME_EVENT => Ok(Self::CalendarTimeEvent),
- actual => Err(RadrootsNip22CommentError::RootKindUnsupported { actual }),
+ actual => Err(Nip22CommentError::RootKindUnsupported { actual }),
}
}
}
-impl From<RadrootsNip22CommentRootKind> for u32 {
- fn from(value: RadrootsNip22CommentRootKind) -> Self {
+impl From<Nip22CommentRootKind> for u32 {
+ fn from(value: Nip22CommentRootKind) -> Self {
value.as_u32()
}
}
-impl TryFrom<u32> for RadrootsNip22CommentRootKind {
- type Error = RadrootsNip22CommentError;
+impl TryFrom<u32> for Nip22CommentRootKind {
+ type Error = Nip22CommentError;
fn try_from(value: u32) -> Result<Self, Self::Error> {
Self::parse(value)
@@ -224,20 +223,20 @@ impl TryFrom<u32> for RadrootsNip22CommentRootKind {
/// The caller asserts the target kind and author. This does not prove event
/// existence, signature validity, actual authorship, or relay availability.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsNip22EventRootReference {
- event_id: RadrootsEventId,
+pub struct Nip22EventRootReference {
+ event_id: EventId,
author: PublicKey,
- kind: RadrootsNip22CommentRootKind,
- relay: Option<RadrootsNostrRelayHint>,
+ kind: Nip22CommentRootKind,
+ relay: Option<NostrRelayHint>,
}
-impl RadrootsNip22EventRootReference {
+impl Nip22EventRootReference {
pub fn new(
- event_id: RadrootsEventId,
+ event_id: EventId,
author: PublicKey,
- kind: RadrootsNip22CommentRootKind,
- relay: Option<RadrootsNostrRelayHint>,
- ) -> Result<Self, RadrootsNip22CommentError> {
+ kind: Nip22CommentRootKind,
+ relay: Option<NostrRelayHint>,
+ ) -> Result<Self, Nip22CommentError> {
validate_optional_relay(&relay)?;
Ok(Self {
event_id,
@@ -252,17 +251,16 @@ impl RadrootsNip22EventRootReference {
author: impl AsRef<str>,
kind: u32,
relay: Option<&str>,
- ) -> Result<Self, RadrootsNip22CommentError> {
+ ) -> Result<Self, Nip22CommentError> {
Self::new(
- RadrootsEventId::parse(event_id)
- .map_err(RadrootsNip22CommentError::RootEventIdInvalid)?,
- parse_public_key(author).map_err(RadrootsNip22CommentError::RootAuthorInvalid)?,
- RadrootsNip22CommentRootKind::parse(kind)?,
+ EventId::parse(event_id).map_err(Nip22CommentError::RootEventIdInvalid)?,
+ parse_public_key(author).map_err(Nip22CommentError::RootAuthorInvalid)?,
+ Nip22CommentRootKind::parse(kind)?,
parse_optional_relay(relay)?,
)
}
- pub const fn event_id(&self) -> &RadrootsEventId {
+ pub const fn event_id(&self) -> &EventId {
&self.event_id
}
@@ -270,11 +268,11 @@ impl RadrootsNip22EventRootReference {
&self.author
}
- pub const fn kind(&self) -> RadrootsNip22CommentRootKind {
+ pub const fn kind(&self) -> Nip22CommentRootKind {
self.kind
}
- pub const fn relay(&self) -> Option<&RadrootsNostrRelayHint> {
+ pub const fn relay(&self) -> Option<&NostrRelayHint> {
self.relay.as_ref()
}
@@ -289,28 +287,28 @@ impl RadrootsNip22EventRootReference {
/// does not prove event existence, signature validity, a current revision, or
/// relay availability.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsNip22AddressRootReference {
- coordinate: RadrootsAddressableCoordinate,
+pub struct Nip22AddressRootReference {
+ coordinate: AddressableCoordinate,
author: PublicKey,
- kind: RadrootsNip22CommentRootKind,
- relay: Option<RadrootsNostrRelayHint>,
+ kind: Nip22CommentRootKind,
+ relay: Option<NostrRelayHint>,
}
-impl RadrootsNip22AddressRootReference {
+impl Nip22AddressRootReference {
pub fn new(
- coordinate: RadrootsAddressableCoordinate,
- relay: Option<RadrootsNostrRelayHint>,
- ) -> Result<Self, RadrootsNip22CommentError> {
- let parts = RadrootsAddressableCoordinateParts::parse(coordinate.as_str())
- .map_err(RadrootsNip22CommentError::RootCoordinateInvalid)?;
- let kind = RadrootsNip22CommentRootKind::parse(parts.kind)?;
- let coordinate = RadrootsAddressableCoordinate::parse(format!(
+ coordinate: AddressableCoordinate,
+ relay: Option<NostrRelayHint>,
+ ) -> Result<Self, Nip22CommentError> {
+ let parts = AddressableCoordinateParts::parse(coordinate.as_str())
+ .map_err(Nip22CommentError::RootCoordinateInvalid)?;
+ let kind = Nip22CommentRootKind::parse(parts.kind)?;
+ let coordinate = AddressableCoordinate::parse(format!(
"{}:{}:{}",
kind.as_u32(),
parts.pubkey,
parts.d_tag
))
- .map_err(RadrootsNip22CommentError::RootCoordinateInvalid)?;
+ .map_err(Nip22CommentError::RootCoordinateInvalid)?;
validate_tag_element(coordinate.as_str())?;
validate_optional_relay(&relay)?;
Ok(Self {
@@ -324,15 +322,15 @@ impl RadrootsNip22AddressRootReference {
pub fn parse(
coordinate: impl AsRef<str>,
relay: Option<&str>,
- ) -> Result<Self, RadrootsNip22CommentError> {
+ ) -> Result<Self, Nip22CommentError> {
Self::new(
- RadrootsAddressableCoordinate::parse(coordinate)
- .map_err(RadrootsNip22CommentError::RootCoordinateInvalid)?,
+ AddressableCoordinate::parse(coordinate)
+ .map_err(Nip22CommentError::RootCoordinateInvalid)?,
parse_optional_relay(relay)?,
)
}
- pub const fn coordinate(&self) -> &RadrootsAddressableCoordinate {
+ pub const fn coordinate(&self) -> &AddressableCoordinate {
&self.coordinate
}
@@ -340,11 +338,11 @@ impl RadrootsNip22AddressRootReference {
&self.author
}
- pub const fn kind(&self) -> RadrootsNip22CommentRootKind {
+ pub const fn kind(&self) -> Nip22CommentRootKind {
self.kind
}
- pub const fn relay(&self) -> Option<&RadrootsNostrRelayHint> {
+ pub const fn relay(&self) -> Option<&NostrRelayHint> {
self.relay.as_ref()
}
@@ -359,18 +357,18 @@ impl RadrootsNip22AddressRootReference {
/// not prove event existence, target kind, signature validity, actual
/// authorship, or relay availability.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsNip22CommentParentReference {
- event_id: RadrootsEventId,
+pub struct Nip22CommentParentReference {
+ event_id: EventId,
author: PublicKey,
- relay: Option<RadrootsNostrRelayHint>,
+ relay: Option<NostrRelayHint>,
}
-impl RadrootsNip22CommentParentReference {
+impl Nip22CommentParentReference {
pub fn new(
- event_id: RadrootsEventId,
+ event_id: EventId,
author: PublicKey,
- relay: Option<RadrootsNostrRelayHint>,
- ) -> Result<Self, RadrootsNip22CommentError> {
+ relay: Option<NostrRelayHint>,
+ ) -> Result<Self, Nip22CommentError> {
validate_optional_relay(&relay)?;
Ok(Self {
event_id,
@@ -383,16 +381,15 @@ impl RadrootsNip22CommentParentReference {
event_id: impl AsRef<str>,
author: impl AsRef<str>,
relay: Option<&str>,
- ) -> Result<Self, RadrootsNip22CommentError> {
+ ) -> Result<Self, Nip22CommentError> {
Self::new(
- RadrootsEventId::parse(event_id)
- .map_err(RadrootsNip22CommentError::ParentEventIdInvalid)?,
- parse_public_key(author).map_err(RadrootsNip22CommentError::ParentAuthorInvalid)?,
+ EventId::parse(event_id).map_err(Nip22CommentError::ParentEventIdInvalid)?,
+ parse_public_key(author).map_err(Nip22CommentError::ParentAuthorInvalid)?,
parse_optional_relay(relay)?,
)
}
- pub const fn event_id(&self) -> &RadrootsEventId {
+ pub const fn event_id(&self) -> &EventId {
&self.event_id
}
@@ -400,7 +397,7 @@ impl RadrootsNip22CommentParentReference {
&self.author
}
- pub const fn relay(&self) -> Option<&RadrootsNostrRelayHint> {
+ pub const fn relay(&self) -> Option<&NostrRelayHint> {
self.relay.as_ref()
}
@@ -410,13 +407,13 @@ impl RadrootsNip22CommentParentReference {
}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsNip22CommentRoot {
- Event(RadrootsNip22EventRootReference),
- Address(RadrootsNip22AddressRootReference),
+pub enum Nip22CommentRoot {
+ Event(Nip22EventRootReference),
+ Address(Nip22AddressRootReference),
}
-impl RadrootsNip22CommentRoot {
- pub const fn kind(&self) -> RadrootsNip22CommentRootKind {
+impl Nip22CommentRoot {
+ pub const fn kind(&self) -> Nip22CommentRootKind {
match self {
Self::Event(reference) => reference.kind(),
Self::Address(reference) => reference.kind(),
@@ -430,7 +427,7 @@ impl RadrootsNip22CommentRoot {
}
}
- pub const fn relay(&self) -> Option<&RadrootsNostrRelayHint> {
+ pub const fn relay(&self) -> Option<&NostrRelayHint> {
match self {
Self::Event(reference) => reference.relay(),
Self::Address(reference) => reference.relay(),
@@ -438,27 +435,23 @@ impl RadrootsNip22CommentRoot {
}
}
-impl From<RadrootsNip22EventRootReference> for RadrootsNip22CommentRoot {
- fn from(value: RadrootsNip22EventRootReference) -> Self {
+impl From<Nip22EventRootReference> for Nip22CommentRoot {
+ fn from(value: Nip22EventRootReference) -> Self {
Self::Event(value)
}
}
-impl From<RadrootsNip22AddressRootReference> for RadrootsNip22CommentRoot {
- fn from(value: RadrootsNip22AddressRootReference) -> Self {
+impl From<Nip22AddressRootReference> for Nip22CommentRoot {
+ fn from(value: Nip22AddressRootReference) -> Self {
Self::Address(value)
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsNip22CommentPosition {
+pub enum Nip22CommentPosition {
TopLevelEvent,
- TopLevelAddress {
- current_revision: RadrootsEventId,
- },
- Nested {
- parent: RadrootsNip22CommentParentReference,
- },
+ TopLevelAddress { current_revision: EventId },
+ Nested { parent: Nip22CommentParentReference },
}
/// Strict authored kind-1111 NIP-22 comment.
@@ -466,78 +459,77 @@ pub enum RadrootsNip22CommentPosition {
/// This type is opaque and has no Serde construction path.
///
/// ```compile_fail
-/// let _: radroots_event::post::comment::RadrootsAuthoredNip22Comment =
+/// let _: radroots_event::post::comment::AuthoredNip22Comment =
/// serde_json::from_str(r#"{"content":"comment"}"#).unwrap();
/// ```
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsAuthoredNip22Comment {
+pub struct AuthoredNip22Comment {
content: String,
- root: RadrootsNip22CommentRoot,
- position: RadrootsNip22CommentPosition,
+ root: Nip22CommentRoot,
+ position: Nip22CommentPosition,
}
-impl RadrootsAuthoredNip22Comment {
+impl AuthoredNip22Comment {
pub fn top_level_event(
content: impl Into<String>,
- root: RadrootsNip22EventRootReference,
- ) -> Result<Self, RadrootsNip22CommentError> {
+ root: Nip22EventRootReference,
+ ) -> Result<Self, Nip22CommentError> {
Self::new(
content.into(),
- RadrootsNip22CommentRoot::Event(root),
- RadrootsNip22CommentPosition::TopLevelEvent,
+ Nip22CommentRoot::Event(root),
+ Nip22CommentPosition::TopLevelEvent,
)
}
pub fn top_level_address(
content: impl Into<String>,
- root: RadrootsNip22AddressRootReference,
- current_revision: RadrootsEventId,
- ) -> Result<Self, RadrootsNip22CommentError> {
+ root: Nip22AddressRootReference,
+ current_revision: EventId,
+ ) -> Result<Self, Nip22CommentError> {
Self::new(
content.into(),
- RadrootsNip22CommentRoot::Address(root),
- RadrootsNip22CommentPosition::TopLevelAddress { current_revision },
+ Nip22CommentRoot::Address(root),
+ Nip22CommentPosition::TopLevelAddress { current_revision },
)
}
pub fn parse_top_level_address(
content: impl Into<String>,
- root: RadrootsNip22AddressRootReference,
+ root: Nip22AddressRootReference,
current_revision: impl AsRef<str>,
- ) -> Result<Self, RadrootsNip22CommentError> {
+ ) -> Result<Self, Nip22CommentError> {
Self::top_level_address(
content,
root,
- RadrootsEventId::parse(current_revision)
- .map_err(RadrootsNip22CommentError::RevisionEventIdInvalid)?,
+ EventId::parse(current_revision).map_err(Nip22CommentError::RevisionEventIdInvalid)?,
)
}
pub fn nested(
content: impl Into<String>,
- root: impl Into<RadrootsNip22CommentRoot>,
- parent: RadrootsNip22CommentParentReference,
- ) -> Result<Self, RadrootsNip22CommentError> {
+ root: impl Into<Nip22CommentRoot>,
+ parent: Nip22CommentParentReference,
+ ) -> Result<Self, Nip22CommentError> {
let root = root.into();
if matches!(
&root,
- RadrootsNip22CommentRoot::Event(reference)
+ Nip22CommentRoot::Event(reference)
if reference.event_id() == parent.event_id()
) {
- return Err(RadrootsNip22CommentError::ParentReferenceMismatch);
+ return Err(Nip22CommentError::ParentReferenceMismatch);
}
Self::new(
content.into(),
root,
- RadrootsNip22CommentPosition::Nested { parent },
+ Nip22CommentPosition::Nested { parent },
)
}
fn new(
content: String,
- root: RadrootsNip22CommentRoot,
- position: RadrootsNip22CommentPosition,
- ) -> Result<Self, RadrootsNip22CommentError> {
+ root: Nip22CommentRoot,
+ position: Nip22CommentPosition,
+ ) -> Result<Self, Nip22CommentError> {
validate_content(&content)?;
validate_authored_comment_wire_size(&content, &root, &position)?;
Ok(Self {
@@ -551,48 +543,44 @@ impl RadrootsAuthoredNip22Comment {
&self.content
}
- pub const fn root(&self) -> &RadrootsNip22CommentRoot {
+ pub const fn root(&self) -> &Nip22CommentRoot {
&self.root
}
- pub const fn position(&self) -> &RadrootsNip22CommentPosition {
+ pub const fn position(&self) -> &Nip22CommentPosition {
&self.position
}
}
-fn parse_optional_relay(
- relay: Option<&str>,
-) -> Result<Option<RadrootsNostrRelayHint>, RadrootsNip22CommentError> {
+fn parse_optional_relay(relay: Option<&str>) -> Result<Option<NostrRelayHint>, Nip22CommentError> {
match relay {
None | Some("") => Ok(None),
Some(relay) => {
validate_tag_element(relay)?;
- RadrootsNostrRelayHint::parse(relay)
+ NostrRelayHint::parse(relay)
.map(Some)
- .map_err(RadrootsNip22CommentError::RelayInvalid)
+ .map_err(Nip22CommentError::RelayInvalid)
}
}
}
-fn validate_optional_relay(
- relay: &Option<RadrootsNostrRelayHint>,
-) -> Result<(), RadrootsNip22CommentError> {
+fn validate_optional_relay(relay: &Option<NostrRelayHint>) -> Result<(), Nip22CommentError> {
if let Some(relay) = relay {
validate_tag_element(relay.as_str())?;
}
Ok(())
}
-fn relay_or_empty(relay: Option<&RadrootsNostrRelayHint>) -> &str {
- relay.map_or("", RadrootsNostrRelayHint::as_str)
+fn relay_or_empty(relay: Option<&NostrRelayHint>) -> &str {
+ relay.map_or("", NostrRelayHint::as_str)
}
-fn validate_content(content: &str) -> Result<(), RadrootsNip22CommentError> {
+fn validate_content(content: &str) -> Result<(), Nip22CommentError> {
if content.trim().is_empty() {
- return Err(RadrootsNip22CommentError::ContentMissing);
+ return Err(Nip22CommentError::ContentMissing);
}
if content.len() > RADROOTS_NIP22_COMMENT_CONTENT_MAX_BYTES {
- return Err(RadrootsNip22CommentError::ContentTooLarge {
+ return Err(Nip22CommentError::ContentTooLarge {
max: RADROOTS_NIP22_COMMENT_CONTENT_MAX_BYTES,
actual: content.len(),
});
@@ -600,9 +588,9 @@ fn validate_content(content: &str) -> Result<(), RadrootsNip22CommentError> {
Ok(())
}
-fn validate_tag_element(element: &str) -> Result<(), RadrootsNip22CommentError> {
+fn validate_tag_element(element: &str) -> Result<(), Nip22CommentError> {
if element.len() > RADROOTS_NIP22_COMMENT_TAG_ELEMENT_MAX_BYTES {
- return Err(RadrootsNip22CommentError::TagElementTooLarge {
+ return Err(Nip22CommentError::TagElementTooLarge {
max: RADROOTS_NIP22_COMMENT_TAG_ELEMENT_MAX_BYTES,
actual: element.len(),
});
@@ -612,16 +600,16 @@ fn validate_tag_element(element: &str) -> Result<(), RadrootsNip22CommentError>
fn validate_authored_comment_wire_size(
content: &str,
- root: &RadrootsNip22CommentRoot,
- position: &RadrootsNip22CommentPosition,
-) -> Result<(), RadrootsNip22CommentError> {
+ root: &Nip22CommentRoot,
+ position: &Nip22CommentPosition,
+) -> Result<(), Nip22CommentError> {
let mut tag_bytes = 0usize;
let mut tags_json_bytes = 2usize;
let mut tag_count = 0usize;
let root_kind = root.kind().as_u32().to_string();
let root_tag_element_count = match root {
- RadrootsNip22CommentRoot::Event(reference) => {
+ Nip22CommentRoot::Event(reference) => {
add_tag(
&mut tag_bytes,
&mut tags_json_bytes,
@@ -635,7 +623,7 @@ fn validate_authored_comment_wire_size(
);
8usize + usize::from(reference.relay().is_some())
}
- RadrootsNip22CommentRoot::Address(reference) => {
+ Nip22CommentRoot::Address(reference) => {
add_optional_relay_tag(
&mut tag_bytes,
&mut tags_json_bytes,
@@ -663,10 +651,7 @@ fn validate_authored_comment_wire_size(
);
let position_tag_element_count = match (root, position) {
- (
- RadrootsNip22CommentRoot::Event(reference),
- RadrootsNip22CommentPosition::TopLevelEvent,
- ) => {
+ (Nip22CommentRoot::Event(reference), Nip22CommentPosition::TopLevelEvent) => {
add_tag(
&mut tag_bytes,
&mut tags_json_bytes,
@@ -695,8 +680,8 @@ fn validate_authored_comment_wire_size(
8usize + usize::from(reference.relay().is_some())
}
(
- RadrootsNip22CommentRoot::Address(reference),
- RadrootsNip22CommentPosition::TopLevelAddress { current_revision },
+ Nip22CommentRoot::Address(reference),
+ Nip22CommentPosition::TopLevelAddress { current_revision },
) => {
add_optional_relay_tag(
&mut tag_bytes,
@@ -730,7 +715,7 @@ fn validate_authored_comment_wire_size(
);
8usize + 3 * usize::from(reference.relay().is_some())
}
- (_, RadrootsNip22CommentPosition::Nested { parent }) => {
+ (_, Nip22CommentPosition::Nested { parent }) => {
add_tag(
&mut tag_bytes,
&mut tags_json_bytes,
@@ -762,21 +747,21 @@ fn validate_authored_comment_wire_size(
};
if tag_count > RADROOTS_NIP22_COMMENT_TAG_MAX_COUNT {
- return Err(RadrootsNip22CommentError::TagCountExceeded {
+ return Err(Nip22CommentError::TagCountExceeded {
max: RADROOTS_NIP22_COMMENT_TAG_MAX_COUNT,
actual: tag_count,
});
}
let tag_element_count = root_tag_element_count.saturating_add(position_tag_element_count);
if tag_element_count > RADROOTS_NIP22_COMMENT_TAG_TOTAL_ELEMENT_MAX_COUNT {
- return Err(RadrootsNip22CommentError::TagElementCountExceeded {
+ return Err(Nip22CommentError::TagElementCountExceeded {
max: RADROOTS_NIP22_COMMENT_TAG_TOTAL_ELEMENT_MAX_COUNT,
actual: tag_element_count,
});
}
if tag_bytes > RADROOTS_NIP22_COMMENT_TAG_TOTAL_MAX_BYTES {
- return Err(RadrootsNip22CommentError::TagBytesExceeded {
+ return Err(Nip22CommentError::TagBytesExceeded {
max: RADROOTS_NIP22_COMMENT_TAG_TOTAL_MAX_BYTES,
actual: tag_bytes,
});
@@ -785,7 +770,7 @@ fn validate_authored_comment_wire_size(
.saturating_add(tags_json_bytes)
.saturating_add(canonical_json_string_bytes(content));
if actual > RADROOTS_NIP22_COMMENT_EVENT_WIRE_MAX_BYTES {
- return Err(RadrootsNip22CommentError::EventWireTooLarge {
+ return Err(Nip22CommentError::EventWireTooLarge {
max: RADROOTS_NIP22_COMMENT_EVENT_WIRE_MAX_BYTES,
actual,
});
@@ -799,7 +784,7 @@ fn add_optional_relay_tag(
tag_count: &mut usize,
name: &str,
value: &str,
- relay: Option<&RadrootsNostrRelayHint>,
+ relay: Option<&NostrRelayHint>,
) {
if let Some(relay) = relay {
add_tag(
@@ -847,8 +832,8 @@ fn canonical_json_string_bytes(value: &str) -> usize {
mod tests {
use super::*;
- fn event_root(kind: u32) -> RadrootsNip22EventRootReference {
- RadrootsNip22EventRootReference::parse(
+ fn event_root(kind: u32) -> Nip22EventRootReference {
+ Nip22EventRootReference::parse(
"a".repeat(64),
crate::test_valid_hex_64('b'),
kind,
@@ -857,16 +842,16 @@ mod tests {
.expect("event root")
}
- fn address_root(kind: u32) -> RadrootsNip22AddressRootReference {
- RadrootsNip22AddressRootReference::parse(
+ fn address_root(kind: u32) -> Nip22AddressRootReference {
+ Nip22AddressRootReference::parse(
format!("{kind}:{}:victoria-market", crate::test_valid_hex_64('b')),
Some("wss://relay.example"),
)
.expect("address root")
}
- fn parent() -> RadrootsNip22CommentParentReference {
- RadrootsNip22CommentParentReference::parse(
+ fn parent() -> Nip22CommentParentReference {
+ Nip22CommentParentReference::parse(
"c".repeat(64),
"d".repeat(64),
Some("wss://comments.example"),
@@ -881,17 +866,17 @@ mod tests {
KIND_CALENDAR_DATE_EVENT,
KIND_CALENDAR_TIME_EVENT,
] {
- RadrootsAuthoredNip22Comment::top_level_event("Comment", event_root(kind))
+ AuthoredNip22Comment::top_level_event("Comment", event_root(kind))
.expect("event comment");
- RadrootsAuthoredNip22Comment::parse_top_level_address(
+ AuthoredNip22Comment::parse_top_level_address(
"Comment",
address_root(kind),
"e".repeat(64),
)
.expect("address comment");
- RadrootsAuthoredNip22Comment::nested("Reply", event_root(kind), parent())
+ AuthoredNip22Comment::nested("Reply", event_root(kind), parent())
.expect("nested event comment");
- RadrootsAuthoredNip22Comment::nested("Reply", address_root(kind), parent())
+ AuthoredNip22Comment::nested("Reply", address_root(kind), parent())
.expect("nested address comment");
}
}
@@ -900,32 +885,29 @@ mod tests {
fn rejects_other_root_kinds_and_ambiguous_parent() {
for kind in [1, KIND_COMMENT, 30_023] {
assert!(matches!(
- RadrootsNip22EventRootReference::parse(
+ Nip22EventRootReference::parse(
"a".repeat(64),
crate::test_valid_hex_64('b'),
kind,
None
),
- Err(RadrootsNip22CommentError::RootKindUnsupported { actual }) if actual == kind
+ Err(Nip22CommentError::RootKindUnsupported { actual }) if actual == kind
));
}
let root = event_root(KIND_CLASSIFIED_LISTING);
- let parent = RadrootsNip22CommentParentReference::parse(
- root.event_id().to_hex(),
- "d".repeat(64),
- None,
- )
- .expect("parent");
+ let parent =
+ Nip22CommentParentReference::parse(root.event_id().to_hex(), "d".repeat(64), None)
+ .expect("parent");
assert_eq!(
- RadrootsAuthoredNip22Comment::nested("Reply", root, parent).unwrap_err(),
- RadrootsNip22CommentError::ParentReferenceMismatch
+ AuthoredNip22Comment::nested("Reply", root, parent).unwrap_err(),
+ Nip22CommentError::ParentReferenceMismatch
);
}
#[test]
fn canonicalizes_address_author_and_requires_current_revision() {
- let root = RadrootsNip22AddressRootReference::parse(
+ let root = Nip22AddressRootReference::parse(
format!("30402:{}:listing", crate::test_valid_hex_64('B')),
None,
)
@@ -940,11 +922,11 @@ mod tests {
);
let comment =
- RadrootsAuthoredNip22Comment::parse_top_level_address("Comment", root, "E".repeat(64))
+ AuthoredNip22Comment::parse_top_level_address("Comment", root, "E".repeat(64))
.expect("top-level address");
assert!(matches!(
comment.position(),
- RadrootsNip22CommentPosition::TopLevelAddress { current_revision }
+ Nip22CommentPosition::TopLevelAddress { current_revision }
if current_revision.to_hex() == "e".repeat(64)
));
}
@@ -952,7 +934,7 @@ mod tests {
#[test]
fn address_root_rechecks_the_canonical_coordinate_tag_element() {
let maximum_d_tag = "x".repeat(512);
- let root = RadrootsNip22AddressRootReference::parse(
+ let root = Nip22AddressRootReference::parse(
format!("30402:{}:{maximum_d_tag}", crate::test_valid_hex_64('b')),
None,
)
@@ -965,9 +947,9 @@ mod tests {
"x".repeat(513)
);
assert!(matches!(
- RadrootsNip22AddressRootReference::parse(oversized, None),
- Err(RadrootsNip22CommentError::RootCoordinateInvalid(
- RadrootsIdParseError::TooLong {
+ Nip22AddressRootReference::parse(oversized, None),
+ Err(Nip22CommentError::RootCoordinateInvalid(
+ ParseError::TooLong {
max: 512,
actual: 513
}
@@ -979,13 +961,13 @@ mod tests {
fn relay_element_budget_precedes_relay_syntax() {
let oversized_noncanonical_relay = format!("WSS://relay.example/{}", "x".repeat(4096));
assert!(matches!(
- RadrootsNip22EventRootReference::parse(
+ Nip22EventRootReference::parse(
"a".repeat(64),
crate::test_valid_hex_64('b'),
KIND_CLASSIFIED_LISTING,
Some(&oversized_noncanonical_relay),
),
- Err(RadrootsNip22CommentError::TagElementTooLarge {
+ Err(Nip22CommentError::TagElementTooLarge {
max: RADROOTS_NIP22_COMMENT_TAG_ELEMENT_MAX_BYTES,
actual,
}) if actual == oversized_noncanonical_relay.len()
@@ -994,17 +976,17 @@ mod tests {
#[test]
fn enforces_content_and_relay_element_boundaries() {
- RadrootsAuthoredNip22Comment::top_level_event(
+ AuthoredNip22Comment::top_level_event(
"x".repeat(RADROOTS_NIP22_COMMENT_CONTENT_MAX_BYTES),
event_root(KIND_CLASSIFIED_LISTING),
)
.expect("exact content limit");
assert!(matches!(
- RadrootsAuthoredNip22Comment::top_level_event(
+ AuthoredNip22Comment::top_level_event(
"x".repeat(RADROOTS_NIP22_COMMENT_CONTENT_MAX_BYTES + 1),
event_root(KIND_CLASSIFIED_LISTING)
),
- Err(RadrootsNip22CommentError::ContentTooLarge { max, actual })
+ Err(Nip22CommentError::ContentTooLarge { max, actual })
if max == RADROOTS_NIP22_COMMENT_CONTENT_MAX_BYTES
&& actual == max + 1
));
@@ -1014,7 +996,7 @@ mod tests {
"{prefix}{}",
"a".repeat(RADROOTS_NIP22_COMMENT_TAG_ELEMENT_MAX_BYTES - prefix.len())
);
- RadrootsNip22EventRootReference::parse(
+ Nip22EventRootReference::parse(
"a".repeat(64),
crate::test_valid_hex_64('b'),
KIND_CLASSIFIED_LISTING,
@@ -1023,13 +1005,13 @@ mod tests {
.expect("exact tag-element limit");
let overflow = format!("{exact_relay}a");
assert!(matches!(
- RadrootsNip22EventRootReference::parse(
+ Nip22EventRootReference::parse(
"a".repeat(64),
crate::test_valid_hex_64('b'),
KIND_CLASSIFIED_LISTING,
Some(&overflow)
),
- Err(RadrootsNip22CommentError::TagElementTooLarge { max, actual })
+ Err(Nip22CommentError::TagElementTooLarge { max, actual })
if max == RADROOTS_NIP22_COMMENT_TAG_ELEMENT_MAX_BYTES
&& actual == max + 1
));
@@ -1037,18 +1019,12 @@ mod tests {
#[test]
fn uses_unicode_white_space_for_blank_content() {
- RadrootsAuthoredNip22Comment::top_level_event(
- "\u{001c}",
- event_root(KIND_CLASSIFIED_LISTING),
- )
- .expect("U+001C is not Unicode White_Space");
+ AuthoredNip22Comment::top_level_event("\u{001c}", event_root(KIND_CLASSIFIED_LISTING))
+ .expect("U+001C is not Unicode White_Space");
assert_eq!(
- RadrootsAuthoredNip22Comment::top_level_event(
- "\u{00a0}",
- event_root(KIND_CLASSIFIED_LISTING)
- )
- .unwrap_err(),
- RadrootsNip22CommentError::ContentMissing
+ AuthoredNip22Comment::top_level_event("\u{00a0}", event_root(KIND_CLASSIFIED_LISTING))
+ .unwrap_err(),
+ Nip22CommentError::ContentMissing
);
}
@@ -1058,7 +1034,7 @@ mod tests {
let mut upper = RADROOTS_NIP22_COMMENT_CONTENT_MAX_BYTES;
while lower < upper {
let candidate = lower + (upper - lower).div_ceil(2);
- if RadrootsAuthoredNip22Comment::top_level_event(
+ if AuthoredNip22Comment::top_level_event(
"\u{0001}".repeat(candidate),
event_root(KIND_CLASSIFIED_LISTING),
)
@@ -1070,17 +1046,17 @@ mod tests {
}
}
- RadrootsAuthoredNip22Comment::top_level_event(
+ AuthoredNip22Comment::top_level_event(
"\u{0001}".repeat(lower),
event_root(KIND_CLASSIFIED_LISTING),
)
.expect("largest escaped content fitting the wire budget");
assert!(matches!(
- RadrootsAuthoredNip22Comment::top_level_event(
+ AuthoredNip22Comment::top_level_event(
"\u{0001}".repeat(lower + 1),
event_root(KIND_CLASSIFIED_LISTING)
),
- Err(RadrootsNip22CommentError::EventWireTooLarge { max, .. })
+ Err(Nip22CommentError::EventWireTooLarge { max, .. })
if max == RADROOTS_NIP22_COMMENT_EVENT_WIRE_MAX_BYTES
));
}
diff --git a/crates/event/src/contract/registry_v7.rs b/crates/event/src/contract/registry_v7.rs
@@ -7,18 +7,17 @@ use alloc::{borrow::ToOwned, string::String, vec::Vec};
use crate::{
calendar::{
- RADROOTS_CALENDAR_MAX_PARTICIPANTS, RadrootsCalendarDate, RadrootsCalendarUid,
- RadrootsCalendarUri, RadrootsIanaTimeZoneId, canonical_calendar_geohash_is_valid,
- canonical_calendar_tag_text_is_valid, covered_utc_days,
+ CalendarDate, CalendarUid, CalendarUri, IanaTimeZoneId, RADROOTS_CALENDAR_MAX_PARTICIPANTS,
+ canonical_calendar_geohash_is_valid, canonical_calendar_tag_text_is_valid,
+ covered_utc_days,
},
- envelope::RadrootsEventEnvelope,
+ envelope::EventEnvelope,
envelope::kind::*,
id::{
- RadrootsAddressableCoordinate, RadrootsDTag, RadrootsEventId, RadrootsNip01Coordinate,
- parse_public_key, relay_url_is_valid,
+ AddressableCoordinate, DTag, EventId, Nip01Coordinate, parse_public_key, relay_url_is_valid,
},
listing::classified::{
- RadrootsClassifiedListingPartition, TAG_RADROOTS_PRICE_UNIT, TAG_RADROOTS_QUANTITY,
+ ClassifiedListingPartition, TAG_RADROOTS_PRICE_UNIT, TAG_RADROOTS_QUANTITY,
},
};
use radroots_blossom::BlobUrl;
@@ -26,7 +25,7 @@ use radroots_blossom::BlobUrl;
pub const RADROOTS_EVENT_CONTRACT_REGISTRY_VERSION: u32 = 7;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsEventClass {
+pub enum EventClass {
Regular,
Replaceable,
Addressable,
@@ -34,7 +33,7 @@ pub enum RadrootsEventClass {
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsNostrStandard {
+pub enum NostrStandard {
Nip01,
Nip09,
Nip17,
@@ -60,7 +59,7 @@ pub enum RadrootsNostrStandard {
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsEventPrivacy {
+pub enum EventPrivacy {
Public,
Encrypted,
LocalOnly,
@@ -68,7 +67,7 @@ pub enum RadrootsEventPrivacy {
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsEventStability {
+pub enum EventStability {
Stable,
Experimental,
}
@@ -121,7 +120,7 @@ impl AuthorRole {
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsReducer {
+pub enum Reducer {
CalendarProjection,
FarmOpsProjection,
GroupProjection,
@@ -138,7 +137,7 @@ pub enum RadrootsReducer {
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsContentSchema {
+pub enum ContentSchema {
Empty,
JsonObject,
PlainText,
@@ -149,7 +148,7 @@ pub enum RadrootsContentSchema {
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsTagCardinality {
+pub enum TagCardinality {
RequiredOne,
OptionalOne,
OptionalMany,
@@ -157,7 +156,7 @@ pub enum RadrootsTagCardinality {
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsTagSemantic {
+pub enum TagSemantic {
AddressableCoordinate,
CalendarEventAuthor,
CalendarEventReference,
@@ -203,7 +202,7 @@ pub enum RadrootsTagSemantic {
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsTagValueType {
+pub enum TagValueType {
AddressableCoordinate,
CalendarDate,
CalendarEventCoordinate,
@@ -230,21 +229,21 @@ pub enum RadrootsTagValueType {
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub struct RadrootsTagContract {
+pub struct TagContract {
pub name: &'static str,
- pub cardinality: RadrootsTagCardinality,
- pub semantic: RadrootsTagSemantic,
- pub value_type: RadrootsTagValueType,
+ pub cardinality: TagCardinality,
+ pub semantic: TagSemantic,
+ pub value_type: TagValueType,
pub relay_indexed: bool,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsEventDiscriminator {
+pub enum EventDiscriminator {
KindOnly,
/// Exact profile selection is owned by a verified admission algorithm.
AdmissionOnly,
/// Exact NIP-99 profile selection uses the central raw marker partition.
- ClassifiedListingPartition(RadrootsClassifiedListingPartition),
+ ClassifiedListingPartition(ClassifiedListingPartition),
DTagExact(&'static str),
DTagPrefix(&'static str),
DTagSuffix(&'static str),
@@ -257,12 +256,12 @@ pub enum RadrootsEventDiscriminator {
value: &'static str,
},
EnvelopeType(&'static str),
- Composite(&'static [RadrootsEventDiscriminator]),
+ Composite(&'static [EventDiscriminator]),
}
/// Governs whether a contract may enter the generic frozen-draft boundary.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsEventAuthoringPolicy {
+pub enum EventAuthoringPolicy {
/// Generic contract validation is sufficient to construct a frozen draft.
GenericDraft,
/// Authoring requires a sealed typed API instead of generic draft parts.
@@ -271,7 +270,7 @@ pub enum RadrootsEventAuthoringPolicy {
ReadOnly,
}
-impl RadrootsEventAuthoringPolicy {
+impl EventAuthoringPolicy {
/// Returns whether untyped contract parts may construct a frozen draft.
#[must_use]
pub const fn permits_generic_draft(self) -> bool {
@@ -292,14 +291,14 @@ impl RadrootsEventAuthoringPolicy {
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsContractMatchError {
+pub enum ContractMatchError {
UnsupportedKind(u32),
UnsupportedShape(u32),
AmbiguousShape(u32),
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsContractFamily {
+pub enum ContractFamily {
Account,
Application,
Calendar,
@@ -318,14 +317,14 @@ pub enum RadrootsContractFamily {
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub struct RadrootsContractFamilyMetadata {
- pub family: RadrootsContractFamily,
+pub struct ContractFamilyMetadata {
+ pub family: ContractFamily,
pub id: &'static str,
pub name: &'static str,
}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsContractValidationError {
+pub enum ContractValidationError {
UnknownContract {
contract_id: String,
},
@@ -333,7 +332,7 @@ pub enum RadrootsContractValidationError {
contract_id: &'static str,
},
ContractMatch {
- error: RadrootsContractMatchError,
+ error: ContractMatchError,
},
KindMismatch {
expected: u32,
@@ -374,7 +373,7 @@ pub enum RadrootsContractValidationError {
},
}
-impl RadrootsContractValidationError {
+impl ContractValidationError {
pub const fn code(&self) -> &'static str {
match self {
Self::UnknownContract { .. } => "unknown_contract",
@@ -394,33 +393,33 @@ impl RadrootsContractValidationError {
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub struct RadrootsKindContract {
+pub struct KindContract {
pub kind: u32,
pub canonical_constant: &'static str,
pub name: &'static str,
- pub class: RadrootsEventClass,
- pub standard: RadrootsNostrStandard,
+ pub class: EventClass,
+ pub standard: NostrStandard,
pub accepted_event_contracts: &'static [&'static str],
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub struct RadrootsEventContract {
+pub struct EventContract {
pub id: &'static str,
pub kind: u32,
pub name: &'static str,
pub payload_type: &'static str,
- pub class: RadrootsEventClass,
- pub stability: RadrootsEventStability,
- pub privacy: RadrootsEventPrivacy,
+ pub class: EventClass,
+ pub stability: EventStability,
+ pub privacy: EventPrivacy,
required_author_role: AuthorRole,
- pub content_schema: RadrootsContentSchema,
- authoring_policy: RadrootsEventAuthoringPolicy,
- pub discriminator: RadrootsEventDiscriminator,
- pub tags: &'static [RadrootsTagContract],
- pub reducers: &'static [RadrootsReducer],
+ pub content_schema: ContentSchema,
+ authoring_policy: EventAuthoringPolicy,
+ pub discriminator: EventDiscriminator,
+ pub tags: &'static [TagContract],
+ pub reducers: &'static [Reducer],
}
-impl RadrootsEventContract {
+impl EventContract {
/// Returns the event-authoring role required by this contract.
///
/// Hosts decide whether a concrete signer or actor has this role; the
@@ -432,84 +431,84 @@ impl RadrootsEventContract {
/// Returns the single registry-owned policy governing authoring routes.
#[must_use]
- pub const fn authoring_policy(&self) -> RadrootsEventAuthoringPolicy {
+ pub const fn authoring_policy(&self) -> EventAuthoringPolicy {
self.authoring_policy
}
}
-static CONTRACT_FAMILIES: &[RadrootsContractFamilyMetadata] = &[
- RadrootsContractFamilyMetadata {
- family: RadrootsContractFamily::Account,
+static CONTRACT_FAMILIES: &[ContractFamilyMetadata] = &[
+ ContractFamilyMetadata {
+ family: ContractFamily::Account,
id: "account",
name: "Account",
},
- RadrootsContractFamilyMetadata {
- family: RadrootsContractFamily::Application,
+ ContractFamilyMetadata {
+ family: ContractFamily::Application,
id: "application",
name: "Application",
},
- RadrootsContractFamilyMetadata {
- family: RadrootsContractFamily::Calendar,
+ ContractFamilyMetadata {
+ family: ContractFamily::Calendar,
id: "calendar",
name: "Calendar",
},
- RadrootsContractFamilyMetadata {
- family: RadrootsContractFamily::Farm,
+ ContractFamilyMetadata {
+ family: ContractFamily::Farm,
id: "farm",
name: "Farm",
},
- RadrootsContractFamilyMetadata {
- family: RadrootsContractFamily::Group,
+ ContractFamilyMetadata {
+ family: ContractFamily::Group,
id: "group",
name: "Group",
},
- RadrootsContractFamilyMetadata {
- family: RadrootsContractFamily::Http,
+ ContractFamilyMetadata {
+ family: ContractFamily::Http,
id: "http",
name: "HTTP",
},
- RadrootsContractFamilyMetadata {
- family: RadrootsContractFamily::Job,
+ ContractFamilyMetadata {
+ family: ContractFamily::Job,
id: "job",
name: "Job",
},
- RadrootsContractFamilyMetadata {
- family: RadrootsContractFamily::Knowledge,
+ ContractFamilyMetadata {
+ family: ContractFamily::Knowledge,
id: "knowledge",
name: "Knowledge",
},
- RadrootsContractFamilyMetadata {
- family: RadrootsContractFamily::List,
+ ContractFamilyMetadata {
+ family: ContractFamily::List,
id: "list",
name: "List",
},
- RadrootsContractFamilyMetadata {
- family: RadrootsContractFamily::Market,
+ ContractFamilyMetadata {
+ family: ContractFamily::Market,
id: "market",
name: "Market",
},
- RadrootsContractFamilyMetadata {
- family: RadrootsContractFamily::Message,
+ ContractFamilyMetadata {
+ family: ContractFamily::Message,
id: "message",
name: "Message",
},
- RadrootsContractFamilyMetadata {
- family: RadrootsContractFamily::Profile,
+ ContractFamilyMetadata {
+ family: ContractFamily::Profile,
id: "profile",
name: "Profile",
},
- RadrootsContractFamilyMetadata {
- family: RadrootsContractFamily::Relay,
+ ContractFamilyMetadata {
+ family: ContractFamily::Relay,
id: "relay",
name: "Relay",
},
- RadrootsContractFamilyMetadata {
- family: RadrootsContractFamily::Social,
+ ContractFamilyMetadata {
+ family: ContractFamily::Social,
id: "social",
name: "Social",
},
- RadrootsContractFamilyMetadata {
- family: RadrootsContractFamily::Trade,
+ ContractFamilyMetadata {
+ family: ContractFamily::Trade,
id: "trade",
name: "Trade",
},
@@ -517,12 +516,12 @@ static CONTRACT_FAMILIES: &[RadrootsContractFamilyMetadata] = &[
const fn tag(
name: &'static str,
- cardinality: RadrootsTagCardinality,
- semantic: RadrootsTagSemantic,
- value_type: RadrootsTagValueType,
+ cardinality: TagCardinality,
+ semantic: TagSemantic,
+ value_type: TagValueType,
relay_indexed: bool,
-) -> RadrootsTagContract {
- RadrootsTagContract {
+) -> TagContract {
+ TagContract {
name,
cardinality,
semantic,
@@ -531,665 +530,665 @@ const fn tag(
}
}
-const TAG_D: RadrootsTagContract = tag(
+const TAG_D: TagContract = tag(
"d",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Identifier,
- RadrootsTagValueType::DTag,
+ TagCardinality::RequiredOne,
+ TagSemantic::Identifier,
+ TagValueType::DTag,
true,
);
-const TAG_P_REQUIRED: RadrootsTagContract = tag(
+const TAG_P_REQUIRED: TagContract = tag(
"p",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Counterparty,
- RadrootsTagValueType::PublicKey,
+ TagCardinality::RequiredOne,
+ TagSemantic::Counterparty,
+ TagValueType::PublicKey,
true,
);
-const TAG_P_MANY: RadrootsTagContract = tag(
+const TAG_P_MANY: TagContract = tag(
"p",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::Counterparty,
- RadrootsTagValueType::PublicKey,
+ TagCardinality::OptionalMany,
+ TagSemantic::Counterparty,
+ TagValueType::PublicKey,
true,
);
-const TAG_CALENDAR_PARTICIPANT: RadrootsTagContract = tag(
+const TAG_CALENDAR_PARTICIPANT: TagContract = tag(
"p",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::Participant,
- RadrootsTagValueType::PublicKey,
+ TagCardinality::OptionalMany,
+ TagSemantic::Participant,
+ TagValueType::PublicKey,
true,
);
-const TAG_A_ADDRESS_REQUIRED: RadrootsTagContract = tag(
+const TAG_A_ADDRESS_REQUIRED: TagContract = tag(
"a",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::AddressableCoordinate,
- RadrootsTagValueType::AddressableCoordinate,
+ TagCardinality::RequiredOne,
+ TagSemantic::AddressableCoordinate,
+ TagValueType::AddressableCoordinate,
true,
);
-const TAG_A_OPTIONAL: RadrootsTagContract = tag(
+const TAG_A_OPTIONAL: TagContract = tag(
"a",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::AddressableCoordinate,
- RadrootsTagValueType::AddressableCoordinate,
+ TagCardinality::OptionalOne,
+ TagSemantic::AddressableCoordinate,
+ TagValueType::AddressableCoordinate,
true,
);
-const TAG_A_MANY: RadrootsTagContract = tag(
+const TAG_A_MANY: TagContract = tag(
"a",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::AddressableCoordinate,
- RadrootsTagValueType::AddressableCoordinate,
+ TagCardinality::OptionalMany,
+ TagSemantic::AddressableCoordinate,
+ TagValueType::AddressableCoordinate,
true,
);
-const TAG_CALENDAR_INCLUSION_REQUEST: RadrootsTagContract = tag(
+const TAG_CALENDAR_INCLUSION_REQUEST: TagContract = tag(
"a",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::CalendarInclusionRequest,
- RadrootsTagValueType::AddressableCoordinate,
+ TagCardinality::OptionalMany,
+ TagSemantic::CalendarInclusionRequest,
+ TagValueType::AddressableCoordinate,
true,
);
-const TAG_E_ROOT: RadrootsTagContract = tag(
+const TAG_E_ROOT: TagContract = tag(
"e",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::RootEvent,
- RadrootsTagValueType::EventId,
+ TagCardinality::RequiredOne,
+ TagSemantic::RootEvent,
+ TagValueType::EventId,
true,
);
-const TAG_E_SOURCE_VERSION: RadrootsTagContract = tag(
+const TAG_E_SOURCE_VERSION: TagContract = tag(
"e",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Source,
- RadrootsTagValueType::EventId,
+ TagCardinality::RequiredOne,
+ TagSemantic::Source,
+ TagValueType::EventId,
true,
);
-const TAG_E_BASE_VERSION: RadrootsTagContract = tag(
+const TAG_E_BASE_VERSION: TagContract = tag(
"e",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::PreviousEvent,
- RadrootsTagValueType::EventId,
+ TagCardinality::OptionalOne,
+ TagSemantic::PreviousEvent,
+ TagValueType::EventId,
true,
);
-const TAG_E_MANY: RadrootsTagContract = tag(
+const TAG_E_MANY: TagContract = tag(
"e",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::EventPointer,
- RadrootsTagValueType::EventId,
+ TagCardinality::OptionalMany,
+ TagSemantic::EventPointer,
+ TagValueType::EventId,
true,
);
-const TAG_NIP09_E_TARGET: RadrootsTagContract = tag(
+const TAG_NIP09_E_TARGET: TagContract = tag(
"e",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::EventPointer,
- RadrootsTagValueType::EventId,
+ TagCardinality::OptionalMany,
+ TagSemantic::EventPointer,
+ TagValueType::EventId,
true,
);
-const TAG_NIP09_A_TARGET: RadrootsTagContract = tag(
+const TAG_NIP09_A_TARGET: TagContract = tag(
"a",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::Nip01Coordinate,
- RadrootsTagValueType::Nip01Coordinate,
+ TagCardinality::OptionalMany,
+ TagSemantic::Nip01Coordinate,
+ TagValueType::Nip01Coordinate,
true,
);
-const TAG_NIP09_K_ADVISORY: RadrootsTagContract = tag(
+const TAG_NIP09_K_ADVISORY: TagContract = tag(
"k",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::Kind,
- RadrootsTagValueType::Kind,
+ TagCardinality::OptionalMany,
+ TagSemantic::Kind,
+ TagValueType::Kind,
true,
);
-const TAG_NIP10_E_REQUIRED: RadrootsTagContract = tag(
+const TAG_NIP10_E_REQUIRED: TagContract = tag(
"e",
- RadrootsTagCardinality::RequiredMany,
- RadrootsTagSemantic::EventPointer,
- RadrootsTagValueType::EventId,
+ TagCardinality::RequiredMany,
+ TagSemantic::EventPointer,
+ TagValueType::EventId,
true,
);
-const TAG_NIP10_P_OPTIONAL: RadrootsTagContract = tag(
+const TAG_NIP10_P_OPTIONAL: TagContract = tag(
"p",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::Participant,
- RadrootsTagValueType::PublicKey,
+ TagCardinality::OptionalMany,
+ TagSemantic::Participant,
+ TagValueType::PublicKey,
true,
);
-const TAG_NIP22_E_ROOT: RadrootsTagContract = tag(
+const TAG_NIP22_E_ROOT: TagContract = tag(
"E",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::RootEvent,
- RadrootsTagValueType::EventId,
+ TagCardinality::OptionalOne,
+ TagSemantic::RootEvent,
+ TagValueType::EventId,
true,
);
-const TAG_NIP22_A_ROOT: RadrootsTagContract = tag(
+const TAG_NIP22_A_ROOT: TagContract = tag(
"A",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::AddressableCoordinate,
- RadrootsTagValueType::AddressableCoordinate,
+ TagCardinality::OptionalOne,
+ TagSemantic::AddressableCoordinate,
+ TagValueType::AddressableCoordinate,
true,
);
-const TAG_NIP22_K_ROOT: RadrootsTagContract = tag(
+const TAG_NIP22_K_ROOT: TagContract = tag(
"K",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Kind,
- RadrootsTagValueType::Kind,
+ TagCardinality::RequiredOne,
+ TagSemantic::Kind,
+ TagValueType::Kind,
true,
);
-const TAG_NIP22_P_ROOT: RadrootsTagContract = tag(
+const TAG_NIP22_P_ROOT: TagContract = tag(
"P",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Participant,
- RadrootsTagValueType::PublicKey,
+ TagCardinality::RequiredOne,
+ TagSemantic::Participant,
+ TagValueType::PublicKey,
true,
);
-const TAG_NIP22_A_PARENT: RadrootsTagContract = tag(
+const TAG_NIP22_A_PARENT: TagContract = tag(
"a",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::AddressableCoordinate,
- RadrootsTagValueType::AddressableCoordinate,
+ TagCardinality::OptionalOne,
+ TagSemantic::AddressableCoordinate,
+ TagValueType::AddressableCoordinate,
true,
);
-const TAG_NIP22_E_PARENT: RadrootsTagContract = tag(
+const TAG_NIP22_E_PARENT: TagContract = tag(
"e",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::EventPointer,
- RadrootsTagValueType::EventId,
+ TagCardinality::RequiredOne,
+ TagSemantic::EventPointer,
+ TagValueType::EventId,
true,
);
-const TAG_NIP22_K_PARENT: RadrootsTagContract = tag(
+const TAG_NIP22_K_PARENT: TagContract = tag(
"k",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Kind,
- RadrootsTagValueType::Kind,
+ TagCardinality::RequiredOne,
+ TagSemantic::Kind,
+ TagValueType::Kind,
true,
);
-const TAG_NIP22_P_PARENT: RadrootsTagContract = tag(
+const TAG_NIP22_P_PARENT: TagContract = tag(
"p",
- RadrootsTagCardinality::RequiredMany,
- RadrootsTagSemantic::Participant,
- RadrootsTagValueType::PublicKey,
+ TagCardinality::RequiredMany,
+ TagSemantic::Participant,
+ TagValueType::PublicKey,
true,
);
-const TAG_KIND: RadrootsTagContract = tag(
+const TAG_KIND: TagContract = tag(
"k",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::Kind,
- RadrootsTagValueType::Kind,
+ TagCardinality::OptionalOne,
+ TagSemantic::Kind,
+ TagValueType::Kind,
true,
);
-const TAG_RELAY: RadrootsTagContract = tag(
+const TAG_RELAY: TagContract = tag(
"relay",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::Relay,
- RadrootsTagValueType::RelayUrl,
+ TagCardinality::OptionalMany,
+ TagSemantic::Relay,
+ TagValueType::RelayUrl,
false,
);
-const TAG_GROUP: RadrootsTagContract = tag(
+const TAG_GROUP: TagContract = tag(
"h",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::GroupId,
- RadrootsTagValueType::DTag,
+ TagCardinality::RequiredOne,
+ TagSemantic::GroupId,
+ TagValueType::DTag,
true,
);
-const TAG_TITLE: RadrootsTagContract = tag(
+const TAG_TITLE: TagContract = tag(
"title",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::Title,
- RadrootsTagValueType::Text,
+ TagCardinality::OptionalOne,
+ TagSemantic::Title,
+ TagValueType::Text,
false,
);
-const TAG_CALENDAR_TITLE: RadrootsTagContract = tag(
+const TAG_CALENDAR_TITLE: TagContract = tag(
"title",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Title,
- RadrootsTagValueType::Text,
+ TagCardinality::RequiredOne,
+ TagSemantic::Title,
+ TagValueType::Text,
false,
);
-const TAG_CALENDAR_LEGACY_NAME: RadrootsTagContract = tag(
+const TAG_CALENDAR_LEGACY_NAME: TagContract = tag(
"name",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::Title,
- RadrootsTagValueType::Text,
+ TagCardinality::OptionalOne,
+ TagSemantic::Title,
+ TagValueType::Text,
false,
);
-const TAG_CALENDAR_UID: RadrootsTagContract = tag(
+const TAG_CALENDAR_UID: TagContract = tag(
"d",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Identifier,
- RadrootsTagValueType::CalendarUid,
+ TagCardinality::RequiredOne,
+ TagSemantic::Identifier,
+ TagValueType::CalendarUid,
true,
);
-const TAG_CALENDAR_COLLECTION_DESCRIPTION: RadrootsTagContract = tag(
+const TAG_CALENDAR_COLLECTION_DESCRIPTION: TagContract = tag(
"description",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::ListDescription,
- RadrootsTagValueType::Text,
+ TagCardinality::OptionalOne,
+ TagSemantic::ListDescription,
+ TagValueType::Text,
false,
);
-const TAG_CALENDAR_COLLECTION_EVENT: RadrootsTagContract = tag(
+const TAG_CALENDAR_COLLECTION_EVENT: TagContract = tag(
"a",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::CalendarEventReference,
- RadrootsTagValueType::CalendarEventCoordinate,
+ TagCardinality::OptionalMany,
+ TagSemantic::CalendarEventReference,
+ TagValueType::CalendarEventCoordinate,
true,
);
-const TAG_CALENDAR_RSVP_EVENT: RadrootsTagContract = tag(
+const TAG_CALENDAR_RSVP_EVENT: TagContract = tag(
"a",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::CalendarEventReference,
- RadrootsTagValueType::CalendarEventCoordinate,
+ TagCardinality::RequiredOne,
+ TagSemantic::CalendarEventReference,
+ TagValueType::CalendarEventCoordinate,
true,
);
-const TAG_CALENDAR_RSVP_REVISION: RadrootsTagContract = tag(
+const TAG_CALENDAR_RSVP_REVISION: TagContract = tag(
"e",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::CalendarEventRevision,
- RadrootsTagValueType::EventId,
+ TagCardinality::OptionalOne,
+ TagSemantic::CalendarEventRevision,
+ TagValueType::EventId,
true,
);
-const TAG_CALENDAR_RSVP_STATUS: RadrootsTagContract = tag(
+const TAG_CALENDAR_RSVP_STATUS: TagContract = tag(
"status",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Status,
- RadrootsTagValueType::CalendarRsvpStatus,
+ TagCardinality::RequiredOne,
+ TagSemantic::Status,
+ TagValueType::CalendarRsvpStatus,
false,
);
-const TAG_CALENDAR_RSVP_FREE_BUSY: RadrootsTagContract = tag(
+const TAG_CALENDAR_RSVP_FREE_BUSY: TagContract = tag(
"fb",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::FreeBusy,
- RadrootsTagValueType::CalendarFreeBusy,
+ TagCardinality::OptionalOne,
+ TagSemantic::FreeBusy,
+ TagValueType::CalendarFreeBusy,
false,
);
-const TAG_CALENDAR_RSVP_AUTHOR: RadrootsTagContract = tag(
+const TAG_CALENDAR_RSVP_AUTHOR: TagContract = tag(
"p",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::CalendarEventAuthor,
- RadrootsTagValueType::PublicKey,
+ TagCardinality::OptionalOne,
+ TagSemantic::CalendarEventAuthor,
+ TagValueType::PublicKey,
true,
);
-const TAG_CALENDAR_DATE_START: RadrootsTagContract = tag(
+const TAG_CALENDAR_DATE_START: TagContract = tag(
"start",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::CalendarStart,
- RadrootsTagValueType::CalendarDate,
+ TagCardinality::RequiredOne,
+ TagSemantic::CalendarStart,
+ TagValueType::CalendarDate,
false,
);
-const TAG_CALENDAR_DATE_END: RadrootsTagContract = tag(
+const TAG_CALENDAR_DATE_END: TagContract = tag(
"end",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::CalendarEnd,
- RadrootsTagValueType::CalendarDate,
+ TagCardinality::OptionalOne,
+ TagSemantic::CalendarEnd,
+ TagValueType::CalendarDate,
false,
);
-const TAG_CALENDAR_TIME_START: RadrootsTagContract = tag(
+const TAG_CALENDAR_TIME_START: TagContract = tag(
"start",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::CalendarStart,
- RadrootsTagValueType::UnixTimestamp,
+ TagCardinality::RequiredOne,
+ TagSemantic::CalendarStart,
+ TagValueType::UnixTimestamp,
false,
);
-const TAG_CALENDAR_TIME_END: RadrootsTagContract = tag(
+const TAG_CALENDAR_TIME_END: TagContract = tag(
"end",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::CalendarEnd,
- RadrootsTagValueType::UnixTimestamp,
+ TagCardinality::OptionalOne,
+ TagSemantic::CalendarEnd,
+ TagValueType::UnixTimestamp,
false,
);
-const TAG_CALENDAR_COVERED_UTC_DAY: RadrootsTagContract = tag(
+const TAG_CALENDAR_COVERED_UTC_DAY: TagContract = tag(
"D",
- RadrootsTagCardinality::RequiredMany,
- RadrootsTagSemantic::UtcDayCoverage,
- RadrootsTagValueType::UtcDayIndex,
+ TagCardinality::RequiredMany,
+ TagSemantic::UtcDayCoverage,
+ TagValueType::UtcDayIndex,
true,
);
-const TAG_CALENDAR_START_TZID: RadrootsTagContract = tag(
+const TAG_CALENDAR_START_TZID: TagContract = tag(
"start_tzid",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::TimeZone,
- RadrootsTagValueType::IanaTimeZoneId,
+ TagCardinality::OptionalOne,
+ TagSemantic::TimeZone,
+ TagValueType::IanaTimeZoneId,
false,
);
-const TAG_CALENDAR_END_TZID: RadrootsTagContract = tag(
+const TAG_CALENDAR_END_TZID: TagContract = tag(
"end_tzid",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::TimeZone,
- RadrootsTagValueType::IanaTimeZoneId,
+ TagCardinality::OptionalOne,
+ TagSemantic::TimeZone,
+ TagValueType::IanaTimeZoneId,
false,
);
-const TAG_SUMMARY: RadrootsTagContract = tag(
+const TAG_SUMMARY: TagContract = tag(
"summary",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::Summary,
- RadrootsTagValueType::Text,
+ TagCardinality::OptionalOne,
+ TagSemantic::Summary,
+ TagValueType::Text,
false,
);
-const TAG_PUBLISHED_AT: RadrootsTagContract = tag(
+const TAG_PUBLISHED_AT: TagContract = tag(
"published_at",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::PublishedAt,
- RadrootsTagValueType::UnixTimestamp,
+ TagCardinality::OptionalOne,
+ TagSemantic::PublishedAt,
+ TagValueType::UnixTimestamp,
false,
);
-const TAG_LOCATION: RadrootsTagContract = tag(
+const TAG_LOCATION: TagContract = tag(
"location",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::Location,
- RadrootsTagValueType::Text,
+ TagCardinality::OptionalMany,
+ TagSemantic::Location,
+ TagValueType::Text,
false,
);
-const TAG_CALENDAR_LOCATION: RadrootsTagContract = tag(
+const TAG_CALENDAR_LOCATION: TagContract = tag(
"location",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::Location,
- RadrootsTagValueType::Text,
+ TagCardinality::OptionalMany,
+ TagSemantic::Location,
+ TagValueType::Text,
false,
);
-const TAG_PRICE: RadrootsTagContract = tag(
+const TAG_PRICE: TagContract = tag(
"price",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::Price,
- RadrootsTagValueType::Text,
+ TagCardinality::OptionalMany,
+ TagSemantic::Price,
+ TagValueType::Text,
false,
);
-const TAG_STATUS: RadrootsTagContract = tag(
+const TAG_STATUS: TagContract = tag(
"status",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::Status,
- RadrootsTagValueType::Text,
+ TagCardinality::OptionalOne,
+ TagSemantic::Status,
+ TagValueType::Text,
false,
);
-const TAG_IMAGE: RadrootsTagContract = tag(
+const TAG_IMAGE: TagContract = tag(
"image",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::Image,
- RadrootsTagValueType::Url,
+ TagCardinality::OptionalMany,
+ TagSemantic::Image,
+ TagValueType::Url,
false,
);
-const TAG_FOOD_TITLE: RadrootsTagContract = tag(
+const TAG_FOOD_TITLE: TagContract = tag(
"title",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Title,
- RadrootsTagValueType::Text,
+ TagCardinality::RequiredOne,
+ TagSemantic::Title,
+ TagValueType::Text,
false,
);
-const TAG_FOOD_SUMMARY: RadrootsTagContract = tag(
+const TAG_FOOD_SUMMARY: TagContract = tag(
"summary",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Summary,
- RadrootsTagValueType::Text,
+ TagCardinality::RequiredOne,
+ TagSemantic::Summary,
+ TagValueType::Text,
false,
);
-const TAG_FOOD_PUBLISHED_AT: RadrootsTagContract = tag(
+const TAG_FOOD_PUBLISHED_AT: TagContract = tag(
"published_at",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::PublishedAt,
- RadrootsTagValueType::UnixTimestamp,
+ TagCardinality::RequiredOne,
+ TagSemantic::PublishedAt,
+ TagValueType::UnixTimestamp,
false,
);
-const TAG_FOOD_LOCATION: RadrootsTagContract = tag(
+const TAG_FOOD_LOCATION: TagContract = tag(
"location",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Location,
- RadrootsTagValueType::Text,
+ TagCardinality::RequiredOne,
+ TagSemantic::Location,
+ TagValueType::Text,
false,
);
-const TAG_FOOD_PRICE: RadrootsTagContract = tag(
+const TAG_FOOD_PRICE: TagContract = tag(
"price",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Price,
- RadrootsTagValueType::Text,
+ TagCardinality::RequiredOne,
+ TagSemantic::Price,
+ TagValueType::Text,
false,
);
-const TAG_FOOD_PRICE_UNIT: RadrootsTagContract = tag(
+const TAG_FOOD_PRICE_UNIT: TagContract = tag(
TAG_RADROOTS_PRICE_UNIT,
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Price,
- RadrootsTagValueType::Text,
+ TagCardinality::RequiredOne,
+ TagSemantic::Price,
+ TagValueType::Text,
false,
);
-const TAG_FOOD_QUANTITY: RadrootsTagContract = tag(
+const TAG_FOOD_QUANTITY: TagContract = tag(
TAG_RADROOTS_QUANTITY,
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::Price,
- RadrootsTagValueType::Text,
+ TagCardinality::OptionalOne,
+ TagSemantic::Price,
+ TagValueType::Text,
false,
);
-const TAG_FOOD_STATUS: RadrootsTagContract = tag(
+const TAG_FOOD_STATUS: TagContract = tag(
"status",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Status,
- RadrootsTagValueType::Text,
+ TagCardinality::RequiredOne,
+ TagSemantic::Status,
+ TagValueType::Text,
false,
);
-const TAG_OPERATIONAL_LISTING_FARM: RadrootsTagContract = tag(
+const TAG_OPERATIONAL_LISTING_FARM: TagContract = tag(
"a",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::AddressableCoordinate,
- RadrootsTagValueType::AddressableCoordinate,
+ TagCardinality::RequiredOne,
+ TagSemantic::AddressableCoordinate,
+ TagValueType::AddressableCoordinate,
true,
);
-const TAG_OPERATIONAL_LISTING_PRODUCT_KEY: RadrootsTagContract = tag(
+const TAG_OPERATIONAL_LISTING_PRODUCT_KEY: TagContract = tag(
"key",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Category,
- RadrootsTagValueType::Text,
+ TagCardinality::RequiredOne,
+ TagSemantic::Category,
+ TagValueType::Text,
false,
);
-const TAG_OPERATIONAL_LISTING_TITLE: RadrootsTagContract = tag(
+const TAG_OPERATIONAL_LISTING_TITLE: TagContract = tag(
"title",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Title,
- RadrootsTagValueType::Text,
+ TagCardinality::RequiredOne,
+ TagSemantic::Title,
+ TagValueType::Text,
false,
);
-const TAG_OPERATIONAL_LISTING_CATEGORY: RadrootsTagContract = tag(
+const TAG_OPERATIONAL_LISTING_CATEGORY: TagContract = tag(
"category",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Category,
- RadrootsTagValueType::Text,
+ TagCardinality::RequiredOne,
+ TagSemantic::Category,
+ TagValueType::Text,
false,
);
-const TAG_OPERATIONAL_LISTING_PRIMARY_BIN: RadrootsTagContract = tag(
+const TAG_OPERATIONAL_LISTING_PRIMARY_BIN: TagContract = tag(
"radroots:primary_bin",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::OperationalListingSnapshot,
- RadrootsTagValueType::Text,
+ TagCardinality::RequiredOne,
+ TagSemantic::OperationalListingSnapshot,
+ TagValueType::Text,
false,
);
-const TAG_OPERATIONAL_LISTING_BIN: RadrootsTagContract = tag(
+const TAG_OPERATIONAL_LISTING_BIN: TagContract = tag(
"radroots:bin",
- RadrootsTagCardinality::RequiredMany,
- RadrootsTagSemantic::OperationalListingSnapshot,
- RadrootsTagValueType::Text,
+ TagCardinality::RequiredMany,
+ TagSemantic::OperationalListingSnapshot,
+ TagValueType::Text,
false,
);
-const TAG_OPERATIONAL_LISTING_PRICE: RadrootsTagContract = tag(
+const TAG_OPERATIONAL_LISTING_PRICE: TagContract = tag(
"radroots:price",
- RadrootsTagCardinality::RequiredMany,
- RadrootsTagSemantic::Price,
- RadrootsTagValueType::Text,
+ TagCardinality::RequiredMany,
+ TagSemantic::Price,
+ TagValueType::Text,
false,
);
-const TAG_OPERATIONAL_LISTING_DISCOUNT: RadrootsTagContract = tag(
+const TAG_OPERATIONAL_LISTING_DISCOUNT: TagContract = tag(
"radroots:discount",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::Price,
- RadrootsTagValueType::Text,
+ TagCardinality::OptionalMany,
+ TagSemantic::Price,
+ TagValueType::Text,
false,
);
-const TAG_OPERATIONAL_LISTING_RESOURCE_AREA: RadrootsTagContract = tag(
+const TAG_OPERATIONAL_LISTING_RESOURCE_AREA: TagContract = tag(
"radroots:resource_area",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::AddressableCoordinate,
- RadrootsTagValueType::AddressableCoordinate,
+ TagCardinality::OptionalOne,
+ TagSemantic::AddressableCoordinate,
+ TagValueType::AddressableCoordinate,
false,
);
-const TAG_OPERATIONAL_LISTING_PLOT: RadrootsTagContract = tag(
+const TAG_OPERATIONAL_LISTING_PLOT: TagContract = tag(
"radroots:plot",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::AddressableCoordinate,
- RadrootsTagValueType::AddressableCoordinate,
+ TagCardinality::OptionalOne,
+ TagSemantic::AddressableCoordinate,
+ TagValueType::AddressableCoordinate,
false,
);
-const TAG_OPERATIONAL_LISTING_INVENTORY: RadrootsTagContract = tag(
+const TAG_OPERATIONAL_LISTING_INVENTORY: TagContract = tag(
"inventory",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::OperationalListingSnapshot,
- RadrootsTagValueType::Text,
+ TagCardinality::OptionalOne,
+ TagSemantic::OperationalListingSnapshot,
+ TagValueType::Text,
false,
);
-const TAG_OPERATIONAL_LISTING_AVAILABILITY_START: RadrootsTagContract = tag(
+const TAG_OPERATIONAL_LISTING_AVAILABILITY_START: TagContract = tag(
"radroots:availability_start",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::Status,
- RadrootsTagValueType::UnixTimestamp,
+ TagCardinality::OptionalOne,
+ TagSemantic::Status,
+ TagValueType::UnixTimestamp,
false,
);
-const TAG_OPERATIONAL_LISTING_EXPIRES_AT: RadrootsTagContract = tag(
+const TAG_OPERATIONAL_LISTING_EXPIRES_AT: TagContract = tag(
"expires_at",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::Status,
- RadrootsTagValueType::UnixTimestamp,
+ TagCardinality::OptionalOne,
+ TagSemantic::Status,
+ TagValueType::UnixTimestamp,
false,
);
-const TAG_OPERATIONAL_LISTING_DELIVERY: RadrootsTagContract = tag(
+const TAG_OPERATIONAL_LISTING_DELIVERY: TagContract = tag(
"delivery",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::Reference,
- RadrootsTagValueType::Text,
+ TagCardinality::OptionalOne,
+ TagSemantic::Reference,
+ TagValueType::Text,
false,
);
-const TAG_OPERATIONAL_LISTING_PROCESS: RadrootsTagContract = tag(
+const TAG_OPERATIONAL_LISTING_PROCESS: TagContract = tag(
"process",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::Category,
- RadrootsTagValueType::Text,
+ TagCardinality::OptionalOne,
+ TagSemantic::Category,
+ TagValueType::Text,
false,
);
-const TAG_OPERATIONAL_LISTING_LOT: RadrootsTagContract = tag(
+const TAG_OPERATIONAL_LISTING_LOT: TagContract = tag(
"lot",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::Reference,
- RadrootsTagValueType::Text,
+ TagCardinality::OptionalOne,
+ TagSemantic::Reference,
+ TagValueType::Text,
false,
);
-const TAG_OPERATIONAL_LISTING_PROFILE: RadrootsTagContract = tag(
+const TAG_OPERATIONAL_LISTING_PROFILE: TagContract = tag(
"profile",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::Category,
- RadrootsTagValueType::Text,
+ TagCardinality::OptionalOne,
+ TagSemantic::Category,
+ TagValueType::Text,
false,
);
-const TAG_OPERATIONAL_LISTING_YEAR: RadrootsTagContract = tag(
+const TAG_OPERATIONAL_LISTING_YEAR: TagContract = tag(
"year",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::Category,
- RadrootsTagValueType::Text,
+ TagCardinality::OptionalOne,
+ TagSemantic::Category,
+ TagValueType::Text,
false,
);
-const TAG_CALENDAR_IMAGE: RadrootsTagContract = tag(
+const TAG_CALENDAR_IMAGE: TagContract = tag(
"image",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::Image,
- RadrootsTagValueType::Url,
+ TagCardinality::OptionalOne,
+ TagSemantic::Image,
+ TagValueType::Url,
false,
);
-const TAG_SERVICE_OUTPUT: RadrootsTagContract = tag(
+const TAG_SERVICE_OUTPUT: TagContract = tag(
"output",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::ServiceOutput,
- RadrootsTagValueType::Text,
+ TagCardinality::RequiredOne,
+ TagSemantic::ServiceOutput,
+ TagValueType::Text,
false,
);
-const TAG_URL: RadrootsTagContract = tag(
+const TAG_URL: TagContract = tag(
"url",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::Url,
- RadrootsTagValueType::Url,
+ TagCardinality::OptionalOne,
+ TagSemantic::Url,
+ TagValueType::Url,
false,
);
-const TAG_CONTRACT_REQUIRED: RadrootsTagContract = tag(
+const TAG_CONTRACT_REQUIRED: TagContract = tag(
"contract",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Contract,
- RadrootsTagValueType::ContractId,
+ TagCardinality::RequiredOne,
+ TagSemantic::Contract,
+ TagValueType::ContractId,
false,
);
-const TAG_TOPIC_MANY: RadrootsTagContract = tag(
+const TAG_TOPIC_MANY: TagContract = tag(
"t",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::Topic,
- RadrootsTagValueType::Text,
+ TagCardinality::OptionalMany,
+ TagSemantic::Topic,
+ TagValueType::Text,
true,
);
-const TAG_ASK_MARKER: RadrootsTagContract = tag(
+const TAG_ASK_MARKER: TagContract = tag(
"t",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Topic,
- RadrootsTagValueType::Text,
+ TagCardinality::RequiredOne,
+ TagSemantic::Topic,
+ TagValueType::Text,
true,
);
-const TAG_IMETA_REQUIRED_MANY: RadrootsTagContract = tag(
+const TAG_IMETA_REQUIRED_MANY: TagContract = tag(
"imeta",
- RadrootsTagCardinality::RequiredMany,
- RadrootsTagSemantic::Image,
- RadrootsTagValueType::Text,
+ TagCardinality::RequiredMany,
+ TagSemantic::Image,
+ TagValueType::Text,
false,
);
-const TAG_IMETA_OPTIONAL_MANY: RadrootsTagContract = tag(
+const TAG_IMETA_OPTIONAL_MANY: TagContract = tag(
"imeta",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::Image,
- RadrootsTagValueType::Text,
+ TagCardinality::OptionalMany,
+ TagSemantic::Image,
+ TagValueType::Text,
false,
);
-const TAG_CALENDAR_REFERENCE: RadrootsTagContract = tag(
+const TAG_CALENDAR_REFERENCE: TagContract = tag(
"r",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::Reference,
- RadrootsTagValueType::Uri,
+ TagCardinality::OptionalMany,
+ TagSemantic::Reference,
+ TagValueType::Uri,
true,
);
-const TAG_GEOHASH_OPTIONAL: RadrootsTagContract = tag(
+const TAG_GEOHASH_OPTIONAL: TagContract = tag(
"g",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::Geohash,
- RadrootsTagValueType::Geohash,
+ TagCardinality::OptionalOne,
+ TagSemantic::Geohash,
+ TagValueType::Geohash,
true,
);
-const TAG_SOURCE_MANY: RadrootsTagContract = tag(
+const TAG_SOURCE_MANY: TagContract = tag(
"source",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::Source,
- RadrootsTagValueType::EventPointer,
+ TagCardinality::OptionalMany,
+ TagSemantic::Source,
+ TagValueType::EventPointer,
false,
);
-const TAG_CITATION_MANY: RadrootsTagContract = tag(
+const TAG_CITATION_MANY: TagContract = tag(
"citation",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::Citation,
- RadrootsTagValueType::Sha256,
+ TagCardinality::OptionalMany,
+ TagSemantic::Citation,
+ TagValueType::Sha256,
false,
);
-const TAG_REVIEW_TARGET_REQUIRED: RadrootsTagContract = tag(
+const TAG_REVIEW_TARGET_REQUIRED: TagContract = tag(
"review_target",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::ReviewTarget,
- RadrootsTagValueType::EventPointer,
+ TagCardinality::RequiredOne,
+ TagSemantic::ReviewTarget,
+ TagValueType::EventPointer,
false,
);
-const TAG_EVIDENCE_MANY: RadrootsTagContract = tag(
+const TAG_EVIDENCE_MANY: TagContract = tag(
"evidence",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::Evidence,
- RadrootsTagValueType::EventPointer,
+ TagCardinality::OptionalMany,
+ TagSemantic::Evidence,
+ TagValueType::EventPointer,
false,
);
-const NO_TAGS: &[RadrootsTagContract] = &[];
-const D_TAGS: &[RadrootsTagContract] = &[TAG_D];
-const P_TAGS: &[RadrootsTagContract] = &[TAG_P_MANY];
-const EVENT_POINTER_TAGS: &[RadrootsTagContract] = &[TAG_E_MANY, TAG_P_MANY, TAG_KIND];
-const NIP09_DELETION_TAGS: &[RadrootsTagContract] =
+const NO_TAGS: &[TagContract] = &[];
+const D_TAGS: &[TagContract] = &[TAG_D];
+const P_TAGS: &[TagContract] = &[TAG_P_MANY];
+const EVENT_POINTER_TAGS: &[TagContract] = &[TAG_E_MANY, TAG_P_MANY, TAG_KIND];
+const NIP09_DELETION_TAGS: &[TagContract] =
&[TAG_NIP09_E_TARGET, TAG_NIP09_A_TARGET, TAG_NIP09_K_ADVISORY];
-const NIP22_COMMENT_TAGS: &[RadrootsTagContract] = &[
+const NIP22_COMMENT_TAGS: &[TagContract] = &[
TAG_NIP22_E_ROOT,
TAG_NIP22_A_ROOT,
TAG_NIP22_K_ROOT,
@@ -1199,14 +1198,14 @@ const NIP22_COMMENT_TAGS: &[RadrootsTagContract] = &[
TAG_NIP22_K_PARENT,
TAG_NIP22_P_PARENT,
];
-const LIST_TAGS: &[RadrootsTagContract] = &[TAG_E_MANY, TAG_A_OPTIONAL, TAG_P_MANY, TAG_RELAY];
-const LIST_SET_TAGS: &[RadrootsTagContract] = &[TAG_D, TAG_E_MANY, TAG_A_OPTIONAL, TAG_P_MANY];
-const PROFILE_TAGS: &[RadrootsTagContract] = &[TAG_P_MANY];
-const GROUP_ACTION_TAGS: &[RadrootsTagContract] = &[TAG_GROUP, TAG_P_MANY, TAG_E_MANY];
-const GROUP_STATE_TAGS: &[RadrootsTagContract] = &[TAG_D, TAG_P_MANY, TAG_E_MANY];
-const FILE_METADATA_TAGS: &[RadrootsTagContract] = &[TAG_URL, TAG_IMAGE];
-const ARTICLE_TAGS: &[RadrootsTagContract] = &[TAG_D, TAG_TITLE, TAG_SUMMARY, TAG_PUBLISHED_AT];
-const WIKI_ARTICLE_TAGS: &[RadrootsTagContract] = &[
+const LIST_TAGS: &[TagContract] = &[TAG_E_MANY, TAG_A_OPTIONAL, TAG_P_MANY, TAG_RELAY];
+const LIST_SET_TAGS: &[TagContract] = &[TAG_D, TAG_E_MANY, TAG_A_OPTIONAL, TAG_P_MANY];
+const PROFILE_TAGS: &[TagContract] = &[TAG_P_MANY];
+const GROUP_ACTION_TAGS: &[TagContract] = &[TAG_GROUP, TAG_P_MANY, TAG_E_MANY];
+const GROUP_STATE_TAGS: &[TagContract] = &[TAG_D, TAG_P_MANY, TAG_E_MANY];
+const FILE_METADATA_TAGS: &[TagContract] = &[TAG_URL, TAG_IMAGE];
+const ARTICLE_TAGS: &[TagContract] = &[TAG_D, TAG_TITLE, TAG_SUMMARY, TAG_PUBLISHED_AT];
+const WIKI_ARTICLE_TAGS: &[TagContract] = &[
TAG_D,
TAG_TITLE,
TAG_SUMMARY,
@@ -1216,14 +1215,14 @@ const WIKI_ARTICLE_TAGS: &[RadrootsTagContract] = &[
TAG_A_MANY,
TAG_E_MANY,
];
-const WIKI_REDIRECT_TAGS: &[RadrootsTagContract] = &[TAG_D, TAG_A_ADDRESS_REQUIRED];
-const WIKI_MERGE_REQUEST_TAGS: &[RadrootsTagContract] = &[
+const WIKI_REDIRECT_TAGS: &[TagContract] = &[TAG_D, TAG_A_ADDRESS_REQUIRED];
+const WIKI_MERGE_REQUEST_TAGS: &[TagContract] = &[
TAG_A_ADDRESS_REQUIRED,
TAG_P_REQUIRED,
TAG_E_SOURCE_VERSION,
TAG_E_BASE_VERSION,
];
-const CALENDAR_DATE_EVENT_TAGS: &[RadrootsTagContract] = &[
+const CALENDAR_DATE_EVENT_TAGS: &[TagContract] = &[
TAG_D,
TAG_CALENDAR_TITLE,
TAG_CALENDAR_LEGACY_NAME,
@@ -1238,7 +1237,7 @@ const CALENDAR_DATE_EVENT_TAGS: &[RadrootsTagContract] = &[
TAG_CALENDAR_REFERENCE,
TAG_CALENDAR_INCLUSION_REQUEST,
];
-const CALENDAR_TIME_EVENT_TAGS: &[RadrootsTagContract] = &[
+const CALENDAR_TIME_EVENT_TAGS: &[TagContract] = &[
TAG_D,
TAG_CALENDAR_TITLE,
TAG_CALENDAR_LEGACY_NAME,
@@ -1256,14 +1255,14 @@ const CALENDAR_TIME_EVENT_TAGS: &[RadrootsTagContract] = &[
TAG_CALENDAR_REFERENCE,
TAG_CALENDAR_INCLUSION_REQUEST,
];
-const CALENDAR_COLLECTION_TAGS: &[RadrootsTagContract] = &[
+const CALENDAR_COLLECTION_TAGS: &[TagContract] = &[
TAG_CALENDAR_UID,
TAG_CALENDAR_TITLE,
TAG_CALENDAR_COLLECTION_DESCRIPTION,
TAG_CALENDAR_IMAGE,
TAG_CALENDAR_COLLECTION_EVENT,
];
-const CALENDAR_RSVP_TAGS: &[RadrootsTagContract] = &[
+const CALENDAR_RSVP_TAGS: &[TagContract] = &[
TAG_CALENDAR_UID,
TAG_CALENDAR_RSVP_EVENT,
TAG_CALENDAR_RSVP_REVISION,
@@ -1271,8 +1270,8 @@ const CALENDAR_RSVP_TAGS: &[RadrootsTagContract] = &[
TAG_CALENDAR_RSVP_FREE_BUSY,
TAG_CALENDAR_RSVP_AUTHOR,
];
-const FARM_TAGS: &[RadrootsTagContract] = &[TAG_D, TAG_TITLE, TAG_LOCATION, TAG_IMAGE];
-const FOOD_AVAILABILITY_TAGS: &[RadrootsTagContract] = &[
+const FARM_TAGS: &[TagContract] = &[TAG_D, TAG_TITLE, TAG_LOCATION, TAG_IMAGE];
+const FOOD_AVAILABILITY_TAGS: &[TagContract] = &[
TAG_D,
TAG_FOOD_TITLE,
TAG_FOOD_SUMMARY,
@@ -1284,7 +1283,7 @@ const FOOD_AVAILABILITY_TAGS: &[RadrootsTagContract] = &[
TAG_FOOD_STATUS,
TAG_IMAGE,
];
-const OPERATIONAL_LISTING_TAGS: &[RadrootsTagContract] = &[
+const OPERATIONAL_LISTING_TAGS: &[TagContract] = &[
TAG_D,
TAG_P_REQUIRED,
TAG_OPERATIONAL_LISTING_FARM,
@@ -1313,92 +1312,90 @@ const OPERATIONAL_LISTING_TAGS: &[RadrootsTagContract] = &[
TAG_OPERATIONAL_LISTING_EXPIRES_AT,
TAG_OPERATIONAL_LISTING_DELIVERY,
];
-const TRADE_MUTATION_TAGS: &[RadrootsTagContract] =
+const TRADE_MUTATION_TAGS: &[TagContract] =
&[TAG_CONTRACT_REQUIRED, TAG_D, TAG_P_REQUIRED, TAG_E_MANY];
-const TRADE_VALIDATION_RECEIPT_TAGS: &[RadrootsTagContract] =
+const TRADE_VALIDATION_RECEIPT_TAGS: &[TagContract] =
&[TAG_E_ROOT, TAG_A_OPTIONAL, TAG_SERVICE_OUTPUT];
-const KNOWLEDGE_SOURCE_TAGS: &[RadrootsTagContract] = &[
+const KNOWLEDGE_SOURCE_TAGS: &[TagContract] = &[
TAG_D,
TAG_CONTRACT_REQUIRED,
TAG_TOPIC_MANY,
TAG_SOURCE_MANY,
];
-const KNOWLEDGE_CLAIM_TAGS: &[RadrootsTagContract] = &[
+const KNOWLEDGE_CLAIM_TAGS: &[TagContract] = &[
TAG_CONTRACT_REQUIRED,
TAG_TOPIC_MANY,
TAG_SOURCE_MANY,
TAG_CITATION_MANY,
];
-const KNOWLEDGE_RELATION_TAGS: &[RadrootsTagContract] =
+const KNOWLEDGE_RELATION_TAGS: &[TagContract] =
&[TAG_CONTRACT_REQUIRED, TAG_TOPIC_MANY, TAG_SOURCE_MANY];
-const KNOWLEDGE_REVIEW_TAGS: &[RadrootsTagContract] = &[
+const KNOWLEDGE_REVIEW_TAGS: &[TagContract] = &[
TAG_CONTRACT_REQUIRED,
TAG_REVIEW_TARGET_REQUIRED,
TAG_EVIDENCE_MANY,
];
-const KNOWLEDGE_FIELD_REPORT_TAGS: &[RadrootsTagContract] = &[
+const KNOWLEDGE_FIELD_REPORT_TAGS: &[TagContract] = &[
TAG_CONTRACT_REQUIRED,
TAG_TOPIC_MANY,
TAG_GEOHASH_OPTIONAL,
TAG_EVIDENCE_MANY,
];
-const KNOWLEDGE_CHANGE_PROPOSAL_TAGS: &[RadrootsTagContract] =
- &[TAG_CONTRACT_REQUIRED, TAG_EVIDENCE_MANY];
-const KNOWLEDGE_CONTRIBUTION_TAGS: &[RadrootsTagContract] =
- &[TAG_CONTRACT_REQUIRED, TAG_EVIDENCE_MANY];
-const EVIDENCE_BOUNTY_TAGS: &[RadrootsTagContract] = &[
+const KNOWLEDGE_CHANGE_PROPOSAL_TAGS: &[TagContract] = &[TAG_CONTRACT_REQUIRED, TAG_EVIDENCE_MANY];
+const KNOWLEDGE_CONTRIBUTION_TAGS: &[TagContract] = &[TAG_CONTRACT_REQUIRED, TAG_EVIDENCE_MANY];
+const EVIDENCE_BOUNTY_TAGS: &[TagContract] = &[
TAG_D,
TAG_CONTRACT_REQUIRED,
TAG_TOPIC_MANY,
TAG_EVIDENCE_MANY,
];
-const SOCIAL_REDUCERS: &[RadrootsReducer] = &[RadrootsReducer::SocialProjection];
-const PHOTO_UPDATE_TAGS: &[RadrootsTagContract] = &[TAG_IMETA_REQUIRED_MANY];
-const ASK_TAGS: &[RadrootsTagContract] = &[TAG_ASK_MARKER, TAG_IMETA_OPTIONAL_MANY];
-const NIP10_REPLY_TAGS: &[RadrootsTagContract] = &[TAG_NIP10_E_REQUIRED, TAG_NIP10_P_OPTIONAL];
-const PROFILE_REDUCERS: &[RadrootsReducer] = &[RadrootsReducer::ProfileProjection];
-const FARM_OPS_REDUCERS: &[RadrootsReducer] = &[RadrootsReducer::FarmOpsProjection];
-const GROUP_REDUCERS: &[RadrootsReducer] = &[RadrootsReducer::GroupProjection];
-const CALENDAR_REDUCERS: &[RadrootsReducer] = &[RadrootsReducer::CalendarProjection];
-const OPERATIONAL_LISTING_REDUCERS: &[RadrootsReducer] = &[
- RadrootsReducer::OperationalListingProjection,
- RadrootsReducer::MarketProjection,
- RadrootsReducer::OperationalListingInventoryAccounting,
+const SOCIAL_REDUCERS: &[Reducer] = &[Reducer::SocialProjection];
+const PHOTO_UPDATE_TAGS: &[TagContract] = &[TAG_IMETA_REQUIRED_MANY];
+const ASK_TAGS: &[TagContract] = &[TAG_ASK_MARKER, TAG_IMETA_OPTIONAL_MANY];
+const NIP10_REPLY_TAGS: &[TagContract] = &[TAG_NIP10_E_REQUIRED, TAG_NIP10_P_OPTIONAL];
+const PROFILE_REDUCERS: &[Reducer] = &[Reducer::ProfileProjection];
+const FARM_OPS_REDUCERS: &[Reducer] = &[Reducer::FarmOpsProjection];
+const GROUP_REDUCERS: &[Reducer] = &[Reducer::GroupProjection];
+const CALENDAR_REDUCERS: &[Reducer] = &[Reducer::CalendarProjection];
+const OPERATIONAL_LISTING_REDUCERS: &[Reducer] = &[
+ Reducer::OperationalListingProjection,
+ Reducer::MarketProjection,
+ Reducer::OperationalListingInventoryAccounting,
];
-const FOOD_AVAILABILITY_REDUCERS: &[RadrootsReducer] = &[RadrootsReducer::MarketProjection];
-const TRADE_MUTATION_REDUCERS: &[RadrootsReducer] = &[
- RadrootsReducer::TradeProjection,
- RadrootsReducer::OperationalListingInventoryAccounting,
+const FOOD_AVAILABILITY_REDUCERS: &[Reducer] = &[Reducer::MarketProjection];
+const TRADE_MUTATION_REDUCERS: &[Reducer] = &[
+ Reducer::TradeProjection,
+ Reducer::OperationalListingInventoryAccounting,
];
-const TRADE_VALIDATION_REDUCERS: &[RadrootsReducer] = &[RadrootsReducer::TradeValidation];
-const RELAY_REDUCERS: &[RadrootsReducer] = &[RadrootsReducer::NostrRelayPolicyProjection];
-const KNOWLEDGE_REDUCERS: &[RadrootsReducer] = &[RadrootsReducer::KnowledgeProjection];
+const TRADE_VALIDATION_REDUCERS: &[Reducer] = &[Reducer::TradeValidation];
+const RELAY_REDUCERS: &[Reducer] = &[Reducer::NostrRelayPolicyProjection];
+const KNOWLEDGE_REDUCERS: &[Reducer] = &[Reducer::KnowledgeProjection];
-const FARM_MEMBERS_LIST_DISCRIMINATOR: &[RadrootsEventDiscriminator] = &[
- RadrootsEventDiscriminator::DTagPrefix("farm:"),
- RadrootsEventDiscriminator::DTagSuffix(":members"),
+const FARM_MEMBERS_LIST_DISCRIMINATOR: &[EventDiscriminator] = &[
+ EventDiscriminator::DTagPrefix("farm:"),
+ EventDiscriminator::DTagSuffix(":members"),
];
-const FARM_OWNERS_LIST_DISCRIMINATOR: &[RadrootsEventDiscriminator] = &[
- RadrootsEventDiscriminator::DTagPrefix("farm:"),
- RadrootsEventDiscriminator::DTagSuffix(":members.owners"),
+const FARM_OWNERS_LIST_DISCRIMINATOR: &[EventDiscriminator] = &[
+ EventDiscriminator::DTagPrefix("farm:"),
+ EventDiscriminator::DTagSuffix(":members.owners"),
];
-const FARM_WORKERS_LIST_DISCRIMINATOR: &[RadrootsEventDiscriminator] = &[
- RadrootsEventDiscriminator::DTagPrefix("farm:"),
- RadrootsEventDiscriminator::DTagSuffix(":members.workers"),
+const FARM_WORKERS_LIST_DISCRIMINATOR: &[EventDiscriminator] = &[
+ EventDiscriminator::DTagPrefix("farm:"),
+ EventDiscriminator::DTagSuffix(":members.workers"),
];
-const FARM_PLOTS_LIST_DISCRIMINATOR: &[RadrootsEventDiscriminator] = &[
- RadrootsEventDiscriminator::DTagPrefix("farm:"),
- RadrootsEventDiscriminator::DTagSuffix(":plots"),
+const FARM_PLOTS_LIST_DISCRIMINATOR: &[EventDiscriminator] = &[
+ EventDiscriminator::DTagPrefix("farm:"),
+ EventDiscriminator::DTagSuffix(":plots"),
];
-const FARM_LISTINGS_LIST_DISCRIMINATOR: &[RadrootsEventDiscriminator] = &[
- RadrootsEventDiscriminator::DTagPrefix("farm:"),
- RadrootsEventDiscriminator::DTagSuffix(":listings"),
+const FARM_LISTINGS_LIST_DISCRIMINATOR: &[EventDiscriminator] = &[
+ EventDiscriminator::DTagPrefix("farm:"),
+ EventDiscriminator::DTagSuffix(":listings"),
];
macro_rules! kind_contract {
($kind:expr, $constant:literal, $name:literal, $class:expr, $standard:expr, [$($contract:literal),+ $(,)?]) => {
- RadrootsKindContract {
+ KindContract {
kind: $kind,
canonical_constant: $constant,
name: $name,
@@ -1424,7 +1421,7 @@ macro_rules! event_contract_with_stability {
$reducers:expr,
$stability:expr $(,)?
) => {
- RadrootsEventContract {
+ EventContract {
id: $id,
kind: $kind,
name: $name,
@@ -1434,7 +1431,7 @@ macro_rules! event_contract_with_stability {
privacy: $standard_privacy,
required_author_role: $required_author_role,
content_schema: $content_schema,
- authoring_policy: RadrootsEventAuthoringPolicy::GenericDraft,
+ authoring_policy: EventAuthoringPolicy::GenericDraft,
discriminator: $discriminator,
tags: $tags,
reducers: $reducers,
@@ -1457,7 +1454,7 @@ macro_rules! event_contract_with_authoring_policy {
$tags:expr,
$reducers:expr $(,)?
) => {
- RadrootsEventContract {
+ EventContract {
authoring_policy: $authoring_policy,
..event_contract!(
$id,
@@ -1502,7 +1499,7 @@ macro_rules! event_contract {
$discriminator,
$tags,
$reducers,
- RadrootsEventStability::Stable
+ EventStability::Stable
)
};
}
@@ -1533,26 +1530,26 @@ macro_rules! experimental_event_contract {
$discriminator,
$tags,
$reducers,
- RadrootsEventStability::Experimental
+ EventStability::Experimental
)
};
}
-static KIND_CONTRACTS_REGISTRY_V7: &[RadrootsKindContract] = &[
+static KIND_CONTRACTS_REGISTRY_V7: &[KindContract] = &[
kind_contract!(
KIND_PROFILE,
"KIND_PROFILE",
"Profile Metadata",
- RadrootsEventClass::Replaceable,
- RadrootsNostrStandard::Nip01,
+ EventClass::Replaceable,
+ NostrStandard::Nip01,
["radroots.profile.metadata.v1"]
),
kind_contract!(
KIND_POST,
"KIND_POST",
"Short Text Note",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Nip01,
+ EventClass::Regular,
+ NostrStandard::Nip01,
[
"radroots.social.post.v1",
"radroots.social.update.v1",
@@ -1565,344 +1562,344 @@ static KIND_CONTRACTS_REGISTRY_V7: &[RadrootsKindContract] = &[
KIND_FOLLOW,
"KIND_FOLLOW",
"Contact List",
- RadrootsEventClass::Replaceable,
- RadrootsNostrStandard::Nip01,
+ EventClass::Replaceable,
+ NostrStandard::Nip01,
["radroots.social.follow_list.v1"]
),
kind_contract!(
KIND_DELETION_REQUEST,
"KIND_DELETION_REQUEST",
"Deletion Request",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Nip09,
+ EventClass::Regular,
+ NostrStandard::Nip09,
["radroots.social.deletion_request.v1"]
),
kind_contract!(
KIND_REPOST,
"KIND_REPOST",
"Repost",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Nip18,
+ EventClass::Regular,
+ NostrStandard::Nip18,
["radroots.social.repost.v1"]
),
kind_contract!(
KIND_REACTION,
"KIND_REACTION",
"Reaction",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Nip25,
+ EventClass::Regular,
+ NostrStandard::Nip25,
["radroots.social.reaction.v1"]
),
kind_contract!(
KIND_SEAL,
"KIND_SEAL",
"Seal",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Nip17,
+ EventClass::Regular,
+ NostrStandard::Nip17,
["radroots.message.seal.v1"]
),
kind_contract!(
KIND_MESSAGE,
"KIND_MESSAGE",
"Direct Message",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Nip17,
+ EventClass::Regular,
+ NostrStandard::Nip17,
["radroots.message.private.v1"]
),
kind_contract!(
KIND_MESSAGE_FILE,
"KIND_MESSAGE_FILE",
"Direct Message File",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Nip17,
+ EventClass::Regular,
+ NostrStandard::Nip17,
["radroots.message.file.v1"]
),
kind_contract!(
KIND_GENERIC_REPOST,
"KIND_GENERIC_REPOST",
"Generic Repost",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Nip18,
+ EventClass::Regular,
+ NostrStandard::Nip18,
["radroots.social.generic_repost.v1"]
),
kind_contract!(
KIND_FARM_CRDT_CHANGE,
"KIND_FARM_CRDT_CHANGE",
"Farm CRDT Change",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Radroots,
+ EventClass::Regular,
+ NostrStandard::Radroots,
["radroots.farm.crdt_change.v1"]
),
kind_contract!(
KIND_GIFT_WRAP,
"KIND_GIFT_WRAP",
"Gift Wrap",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Nip17,
+ EventClass::Regular,
+ NostrStandard::Nip17,
["radroots.message.gift_wrap.v1"]
),
kind_contract!(
KIND_FILE_METADATA,
"KIND_FILE_METADATA",
"File Metadata",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Nip94,
+ EventClass::Regular,
+ NostrStandard::Nip94,
["radroots.file.metadata.v1"]
),
kind_contract!(
KIND_COMMENT,
"KIND_COMMENT",
"Comment",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Nip22,
+ EventClass::Regular,
+ NostrStandard::Nip22,
["radroots.social.comment.v1"]
),
kind_contract!(
KIND_REPORT,
"KIND_REPORT",
"Report",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Nip56,
+ EventClass::Regular,
+ NostrStandard::Nip56,
["radroots.social.report.v1"]
),
kind_contract!(
KIND_GROUP_PUT_USER,
"KIND_GROUP_PUT_USER",
"Group Put User",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Nip29,
+ EventClass::Regular,
+ NostrStandard::Nip29,
["radroots.group.put_user.v1"]
),
kind_contract!(
KIND_GROUP_REMOVE_USER,
"KIND_GROUP_REMOVE_USER",
"Group Remove User",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Nip29,
+ EventClass::Regular,
+ NostrStandard::Nip29,
["radroots.group.remove_user.v1"]
),
kind_contract!(
KIND_GROUP_EDIT_METADATA,
"KIND_GROUP_EDIT_METADATA",
"Group Edit Metadata",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Nip29,
+ EventClass::Regular,
+ NostrStandard::Nip29,
["radroots.group.edit_metadata.v1"]
),
kind_contract!(
KIND_GROUP_DELETE_EVENT,
"KIND_GROUP_DELETE_EVENT",
"Group Delete Event",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Nip29,
+ EventClass::Regular,
+ NostrStandard::Nip29,
["radroots.group.delete_event.v1"]
),
kind_contract!(
KIND_GROUP_CREATE_GROUP,
"KIND_GROUP_CREATE_GROUP",
"Group Create Group",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Nip29,
+ EventClass::Regular,
+ NostrStandard::Nip29,
["radroots.group.create_group.v1"]
),
kind_contract!(
KIND_GROUP_DELETE_GROUP,
"KIND_GROUP_DELETE_GROUP",
"Group Delete Group",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Nip29,
+ EventClass::Regular,
+ NostrStandard::Nip29,
["radroots.group.delete_group.v1"]
),
kind_contract!(
KIND_GROUP_CREATE_INVITE,
"KIND_GROUP_CREATE_INVITE",
"Group Create Invite",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Nip29,
+ EventClass::Regular,
+ NostrStandard::Nip29,
["radroots.group.create_invite.v1"]
),
kind_contract!(
KIND_GROUP_JOIN_REQUEST,
"KIND_GROUP_JOIN_REQUEST",
"Group Join Request",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Nip29,
+ EventClass::Regular,
+ NostrStandard::Nip29,
["radroots.group.join_request.v1"]
),
kind_contract!(
KIND_GROUP_LEAVE_REQUEST,
"KIND_GROUP_LEAVE_REQUEST",
"Group Leave Request",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Nip29,
+ EventClass::Regular,
+ NostrStandard::Nip29,
["radroots.group.leave_request.v1"]
),
kind_contract!(
KIND_GEOCHAT,
"KIND_GEOCHAT",
"Geochat",
- RadrootsEventClass::Ephemeral,
- RadrootsNostrStandard::Nip28,
+ EventClass::Ephemeral,
+ NostrStandard::Nip28,
["radroots.social.geochat.v1"]
),
kind_contract!(
KIND_RELAY_AUTH,
"KIND_RELAY_AUTH",
"Relay Auth",
- RadrootsEventClass::Ephemeral,
- RadrootsNostrStandard::Nip42,
+ EventClass::Ephemeral,
+ NostrStandard::Nip42,
["radroots.relay.auth.v1"]
),
kind_contract!(
KIND_HTTP_AUTH,
"KIND_HTTP_AUTH",
"HTTP Auth",
- RadrootsEventClass::Ephemeral,
- RadrootsNostrStandard::Nip98,
+ EventClass::Ephemeral,
+ NostrStandard::Nip98,
["radroots.http.auth.v1"]
),
kind_contract!(
KIND_LIST_MUTE,
"KIND_LIST_MUTE",
"Mute List",
- RadrootsEventClass::Replaceable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Replaceable,
+ NostrStandard::Nip51,
["radroots.list.mute.v1"]
),
kind_contract!(
KIND_LIST_PINNED_NOTES,
"KIND_LIST_PINNED_NOTES",
"Pinned Notes List",
- RadrootsEventClass::Replaceable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Replaceable,
+ NostrStandard::Nip51,
["radroots.list.pinned_notes.v1"]
),
kind_contract!(
KIND_LIST_READ_WRITE_RELAYS,
"KIND_LIST_READ_WRITE_RELAYS",
"Read Write Relays List",
- RadrootsEventClass::Replaceable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Replaceable,
+ NostrStandard::Nip51,
["radroots.list.read_write_relays.v1"]
),
kind_contract!(
KIND_LIST_BOOKMARKS,
"KIND_LIST_BOOKMARKS",
"Bookmarks List",
- RadrootsEventClass::Replaceable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Replaceable,
+ NostrStandard::Nip51,
["radroots.list.bookmarks.v1"]
),
kind_contract!(
KIND_LIST_COMMUNITIES,
"KIND_LIST_COMMUNITIES",
"Communities List",
- RadrootsEventClass::Replaceable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Replaceable,
+ NostrStandard::Nip51,
["radroots.list.communities.v1"]
),
kind_contract!(
KIND_LIST_PUBLIC_CHATS,
"KIND_LIST_PUBLIC_CHATS",
"Public Chats List",
- RadrootsEventClass::Replaceable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Replaceable,
+ NostrStandard::Nip51,
["radroots.list.public_chats.v1"]
),
kind_contract!(
KIND_LIST_BLOCKED_RELAYS,
"KIND_LIST_BLOCKED_RELAYS",
"Blocked Relays List",
- RadrootsEventClass::Replaceable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Replaceable,
+ NostrStandard::Nip51,
["radroots.list.blocked_relays.v1"]
),
kind_contract!(
KIND_LIST_SEARCH_RELAYS,
"KIND_LIST_SEARCH_RELAYS",
"Search Relays List",
- RadrootsEventClass::Replaceable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Replaceable,
+ NostrStandard::Nip51,
["radroots.list.search_relays.v1"]
),
kind_contract!(
KIND_LIST_SIMPLE_GROUPS,
"KIND_LIST_SIMPLE_GROUPS",
"Simple Groups List",
- RadrootsEventClass::Replaceable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Replaceable,
+ NostrStandard::Nip51,
["radroots.list.simple_groups.v1"]
),
kind_contract!(
KIND_LIST_RELAY_FEEDS,
"KIND_LIST_RELAY_FEEDS",
"Relay Feeds List",
- RadrootsEventClass::Replaceable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Replaceable,
+ NostrStandard::Nip51,
["radroots.list.relay_feeds.v1"]
),
kind_contract!(
KIND_LIST_INTERESTS,
"KIND_LIST_INTERESTS",
"Interests List",
- RadrootsEventClass::Replaceable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Replaceable,
+ NostrStandard::Nip51,
["radroots.list.interests.v1"]
),
kind_contract!(
KIND_LIST_MEDIA_FOLLOWS,
"KIND_LIST_MEDIA_FOLLOWS",
"Media Follows List",
- RadrootsEventClass::Replaceable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Replaceable,
+ NostrStandard::Nip51,
["radroots.list.media_follows.v1"]
),
kind_contract!(
KIND_LIST_EMOJIS,
"KIND_LIST_EMOJIS",
"Emojis List",
- RadrootsEventClass::Replaceable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Replaceable,
+ NostrStandard::Nip51,
["radroots.list.emojis.v1"]
),
kind_contract!(
KIND_LIST_DM_RELAYS,
"KIND_LIST_DM_RELAYS",
"DM Relays List",
- RadrootsEventClass::Replaceable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Replaceable,
+ NostrStandard::Nip51,
["radroots.list.dm_relays.v1"]
),
kind_contract!(
KIND_LIST_GOOD_WIKI_AUTHORS,
"KIND_LIST_GOOD_WIKI_AUTHORS",
"Good Wiki Authors List",
- RadrootsEventClass::Replaceable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Replaceable,
+ NostrStandard::Nip51,
["radroots.list.good_wiki_authors.v1"]
),
kind_contract!(
KIND_LIST_GOOD_WIKI_RELAYS,
"KIND_LIST_GOOD_WIKI_RELAYS",
"Good Wiki Relays List",
- RadrootsEventClass::Replaceable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Replaceable,
+ NostrStandard::Nip51,
["radroots.list.good_wiki_relays.v1"]
),
kind_contract!(
KIND_LIST_SET_FOLLOW,
"KIND_LIST_SET_FOLLOW",
"Follow Set",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Addressable,
+ NostrStandard::Nip51,
["radroots.list_set.follow.v1"]
),
kind_contract!(
KIND_LIST_SET_GENERIC,
"KIND_LIST_SET_GENERIC",
"Generic List Set",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Addressable,
+ NostrStandard::Nip51,
[
"radroots.list_set.farm.members.v1",
"radroots.list_set.farm.members.owners.v1",
@@ -1916,232 +1913,232 @@ static KIND_CONTRACTS_REGISTRY_V7: &[RadrootsKindContract] = &[
KIND_LIST_SET_RELAY,
"KIND_LIST_SET_RELAY",
"Relay Set",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Addressable,
+ NostrStandard::Nip51,
["radroots.list_set.relay.v1"]
),
kind_contract!(
KIND_LIST_SET_BOOKMARK,
"KIND_LIST_SET_BOOKMARK",
"Bookmark Set",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Addressable,
+ NostrStandard::Nip51,
["radroots.list_set.bookmark.v1"]
),
kind_contract!(
KIND_LIST_SET_CURATION,
"KIND_LIST_SET_CURATION",
"Curation Set",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Addressable,
+ NostrStandard::Nip51,
["radroots.list_set.curation.v1"]
),
kind_contract!(
KIND_LIST_SET_VIDEO,
"KIND_LIST_SET_VIDEO",
"Video Set",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Addressable,
+ NostrStandard::Nip51,
["radroots.list_set.video.v1"]
),
kind_contract!(
KIND_LIST_SET_PICTURE,
"KIND_LIST_SET_PICTURE",
"Picture Set",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Addressable,
+ NostrStandard::Nip51,
["radroots.list_set.picture.v1"]
),
kind_contract!(
KIND_LIST_SET_KIND_MUTE,
"KIND_LIST_SET_KIND_MUTE",
"Kind Mute Set",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Addressable,
+ NostrStandard::Nip51,
["radroots.list_set.kind_mute.v1"]
),
kind_contract!(
KIND_LIST_SET_INTEREST,
"KIND_LIST_SET_INTEREST",
"Interest Set",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Addressable,
+ NostrStandard::Nip51,
["radroots.list_set.interest.v1"]
),
kind_contract!(
KIND_LIST_SET_EMOJI,
"KIND_LIST_SET_EMOJI",
"Emoji Set",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Addressable,
+ NostrStandard::Nip51,
["radroots.list_set.emoji.v1"]
),
kind_contract!(
KIND_LIST_SET_RELEASE_ARTIFACT,
"KIND_LIST_SET_RELEASE_ARTIFACT",
"Release Artifact Set",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Addressable,
+ NostrStandard::Nip51,
["radroots.list_set.release_artifact.v1"]
),
kind_contract!(
KIND_LIST_SET_APP_CURATION,
"KIND_LIST_SET_APP_CURATION",
"App Curation Set",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Addressable,
+ NostrStandard::Nip51,
["radroots.list_set.app_curation.v1"]
),
kind_contract!(
KIND_ARTICLE,
"KIND_ARTICLE",
"Long Form Article",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip23,
+ EventClass::Addressable,
+ NostrStandard::Nip23,
["radroots.social.article.v1"]
),
kind_contract!(
KIND_WIKI_MERGE_REQUEST,
"KIND_WIKI_MERGE_REQUEST",
"Wiki Merge Request",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Nip54,
+ EventClass::Regular,
+ NostrStandard::Nip54,
["radroots.wiki.merge_request.v1"]
),
kind_contract!(
KIND_WIKI_ARTICLE,
"KIND_WIKI_ARTICLE",
"Wiki Article",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip54,
+ EventClass::Addressable,
+ NostrStandard::Nip54,
["radroots.wiki.article.v1"]
),
kind_contract!(
KIND_WIKI_REDIRECT,
"KIND_WIKI_REDIRECT",
"Wiki Redirect",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip54,
+ EventClass::Addressable,
+ NostrStandard::Nip54,
["radroots.wiki.redirect.v1"]
),
kind_contract!(
KIND_CALENDAR_DATE_EVENT,
"KIND_CALENDAR_DATE_EVENT",
"Calendar Date Event",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip52,
+ EventClass::Addressable,
+ NostrStandard::Nip52,
["radroots.calendar.date_event.v1"]
),
kind_contract!(
KIND_CALENDAR_TIME_EVENT,
"KIND_CALENDAR_TIME_EVENT",
"Calendar Time Event",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip52,
+ EventClass::Addressable,
+ NostrStandard::Nip52,
["radroots.calendar.time_event.v1"]
),
kind_contract!(
KIND_CALENDAR,
"KIND_CALENDAR",
"Calendar Collection",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip52,
+ EventClass::Addressable,
+ NostrStandard::Nip52,
["radroots.calendar.collection.v1"]
),
kind_contract!(
KIND_CALENDAR_EVENT_RSVP,
"KIND_CALENDAR_EVENT_RSVP",
"Calendar RSVP",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip52,
+ EventClass::Addressable,
+ NostrStandard::Nip52,
["radroots.calendar.rsvp.v1"]
),
kind_contract!(
KIND_LIST_SET_STARTER_PACK,
"KIND_LIST_SET_STARTER_PACK",
"Starter Pack Set",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Addressable,
+ NostrStandard::Nip51,
["radroots.list_set.starter_pack.v1"]
),
kind_contract!(
KIND_LIST_SET_MEDIA_STARTER_PACK,
"KIND_LIST_SET_MEDIA_STARTER_PACK",
"Media Starter Pack Set",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip51,
+ EventClass::Addressable,
+ NostrStandard::Nip51,
["radroots.list_set.media_starter_pack.v1"]
),
kind_contract!(
KIND_FARM,
"KIND_FARM",
"Farm",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Radroots,
+ EventClass::Addressable,
+ NostrStandard::Radroots,
["radroots.farm.profile.v1"]
),
kind_contract!(
KIND_PLOT,
"KIND_PLOT",
"Plot",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Radroots,
+ EventClass::Addressable,
+ NostrStandard::Radroots,
["radroots.farm.plot.v1"]
),
kind_contract!(
KIND_COOP,
"KIND_COOP",
"Coop",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Radroots,
+ EventClass::Addressable,
+ NostrStandard::Radroots,
["radroots.farm.coop.v1"]
),
kind_contract!(
KIND_DOCUMENT,
"KIND_DOCUMENT",
"Document",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Radroots,
+ EventClass::Addressable,
+ NostrStandard::Radroots,
["radroots.farm.document.v1"]
),
kind_contract!(
KIND_RESOURCE_AREA,
"KIND_RESOURCE_AREA",
"Resource Area",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Radroots,
+ EventClass::Addressable,
+ NostrStandard::Radroots,
["radroots.farm.resource_area.v1"]
),
kind_contract!(
KIND_RESOURCE_HARVEST_CAP,
"KIND_RESOURCE_HARVEST_CAP",
"Resource Harvest Capacity",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Radroots,
+ EventClass::Addressable,
+ NostrStandard::Radroots,
["radroots.farm.resource_harvest_cap.v1"]
),
kind_contract!(
KIND_ACCOUNT_CLAIM,
"KIND_ACCOUNT_CLAIM",
"Account Claim",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Radroots,
+ EventClass::Addressable,
+ NostrStandard::Radroots,
["radroots.account.claim.v1"]
),
kind_contract!(
KIND_FARM_WORKSPACE_MANIFEST,
"KIND_FARM_WORKSPACE_MANIFEST",
"Farm Workspace Manifest",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip78,
+ EventClass::Addressable,
+ NostrStandard::Nip78,
["radroots.farm.workspace_manifest.v1"]
),
kind_contract!(
KIND_CLASSIFIED_LISTING,
"KIND_CLASSIFIED_LISTING",
"Classified Listing",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip99,
+ EventClass::Addressable,
+ NostrStandard::Nip99,
[
"radroots.operational_listing.published.v1",
"radroots.food.availability.v1"
@@ -2151,168 +2148,168 @@ static KIND_CONTRACTS_REGISTRY_V7: &[RadrootsKindContract] = &[
KIND_KNOWLEDGE_SOURCE,
"KIND_KNOWLEDGE_SOURCE",
"Knowledge Source",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Radroots,
+ EventClass::Addressable,
+ NostrStandard::Radroots,
["radroots.knowledge.source.v1"]
),
kind_contract!(
KIND_EVIDENCE_BOUNTY,
"KIND_EVIDENCE_BOUNTY",
"Evidence Bounty",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Radroots,
+ EventClass::Addressable,
+ NostrStandard::Radroots,
["radroots.knowledge.evidence_bounty.v1"]
),
kind_contract!(
KIND_KNOWLEDGE_CLAIM,
"KIND_KNOWLEDGE_CLAIM",
"Knowledge Claim",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Radroots,
+ EventClass::Regular,
+ NostrStandard::Radroots,
["radroots.knowledge.claim.v1"]
),
kind_contract!(
KIND_KNOWLEDGE_RELATION,
"KIND_KNOWLEDGE_RELATION",
"Knowledge Relation",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Radroots,
+ EventClass::Regular,
+ NostrStandard::Radroots,
["radroots.knowledge.relation.v1"]
),
kind_contract!(
KIND_KNOWLEDGE_REVIEW,
"KIND_KNOWLEDGE_REVIEW",
"Knowledge Review",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Radroots,
+ EventClass::Regular,
+ NostrStandard::Radroots,
["radroots.knowledge.review.v1"]
),
kind_contract!(
KIND_KNOWLEDGE_FIELD_REPORT,
"KIND_KNOWLEDGE_FIELD_REPORT",
"Knowledge Field Report",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Radroots,
+ EventClass::Regular,
+ NostrStandard::Radroots,
["radroots.knowledge.field_report.v1"]
),
kind_contract!(
KIND_KNOWLEDGE_CHANGE_PROPOSAL,
"KIND_KNOWLEDGE_CHANGE_PROPOSAL",
"Knowledge Change Proposal",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Radroots,
+ EventClass::Regular,
+ NostrStandard::Radroots,
["radroots.knowledge.change_proposal.v1"]
),
kind_contract!(
KIND_CONTRIBUTION_ATTESTATION,
"KIND_CONTRIBUTION_ATTESTATION",
"Contribution Attestation",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Radroots,
+ EventClass::Regular,
+ NostrStandard::Radroots,
["radroots.knowledge.contribution_attestation.v1"]
),
kind_contract!(
KIND_APPLICATION_HANDLER,
"KIND_APPLICATION_HANDLER",
"Application Handler",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Radroots,
+ EventClass::Addressable,
+ NostrStandard::Radroots,
["radroots.application.handler.v1"]
),
kind_contract!(
KIND_GROUP_METADATA,
"KIND_GROUP_METADATA",
"Group Metadata",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip29,
+ EventClass::Addressable,
+ NostrStandard::Nip29,
["radroots.group.metadata.v1"]
),
kind_contract!(
KIND_GROUP_ADMINS,
"KIND_GROUP_ADMINS",
"Group Admins",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip29,
+ EventClass::Addressable,
+ NostrStandard::Nip29,
["radroots.group.admins.v1"]
),
kind_contract!(
KIND_GROUP_MEMBERS,
"KIND_GROUP_MEMBERS",
"Group Members",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip29,
+ EventClass::Addressable,
+ NostrStandard::Nip29,
["radroots.group.members.v1"]
),
kind_contract!(
KIND_GROUP_ROLES,
"KIND_GROUP_ROLES",
"Group Roles",
- RadrootsEventClass::Addressable,
- RadrootsNostrStandard::Nip29,
+ EventClass::Addressable,
+ NostrStandard::Nip29,
["radroots.group.roles.v1"]
),
kind_contract!(
KIND_TRADE_PROPOSAL,
"KIND_TRADE_PROPOSAL",
"Trade Proposal",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Radroots,
+ EventClass::Regular,
+ NostrStandard::Radroots,
["radroots.trade.proposal.v1"]
),
kind_contract!(
KIND_TRADE_DECISION,
"KIND_TRADE_DECISION",
"Trade Decision",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Radroots,
+ EventClass::Regular,
+ NostrStandard::Radroots,
["radroots.trade.decision.v1"]
),
kind_contract!(
KIND_TRADE_REVISION_PROPOSAL,
"KIND_TRADE_REVISION_PROPOSAL",
"Trade Revision Proposal",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Radroots,
+ EventClass::Regular,
+ NostrStandard::Radroots,
["radroots.trade.revision_proposal.v1"]
),
kind_contract!(
KIND_TRADE_REVISION_DECISION,
"KIND_TRADE_REVISION_DECISION",
"Trade Revision Decision",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Radroots,
+ EventClass::Regular,
+ NostrStandard::Radroots,
["radroots.trade.revision_decision.v1"]
),
kind_contract!(
KIND_TRADE_CANCELLATION,
"KIND_TRADE_CANCELLATION",
"Trade Cancellation",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Radroots,
+ EventClass::Regular,
+ NostrStandard::Radroots,
["radroots.trade.cancellation.v1"]
),
kind_contract!(
KIND_TRADE_VALIDATION_RECEIPT,
"KIND_TRADE_VALIDATION_RECEIPT",
"Trade Validation Receipt",
- RadrootsEventClass::Regular,
- RadrootsNostrStandard::Radroots,
+ EventClass::Regular,
+ NostrStandard::Radroots,
["radroots.trade.validation_receipt.v1"]
),
];
-static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
+static EVENT_CONTRACTS_REGISTRY_V7: &[EventContract] = &[
event_contract_with_authoring_policy!(
"radroots.profile.metadata.v1",
KIND_PROFILE,
"Profile Metadata",
"RadrootsAuthoredProfile / RadrootsInboundProfileMetadata",
- RadrootsEventClass::Replaceable,
- RadrootsEventPrivacy::Public,
+ EventClass::Replaceable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventAuthoringPolicy::TypedOnly,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventAuthoringPolicy::TypedOnly,
+ EventDiscriminator::KindOnly,
PROFILE_TAGS,
PROFILE_REDUCERS
),
@@ -2321,12 +2318,12 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_POST,
"Short Text Note",
"RadrootsPost",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::PlainText,
- RadrootsEventAuthoringPolicy::ReadOnly,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::PlainText,
+ EventAuthoringPolicy::ReadOnly,
+ EventDiscriminator::KindOnly,
NO_TAGS,
SOCIAL_REDUCERS
),
@@ -2335,12 +2332,12 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_POST,
"Root Text Update",
"RadrootsAuthoredUpdate / RadrootsInboundPostProjection",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::PlainText,
- RadrootsEventAuthoringPolicy::TypedOnly,
- RadrootsEventDiscriminator::AdmissionOnly,
+ ContentSchema::PlainText,
+ EventAuthoringPolicy::TypedOnly,
+ EventDiscriminator::AdmissionOnly,
NO_TAGS,
SOCIAL_REDUCERS
),
@@ -2349,12 +2346,12 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_POST,
"NIP-92 Photo Update",
"RadrootsAuthoredPhotoUpdate / RadrootsInboundPostProjection",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::PlainText,
- RadrootsEventAuthoringPolicy::TypedOnly,
- RadrootsEventDiscriminator::AdmissionOnly,
+ ContentSchema::PlainText,
+ EventAuthoringPolicy::TypedOnly,
+ EventDiscriminator::AdmissionOnly,
PHOTO_UPDATE_TAGS,
SOCIAL_REDUCERS
),
@@ -2363,12 +2360,12 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_POST,
"Root Ask",
"RadrootsAuthoredAsk / RadrootsInboundPostProjection",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::PlainText,
- RadrootsEventAuthoringPolicy::TypedOnly,
- RadrootsEventDiscriminator::AdmissionOnly,
+ ContentSchema::PlainText,
+ EventAuthoringPolicy::TypedOnly,
+ EventDiscriminator::AdmissionOnly,
ASK_TAGS,
SOCIAL_REDUCERS
),
@@ -2377,12 +2374,12 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_POST,
"NIP-10 Reply",
"RadrootsAuthoredNip10Reply / RadrootsInboundNip10ReplyProjection",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::PlainText,
- RadrootsEventAuthoringPolicy::TypedOnly,
- RadrootsEventDiscriminator::AdmissionOnly,
+ ContentSchema::PlainText,
+ EventAuthoringPolicy::TypedOnly,
+ EventDiscriminator::AdmissionOnly,
NIP10_REPLY_TAGS,
SOCIAL_REDUCERS
),
@@ -2391,11 +2388,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_FOLLOW,
"Contact List",
"RadrootsFollowList",
- RadrootsEventClass::Replaceable,
- RadrootsEventPrivacy::Public,
+ EventClass::Replaceable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
P_TAGS,
PROFILE_REDUCERS
),
@@ -2404,12 +2401,12 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_DELETION_REQUEST,
"Deletion Request",
"RadrootsAuthoredNip09DeletionRequest / RadrootsInboundNip09DeletionProjection",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::PlainText,
- RadrootsEventAuthoringPolicy::TypedOnly,
- RadrootsEventDiscriminator::AdmissionOnly,
+ ContentSchema::PlainText,
+ EventAuthoringPolicy::TypedOnly,
+ EventDiscriminator::AdmissionOnly,
NIP09_DELETION_TAGS,
SOCIAL_REDUCERS
),
@@ -2418,11 +2415,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_REPOST,
"Repost",
"RadrootsRepost",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
EVENT_POINTER_TAGS,
SOCIAL_REDUCERS
),
@@ -2431,11 +2428,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_REACTION,
"Reaction",
"RadrootsReaction",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::PlainText,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::PlainText,
+ EventDiscriminator::KindOnly,
EVENT_POINTER_TAGS,
SOCIAL_REDUCERS
),
@@ -2444,11 +2441,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_SEAL,
"Seal",
"RadrootsSeal",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Encrypted,
+ EventClass::Regular,
+ EventPrivacy::Encrypted,
AuthorRole::Any,
- RadrootsContentSchema::Encrypted,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::Encrypted,
+ EventDiscriminator::KindOnly,
NO_TAGS,
SOCIAL_REDUCERS
),
@@ -2457,11 +2454,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_MESSAGE,
"Direct Message",
"RadrootsMessage",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Encrypted,
+ EventClass::Regular,
+ EventPrivacy::Encrypted,
AuthorRole::Any,
- RadrootsContentSchema::Encrypted,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::Encrypted,
+ EventDiscriminator::KindOnly,
P_TAGS,
SOCIAL_REDUCERS
),
@@ -2470,11 +2467,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_MESSAGE_FILE,
"Direct Message File",
"RadrootsMessageFile",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Encrypted,
+ EventClass::Regular,
+ EventPrivacy::Encrypted,
AuthorRole::Any,
- RadrootsContentSchema::Encrypted,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::Encrypted,
+ EventDiscriminator::KindOnly,
P_TAGS,
SOCIAL_REDUCERS
),
@@ -2483,11 +2480,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_GENERIC_REPOST,
"Generic Repost",
"RadrootsGenericRepost",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
EVENT_POINTER_TAGS,
SOCIAL_REDUCERS
),
@@ -2496,11 +2493,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_FARM_CRDT_CHANGE,
"Farm CRDT Change",
"RadrootsFarmCrdtChange",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Encrypted,
+ EventClass::Regular,
+ EventPrivacy::Encrypted,
AuthorRole::Farmer,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
NO_TAGS,
FARM_OPS_REDUCERS
),
@@ -2509,11 +2506,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_GIFT_WRAP,
"Gift Wrap",
"RadrootsGiftWrap",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Encrypted,
+ EventClass::Regular,
+ EventPrivacy::Encrypted,
AuthorRole::Any,
- RadrootsContentSchema::Encrypted,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::Encrypted,
+ EventDiscriminator::KindOnly,
P_TAGS,
SOCIAL_REDUCERS
),
@@ -2522,11 +2519,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_FILE_METADATA,
"File Metadata",
"RadrootsFileMetadata",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
FILE_METADATA_TAGS,
SOCIAL_REDUCERS
),
@@ -2535,12 +2532,12 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_COMMENT,
"Comment",
"RadrootsAuthoredNip22Comment / RadrootsInboundNip22CommentProjection",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::PlainText,
- RadrootsEventAuthoringPolicy::TypedOnly,
- RadrootsEventDiscriminator::AdmissionOnly,
+ ContentSchema::PlainText,
+ EventAuthoringPolicy::TypedOnly,
+ EventDiscriminator::AdmissionOnly,
NIP22_COMMENT_TAGS,
SOCIAL_REDUCERS
),
@@ -2549,11 +2546,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_REPORT,
"Report",
"RadrootsReport",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Moderator,
- RadrootsContentSchema::PlainText,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::PlainText,
+ EventDiscriminator::KindOnly,
EVENT_POINTER_TAGS,
SOCIAL_REDUCERS
),
@@ -2562,11 +2559,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_GROUP_PUT_USER,
"Group Put User",
"RadrootsGroupPutUser",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Moderator,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
GROUP_ACTION_TAGS,
GROUP_REDUCERS
),
@@ -2575,11 +2572,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_GROUP_REMOVE_USER,
"Group Remove User",
"RadrootsGroupRemoveUser",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Moderator,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
GROUP_ACTION_TAGS,
GROUP_REDUCERS
),
@@ -2588,11 +2585,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_GROUP_EDIT_METADATA,
"Group Edit Metadata",
"RadrootsGroupEditMetadata",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Moderator,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
GROUP_ACTION_TAGS,
GROUP_REDUCERS
),
@@ -2601,11 +2598,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_GROUP_DELETE_EVENT,
"Group Delete Event",
"RadrootsGroupDeleteEvent",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Moderator,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
GROUP_ACTION_TAGS,
GROUP_REDUCERS
),
@@ -2614,11 +2611,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_GROUP_CREATE_GROUP,
"Group Create Group",
"RadrootsGroupCreateGroup",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Moderator,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
GROUP_ACTION_TAGS,
GROUP_REDUCERS
),
@@ -2627,11 +2624,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_GROUP_DELETE_GROUP,
"Group Delete Group",
"RadrootsGroupDeleteGroup",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Moderator,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
GROUP_ACTION_TAGS,
GROUP_REDUCERS
),
@@ -2640,11 +2637,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_GROUP_CREATE_INVITE,
"Group Create Invite",
"RadrootsGroupCreateInvite",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Moderator,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
GROUP_ACTION_TAGS,
GROUP_REDUCERS
),
@@ -2653,11 +2650,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_GROUP_JOIN_REQUEST,
"Group Join Request",
"RadrootsGroupJoinRequest",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Member,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
GROUP_ACTION_TAGS,
GROUP_REDUCERS
),
@@ -2666,11 +2663,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_GROUP_LEAVE_REQUEST,
"Group Leave Request",
"RadrootsGroupLeaveRequest",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Member,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
GROUP_ACTION_TAGS,
GROUP_REDUCERS
),
@@ -2679,11 +2676,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_GEOCHAT,
"Geochat",
"RadrootsGeochat",
- RadrootsEventClass::Ephemeral,
- RadrootsEventPrivacy::Public,
+ EventClass::Ephemeral,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::PlainText,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::PlainText,
+ EventDiscriminator::KindOnly,
NO_TAGS,
SOCIAL_REDUCERS
),
@@ -2692,11 +2689,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_RELAY_AUTH,
"Relay Auth",
"RadrootsRelayAuth",
- RadrootsEventClass::Ephemeral,
- RadrootsEventPrivacy::Public,
+ EventClass::Ephemeral,
+ EventPrivacy::Public,
AuthorRole::Relay,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
NO_TAGS,
RELAY_REDUCERS
),
@@ -2705,11 +2702,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_HTTP_AUTH,
"HTTP Auth",
"RadrootsHttpAuth",
- RadrootsEventClass::Ephemeral,
- RadrootsEventPrivacy::Public,
+ EventClass::Ephemeral,
+ EventPrivacy::Public,
AuthorRole::Application,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
NO_TAGS,
RELAY_REDUCERS
),
@@ -2718,11 +2715,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_MUTE,
"Mute List",
"RadrootsList",
- RadrootsEventClass::Replaceable,
- RadrootsEventPrivacy::Public,
+ EventClass::Replaceable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_TAGS,
SOCIAL_REDUCERS
),
@@ -2731,11 +2728,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_PINNED_NOTES,
"Pinned Notes List",
"RadrootsList",
- RadrootsEventClass::Replaceable,
- RadrootsEventPrivacy::Public,
+ EventClass::Replaceable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_TAGS,
SOCIAL_REDUCERS
),
@@ -2744,11 +2741,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_READ_WRITE_RELAYS,
"Read Write Relays List",
"RadrootsList",
- RadrootsEventClass::Replaceable,
- RadrootsEventPrivacy::Public,
+ EventClass::Replaceable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_TAGS,
SOCIAL_REDUCERS
),
@@ -2757,11 +2754,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_BOOKMARKS,
"Bookmarks List",
"RadrootsList",
- RadrootsEventClass::Replaceable,
- RadrootsEventPrivacy::Public,
+ EventClass::Replaceable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_TAGS,
SOCIAL_REDUCERS
),
@@ -2770,11 +2767,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_COMMUNITIES,
"Communities List",
"RadrootsList",
- RadrootsEventClass::Replaceable,
- RadrootsEventPrivacy::Public,
+ EventClass::Replaceable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_TAGS,
SOCIAL_REDUCERS
),
@@ -2783,11 +2780,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_PUBLIC_CHATS,
"Public Chats List",
"RadrootsList",
- RadrootsEventClass::Replaceable,
- RadrootsEventPrivacy::Public,
+ EventClass::Replaceable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_TAGS,
SOCIAL_REDUCERS
),
@@ -2796,11 +2793,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_BLOCKED_RELAYS,
"Blocked Relays List",
"RadrootsList",
- RadrootsEventClass::Replaceable,
- RadrootsEventPrivacy::Public,
+ EventClass::Replaceable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_TAGS,
SOCIAL_REDUCERS
),
@@ -2809,11 +2806,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_SEARCH_RELAYS,
"Search Relays List",
"RadrootsList",
- RadrootsEventClass::Replaceable,
- RadrootsEventPrivacy::Public,
+ EventClass::Replaceable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_TAGS,
SOCIAL_REDUCERS
),
@@ -2822,11 +2819,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_SIMPLE_GROUPS,
"Simple Groups List",
"RadrootsList",
- RadrootsEventClass::Replaceable,
- RadrootsEventPrivacy::Public,
+ EventClass::Replaceable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_TAGS,
SOCIAL_REDUCERS
),
@@ -2835,11 +2832,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_RELAY_FEEDS,
"Relay Feeds List",
"RadrootsList",
- RadrootsEventClass::Replaceable,
- RadrootsEventPrivacy::Public,
+ EventClass::Replaceable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_TAGS,
SOCIAL_REDUCERS
),
@@ -2848,11 +2845,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_INTERESTS,
"Interests List",
"RadrootsList",
- RadrootsEventClass::Replaceable,
- RadrootsEventPrivacy::Public,
+ EventClass::Replaceable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_TAGS,
SOCIAL_REDUCERS
),
@@ -2861,11 +2858,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_MEDIA_FOLLOWS,
"Media Follows List",
"RadrootsList",
- RadrootsEventClass::Replaceable,
- RadrootsEventPrivacy::Public,
+ EventClass::Replaceable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_TAGS,
SOCIAL_REDUCERS
),
@@ -2874,11 +2871,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_EMOJIS,
"Emojis List",
"RadrootsList",
- RadrootsEventClass::Replaceable,
- RadrootsEventPrivacy::Public,
+ EventClass::Replaceable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_TAGS,
SOCIAL_REDUCERS
),
@@ -2887,11 +2884,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_DM_RELAYS,
"DM Relays List",
"RadrootsList",
- RadrootsEventClass::Replaceable,
- RadrootsEventPrivacy::Public,
+ EventClass::Replaceable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_TAGS,
SOCIAL_REDUCERS
),
@@ -2900,11 +2897,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_GOOD_WIKI_AUTHORS,
"Good Wiki Authors List",
"RadrootsList",
- RadrootsEventClass::Replaceable,
- RadrootsEventPrivacy::Public,
+ EventClass::Replaceable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_TAGS,
SOCIAL_REDUCERS
),
@@ -2913,11 +2910,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_GOOD_WIKI_RELAYS,
"Good Wiki Relays List",
"RadrootsList",
- RadrootsEventClass::Replaceable,
- RadrootsEventPrivacy::Public,
+ EventClass::Replaceable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_TAGS,
SOCIAL_REDUCERS
),
@@ -2926,11 +2923,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_SET_FOLLOW,
"Follow Set",
"RadrootsListSet",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_SET_TAGS,
SOCIAL_REDUCERS
),
@@ -2939,11 +2936,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_SET_GENERIC,
"Farm Members List Set",
"RadrootsListSet",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Farmer,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::Composite(FARM_MEMBERS_LIST_DISCRIMINATOR),
+ ContentSchema::JsonObject,
+ EventDiscriminator::Composite(FARM_MEMBERS_LIST_DISCRIMINATOR),
LIST_SET_TAGS,
FARM_OPS_REDUCERS
),
@@ -2952,11 +2949,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_SET_GENERIC,
"Farm Owners List Set",
"RadrootsListSet",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Farmer,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::Composite(FARM_OWNERS_LIST_DISCRIMINATOR),
+ ContentSchema::JsonObject,
+ EventDiscriminator::Composite(FARM_OWNERS_LIST_DISCRIMINATOR),
LIST_SET_TAGS,
FARM_OPS_REDUCERS
),
@@ -2965,11 +2962,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_SET_GENERIC,
"Farm Workers List Set",
"RadrootsListSet",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Farmer,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::Composite(FARM_WORKERS_LIST_DISCRIMINATOR),
+ ContentSchema::JsonObject,
+ EventDiscriminator::Composite(FARM_WORKERS_LIST_DISCRIMINATOR),
LIST_SET_TAGS,
FARM_OPS_REDUCERS
),
@@ -2978,11 +2975,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_SET_GENERIC,
"Farm Plots List Set",
"RadrootsListSet",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Farmer,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::Composite(FARM_PLOTS_LIST_DISCRIMINATOR),
+ ContentSchema::JsonObject,
+ EventDiscriminator::Composite(FARM_PLOTS_LIST_DISCRIMINATOR),
LIST_SET_TAGS,
FARM_OPS_REDUCERS
),
@@ -2991,11 +2988,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_SET_GENERIC,
"Farm Listings List Set",
"RadrootsListSet",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Farmer,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::Composite(FARM_LISTINGS_LIST_DISCRIMINATOR),
+ ContentSchema::JsonObject,
+ EventDiscriminator::Composite(FARM_LISTINGS_LIST_DISCRIMINATOR),
LIST_SET_TAGS,
FARM_OPS_REDUCERS
),
@@ -3004,11 +3001,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_SET_GENERIC,
"Member Of Farms List Set",
"RadrootsListSet",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Member,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::DTagExact("member_of.farms"),
+ ContentSchema::JsonObject,
+ EventDiscriminator::DTagExact("member_of.farms"),
LIST_SET_TAGS,
FARM_OPS_REDUCERS
),
@@ -3017,11 +3014,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_SET_RELAY,
"Relay Set",
"RadrootsListSet",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_SET_TAGS,
RELAY_REDUCERS
),
@@ -3030,11 +3027,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_SET_BOOKMARK,
"Bookmark Set",
"RadrootsListSet",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_SET_TAGS,
SOCIAL_REDUCERS
),
@@ -3043,11 +3040,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_SET_CURATION,
"Curation Set",
"RadrootsListSet",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_SET_TAGS,
SOCIAL_REDUCERS
),
@@ -3056,11 +3053,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_SET_VIDEO,
"Video Set",
"RadrootsListSet",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_SET_TAGS,
SOCIAL_REDUCERS
),
@@ -3069,11 +3066,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_SET_PICTURE,
"Picture Set",
"RadrootsListSet",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_SET_TAGS,
SOCIAL_REDUCERS
),
@@ -3082,11 +3079,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_SET_KIND_MUTE,
"Kind Mute Set",
"RadrootsListSet",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_SET_TAGS,
SOCIAL_REDUCERS
),
@@ -3095,11 +3092,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_SET_INTEREST,
"Interest Set",
"RadrootsListSet",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_SET_TAGS,
SOCIAL_REDUCERS
),
@@ -3108,11 +3105,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_SET_EMOJI,
"Emoji Set",
"RadrootsListSet",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_SET_TAGS,
SOCIAL_REDUCERS
),
@@ -3121,11 +3118,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_SET_RELEASE_ARTIFACT,
"Release Artifact Set",
"RadrootsListSet",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_SET_TAGS,
SOCIAL_REDUCERS
),
@@ -3134,11 +3131,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_SET_APP_CURATION,
"App Curation Set",
"RadrootsListSet",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_SET_TAGS,
SOCIAL_REDUCERS
),
@@ -3147,11 +3144,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_ARTICLE,
"Long Form Article",
"RadrootsArticle",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::Markdown,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::Markdown,
+ EventDiscriminator::KindOnly,
ARTICLE_TAGS,
SOCIAL_REDUCERS
),
@@ -3160,11 +3157,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_WIKI_MERGE_REQUEST,
"Wiki Merge Request",
"RadrootsWikiMergeRequest",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::PlainText,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::PlainText,
+ EventDiscriminator::KindOnly,
WIKI_MERGE_REQUEST_TAGS,
KNOWLEDGE_REDUCERS
),
@@ -3173,11 +3170,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_WIKI_ARTICLE,
"Wiki Article",
"RadrootsWikiArticle",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::Djot,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::Djot,
+ EventDiscriminator::KindOnly,
WIKI_ARTICLE_TAGS,
KNOWLEDGE_REDUCERS
),
@@ -3186,11 +3183,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_WIKI_REDIRECT,
"Wiki Redirect",
"RadrootsWikiRedirect",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::Empty,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::Empty,
+ EventDiscriminator::KindOnly,
WIKI_REDIRECT_TAGS,
KNOWLEDGE_REDUCERS
),
@@ -3199,11 +3196,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_CALENDAR_DATE_EVENT,
"Calendar Date Event",
"RadrootsAdmittedCalendarDateEvent",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::PlainText,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::PlainText,
+ EventDiscriminator::KindOnly,
CALENDAR_DATE_EVENT_TAGS,
CALENDAR_REDUCERS
),
@@ -3212,11 +3209,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_CALENDAR_TIME_EVENT,
"Calendar Time Event",
"RadrootsAdmittedCalendarTimeEvent",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::PlainText,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::PlainText,
+ EventDiscriminator::KindOnly,
CALENDAR_TIME_EVENT_TAGS,
CALENDAR_REDUCERS
),
@@ -3225,11 +3222,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_CALENDAR,
"Calendar Collection",
"RadrootsAdmittedCalendar",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::PlainText,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::PlainText,
+ EventDiscriminator::KindOnly,
CALENDAR_COLLECTION_TAGS,
CALENDAR_REDUCERS
),
@@ -3238,11 +3235,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_CALENDAR_EVENT_RSVP,
"Calendar RSVP",
"RadrootsAdmittedCalendarEventRsvp",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::PlainText,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::PlainText,
+ EventDiscriminator::KindOnly,
CALENDAR_RSVP_TAGS,
CALENDAR_REDUCERS
),
@@ -3251,11 +3248,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_SET_STARTER_PACK,
"Starter Pack Set",
"RadrootsListSet",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_SET_TAGS,
SOCIAL_REDUCERS
),
@@ -3264,11 +3261,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_LIST_SET_MEDIA_STARTER_PACK,
"Media Starter Pack Set",
"RadrootsListSet",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
LIST_SET_TAGS,
SOCIAL_REDUCERS
),
@@ -3277,11 +3274,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_FARM,
"Farm",
"RadrootsFarm",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Farmer,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
FARM_TAGS,
FARM_OPS_REDUCERS
),
@@ -3290,11 +3287,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_PLOT,
"Plot",
"RadrootsPlot",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Farmer,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
FARM_TAGS,
FARM_OPS_REDUCERS
),
@@ -3303,11 +3300,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_COOP,
"Coop",
"RadrootsCoop",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Farmer,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
FARM_TAGS,
FARM_OPS_REDUCERS
),
@@ -3316,11 +3313,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_DOCUMENT,
"Document",
"RadrootsDocument",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Farmer,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
D_TAGS,
FARM_OPS_REDUCERS
),
@@ -3329,11 +3326,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_RESOURCE_AREA,
"Resource Area",
"RadrootsResourceArea",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Farmer,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
FARM_TAGS,
FARM_OPS_REDUCERS
),
@@ -3342,11 +3339,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_RESOURCE_HARVEST_CAP,
"Resource Harvest Capacity",
"RadrootsResourceHarvestCap",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Farmer,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
FARM_TAGS,
FARM_OPS_REDUCERS
),
@@ -3355,11 +3352,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_ACCOUNT_CLAIM,
"Account Claim",
"RadrootsAccountClaim",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
D_TAGS,
PROFILE_REDUCERS
),
@@ -3368,11 +3365,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_FARM_WORKSPACE_MANIFEST,
"Farm Workspace Manifest",
"RadrootsFarmWorkspaceManifest",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Encrypted,
+ EventClass::Addressable,
+ EventPrivacy::Encrypted,
AuthorRole::Farmer,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
D_TAGS,
FARM_OPS_REDUCERS
),
@@ -3381,12 +3378,12 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_CLASSIFIED_LISTING,
"Operational Listing",
"RadrootsOperationalListing",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Seller,
- RadrootsContentSchema::Markdown,
- RadrootsEventDiscriminator::ClassifiedListingPartition(
- RadrootsClassifiedListingPartition::OperationalListing,
+ ContentSchema::Markdown,
+ EventDiscriminator::ClassifiedListingPartition(
+ ClassifiedListingPartition::OperationalListing,
),
OPERATIONAL_LISTING_TAGS,
OPERATIONAL_LISTING_REDUCERS
@@ -3396,12 +3393,12 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_CLASSIFIED_LISTING,
"Food Availability",
"RadrootsFoodAvailabilityDetails / RadrootsInboundFoodAvailabilityProjection",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Seller,
- RadrootsContentSchema::Markdown,
- RadrootsEventAuthoringPolicy::TypedOnly,
- RadrootsEventDiscriminator::AdmissionOnly,
+ ContentSchema::Markdown,
+ EventAuthoringPolicy::TypedOnly,
+ EventDiscriminator::AdmissionOnly,
FOOD_AVAILABILITY_TAGS,
FOOD_AVAILABILITY_REDUCERS
),
@@ -3410,11 +3407,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_KNOWLEDGE_SOURCE,
"Knowledge Source",
"RadrootsKnowledgeSource",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::TagEquals {
+ ContentSchema::JsonObject,
+ EventDiscriminator::TagEquals {
name: "contract",
value: "radroots.knowledge.source.v1",
},
@@ -3426,11 +3423,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_EVIDENCE_BOUNTY,
"Evidence Bounty",
"RadrootsEvidenceBounty",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::TagEquals {
+ ContentSchema::JsonObject,
+ EventDiscriminator::TagEquals {
name: "contract",
value: "radroots.knowledge.evidence_bounty.v1",
},
@@ -3442,11 +3439,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_KNOWLEDGE_CLAIM,
"Knowledge Claim",
"RadrootsKnowledgeClaim",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::TagEquals {
+ ContentSchema::JsonObject,
+ EventDiscriminator::TagEquals {
name: "contract",
value: "radroots.knowledge.claim.v1",
},
@@ -3458,11 +3455,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_KNOWLEDGE_RELATION,
"Knowledge Relation",
"RadrootsKnowledgeRelation",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::TagEquals {
+ ContentSchema::JsonObject,
+ EventDiscriminator::TagEquals {
name: "contract",
value: "radroots.knowledge.relation.v1",
},
@@ -3474,11 +3471,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_KNOWLEDGE_REVIEW,
"Knowledge Review",
"RadrootsKnowledgeReview",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::TagEquals {
+ ContentSchema::JsonObject,
+ EventDiscriminator::TagEquals {
name: "contract",
value: "radroots.knowledge.review.v1",
},
@@ -3490,11 +3487,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_KNOWLEDGE_FIELD_REPORT,
"Knowledge Field Report",
"RadrootsKnowledgeFieldReport",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::TagEquals {
+ ContentSchema::JsonObject,
+ EventDiscriminator::TagEquals {
name: "contract",
value: "radroots.knowledge.field_report.v1",
},
@@ -3506,11 +3503,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_KNOWLEDGE_CHANGE_PROPOSAL,
"Knowledge Change Proposal",
"RadrootsKnowledgeChangeProposal",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::TagEquals {
+ ContentSchema::JsonObject,
+ EventDiscriminator::TagEquals {
name: "contract",
value: "radroots.knowledge.change_proposal.v1",
},
@@ -3522,11 +3519,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_CONTRIBUTION_ATTESTATION,
"Contribution Attestation",
"RadrootsContributionAttestation",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::TagEquals {
+ ContentSchema::JsonObject,
+ EventDiscriminator::TagEquals {
name: "contract",
value: "radroots.knowledge.contribution_attestation.v1",
},
@@ -3538,11 +3535,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_APPLICATION_HANDLER,
"Application Handler",
"RadrootsApplicationHandler",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Application,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
D_TAGS,
SOCIAL_REDUCERS
),
@@ -3551,11 +3548,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_GROUP_METADATA,
"Group Metadata",
"RadrootsGroupMetadata",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Moderator,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
GROUP_STATE_TAGS,
GROUP_REDUCERS
),
@@ -3564,11 +3561,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_GROUP_ADMINS,
"Group Admins",
"RadrootsGroupAdmins",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Moderator,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
GROUP_STATE_TAGS,
GROUP_REDUCERS
),
@@ -3577,11 +3574,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_GROUP_MEMBERS,
"Group Members",
"RadrootsGroupMembers",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Moderator,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
GROUP_STATE_TAGS,
GROUP_REDUCERS
),
@@ -3590,11 +3587,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_GROUP_ROLES,
"Group Roles",
"RadrootsGroupRoles",
- RadrootsEventClass::Addressable,
- RadrootsEventPrivacy::Public,
+ EventClass::Addressable,
+ EventPrivacy::Public,
AuthorRole::Moderator,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
GROUP_STATE_TAGS,
GROUP_REDUCERS
),
@@ -3603,11 +3600,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_TRADE_PROPOSAL,
"Trade Proposal",
"RadrootsTradeMutationEnvelopeV1",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Buyer,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::ContentJsonFieldEquals {
+ ContentSchema::JsonObject,
+ EventDiscriminator::ContentJsonFieldEquals {
field: "contract_id",
value: "radroots.trade.proposal.v1",
},
@@ -3619,11 +3616,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_TRADE_DECISION,
"Trade Decision",
"RadrootsTradeMutationEnvelopeV1",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Seller,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::ContentJsonFieldEquals {
+ ContentSchema::JsonObject,
+ EventDiscriminator::ContentJsonFieldEquals {
field: "contract_id",
value: "radroots.trade.decision.v1",
},
@@ -3635,11 +3632,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_TRADE_REVISION_PROPOSAL,
"Trade Revision Proposal",
"RadrootsTradeMutationEnvelopeV1",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::ContentJsonFieldEquals {
+ ContentSchema::JsonObject,
+ EventDiscriminator::ContentJsonFieldEquals {
field: "contract_id",
value: "radroots.trade.revision_proposal.v1",
},
@@ -3651,11 +3648,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_TRADE_REVISION_DECISION,
"Trade Revision Decision",
"RadrootsTradeMutationEnvelopeV1",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::ContentJsonFieldEquals {
+ ContentSchema::JsonObject,
+ EventDiscriminator::ContentJsonFieldEquals {
field: "contract_id",
value: "radroots.trade.revision_decision.v1",
},
@@ -3667,11 +3664,11 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_TRADE_CANCELLATION,
"Trade Cancellation",
"RadrootsTradeMutationEnvelopeV1",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Buyer,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::ContentJsonFieldEquals {
+ ContentSchema::JsonObject,
+ EventDiscriminator::ContentJsonFieldEquals {
field: "contract_id",
value: "radroots.trade.cancellation.v1",
},
@@ -3683,48 +3680,46 @@ static EVENT_CONTRACTS_REGISTRY_V7: &[RadrootsEventContract] = &[
KIND_TRADE_VALIDATION_RECEIPT,
"Trade Validation Receipt",
"RadrootsTradeValidationReceipt",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Service,
- RadrootsContentSchema::JsonObject,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::JsonObject,
+ EventDiscriminator::KindOnly,
TRADE_VALIDATION_RECEIPT_TAGS,
TRADE_VALIDATION_REDUCERS
),
];
-pub fn all_kind_contracts() -> &'static [RadrootsKindContract] {
+pub fn all_kind_contracts() -> &'static [KindContract] {
all_kind_contracts_registry_v7()
}
/// Returns the immutable kind-contract inventory for registry v7.
-pub const fn all_kind_contracts_registry_v7() -> &'static [RadrootsKindContract] {
+pub const fn all_kind_contracts_registry_v7() -> &'static [KindContract] {
KIND_CONTRACTS_REGISTRY_V7
}
-pub fn all_event_contracts() -> &'static [RadrootsEventContract] {
+pub fn all_event_contracts() -> &'static [EventContract] {
all_event_contracts_registry_v7()
}
/// Returns the immutable event-contract inventory for registry v7.
-pub const fn all_event_contracts_registry_v7() -> &'static [RadrootsEventContract] {
+pub const fn all_event_contracts_registry_v7() -> &'static [EventContract] {
EVENT_CONTRACTS_REGISTRY_V7
}
-pub fn contract_families() -> &'static [RadrootsContractFamilyMetadata] {
+pub fn contract_families() -> &'static [ContractFamilyMetadata] {
CONTRACT_FAMILIES
}
-pub fn event_contract_family(contract: &RadrootsEventContract) -> Option<RadrootsContractFamily> {
+pub fn event_contract_family(contract: &EventContract) -> Option<ContractFamily> {
contract_family_for_id(contract.id)
}
-pub fn kind_contract_family(contract: &RadrootsKindContract) -> Option<RadrootsContractFamily> {
+pub fn kind_contract_family(contract: &KindContract) -> Option<ContractFamily> {
Some(match contract.kind {
- KIND_PROFILE | KIND_FOLLOW | KIND_ACCOUNT_CLAIM => RadrootsContractFamily::Profile,
- KIND_SEAL | KIND_MESSAGE | KIND_MESSAGE_FILE | KIND_GIFT_WRAP => {
- RadrootsContractFamily::Message
- }
+ KIND_PROFILE | KIND_FOLLOW | KIND_ACCOUNT_CLAIM => ContractFamily::Profile,
+ KIND_SEAL | KIND_MESSAGE | KIND_MESSAGE_FILE | KIND_GIFT_WRAP => ContractFamily::Message,
KIND_COMMENT
| KIND_DELETION_REQUEST
| KIND_GEOCHAT
@@ -3733,8 +3728,8 @@ pub fn kind_contract_family(contract: &RadrootsKindContract) -> Option<RadrootsC
| KIND_REPOST
| KIND_GENERIC_REPOST
| KIND_ARTICLE
- | KIND_FILE_METADATA => RadrootsContractFamily::Social,
- KIND_RELAY_AUTH | KIND_HTTP_AUTH => RadrootsContractFamily::Relay,
+ | KIND_FILE_METADATA => ContractFamily::Social,
+ KIND_RELAY_AUTH | KIND_HTTP_AUTH => ContractFamily::Relay,
KIND_GROUP_PUT_USER
| KIND_GROUP_REMOVE_USER
| KIND_GROUP_EDIT_METADATA
@@ -3747,7 +3742,7 @@ pub fn kind_contract_family(contract: &RadrootsKindContract) -> Option<RadrootsC
| KIND_GROUP_METADATA
| KIND_GROUP_ADMINS
| KIND_GROUP_MEMBERS
- | KIND_GROUP_ROLES => RadrootsContractFamily::Group,
+ | KIND_GROUP_ROLES => ContractFamily::Group,
KIND_LIST_MUTE
| KIND_LIST_PINNED_NOTES
| KIND_LIST_READ_WRITE_RELAYS
@@ -3777,11 +3772,11 @@ pub fn kind_contract_family(contract: &RadrootsKindContract) -> Option<RadrootsC
| KIND_LIST_SET_RELEASE_ARTIFACT
| KIND_LIST_SET_APP_CURATION
| KIND_LIST_SET_STARTER_PACK
- | KIND_LIST_SET_MEDIA_STARTER_PACK => RadrootsContractFamily::List,
+ | KIND_LIST_SET_MEDIA_STARTER_PACK => ContractFamily::List,
KIND_CALENDAR_DATE_EVENT
| KIND_CALENDAR_TIME_EVENT
| KIND_CALENDAR
- | KIND_CALENDAR_EVENT_RSVP => RadrootsContractFamily::Calendar,
+ | KIND_CALENDAR_EVENT_RSVP => ContractFamily::Calendar,
KIND_FARM
| KIND_PLOT
| KIND_COOP
@@ -3789,14 +3784,14 @@ pub fn kind_contract_family(contract: &RadrootsKindContract) -> Option<RadrootsC
| KIND_RESOURCE_AREA
| KIND_RESOURCE_HARVEST_CAP
| KIND_FARM_WORKSPACE_MANIFEST
- | KIND_FARM_CRDT_CHANGE => RadrootsContractFamily::Farm,
- KIND_CLASSIFIED_LISTING => RadrootsContractFamily::Market,
+ | KIND_FARM_CRDT_CHANGE => ContractFamily::Farm,
+ KIND_CLASSIFIED_LISTING => ContractFamily::Market,
KIND_TRADE_VALIDATION_RECEIPT
| KIND_TRADE_PROPOSAL
| KIND_TRADE_DECISION
| KIND_TRADE_REVISION_PROPOSAL
| KIND_TRADE_REVISION_DECISION
- | KIND_TRADE_CANCELLATION => RadrootsContractFamily::Trade,
+ | KIND_TRADE_CANCELLATION => ContractFamily::Trade,
KIND_WIKI_MERGE_REQUEST
| KIND_WIKI_ARTICLE
| KIND_WIKI_REDIRECT
@@ -3807,27 +3802,25 @@ pub fn kind_contract_family(contract: &RadrootsKindContract) -> Option<RadrootsC
| KIND_KNOWLEDGE_REVIEW
| KIND_KNOWLEDGE_FIELD_REPORT
| KIND_KNOWLEDGE_CHANGE_PROPOSAL
- | KIND_CONTRIBUTION_ATTESTATION => RadrootsContractFamily::Knowledge,
- KIND_JOB_FEEDBACK => RadrootsContractFamily::Job,
- _ if is_request_kind(contract.kind) || is_result_kind(contract.kind) => {
- RadrootsContractFamily::Job
- }
+ | KIND_CONTRIBUTION_ATTESTATION => ContractFamily::Knowledge,
+ KIND_JOB_FEEDBACK => ContractFamily::Job,
+ _ if is_request_kind(contract.kind) || is_result_kind(contract.kind) => ContractFamily::Job,
_ => return None,
})
}
-pub fn kind_contract(kind: u32) -> Option<&'static RadrootsKindContract> {
+pub fn kind_contract(kind: u32) -> Option<&'static KindContract> {
kind_contract_registry_v7(kind)
}
/// Resolves a kind contract from the immutable registry-v7 inventory.
-pub fn kind_contract_registry_v7(kind: u32) -> Option<&'static RadrootsKindContract> {
+pub fn kind_contract_registry_v7(kind: u32) -> Option<&'static KindContract> {
KIND_CONTRACTS_REGISTRY_V7
.iter()
.find(|contract| contract.kind == kind)
}
-pub fn event_contract(id: &str) -> Option<&'static RadrootsEventContract> {
+pub fn event_contract(id: &str) -> Option<&'static EventContract> {
event_contract_registry_v7(id)
}
@@ -3835,13 +3828,13 @@ pub fn event_contract(id: &str) -> Option<&'static RadrootsEventContract> {
///
/// Event-store reconciliation v1 depends on this historical entry point.
/// Later registries must retain it and add a new versioned lookup.
-pub fn event_contract_registry_v7(id: &str) -> Option<&'static RadrootsEventContract> {
+pub fn event_contract_registry_v7(id: &str) -> Option<&'static EventContract> {
EVENT_CONTRACTS_REGISTRY_V7
.iter()
.find(|contract| contract.id == id)
}
-pub fn event_contracts_for_kind(kind: u32) -> impl Iterator<Item = &'static RadrootsEventContract> {
+pub fn event_contracts_for_kind(kind: u32) -> impl Iterator<Item = &'static EventContract> {
EVENT_CONTRACTS_REGISTRY_V7
.iter()
.filter(move |contract| contract.kind == kind)
@@ -3851,7 +3844,7 @@ pub fn identify_event_contract(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<&'static RadrootsEventContract, RadrootsContractMatchError> {
+) -> Result<&'static EventContract, ContractMatchError> {
identify_event_contract_in_registry(
kind,
tags,
@@ -3865,11 +3858,11 @@ fn identify_event_contract_in_registry(
kind: u32,
tags: &[Vec<String>],
content: &str,
- kind_contracts: &'static [RadrootsKindContract],
- event_contracts: &'static [RadrootsEventContract],
-) -> Result<&'static RadrootsEventContract, RadrootsContractMatchError> {
+ kind_contracts: &'static [KindContract],
+ event_contracts: &'static [EventContract],
+) -> Result<&'static EventContract, ContractMatchError> {
if !kind_contracts.iter().any(|contract| contract.kind == kind) {
- return Err(RadrootsContractMatchError::UnsupportedKind(kind));
+ return Err(ContractMatchError::UnsupportedKind(kind));
}
identify_from_contracts(
event_contracts
@@ -3882,8 +3875,8 @@ fn identify_event_contract_in_registry(
}
pub fn validate_event_contract(
- event: &RadrootsEventEnvelope,
-) -> Result<&'static RadrootsEventContract, RadrootsContractValidationError> {
+ event: &EventEnvelope,
+) -> Result<&'static EventContract, ContractValidationError> {
validate_event_contract_in_registry(
event,
KIND_CONTRACTS_REGISTRY_V7,
@@ -3896,8 +3889,8 @@ pub fn validate_event_contract(
/// Event-store migration 0002 depends on this historical entry point. Later
/// registries must retain it and add a new versioned validator.
pub fn validate_event_contract_registry_v7(
- event: &RadrootsEventEnvelope,
-) -> Result<&'static RadrootsEventContract, RadrootsContractValidationError> {
+ event: &EventEnvelope,
+) -> Result<&'static EventContract, ContractValidationError> {
validate_event_contract_in_registry(
event,
KIND_CONTRACTS_REGISTRY_V7,
@@ -3906,10 +3899,10 @@ pub fn validate_event_contract_registry_v7(
}
fn validate_event_contract_in_registry(
- event: &RadrootsEventEnvelope,
- kind_contracts: &'static [RadrootsKindContract],
- event_contracts: &'static [RadrootsEventContract],
-) -> Result<&'static RadrootsEventContract, RadrootsContractValidationError> {
+ event: &EventEnvelope,
+ kind_contracts: &'static [KindContract],
+ event_contracts: &'static [EventContract],
+) -> Result<&'static EventContract, ContractValidationError> {
let tags = event.tags_as_vec();
let contract = identify_event_contract_in_registry(
event.kind_u32(),
@@ -3918,7 +3911,7 @@ fn validate_event_contract_in_registry(
kind_contracts,
event_contracts,
)
- .map_err(|error| RadrootsContractValidationError::ContractMatch { error })?;
+ .map_err(|error| ContractValidationError::ContractMatch { error })?;
validate_event_contract_parts_in_registry(
event.kind_u32(),
&tags,
@@ -3930,9 +3923,9 @@ fn validate_event_contract_in_registry(
}
pub fn validate_event_contract_shape(
- event: &RadrootsEventEnvelope,
+ event: &EventEnvelope,
contract_id: &str,
-) -> Result<(), RadrootsContractValidationError> {
+) -> Result<(), ContractValidationError> {
let tags = event.tags_as_vec();
validate_event_contract_parts(event.kind_u32(), &tags, event.content(), contract_id)
}
@@ -3942,12 +3935,11 @@ pub fn validate_event_contract_parts(
tags: &[Vec<String>],
content: &str,
contract_id: &str,
-) -> Result<(), RadrootsContractValidationError> {
- let contract = event_contract(contract_id).ok_or_else(|| {
- RadrootsContractValidationError::UnknownContract {
+) -> Result<(), ContractValidationError> {
+ let contract =
+ event_contract(contract_id).ok_or_else(|| ContractValidationError::UnknownContract {
contract_id: contract_id.to_owned(),
- }
- })?;
+ })?;
validate_event_contract_parts_in_registry(
kind,
tags,
@@ -3961,20 +3953,17 @@ fn validate_event_contract_parts_in_registry(
kind: u32,
tags: &[Vec<String>],
content: &str,
- contract: &RadrootsEventContract,
- event_contracts: &'static [RadrootsEventContract],
-) -> Result<(), RadrootsContractValidationError> {
+ contract: &EventContract,
+ event_contracts: &'static [EventContract],
+) -> Result<(), ContractValidationError> {
if kind != contract.kind {
- return Err(RadrootsContractValidationError::KindMismatch {
+ return Err(ContractValidationError::KindMismatch {
expected: contract.kind,
actual: kind,
});
}
- if matches!(
- contract.discriminator,
- RadrootsEventDiscriminator::AdmissionOnly
- ) {
- return Err(RadrootsContractValidationError::AdmissionRequired {
+ if matches!(contract.discriminator, EventDiscriminator::AdmissionOnly) {
+ return Err(ContractValidationError::AdmissionRequired {
contract_id: contract.id,
});
}
@@ -3989,24 +3978,23 @@ fn validate_event_contract_parts_in_registry(
fn validate_classified_listing_partition_parts(
tags: &[Vec<String>],
- contract: &RadrootsEventContract,
-) -> Result<(), RadrootsContractValidationError> {
- let RadrootsEventDiscriminator::ClassifiedListingPartition(expected) = contract.discriminator
- else {
+ contract: &EventContract,
+) -> Result<(), ContractValidationError> {
+ let EventDiscriminator::ClassifiedListingPartition(expected) = contract.discriminator else {
return Ok(());
};
if classify_classified_listing_raw_tags_registry_v7(tags) == expected {
Ok(())
} else {
- Err(RadrootsContractValidationError::ContractMatch {
- error: RadrootsContractMatchError::UnsupportedShape(contract.kind),
+ Err(ContractValidationError::ContractMatch {
+ error: ContractMatchError::UnsupportedShape(contract.kind),
})
}
}
fn classify_classified_listing_raw_tags_registry_v7(
tags: &[Vec<String>],
-) -> RadrootsClassifiedListingPartition {
+) -> ClassifiedListingPartition {
let mut has_focused_marker = false;
let mut has_operational_marker = false;
@@ -4023,15 +4011,15 @@ fn classify_classified_listing_raw_tags_registry_v7(
}
if has_focused_marker && has_operational_marker {
- return RadrootsClassifiedListingPartition::Ambiguous;
+ return ClassifiedListingPartition::Ambiguous;
}
}
match (has_focused_marker, has_operational_marker) {
- (true, false) => RadrootsClassifiedListingPartition::FocusedFoodAvailability,
- (false, true) => RadrootsClassifiedListingPartition::OperationalListing,
- (false, false) => RadrootsClassifiedListingPartition::GenericNip99,
- (true, true) => RadrootsClassifiedListingPartition::Ambiguous,
+ (true, false) => ClassifiedListingPartition::FocusedFoodAvailability,
+ (false, true) => ClassifiedListingPartition::OperationalListing,
+ (false, false) => ClassifiedListingPartition::GenericNip99,
+ (true, true) => ClassifiedListingPartition::Ambiguous,
}
}
@@ -4040,9 +4028,9 @@ fn identify_from_contracts<'a, I>(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<&'a RadrootsEventContract, RadrootsContractMatchError>
+) -> Result<&'a EventContract, ContractMatchError>
where
- I: IntoIterator<Item = &'a RadrootsEventContract>,
+ I: IntoIterator<Item = &'a EventContract>,
{
let mut matched = None;
let mut matched_count = 0;
@@ -4056,42 +4044,42 @@ where
match (matched, matched_count) {
(Some(contract), 1) => Ok(contract),
- (None, _) => Err(RadrootsContractMatchError::UnsupportedShape(kind)),
- (Some(_), _) => Err(RadrootsContractMatchError::AmbiguousShape(kind)),
+ (None, _) => Err(ContractMatchError::UnsupportedShape(kind)),
+ (Some(_), _) => Err(ContractMatchError::AmbiguousShape(kind)),
}
}
-fn contract_family_for_id(id: &str) -> Option<RadrootsContractFamily> {
+fn contract_family_for_id(id: &str) -> Option<ContractFamily> {
if id.starts_with("radroots.account.") {
- Some(RadrootsContractFamily::Account)
+ Some(ContractFamily::Account)
} else if id.starts_with("radroots.application.") {
- Some(RadrootsContractFamily::Application)
+ Some(ContractFamily::Application)
} else if id.starts_with("radroots.calendar.") {
- Some(RadrootsContractFamily::Calendar)
+ Some(ContractFamily::Calendar)
} else if id.starts_with("radroots.farm.") {
- Some(RadrootsContractFamily::Farm)
+ Some(ContractFamily::Farm)
} else if id.starts_with("radroots.group.") {
- Some(RadrootsContractFamily::Group)
+ Some(ContractFamily::Group)
} else if id.starts_with("radroots.http.") {
- Some(RadrootsContractFamily::Http)
+ Some(ContractFamily::Http)
} else if id.starts_with("radroots.job.") {
- Some(RadrootsContractFamily::Job)
+ Some(ContractFamily::Job)
} else if id.starts_with("radroots.knowledge.") || id.starts_with("radroots.wiki.") {
- Some(RadrootsContractFamily::Knowledge)
+ Some(ContractFamily::Knowledge)
} else if id.starts_with("radroots.list.") || id.starts_with("radroots.list_set.") {
- Some(RadrootsContractFamily::List)
+ Some(ContractFamily::List)
} else if id.starts_with("radroots.operational_listing.") || id.starts_with("radroots.food.") {
- Some(RadrootsContractFamily::Market)
+ Some(ContractFamily::Market)
} else if id.starts_with("radroots.message.") {
- Some(RadrootsContractFamily::Message)
+ Some(ContractFamily::Message)
} else if id.starts_with("radroots.profile.") {
- Some(RadrootsContractFamily::Profile)
+ Some(ContractFamily::Profile)
} else if id.starts_with("radroots.relay.") {
- Some(RadrootsContractFamily::Relay)
+ Some(ContractFamily::Relay)
} else if id.starts_with("radroots.social.") {
- Some(RadrootsContractFamily::Social)
+ Some(ContractFamily::Social)
} else if id.starts_with("radroots.trade.") {
- Some(RadrootsContractFamily::Trade)
+ Some(ContractFamily::Trade)
} else {
None
}
@@ -4099,19 +4087,19 @@ fn contract_family_for_id(id: &str) -> Option<RadrootsContractFamily> {
fn validate_content_shape_parts(
content: &str,
- contract: &RadrootsEventContract,
-) -> Result<(), RadrootsContractValidationError> {
+ contract: &EventContract,
+) -> Result<(), ContractValidationError> {
match contract.content_schema {
- RadrootsContentSchema::Empty => {
+ ContentSchema::Empty => {
if content.is_empty() {
Ok(())
} else {
- Err(RadrootsContractValidationError::ContentMustBeEmpty {
+ Err(ContractValidationError::ContentMustBeEmpty {
contract_id: contract.id,
})
}
}
- RadrootsContentSchema::JsonObject => parse_content_object(content, contract.id).map(|_| ()),
+ ContentSchema::JsonObject => parse_content_object(content, contract.id).map(|_| ()),
_ => Ok(()),
}
}
@@ -4119,16 +4107,16 @@ fn validate_content_shape_parts(
#[cfg(test)]
fn validate_contract_tags_parts(
tags: &[Vec<String>],
- contract: &RadrootsEventContract,
-) -> Result<(), RadrootsContractValidationError> {
+ contract: &EventContract,
+) -> Result<(), ContractValidationError> {
validate_contract_tags_parts_in_registry(tags, contract, EVENT_CONTRACTS_REGISTRY_V7)
}
fn validate_contract_tags_parts_in_registry(
tags: &[Vec<String>],
- contract: &RadrootsEventContract,
- event_contracts: &'static [RadrootsEventContract],
-) -> Result<(), RadrootsContractValidationError> {
+ contract: &EventContract,
+ event_contracts: &'static [EventContract],
+) -> Result<(), ContractValidationError> {
for tag_contract in contract.tags {
let count = tag_count(tags, tag_contract.name);
let has_multiple_contracts_for_name = contract
@@ -4138,42 +4126,42 @@ fn validate_contract_tags_parts_in_registry(
.count()
> 1;
match tag_contract.cardinality {
- RadrootsTagCardinality::RequiredOne => {
+ TagCardinality::RequiredOne => {
if count == 0 {
- return Err(RadrootsContractValidationError::MissingTag {
+ return Err(ContractValidationError::MissingTag {
contract_id: contract.id,
name: tag_contract.name,
});
}
if count != 1 && !has_multiple_contracts_for_name {
- return Err(RadrootsContractValidationError::TagCardinalityMismatch {
+ return Err(ContractValidationError::TagCardinalityMismatch {
contract_id: contract.id,
name: tag_contract.name,
});
}
}
- RadrootsTagCardinality::RequiredMany => {
+ TagCardinality::RequiredMany => {
if count == 0 {
- return Err(RadrootsContractValidationError::MissingTag {
+ return Err(ContractValidationError::MissingTag {
contract_id: contract.id,
name: tag_contract.name,
});
}
}
- RadrootsTagCardinality::OptionalOne => {
+ TagCardinality::OptionalOne => {
if count > 1 && !has_multiple_contracts_for_name {
- return Err(RadrootsContractValidationError::TagCardinalityMismatch {
+ return Err(ContractValidationError::TagCardinalityMismatch {
contract_id: contract.id,
name: tag_contract.name,
});
}
}
- RadrootsTagCardinality::OptionalMany => {}
+ TagCardinality::OptionalMany => {}
}
if tag_contract.name == "contract" {
let actual = tag_value(tags, "contract").map(ToOwned::to_owned);
if actual.as_deref() != Some(contract.id) {
- return Err(RadrootsContractValidationError::TagValueMismatch {
+ return Err(ContractValidationError::TagValueMismatch {
contract_id: contract.id,
name: "contract",
expected: contract.id.to_owned(),
@@ -4188,16 +4176,16 @@ fn validate_contract_tags_parts_in_registry(
fn validate_contract_tag_values_in_registry(
tags: &[Vec<String>],
- contract: &RadrootsEventContract,
- tag_contract: &RadrootsTagContract,
- event_contracts: &'static [RadrootsEventContract],
-) -> Result<(), RadrootsContractValidationError> {
+ contract: &EventContract,
+ tag_contract: &TagContract,
+ event_contracts: &'static [EventContract],
+) -> Result<(), ContractValidationError> {
for tag in tags
.iter()
.filter(|tag| tag.first().map(|value| value.as_str()) == Some(tag_contract.name))
{
if !tag_value_is_valid_in_registry(tag, tag_contract.value_type, event_contracts) {
- return Err(RadrootsContractValidationError::TagValueMismatch {
+ return Err(ContractValidationError::TagValueMismatch {
contract_id: contract.id,
name: tag_contract.name,
expected: tag_value_type_expectation(tag_contract.value_type).to_owned(),
@@ -4209,51 +4197,45 @@ fn validate_contract_tag_values_in_registry(
}
#[cfg(test)]
-fn tag_value_is_valid(tag: &[String], value_type: RadrootsTagValueType) -> bool {
+fn tag_value_is_valid(tag: &[String], value_type: TagValueType) -> bool {
tag_value_is_valid_in_registry(tag, value_type, EVENT_CONTRACTS_REGISTRY_V7)
}
fn tag_value_is_valid_in_registry(
tag: &[String],
- value_type: RadrootsTagValueType,
- event_contracts: &'static [RadrootsEventContract],
+ value_type: TagValueType,
+ event_contracts: &'static [EventContract],
) -> bool {
let Some(value) = tag.get(1).map(String::as_str) else {
return false;
};
match value_type {
- RadrootsTagValueType::AddressableCoordinate => {
- RadrootsAddressableCoordinate::parse(value).is_ok()
- }
- RadrootsTagValueType::CalendarDate => RadrootsCalendarDate::parse(value).is_ok(),
- RadrootsTagValueType::CalendarEventCoordinate => {
+ TagValueType::AddressableCoordinate => AddressableCoordinate::parse(value).is_ok(),
+ TagValueType::CalendarDate => CalendarDate::parse(value).is_ok(),
+ TagValueType::CalendarEventCoordinate => {
canonical_calendar_event_coordinate_is_valid(value)
}
- RadrootsTagValueType::CalendarFreeBusy => matches!(value, "free" | "busy"),
- RadrootsTagValueType::CalendarRsvpStatus => {
+ TagValueType::CalendarFreeBusy => matches!(value, "free" | "busy"),
+ TagValueType::CalendarRsvpStatus => {
matches!(value, "accepted" | "declined" | "tentative")
}
- RadrootsTagValueType::CalendarUid => RadrootsCalendarUid::parse(value).is_ok(),
- RadrootsTagValueType::ContractId => {
- event_contracts.iter().any(|contract| contract.id == value)
- }
- RadrootsTagValueType::DTag => RadrootsDTag::parse(value).is_ok(),
- RadrootsTagValueType::EventId | RadrootsTagValueType::Sha256 => {
- RadrootsEventId::parse(value).is_ok()
- }
- RadrootsTagValueType::EventPointer => event_pointer_tag_is_valid(tag),
- RadrootsTagValueType::Geohash => geohash_is_valid(value),
- RadrootsTagValueType::IanaTimeZoneId => RadrootsIanaTimeZoneId::parse(value).is_ok(),
- RadrootsTagValueType::Kind => value.parse::<u32>().is_ok(),
- RadrootsTagValueType::Nip01Coordinate => RadrootsNip01Coordinate::parse(value).is_ok(),
- RadrootsTagValueType::PublicKey => parse_public_key(value).is_ok(),
- RadrootsTagValueType::RelayUrl => relay_url_is_valid(value),
- RadrootsTagValueType::Text => visible_text_is_valid(value),
- RadrootsTagValueType::UnixTimestamp => value.parse::<u64>().is_ok(),
- RadrootsTagValueType::Uri => RadrootsCalendarUri::parse(value).is_ok(),
- RadrootsTagValueType::Url => url_is_valid(value),
- RadrootsTagValueType::UtcDayIndex => canonical_u64(value).is_some(),
- RadrootsTagValueType::Uuid => uuid_is_valid(value),
+ TagValueType::CalendarUid => CalendarUid::parse(value).is_ok(),
+ TagValueType::ContractId => event_contracts.iter().any(|contract| contract.id == value),
+ TagValueType::DTag => DTag::parse(value).is_ok(),
+ TagValueType::EventId | TagValueType::Sha256 => EventId::parse(value).is_ok(),
+ TagValueType::EventPointer => event_pointer_tag_is_valid(tag),
+ TagValueType::Geohash => geohash_is_valid(value),
+ TagValueType::IanaTimeZoneId => IanaTimeZoneId::parse(value).is_ok(),
+ TagValueType::Kind => value.parse::<u32>().is_ok(),
+ TagValueType::Nip01Coordinate => Nip01Coordinate::parse(value).is_ok(),
+ TagValueType::PublicKey => parse_public_key(value).is_ok(),
+ TagValueType::RelayUrl => relay_url_is_valid(value),
+ TagValueType::Text => visible_text_is_valid(value),
+ TagValueType::UnixTimestamp => value.parse::<u64>().is_ok(),
+ TagValueType::Uri => CalendarUri::parse(value).is_ok(),
+ TagValueType::Url => url_is_valid(value),
+ TagValueType::UtcDayIndex => canonical_u64(value).is_some(),
+ TagValueType::Uuid => uuid_is_valid(value),
}
}
@@ -4265,10 +4247,10 @@ fn event_pointer_tag_is_valid(tag: &[String]) -> bool {
let author = tag[2].as_str();
let kind = tag[3].as_str();
let d_tag = tag[4].as_str();
- RadrootsEventId::parse(id).is_ok()
+ EventId::parse(id).is_ok()
&& parse_public_key(author).is_ok()
&& kind.parse::<u32>().is_ok()
- && (d_tag.is_empty() || RadrootsDTag::parse(d_tag).is_ok())
+ && (d_tag.is_empty() || DTag::parse(d_tag).is_ok())
&& tag
.iter()
.skip(5)
@@ -4307,31 +4289,31 @@ fn uuid_is_valid(value: &str) -> bool {
})
}
-fn tag_value_type_expectation(value_type: RadrootsTagValueType) -> &'static str {
+fn tag_value_type_expectation(value_type: TagValueType) -> &'static str {
match value_type {
- RadrootsTagValueType::AddressableCoordinate => "addressable_coordinate",
- RadrootsTagValueType::CalendarDate => "calendar_date_yyyy_mm_dd",
- RadrootsTagValueType::CalendarEventCoordinate => "canonical_kind_31922_or_31923_coordinate",
- RadrootsTagValueType::CalendarFreeBusy => "calendar_free_or_busy",
- RadrootsTagValueType::CalendarRsvpStatus => "calendar_rsvp_status",
- RadrootsTagValueType::CalendarUid => "canonical_128_bit_base64url_calendar_uid",
- RadrootsTagValueType::ContractId => "contract_id",
- RadrootsTagValueType::DTag => "d_tag",
- RadrootsTagValueType::EventId => "event_id",
- RadrootsTagValueType::EventPointer => "event_pointer",
- RadrootsTagValueType::Geohash => "geohash",
- RadrootsTagValueType::IanaTimeZoneId => "canonical_iana_time_zone_id",
- RadrootsTagValueType::Kind => "kind",
- RadrootsTagValueType::Nip01Coordinate => "nip01_coordinate",
- RadrootsTagValueType::PublicKey => "public_key",
- RadrootsTagValueType::RelayUrl => "relay_url",
- RadrootsTagValueType::Sha256 => "sha256",
- RadrootsTagValueType::Text => "text",
- RadrootsTagValueType::UnixTimestamp => "unix_timestamp",
- RadrootsTagValueType::Uri => "absolute_uri",
- RadrootsTagValueType::Url => "url",
- RadrootsTagValueType::UtcDayIndex => "canonical_decimal_utc_day_index",
- RadrootsTagValueType::Uuid => "uuid",
+ TagValueType::AddressableCoordinate => "addressable_coordinate",
+ TagValueType::CalendarDate => "calendar_date_yyyy_mm_dd",
+ TagValueType::CalendarEventCoordinate => "canonical_kind_31922_or_31923_coordinate",
+ TagValueType::CalendarFreeBusy => "calendar_free_or_busy",
+ TagValueType::CalendarRsvpStatus => "calendar_rsvp_status",
+ TagValueType::CalendarUid => "canonical_128_bit_base64url_calendar_uid",
+ TagValueType::ContractId => "contract_id",
+ TagValueType::DTag => "d_tag",
+ TagValueType::EventId => "event_id",
+ TagValueType::EventPointer => "event_pointer",
+ TagValueType::Geohash => "geohash",
+ TagValueType::IanaTimeZoneId => "canonical_iana_time_zone_id",
+ TagValueType::Kind => "kind",
+ TagValueType::Nip01Coordinate => "nip01_coordinate",
+ TagValueType::PublicKey => "public_key",
+ TagValueType::RelayUrl => "relay_url",
+ TagValueType::Sha256 => "sha256",
+ TagValueType::Text => "text",
+ TagValueType::UnixTimestamp => "unix_timestamp",
+ TagValueType::Uri => "absolute_uri",
+ TagValueType::Url => "url",
+ TagValueType::UtcDayIndex => "canonical_decimal_utc_day_index",
+ TagValueType::Uuid => "uuid",
}
}
@@ -4347,8 +4329,8 @@ fn canonical_u64(value: &str) -> Option<u64> {
fn validate_custom_calendar_contract_parts(
tags: &[Vec<String>],
- contract: &RadrootsEventContract,
-) -> Result<(), RadrootsContractValidationError> {
+ contract: &EventContract,
+) -> Result<(), ContractValidationError> {
match contract.id {
"radroots.calendar.date_event.v1" => validate_calendar_date_contract(tags, contract),
"radroots.calendar.time_event.v1" => validate_calendar_time_contract(tags, contract),
@@ -4360,8 +4342,8 @@ fn validate_custom_calendar_contract_parts(
fn validate_calendar_collection_contract(
tags: &[Vec<String>],
- contract: &RadrootsEventContract,
-) -> Result<(), RadrootsContractValidationError> {
+ contract: &EventContract,
+) -> Result<(), ContractValidationError> {
validate_exact_calendar_tags(tags, contract, &["d", "title", "description", "image"])?;
validate_canonical_calendar_text_tags(tags, contract, &["title", "description"])?;
validate_calendar_event_reference_tags(tags, contract)?;
@@ -4390,8 +4372,8 @@ fn validate_calendar_collection_contract(
fn validate_calendar_rsvp_contract(
tags: &[Vec<String>],
- contract: &RadrootsEventContract,
-) -> Result<(), RadrootsContractValidationError> {
+ contract: &EventContract,
+) -> Result<(), ContractValidationError> {
validate_exact_calendar_tags(tags, contract, &["d", "status", "fb"])?;
validate_calendar_event_reference_tags(tags, contract)?;
validate_calendar_rsvp_pointer_tag(tags, contract, "e", true)?;
@@ -4401,9 +4383,7 @@ fn validate_calendar_rsvp_contract(
.iter()
.find(|tag| tag.first().map(String::as_str) == Some("a"))
.and_then(|tag| tag.get(1))
- .and_then(|coordinate| {
- crate::id::RadrootsAddressableCoordinateParts::parse(coordinate).ok()
- })
+ .and_then(|coordinate| crate::id::AddressableCoordinateParts::parse(coordinate).ok())
.map(|parts| parts.pubkey);
if let Some(author_hint) = tag_value(tags, "p") {
let hint = parse_public_key(author_hint).ok();
@@ -4423,8 +4403,8 @@ fn validate_calendar_rsvp_contract(
fn validate_calendar_event_reference_tags(
tags: &[Vec<String>],
- contract: &RadrootsEventContract,
-) -> Result<(), RadrootsContractValidationError> {
+ contract: &EventContract,
+) -> Result<(), ContractValidationError> {
for tag in tags
.iter()
.filter(|tag| tag.first().map(String::as_str) == Some("a"))
@@ -4449,17 +4429,17 @@ fn validate_calendar_event_reference_tags(
fn validate_calendar_rsvp_pointer_tag(
tags: &[Vec<String>],
- contract: &RadrootsEventContract,
+ contract: &EventContract,
name: &'static str,
event_id: bool,
-) -> Result<(), RadrootsContractValidationError> {
+) -> Result<(), ContractValidationError> {
for tag in tags
.iter()
.filter(|tag| tag.first().map(String::as_str) == Some(name))
{
let value_is_canonical = tag.get(1).is_some_and(|value| {
if event_id {
- RadrootsEventId::parse(value).is_ok_and(|parsed| parsed.to_hex() == *value)
+ EventId::parse(value).is_ok_and(|parsed| parsed.to_hex() == *value)
} else {
parse_public_key(value).is_ok_and(|parsed| parsed.to_hex() == *value)
}
@@ -4485,9 +4465,9 @@ fn validate_calendar_rsvp_pointer_tag(
fn validate_canonical_calendar_text_tags(
tags: &[Vec<String>],
- contract: &RadrootsEventContract,
+ contract: &EventContract,
names: &[&'static str],
-) -> Result<(), RadrootsContractValidationError> {
+) -> Result<(), ContractValidationError> {
for name in names {
for tag in tags
.iter()
@@ -4511,8 +4491,8 @@ fn validate_canonical_calendar_text_tags(
fn validate_calendar_blossom_image(
tags: &[Vec<String>],
- contract: &RadrootsEventContract,
-) -> Result<(), RadrootsContractValidationError> {
+ contract: &EventContract,
+) -> Result<(), ContractValidationError> {
if let Some(image) = tag_value(tags, "image")
&& BlobUrl::parse(image).is_err()
{
@@ -4528,8 +4508,8 @@ fn validate_calendar_blossom_image(
fn validate_calendar_date_contract(
tags: &[Vec<String>],
- contract: &RadrootsEventContract,
-) -> Result<(), RadrootsContractValidationError> {
+ contract: &EventContract,
+) -> Result<(), ContractValidationError> {
validate_exact_calendar_tags(
tags,
contract,
@@ -4569,8 +4549,8 @@ fn validate_calendar_date_contract(
fn validate_calendar_time_contract(
tags: &[Vec<String>],
- contract: &RadrootsEventContract,
-) -> Result<(), RadrootsContractValidationError> {
+ contract: &EventContract,
+) -> Result<(), ContractValidationError> {
validate_exact_calendar_tags(
tags,
contract,
@@ -4638,9 +4618,9 @@ fn validate_calendar_time_contract(
fn validate_exact_calendar_tags(
tags: &[Vec<String>],
- contract: &RadrootsEventContract,
+ contract: &EventContract,
names: &[&'static str],
-) -> Result<(), RadrootsContractValidationError> {
+) -> Result<(), ContractValidationError> {
for name in names {
for tag in tags
.iter()
@@ -4661,8 +4641,8 @@ fn validate_exact_calendar_tags(
fn validate_calendar_participant_tags(
tags: &[Vec<String>],
- contract: &RadrootsEventContract,
-) -> Result<(), RadrootsContractValidationError> {
+ contract: &EventContract,
+) -> Result<(), ContractValidationError> {
if tag_count(tags, "p") > RADROOTS_CALENDAR_MAX_PARTICIPANTS {
return Err(calendar_tag_mismatch(
contract,
@@ -4706,8 +4686,8 @@ fn validate_calendar_participant_tags(
fn validate_calendar_inclusion_request_tags(
tags: &[Vec<String>],
- contract: &RadrootsEventContract,
-) -> Result<(), RadrootsContractValidationError> {
+ contract: &EventContract,
+) -> Result<(), ContractValidationError> {
for tag in tags
.iter()
.filter(|tag| tag.first().map(String::as_str) == Some("a"))
@@ -4737,7 +4717,7 @@ fn canonical_calendar_coordinate_is_valid(value: &str) -> bool {
let Some((pubkey, d_tag)) = remainder.split_once(':') else {
return false;
};
- let Ok(parts) = crate::id::RadrootsAddressableCoordinateParts::parse(value) else {
+ let Ok(parts) = crate::id::AddressableCoordinateParts::parse(value) else {
return false;
};
kind == "31924" && pubkey == parts.pubkey.to_hex() && d_tag == parts.d_tag.as_str()
@@ -4750,7 +4730,7 @@ fn canonical_calendar_event_coordinate_is_valid(value: &str) -> bool {
let Some((pubkey, d_tag)) = remainder.split_once(':') else {
return false;
};
- let Ok(parts) = crate::id::RadrootsAddressableCoordinateParts::parse(value) else {
+ let Ok(parts) = crate::id::AddressableCoordinateParts::parse(value) else {
return false;
};
matches!(
@@ -4763,8 +4743,8 @@ fn canonical_calendar_event_coordinate_is_valid(value: &str) -> bool {
fn validate_canonical_calendar_common_tags(
tags: &[Vec<String>],
- contract: &RadrootsEventContract,
-) -> Result<(), RadrootsContractValidationError> {
+ contract: &EventContract,
+) -> Result<(), ContractValidationError> {
for name in ["title", "location", "summary", "t", "name"] {
for tag in tags
.iter()
@@ -4808,14 +4788,14 @@ fn validate_canonical_calendar_common_tags(
fn calendar_date_tag(
tags: &[Vec<String>],
- contract: &RadrootsEventContract,
+ contract: &EventContract,
name: &'static str,
-) -> Result<RadrootsCalendarDate, RadrootsContractValidationError> {
- let value = tag_value(tags, name).ok_or(RadrootsContractValidationError::MissingTag {
+) -> Result<CalendarDate, ContractValidationError> {
+ let value = tag_value(tags, name).ok_or(ContractValidationError::MissingTag {
contract_id: contract.id,
name,
})?;
- RadrootsCalendarDate::parse(value).map_err(|_| {
+ CalendarDate::parse(value).map_err(|_| {
calendar_tag_mismatch(
contract,
name,
@@ -4827,9 +4807,9 @@ fn calendar_date_tag(
fn optional_calendar_date_tag(
tags: &[Vec<String>],
- contract: &RadrootsEventContract,
+ contract: &EventContract,
name: &'static str,
-) -> Result<Option<RadrootsCalendarDate>, RadrootsContractValidationError> {
+) -> Result<Option<CalendarDate>, ContractValidationError> {
tag_value(tags, name)
.map(|_| calendar_date_tag(tags, contract, name))
.transpose()
@@ -4837,10 +4817,10 @@ fn optional_calendar_date_tag(
fn canonical_calendar_u64_tag(
tags: &[Vec<String>],
- contract: &RadrootsEventContract,
+ contract: &EventContract,
name: &'static str,
-) -> Result<u64, RadrootsContractValidationError> {
- let value = tag_value(tags, name).ok_or(RadrootsContractValidationError::MissingTag {
+) -> Result<u64, ContractValidationError> {
+ let value = tag_value(tags, name).ok_or(ContractValidationError::MissingTag {
contract_id: contract.id,
name,
})?;
@@ -4856,21 +4836,21 @@ fn canonical_calendar_u64_tag(
fn optional_canonical_calendar_u64_tag(
tags: &[Vec<String>],
- contract: &RadrootsEventContract,
+ contract: &EventContract,
name: &'static str,
-) -> Result<Option<u64>, RadrootsContractValidationError> {
+) -> Result<Option<u64>, ContractValidationError> {
tag_value(tags, name)
.map(|_| canonical_calendar_u64_tag(tags, contract, name))
.transpose()
}
fn calendar_tag_mismatch(
- contract: &RadrootsEventContract,
+ contract: &EventContract,
name: &'static str,
expected: &'static str,
actual: Option<String>,
-) -> RadrootsContractValidationError {
- RadrootsContractValidationError::TagValueMismatch {
+) -> ContractValidationError {
+ ContractValidationError::TagValueMismatch {
contract_id: contract.id,
name,
expected: expected.to_owned(),
@@ -4880,8 +4860,8 @@ fn calendar_tag_mismatch(
fn validate_custom_knowledge_contract_parts(
content: &str,
- contract: &RadrootsEventContract,
-) -> Result<(), RadrootsContractValidationError> {
+ contract: &EventContract,
+) -> Result<(), ContractValidationError> {
let Some(expected_schema) = custom_knowledge_schema(contract.id) else {
return Ok(());
};
@@ -4891,14 +4871,14 @@ fn validate_custom_knowledge_contract_parts(
match object.get("schema").and_then(|value| value.as_str()) {
Some(actual) if actual == expected_schema => {}
Some(_) => {
- return Err(RadrootsContractValidationError::ContentFieldMismatch {
+ return Err(ContractValidationError::ContentFieldMismatch {
contract_id: contract.id,
field: "schema",
expected: expected_schema.to_owned(),
});
}
None => {
- return Err(RadrootsContractValidationError::MissingContentField {
+ return Err(ContractValidationError::MissingContentField {
contract_id: contract.id,
field: "schema",
});
@@ -4910,12 +4890,12 @@ fn validate_custom_knowledge_contract_parts(
.and_then(|value| value.as_u64())
{
Some(1) => Ok(()),
- Some(_) => Err(RadrootsContractValidationError::ContentFieldMismatch {
+ Some(_) => Err(ContractValidationError::ContentFieldMismatch {
contract_id: contract.id,
field: "schema_version",
expected: "1".to_owned(),
}),
- None => Err(RadrootsContractValidationError::MissingContentField {
+ None => Err(ContractValidationError::MissingContentField {
contract_id: contract.id,
field: "schema_version",
}),
@@ -4924,30 +4904,27 @@ fn validate_custom_knowledge_contract_parts(
fn validate_discriminator_parts(
content: &str,
- contract: &RadrootsEventContract,
-) -> Result<(), RadrootsContractValidationError> {
- if matches!(
- contract.discriminator,
- RadrootsEventDiscriminator::AdmissionOnly
- ) {
- return Err(RadrootsContractValidationError::AdmissionRequired {
+ contract: &EventContract,
+) -> Result<(), ContractValidationError> {
+ if matches!(contract.discriminator, EventDiscriminator::AdmissionOnly) {
+ return Err(ContractValidationError::AdmissionRequired {
contract_id: contract.id,
});
}
let (field, value) = match &contract.discriminator {
- RadrootsEventDiscriminator::ContentJsonFieldEquals { field, value } => (*field, *value),
- RadrootsEventDiscriminator::EnvelopeType(value) => ("type", *value),
+ EventDiscriminator::ContentJsonFieldEquals { field, value } => (*field, *value),
+ EventDiscriminator::EnvelopeType(value) => ("type", *value),
_ => return Ok(()),
};
let object = parse_content_object(content, contract.id)?;
match object.get(field).and_then(|actual| actual.as_str()) {
Some(actual) if actual == value => Ok(()),
- Some(_) => Err(RadrootsContractValidationError::ContentFieldMismatch {
+ Some(_) => Err(ContractValidationError::ContentFieldMismatch {
contract_id: contract.id,
field,
expected: value.to_owned(),
}),
- None => Err(RadrootsContractValidationError::MissingContentField {
+ None => Err(ContractValidationError::MissingContentField {
contract_id: contract.id,
field,
}),
@@ -4957,17 +4934,17 @@ fn validate_discriminator_parts(
fn parse_content_object(
content: &str,
contract_id: &'static str,
-) -> Result<serde_json::Map<String, serde_json::Value>, RadrootsContractValidationError> {
+) -> Result<serde_json::Map<String, serde_json::Value>, ContractValidationError> {
match serde_json::from_str::<serde_json::Value>(content) {
Ok(serde_json::Value::Object(object)) => Ok(object),
- _ => Err(RadrootsContractValidationError::InvalidJsonContent { contract_id }),
+ _ => Err(ContractValidationError::InvalidJsonContent { contract_id }),
}
}
fn reject_forbidden_knowledge_fields(
object: &serde_json::Map<String, serde_json::Value>,
contract_id: &'static str,
-) -> Result<(), RadrootsContractValidationError> {
+) -> Result<(), ContractValidationError> {
for field in [
"review_status",
"canon_status",
@@ -4977,10 +4954,7 @@ fn reject_forbidden_knowledge_fields(
"trusted",
] {
if object.contains_key(field) {
- return Err(RadrootsContractValidationError::ForbiddenContentField {
- contract_id,
- field,
- });
+ return Err(ContractValidationError::ForbiddenContentField { contract_id, field });
}
}
Ok(())
@@ -5003,33 +4977,31 @@ fn custom_knowledge_schema(contract_id: &str) -> Option<&'static str> {
}
fn discriminator_matches(
- discriminator: &RadrootsEventDiscriminator,
+ discriminator: &EventDiscriminator,
tags: &[Vec<String>],
content: &str,
) -> bool {
match discriminator {
- RadrootsEventDiscriminator::KindOnly => true,
- RadrootsEventDiscriminator::AdmissionOnly => false,
- RadrootsEventDiscriminator::ClassifiedListingPartition(expected) => {
+ EventDiscriminator::KindOnly => true,
+ EventDiscriminator::AdmissionOnly => false,
+ EventDiscriminator::ClassifiedListingPartition(expected) => {
classify_classified_listing_raw_tags_registry_v7(tags) == *expected
}
- RadrootsEventDiscriminator::DTagExact(expected) => tag_value(tags, "d") == Some(*expected),
- RadrootsEventDiscriminator::DTagPrefix(prefix) => tag_value(tags, "d")
+ EventDiscriminator::DTagExact(expected) => tag_value(tags, "d") == Some(*expected),
+ EventDiscriminator::DTagPrefix(prefix) => tag_value(tags, "d")
.map(|value| value.starts_with(prefix))
.unwrap_or(false),
- RadrootsEventDiscriminator::DTagSuffix(suffix) => tag_value(tags, "d")
+ EventDiscriminator::DTagSuffix(suffix) => tag_value(tags, "d")
.map(|value| value.ends_with(suffix))
.unwrap_or(false),
- RadrootsEventDiscriminator::TagEquals { name, value } => {
- tag_value(tags, name) == Some(*value)
- }
- RadrootsEventDiscriminator::ContentJsonFieldEquals { field, value } => {
+ EventDiscriminator::TagEquals { name, value } => tag_value(tags, name) == Some(*value),
+ EventDiscriminator::ContentJsonFieldEquals { field, value } => {
content_json_string_field_equals(content, field, value)
}
- RadrootsEventDiscriminator::EnvelopeType(expected) => {
+ EventDiscriminator::EnvelopeType(expected) => {
content_json_string_field_equals(content, "type", expected)
}
- RadrootsEventDiscriminator::Composite(parts) => parts
+ EventDiscriminator::Composite(parts) => parts
.iter()
.all(|part| discriminator_matches(part, tags, content)),
}
diff --git a/crates/event/src/contract/registry_v7/tests.rs b/crates/event/src/contract/registry_v7/tests.rs
@@ -1,18 +1,18 @@
use super::*;
-use crate::envelope::RadrootsEventEnvelopeParts;
+use crate::envelope::EventEnvelopeParts;
use std::collections::BTreeSet;
-static AMBIGUOUS_TEST_CONTRACTS: &[RadrootsEventContract] = &[
+static AMBIGUOUS_TEST_CONTRACTS: &[EventContract] = &[
event_contract!(
"radroots.test.one.v1",
KIND_POST,
"Test One",
"Test",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::PlainText,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::PlainText,
+ EventDiscriminator::KindOnly,
NO_TAGS,
SOCIAL_REDUCERS,
),
@@ -21,94 +21,91 @@ static AMBIGUOUS_TEST_CONTRACTS: &[RadrootsEventContract] = &[
KIND_POST,
"Test Two",
"Test",
- RadrootsEventClass::Regular,
- RadrootsEventPrivacy::Public,
+ EventClass::Regular,
+ EventPrivacy::Public,
AuthorRole::Any,
- RadrootsContentSchema::PlainText,
- RadrootsEventDiscriminator::KindOnly,
+ ContentSchema::PlainText,
+ EventDiscriminator::KindOnly,
NO_TAGS,
SOCIAL_REDUCERS,
),
];
-static REQUIRED_MANY_TEST_TAGS: &[RadrootsTagContract] = &[tag(
+static REQUIRED_MANY_TEST_TAGS: &[TagContract] = &[tag(
"test_many",
- RadrootsTagCardinality::RequiredMany,
- RadrootsTagSemantic::Topic,
- RadrootsTagValueType::Text,
+ TagCardinality::RequiredMany,
+ TagSemantic::Topic,
+ TagValueType::Text,
false,
)];
-static OPTIONAL_ONE_TEST_TAGS: &[RadrootsTagContract] = &[tag(
+static OPTIONAL_ONE_TEST_TAGS: &[TagContract] = &[tag(
"test_optional",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::Topic,
- RadrootsTagValueType::Text,
+ TagCardinality::OptionalOne,
+ TagSemantic::Topic,
+ TagValueType::Text,
false,
)];
-static DUPLICATE_REQUIRED_TEST_TAGS: &[RadrootsTagContract] = &[
+static DUPLICATE_REQUIRED_TEST_TAGS: &[TagContract] = &[
tag(
"test_required",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Topic,
- RadrootsTagValueType::Text,
+ TagCardinality::RequiredOne,
+ TagSemantic::Topic,
+ TagValueType::Text,
false,
),
tag(
"test_required",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Category,
- RadrootsTagValueType::Text,
+ TagCardinality::RequiredOne,
+ TagSemantic::Category,
+ TagValueType::Text,
false,
),
];
-static DUPLICATE_OPTIONAL_TEST_TAGS: &[RadrootsTagContract] = &[
+static DUPLICATE_OPTIONAL_TEST_TAGS: &[TagContract] = &[
tag(
"test_optional",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::Topic,
- RadrootsTagValueType::Text,
+ TagCardinality::OptionalOne,
+ TagSemantic::Topic,
+ TagValueType::Text,
false,
),
tag(
"test_optional",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::Category,
- RadrootsTagValueType::Text,
+ TagCardinality::OptionalOne,
+ TagSemantic::Category,
+ TagValueType::Text,
false,
),
];
-fn synthetic_event_contract(
- id: &'static str,
- tags: &'static [RadrootsTagContract],
-) -> RadrootsEventContract {
- RadrootsEventContract {
+fn synthetic_event_contract(id: &'static str, tags: &'static [TagContract]) -> EventContract {
+ EventContract {
id,
kind: KIND_POST,
name: "Test",
payload_type: "Test",
- class: RadrootsEventClass::Regular,
- stability: RadrootsEventStability::Experimental,
- privacy: RadrootsEventPrivacy::Public,
+ class: EventClass::Regular,
+ stability: EventStability::Experimental,
+ privacy: EventPrivacy::Public,
required_author_role: AuthorRole::Any,
- content_schema: RadrootsContentSchema::PlainText,
- authoring_policy: RadrootsEventAuthoringPolicy::GenericDraft,
- discriminator: RadrootsEventDiscriminator::KindOnly,
+ content_schema: ContentSchema::PlainText,
+ authoring_policy: EventAuthoringPolicy::GenericDraft,
+ discriminator: EventDiscriminator::KindOnly,
tags,
reducers: SOCIAL_REDUCERS,
}
}
-fn synthetic_kind_contract(kind: u32) -> RadrootsKindContract {
- RadrootsKindContract {
+fn synthetic_kind_contract(kind: u32) -> KindContract {
+ KindContract {
kind,
canonical_constant: "KIND_TEST",
name: "Test",
- class: RadrootsEventClass::Regular,
- standard: RadrootsNostrStandard::Radroots,
+ class: EventClass::Regular,
+ standard: NostrStandard::Radroots,
accepted_event_contracts: &[],
}
}
@@ -118,7 +115,7 @@ fn author_role_catalog_is_event_owned_complete_and_schema_stable() {
let declared = AuthorRole::ALL.into_iter().collect::<BTreeSet<_>>();
let used = all_event_contracts_registry_v7()
.iter()
- .map(RadrootsEventContract::required_author_role)
+ .map(EventContract::required_author_role)
.collect::<BTreeSet<_>>();
let labels = AuthorRole::ALL
.into_iter()
@@ -140,24 +137,24 @@ fn author_role_catalog_is_event_owned_complete_and_schema_stable() {
#[test]
fn authoring_policy_matrix_is_centralized_and_complete() {
- let generic = RadrootsEventAuthoringPolicy::GenericDraft;
+ let generic = EventAuthoringPolicy::GenericDraft;
assert!(generic.permits_generic_draft());
assert!(generic.permits_typed_authoring());
assert!(!generic.is_read_only());
- let typed = RadrootsEventAuthoringPolicy::TypedOnly;
+ let typed = EventAuthoringPolicy::TypedOnly;
assert!(!typed.permits_generic_draft());
assert!(typed.permits_typed_authoring());
assert!(!typed.is_read_only());
- let read_only = RadrootsEventAuthoringPolicy::ReadOnly;
+ let read_only = EventAuthoringPolicy::ReadOnly;
assert!(!read_only.permits_generic_draft());
assert!(!read_only.permits_typed_authoring());
assert!(read_only.is_read_only());
}
-fn unsigned_event(kind: u32, tags: Vec<Vec<&str>>, content: &str) -> RadrootsEventEnvelope {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+fn unsigned_event(kind: u32, tags: Vec<Vec<&str>>, content: &str) -> EventEnvelope {
+ EventEnvelope::new(EventEnvelopeParts {
id: "0".repeat(64),
author: crate::test_valid_hex_64('1'),
created_at: 1_700_000_000,
@@ -172,8 +169,8 @@ fn unsigned_event(kind: u32, tags: Vec<Vec<&str>>, content: &str) -> RadrootsEve
.expect("event envelope")
}
-fn unsigned_event_owned(kind: u32, tags: Vec<Vec<String>>, content: &str) -> RadrootsEventEnvelope {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+fn unsigned_event_owned(kind: u32, tags: Vec<Vec<String>>, content: &str) -> EventEnvelope {
+ EventEnvelope::new(EventEnvelopeParts {
id: "0".repeat(64),
author: crate::test_valid_hex_64('1'),
created_at: 1_700_000_000,
@@ -263,48 +260,54 @@ fn every_event_contract_is_listed_by_its_kind_contract() {
fn calendar_contracts_expose_current_nip52_types_content_and_tags() {
let date = event_contract("radroots.calendar.date_event.v1").expect("calendar date");
assert_eq!(date.payload_type, "RadrootsAdmittedCalendarDateEvent");
- assert_eq!(date.content_schema, RadrootsContentSchema::PlainText);
- assert!(date.tags.iter().any(|tag| {
- tag.name == "title" && tag.cardinality == RadrootsTagCardinality::RequiredOne
- }));
- assert!(date.tags.iter().any(|tag| {
- tag.name == "name" && tag.cardinality == RadrootsTagCardinality::OptionalOne
- }));
+ assert_eq!(date.content_schema, ContentSchema::PlainText);
+ assert!(
+ date.tags
+ .iter()
+ .any(|tag| { tag.name == "title" && tag.cardinality == TagCardinality::RequiredOne })
+ );
+ assert!(
+ date.tags
+ .iter()
+ .any(|tag| { tag.name == "name" && tag.cardinality == TagCardinality::OptionalOne })
+ );
assert!(
date.tags
.iter()
- .any(|tag| tag.name == "start" && tag.value_type == RadrootsTagValueType::CalendarDate)
+ .any(|tag| tag.name == "start" && tag.value_type == TagValueType::CalendarDate)
);
assert!(!date.tags.iter().any(|tag| tag.name == "D"));
let time = event_contract("radroots.calendar.time_event.v1").expect("calendar time");
assert_eq!(time.payload_type, "RadrootsAdmittedCalendarTimeEvent");
- assert_eq!(time.content_schema, RadrootsContentSchema::PlainText);
+ assert_eq!(time.content_schema, ContentSchema::PlainText);
assert!(time.tags.iter().any(|tag| {
tag.name == "D"
- && tag.cardinality == RadrootsTagCardinality::RequiredMany
- && tag.value_type == RadrootsTagValueType::UtcDayIndex
- }));
- assert!(time.tags.iter().any(|tag| {
- tag.name == "name" && tag.cardinality == RadrootsTagCardinality::OptionalOne
+ && tag.cardinality == TagCardinality::RequiredMany
+ && tag.value_type == TagValueType::UtcDayIndex
}));
+ assert!(
+ time.tags
+ .iter()
+ .any(|tag| { tag.name == "name" && tag.cardinality == TagCardinality::OptionalOne })
+ );
let calendar = event_contract("radroots.calendar.collection.v1").expect("calendar");
assert_eq!(calendar.payload_type, "RadrootsAdmittedCalendar");
- assert_eq!(calendar.content_schema, RadrootsContentSchema::PlainText);
+ assert_eq!(calendar.content_schema, ContentSchema::PlainText);
assert!(calendar.tags.iter().any(|tag| {
tag.name == "a"
- && tag.cardinality == RadrootsTagCardinality::OptionalMany
- && tag.value_type == RadrootsTagValueType::CalendarEventCoordinate
+ && tag.cardinality == TagCardinality::OptionalMany
+ && tag.value_type == TagValueType::CalendarEventCoordinate
}));
let rsvp = event_contract("radroots.calendar.rsvp.v1").expect("calendar RSVP");
assert_eq!(rsvp.payload_type, "RadrootsAdmittedCalendarEventRsvp");
- assert_eq!(rsvp.content_schema, RadrootsContentSchema::PlainText);
+ assert_eq!(rsvp.content_schema, ContentSchema::PlainText);
assert!(rsvp.tags.iter().any(|tag| {
tag.name == "status"
- && tag.cardinality == RadrootsTagCardinality::RequiredOne
- && tag.value_type == RadrootsTagValueType::CalendarRsvpStatus
+ && tag.cardinality == TagCardinality::RequiredOne
+ && tag.value_type == TagValueType::CalendarRsvpStatus
}));
}
@@ -346,7 +349,7 @@ fn calendar_collection_and_rsvp_contracts_enforce_strict_nip52_shapes() {
"",
"radroots.calendar.collection.v1",
),
- Err(RadrootsContractValidationError::TagValueMismatch { name: "a", .. })
+ Err(ContractValidationError::TagValueMismatch { name: "a", .. })
));
let rsvp = vec![
@@ -388,7 +391,7 @@ fn calendar_collection_and_rsvp_contracts_enforce_strict_nip52_shapes() {
"",
"radroots.calendar.rsvp.v1",
),
- Err(RadrootsContractValidationError::TagValueMismatch { name: "p", .. })
+ Err(ContractValidationError::TagValueMismatch { name: "p", .. })
));
let declined_with_observed_free_busy = vec![
@@ -442,7 +445,7 @@ fn calendar_date_contract_validates_gregorian_exclusive_ranges_without_day_tags(
"description",
"radroots.calendar.date_event.v1",
),
- Err(RadrootsContractValidationError::TagCardinalityMismatch { name: "name", .. })
+ Err(ContractValidationError::TagCardinalityMismatch { name: "name", .. })
));
for invalid in [
@@ -471,7 +474,7 @@ fn calendar_date_contract_validates_gregorian_exclusive_ranges_without_day_tags(
"description",
"radroots.calendar.date_event.v1",
),
- Err(RadrootsContractValidationError::TagValueMismatch { .. })
+ Err(ContractValidationError::TagValueMismatch { .. })
));
}
}
@@ -526,7 +529,7 @@ fn calendar_time_contract_requires_exact_derived_bounded_day_coverage() {
"description",
"radroots.calendar.time_event.v1",
),
- Err(RadrootsContractValidationError::TagValueMismatch { .. })
+ Err(ContractValidationError::TagValueMismatch { .. })
));
}
}
@@ -540,8 +543,8 @@ fn trade_mutation_contract_requires_exact_contract_tag() {
.find(|tag| tag.name == "contract")
.expect("contract tag");
- assert_eq!(tag.semantic, RadrootsTagSemantic::Contract);
- assert_eq!(tag.value_type, RadrootsTagValueType::ContractId);
+ assert_eq!(tag.semantic, TagSemantic::Contract);
+ assert_eq!(tag.value_type, TagValueType::ContractId);
assert!(!tag.relay_indexed);
}
@@ -563,8 +566,8 @@ fn classified_listing_kind_profiles_are_partitioned_and_explicit() {
let kind = kind_contract(KIND_CLASSIFIED_LISTING).expect("classified listing kind");
assert_eq!(kind.canonical_constant, "KIND_CLASSIFIED_LISTING");
assert_eq!(kind.name, "Classified Listing");
- assert_eq!(kind.class, RadrootsEventClass::Addressable);
- assert_eq!(kind.standard, RadrootsNostrStandard::Nip99);
+ assert_eq!(kind.class, EventClass::Addressable);
+ assert_eq!(kind.standard, NostrStandard::Nip99);
assert_eq!(
kind.accepted_event_contracts,
&[
@@ -577,11 +580,11 @@ fn classified_listing_kind_profiles_are_partitioned_and_explicit() {
.expect("operational listing profile");
assert_eq!(operational.name, "Operational Listing");
assert_eq!(operational.payload_type, "RadrootsOperationalListing");
- assert_eq!(operational.content_schema, RadrootsContentSchema::Markdown);
+ assert_eq!(operational.content_schema, ContentSchema::Markdown);
assert_eq!(
operational.discriminator,
- RadrootsEventDiscriminator::ClassifiedListingPartition(
- RadrootsClassifiedListingPartition::OperationalListing,
+ EventDiscriminator::ClassifiedListingPartition(
+ ClassifiedListingPartition::OperationalListing,
)
);
@@ -592,39 +595,30 @@ fn classified_listing_kind_profiles_are_partitioned_and_explicit() {
food.payload_type,
"RadrootsFoodAvailabilityDetails / RadrootsInboundFoodAvailabilityProjection"
);
- assert_eq!(food.class, RadrootsEventClass::Addressable);
- assert_eq!(food.privacy, RadrootsEventPrivacy::Public);
+ assert_eq!(food.class, EventClass::Addressable);
+ assert_eq!(food.privacy, EventPrivacy::Public);
assert_eq!(food.required_author_role(), AuthorRole::Seller);
- assert_eq!(food.content_schema, RadrootsContentSchema::Markdown);
- assert_eq!(
- food.authoring_policy(),
- RadrootsEventAuthoringPolicy::TypedOnly
- );
- assert_eq!(
- food.discriminator,
- RadrootsEventDiscriminator::AdmissionOnly
- );
- assert_eq!(food.reducers, &[RadrootsReducer::MarketProjection]);
- assert_eq!(
- event_contract_family(food),
- Some(RadrootsContractFamily::Market)
- );
+ assert_eq!(food.content_schema, ContentSchema::Markdown);
+ assert_eq!(food.authoring_policy(), EventAuthoringPolicy::TypedOnly);
+ assert_eq!(food.discriminator, EventDiscriminator::AdmissionOnly);
+ assert_eq!(food.reducers, &[Reducer::MarketProjection]);
+ assert_eq!(event_contract_family(food), Some(ContractFamily::Market));
assert_eq!(
food.tags
.iter()
.map(|tag| (tag.name, tag.cardinality))
.collect::<Vec<_>>(),
vec![
- ("d", RadrootsTagCardinality::RequiredOne),
- ("title", RadrootsTagCardinality::RequiredOne),
- ("summary", RadrootsTagCardinality::RequiredOne),
- ("published_at", RadrootsTagCardinality::RequiredOne),
- ("location", RadrootsTagCardinality::RequiredOne),
- ("price", RadrootsTagCardinality::RequiredOne),
- ("radroots:price_unit", RadrootsTagCardinality::RequiredOne),
- ("radroots:quantity", RadrootsTagCardinality::OptionalOne),
- ("status", RadrootsTagCardinality::RequiredOne),
- ("image", RadrootsTagCardinality::OptionalMany),
+ ("d", TagCardinality::RequiredOne),
+ ("title", TagCardinality::RequiredOne),
+ ("summary", TagCardinality::RequiredOne),
+ ("published_at", TagCardinality::RequiredOne),
+ ("location", TagCardinality::RequiredOne),
+ ("price", TagCardinality::RequiredOne),
+ ("radroots:price_unit", TagCardinality::RequiredOne),
+ ("radroots:quantity", TagCardinality::OptionalOne),
+ ("status", TagCardinality::RequiredOne),
+ ("image", TagCardinality::OptionalMany),
]
);
assert!(event_contract("radroots.listing.published.v1").is_none());
@@ -671,7 +665,7 @@ fn classified_listing_kind_profiles_are_partitioned_and_explicit() {
"Carrots",
operational.id,
),
- Err(RadrootsContractValidationError::MissingTag {
+ Err(ContractValidationError::MissingTag {
contract_id: "radroots.operational_listing.published.v1",
name: "d",
})
@@ -680,27 +674,27 @@ fn classified_listing_kind_profiles_are_partitioned_and_explicit() {
let focused = vec![owned_tag(&["radroots:price_unit", "lb"])];
assert_eq!(
identify_event_contract(KIND_CLASSIFIED_LISTING, &focused, "Carrots"),
- Err(RadrootsContractMatchError::UnsupportedShape(
+ Err(ContractMatchError::UnsupportedShape(
KIND_CLASSIFIED_LISTING
))
);
assert_eq!(
validate_event_contract_parts(KIND_CLASSIFIED_LISTING, &focused, "Carrots", food.id,),
- Err(RadrootsContractValidationError::AdmissionRequired {
+ Err(ContractValidationError::AdmissionRequired {
contract_id: "radroots.food.availability.v1",
})
);
assert_eq!(
validate_event_contract_parts(KIND_CLASSIFIED_LISTING, &focused, "Carrots", operational.id,),
- Err(RadrootsContractValidationError::ContractMatch {
- error: RadrootsContractMatchError::UnsupportedShape(KIND_CLASSIFIED_LISTING),
+ Err(ContractValidationError::ContractMatch {
+ error: ContractMatchError::UnsupportedShape(KIND_CLASSIFIED_LISTING),
})
);
let generic = vec![owned_tag(&["d", "carrots"])];
assert_eq!(
identify_event_contract(KIND_CLASSIFIED_LISTING, &generic, "Carrots"),
- Err(RadrootsContractMatchError::UnsupportedShape(
+ Err(ContractMatchError::UnsupportedShape(
KIND_CLASSIFIED_LISTING
))
);
@@ -711,7 +705,7 @@ fn classified_listing_kind_profiles_are_partitioned_and_explicit() {
];
assert_eq!(
identify_event_contract(KIND_CLASSIFIED_LISTING, &ambiguous, "Carrots"),
- Err(RadrootsContractMatchError::UnsupportedShape(
+ Err(ContractMatchError::UnsupportedShape(
KIND_CLASSIFIED_LISTING
))
);
@@ -748,82 +742,54 @@ fn event_contract_lookup_supports_knowledge_contract_kinds() {
#[test]
fn exposes_contract_family_metadata() {
- assert!(contract_families().iter().any(|family| family.family
- == RadrootsContractFamily::Knowledge
- && family.id == "knowledge"));
+ assert!(
+ contract_families()
+ .iter()
+ .any(|family| family.family == ContractFamily::Knowledge && family.id == "knowledge")
+ );
assert_eq!(
event_contract_family(event_contract("radroots.wiki.article.v1").expect("wiki")),
- Some(RadrootsContractFamily::Knowledge)
+ Some(ContractFamily::Knowledge)
);
assert_eq!(
kind_contract_family(kind_contract(KIND_KNOWLEDGE_CLAIM).expect("claim kind")),
- Some(RadrootsContractFamily::Knowledge)
+ Some(ContractFamily::Knowledge)
);
assert_eq!(
kind_contract_family(kind_contract(KIND_LIST_SET_GENERIC).expect("list kind")),
- Some(RadrootsContractFamily::List)
+ Some(ContractFamily::List)
);
}
#[test]
fn contract_family_helpers_cover_prefixes_and_kind_branches() {
for (id, family) in [
- (
- "radroots.account.test.v1",
- Some(RadrootsContractFamily::Account),
- ),
+ ("radroots.account.test.v1", Some(ContractFamily::Account)),
(
"radroots.application.test.v1",
- Some(RadrootsContractFamily::Application),
- ),
- (
- "radroots.calendar.test.v1",
- Some(RadrootsContractFamily::Calendar),
+ Some(ContractFamily::Application),
),
- ("radroots.farm.test.v1", Some(RadrootsContractFamily::Farm)),
- (
- "radroots.group.test.v1",
- Some(RadrootsContractFamily::Group),
- ),
- ("radroots.http.test.v1", Some(RadrootsContractFamily::Http)),
- ("radroots.job.test.v1", Some(RadrootsContractFamily::Job)),
+ ("radroots.calendar.test.v1", Some(ContractFamily::Calendar)),
+ ("radroots.farm.test.v1", Some(ContractFamily::Farm)),
+ ("radroots.group.test.v1", Some(ContractFamily::Group)),
+ ("radroots.http.test.v1", Some(ContractFamily::Http)),
+ ("radroots.job.test.v1", Some(ContractFamily::Job)),
(
"radroots.knowledge.test.v1",
- Some(RadrootsContractFamily::Knowledge),
- ),
- (
- "radroots.wiki.test.v1",
- Some(RadrootsContractFamily::Knowledge),
- ),
- ("radroots.list.test.v1", Some(RadrootsContractFamily::List)),
- (
- "radroots.list_set.test.v1",
- Some(RadrootsContractFamily::List),
+ Some(ContractFamily::Knowledge),
),
+ ("radroots.wiki.test.v1", Some(ContractFamily::Knowledge)),
+ ("radroots.list.test.v1", Some(ContractFamily::List)),
+ ("radroots.list_set.test.v1", Some(ContractFamily::List)),
(
"radroots.operational_listing.test.v1",
- Some(RadrootsContractFamily::Market),
- ),
- (
- "radroots.food.test.v1",
- Some(RadrootsContractFamily::Market),
- ),
- (
- "radroots.message.test.v1",
- Some(RadrootsContractFamily::Message),
- ),
- (
- "radroots.profile.test.v1",
- Some(RadrootsContractFamily::Profile),
- ),
- (
- "radroots.relay.test.v1",
- Some(RadrootsContractFamily::Relay),
- ),
- (
- "radroots.trade.test.v1",
- Some(RadrootsContractFamily::Trade),
+ Some(ContractFamily::Market),
),
+ ("radroots.food.test.v1", Some(ContractFamily::Market)),
+ ("radroots.message.test.v1", Some(ContractFamily::Message)),
+ ("radroots.profile.test.v1", Some(ContractFamily::Profile)),
+ ("radroots.relay.test.v1", Some(ContractFamily::Relay)),
+ ("radroots.trade.test.v1", Some(ContractFamily::Trade)),
("radroots.order.test.v1", None),
("radroots.test.unknown.v1", None),
] {
@@ -831,20 +797,20 @@ fn contract_family_helpers_cover_prefixes_and_kind_branches() {
}
for (kind, family) in [
- (KIND_PROFILE, RadrootsContractFamily::Profile),
- (KIND_MESSAGE, RadrootsContractFamily::Message),
- (KIND_POST, RadrootsContractFamily::Social),
- (KIND_RELAY_AUTH, RadrootsContractFamily::Relay),
- (KIND_GROUP_ROLES, RadrootsContractFamily::Group),
- (KIND_LIST_SET_GENERIC, RadrootsContractFamily::List),
- (KIND_CALENDAR_EVENT_RSVP, RadrootsContractFamily::Calendar),
- (KIND_FARM_CRDT_CHANGE, RadrootsContractFamily::Farm),
- (KIND_CLASSIFIED_LISTING, RadrootsContractFamily::Market),
- (KIND_TRADE_CANCELLATION, RadrootsContractFamily::Trade),
- (KIND_KNOWLEDGE_CLAIM, RadrootsContractFamily::Knowledge),
- (KIND_JOB_FEEDBACK, RadrootsContractFamily::Job),
- (KIND_JOB_REQUEST_MIN, RadrootsContractFamily::Job),
- (KIND_JOB_RESULT_MIN, RadrootsContractFamily::Job),
+ (KIND_PROFILE, ContractFamily::Profile),
+ (KIND_MESSAGE, ContractFamily::Message),
+ (KIND_POST, ContractFamily::Social),
+ (KIND_RELAY_AUTH, ContractFamily::Relay),
+ (KIND_GROUP_ROLES, ContractFamily::Group),
+ (KIND_LIST_SET_GENERIC, ContractFamily::List),
+ (KIND_CALENDAR_EVENT_RSVP, ContractFamily::Calendar),
+ (KIND_FARM_CRDT_CHANGE, ContractFamily::Farm),
+ (KIND_CLASSIFIED_LISTING, ContractFamily::Market),
+ (KIND_TRADE_CANCELLATION, ContractFamily::Trade),
+ (KIND_KNOWLEDGE_CLAIM, ContractFamily::Knowledge),
+ (KIND_JOB_FEEDBACK, ContractFamily::Job),
+ (KIND_JOB_REQUEST_MIN, ContractFamily::Job),
+ (KIND_JOB_RESULT_MIN, ContractFamily::Job),
] {
assert_eq!(
kind_contract_family(&synthetic_kind_contract(kind)),
@@ -863,33 +829,24 @@ fn contract_family_helpers_cover_prefixes_and_kind_branches() {
fn exposes_knowledge_contracts() {
let wiki_article = event_contract("radroots.wiki.article.v1").expect("wiki article");
assert_eq!(wiki_article.kind, KIND_WIKI_ARTICLE);
- assert_eq!(wiki_article.stability, RadrootsEventStability::Experimental);
+ assert_eq!(wiki_article.stability, EventStability::Experimental);
assert_eq!(
kind_contract(KIND_WIKI_ARTICLE)
.expect("wiki kind")
.standard,
- RadrootsNostrStandard::Nip54
+ NostrStandard::Nip54
);
- assert_eq!(wiki_article.content_schema, RadrootsContentSchema::Djot);
+ assert_eq!(wiki_article.content_schema, ContentSchema::Djot);
let wiki_merge_request =
event_contract("radroots.wiki.merge_request.v1").expect("wiki merge request");
- assert_eq!(
- wiki_merge_request.stability,
- RadrootsEventStability::Experimental
- );
- assert_eq!(
- wiki_merge_request.content_schema,
- RadrootsContentSchema::PlainText
- );
+ assert_eq!(wiki_merge_request.stability, EventStability::Experimental);
+ assert_eq!(wiki_merge_request.content_schema, ContentSchema::PlainText);
let wiki_redirect = event_contract("radroots.wiki.redirect.v1").expect("wiki redirect");
assert_eq!(wiki_redirect.kind, KIND_WIKI_REDIRECT);
- assert_eq!(
- wiki_redirect.stability,
- RadrootsEventStability::Experimental
- );
- assert_eq!(wiki_redirect.content_schema, RadrootsContentSchema::Empty);
+ assert_eq!(wiki_redirect.stability, EventStability::Experimental);
+ assert_eq!(wiki_redirect.content_schema, ContentSchema::Empty);
for id in [
"radroots.knowledge.source.v1",
@@ -902,18 +859,18 @@ fn exposes_knowledge_contracts() {
"radroots.knowledge.contribution_attestation.v1",
] {
let contract = event_contract(id).expect(id);
- assert_eq!(contract.stability, RadrootsEventStability::Experimental);
+ assert_eq!(contract.stability, EventStability::Experimental);
assert_eq!(
event_contract_family(contract),
- Some(RadrootsContractFamily::Knowledge)
+ Some(ContractFamily::Knowledge)
);
let contract_tag = contract
.tags
.iter()
.find(|tag| tag.name == "contract")
.expect("contract tag");
- assert_eq!(contract_tag.semantic, RadrootsTagSemantic::Contract);
- assert_eq!(contract_tag.value_type, RadrootsTagValueType::ContractId);
+ assert_eq!(contract_tag.semantic, TagSemantic::Contract);
+ assert_eq!(contract_tag.value_type, TagValueType::ContractId);
}
}
@@ -940,10 +897,7 @@ fn post_subtype_contracts_require_verified_admission() {
let generic = identify_event_contract(KIND_POST, &tags, "Question")
.expect("unsigned kind-1 identification remains generic");
assert_eq!(generic.id, "radroots.social.post.v1");
- assert_eq!(
- generic.authoring_policy(),
- RadrootsEventAuthoringPolicy::ReadOnly
- );
+ assert_eq!(generic.authoring_policy(), EventAuthoringPolicy::ReadOnly);
for id in [
"radroots.social.update.v1",
@@ -954,15 +908,12 @@ fn post_subtype_contracts_require_verified_admission() {
let contract = event_contract(id).expect(id);
assert_eq!(
event_contract_family(contract),
- Some(RadrootsContractFamily::Social)
- );
- assert_eq!(
- contract.authoring_policy(),
- RadrootsEventAuthoringPolicy::TypedOnly
+ Some(ContractFamily::Social)
);
+ assert_eq!(contract.authoring_policy(), EventAuthoringPolicy::TypedOnly);
assert_eq!(
validate_event_contract_parts(KIND_POST, &tags, "Question", id),
- Err(RadrootsContractValidationError::AdmissionRequired { contract_id: id })
+ Err(ContractValidationError::AdmissionRequired { contract_id: id })
);
}
@@ -970,13 +921,13 @@ fn post_subtype_contracts_require_verified_admission() {
event_contract("radroots.profile.metadata.v1")
.expect("strict authored profile contract")
.authoring_policy(),
- RadrootsEventAuthoringPolicy::TypedOnly
+ EventAuthoringPolicy::TypedOnly
);
assert_eq!(
event_contract("radroots.social.geochat.v1")
.expect("generic-draft control contract")
.authoring_policy(),
- RadrootsEventAuthoringPolicy::GenericDraft
+ EventAuthoringPolicy::GenericDraft
);
}
@@ -987,8 +938,8 @@ fn nip22_comment_contract_is_typed_and_admission_only() {
let kind = kind_contract(KIND_COMMENT).expect("Comment kind");
assert_eq!(kind.canonical_constant, "KIND_COMMENT");
assert_eq!(kind.kind, 1111);
- assert_eq!(kind.class, RadrootsEventClass::Regular);
- assert_eq!(kind.standard, RadrootsNostrStandard::Nip22);
+ assert_eq!(kind.class, EventClass::Regular);
+ assert_eq!(kind.standard, NostrStandard::Nip22);
assert_eq!(
kind.accepted_event_contracts,
&["radroots.social.comment.v1"]
@@ -1000,22 +951,16 @@ fn nip22_comment_contract_is_typed_and_admission_only() {
"RadrootsAuthoredNip22Comment / RadrootsInboundNip22CommentProjection"
);
assert_eq!(contract.kind, KIND_COMMENT);
- assert_eq!(contract.class, RadrootsEventClass::Regular);
- assert_eq!(contract.privacy, RadrootsEventPrivacy::Public);
+ assert_eq!(contract.class, EventClass::Regular);
+ assert_eq!(contract.privacy, EventPrivacy::Public);
assert_eq!(contract.required_author_role(), AuthorRole::Any);
- assert_eq!(contract.content_schema, RadrootsContentSchema::PlainText);
- assert_eq!(
- contract.authoring_policy(),
- RadrootsEventAuthoringPolicy::TypedOnly
- );
- assert_eq!(
- contract.discriminator,
- RadrootsEventDiscriminator::AdmissionOnly
- );
- assert_eq!(contract.reducers, &[RadrootsReducer::SocialProjection]);
+ assert_eq!(contract.content_schema, ContentSchema::PlainText);
+ assert_eq!(contract.authoring_policy(), EventAuthoringPolicy::TypedOnly);
+ assert_eq!(contract.discriminator, EventDiscriminator::AdmissionOnly);
+ assert_eq!(contract.reducers, &[Reducer::SocialProjection]);
assert_eq!(
event_contract_family(contract),
- Some(RadrootsContractFamily::Social)
+ Some(ContractFamily::Social)
);
assert_eq!(
contract.tags.iter().map(|tag| tag.name).collect::<Vec<_>>(),
@@ -1027,7 +972,7 @@ fn nip22_comment_contract_is_typed_and_admission_only() {
);
assert_eq!(
validate_event_contract_parts(KIND_COMMENT, &[], "Comment", contract.id),
- Err(RadrootsContractValidationError::AdmissionRequired {
+ Err(ContractValidationError::AdmissionRequired {
contract_id: "radroots.social.comment.v1",
})
);
@@ -1047,8 +992,8 @@ fn nip09_deletion_request_contract_is_typed_and_admission_only() {
let kind = kind_contract(KIND_DELETION_REQUEST).expect("deletion request kind");
assert_eq!(kind.canonical_constant, "KIND_DELETION_REQUEST");
assert_eq!(kind.kind, 5);
- assert_eq!(kind.class, RadrootsEventClass::Regular);
- assert_eq!(kind.standard, RadrootsNostrStandard::Nip09);
+ assert_eq!(kind.class, EventClass::Regular);
+ assert_eq!(kind.standard, NostrStandard::Nip09);
assert_eq!(
kind.accepted_event_contracts,
&["radroots.social.deletion_request.v1"]
@@ -1061,22 +1006,16 @@ fn nip09_deletion_request_contract_is_typed_and_admission_only() {
"RadrootsAuthoredNip09DeletionRequest / RadrootsInboundNip09DeletionProjection"
);
assert_eq!(contract.kind, KIND_DELETION_REQUEST);
- assert_eq!(contract.class, RadrootsEventClass::Regular);
- assert_eq!(contract.privacy, RadrootsEventPrivacy::Public);
+ assert_eq!(contract.class, EventClass::Regular);
+ assert_eq!(contract.privacy, EventPrivacy::Public);
assert_eq!(contract.required_author_role(), AuthorRole::Any);
- assert_eq!(contract.content_schema, RadrootsContentSchema::PlainText);
- assert_eq!(
- contract.authoring_policy(),
- RadrootsEventAuthoringPolicy::TypedOnly
- );
- assert_eq!(
- contract.discriminator,
- RadrootsEventDiscriminator::AdmissionOnly
- );
- assert_eq!(contract.reducers, &[RadrootsReducer::SocialProjection]);
+ assert_eq!(contract.content_schema, ContentSchema::PlainText);
+ assert_eq!(contract.authoring_policy(), EventAuthoringPolicy::TypedOnly);
+ assert_eq!(contract.discriminator, EventDiscriminator::AdmissionOnly);
+ assert_eq!(contract.reducers, &[Reducer::SocialProjection]);
assert_eq!(
event_contract_family(contract),
- Some(RadrootsContractFamily::Social)
+ Some(ContractFamily::Social)
);
assert_eq!(
contract
@@ -1093,23 +1032,23 @@ fn nip09_deletion_request_contract_is_typed_and_admission_only() {
vec![
(
"e",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::EventPointer,
- RadrootsTagValueType::EventId,
+ TagCardinality::OptionalMany,
+ TagSemantic::EventPointer,
+ TagValueType::EventId,
true,
),
(
"a",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::Nip01Coordinate,
- RadrootsTagValueType::Nip01Coordinate,
+ TagCardinality::OptionalMany,
+ TagSemantic::Nip01Coordinate,
+ TagValueType::Nip01Coordinate,
true,
),
(
"k",
- RadrootsTagCardinality::OptionalMany,
- RadrootsTagSemantic::Kind,
- RadrootsTagValueType::Kind,
+ TagCardinality::OptionalMany,
+ TagSemantic::Kind,
+ TagValueType::Kind,
true,
),
]
@@ -1128,7 +1067,7 @@ fn nip09_deletion_request_contract_is_typed_and_admission_only() {
);
assert_eq!(
validate_event_contract_parts(KIND_DELETION_REQUEST, &[], "superseded", contract.id,),
- Err(RadrootsContractValidationError::AdmissionRequired {
+ Err(ContractValidationError::AdmissionRequired {
contract_id: "radroots.social.deletion_request.v1",
})
);
@@ -1157,21 +1096,19 @@ fn identifies_composite_list_set_shape() {
fn rejects_unknown_or_unsupported_shapes() {
assert_eq!(
identify_event_contract(999_999, &[], "{}"),
- Err(RadrootsContractMatchError::UnsupportedKind(999_999))
+ Err(ContractMatchError::UnsupportedKind(999_999))
);
assert_eq!(
validate_event_contract(&unsigned_event(999_999, Vec::new(), "{}")),
- Err(RadrootsContractValidationError::ContractMatch {
- error: RadrootsContractMatchError::UnsupportedKind(999_999),
+ Err(ContractValidationError::ContractMatch {
+ error: ContractMatchError::UnsupportedKind(999_999),
})
);
let tags = vec![vec!["d".to_owned(), "unknown".to_owned()]];
assert_eq!(
identify_event_contract(KIND_LIST_SET_GENERIC, &tags, "{}"),
- Err(RadrootsContractMatchError::UnsupportedShape(
- KIND_LIST_SET_GENERIC
- ))
+ Err(ContractMatchError::UnsupportedShape(KIND_LIST_SET_GENERIC))
);
}
@@ -1179,19 +1116,19 @@ fn rejects_unknown_or_unsupported_shapes() {
fn rejects_ambiguous_shapes() {
assert_eq!(
identify_from_contracts(AMBIGUOUS_TEST_CONTRACTS.iter(), KIND_POST, &[], ""),
- Err(RadrootsContractMatchError::AmbiguousShape(KIND_POST))
+ Err(ContractMatchError::AmbiguousShape(KIND_POST))
);
}
#[test]
fn supports_content_field_discriminators() {
assert!(discriminator_matches(
- &RadrootsEventDiscriminator::EnvelopeType("proposal"),
+ &EventDiscriminator::EnvelopeType("proposal"),
&[],
r#"{"domain":"radroots.trade","type":"proposal"}"#
));
assert!(discriminator_matches(
- &RadrootsEventDiscriminator::ContentJsonFieldEquals {
+ &EventDiscriminator::ContentJsonFieldEquals {
field: "domain",
value: "radroots.trade"
},
@@ -1201,28 +1138,28 @@ fn supports_content_field_discriminators() {
let base = *event_contract("radroots.trade.proposal.v1").expect("trade proposal");
for discriminator in [
- RadrootsEventDiscriminator::ContentJsonFieldEquals {
+ EventDiscriminator::ContentJsonFieldEquals {
field: "type",
value: "proposal",
},
- RadrootsEventDiscriminator::EnvelopeType("proposal"),
+ EventDiscriminator::EnvelopeType("proposal"),
] {
- let contract = RadrootsEventContract {
+ let contract = EventContract {
discriminator,
..base
};
assert!(validate_discriminator_parts(r#"{"type":"proposal"}"#, &contract).is_ok());
assert!(matches!(
validate_discriminator_parts(r#"{"type":"decision"}"#, &contract),
- Err(RadrootsContractValidationError::ContentFieldMismatch { .. })
+ Err(ContractValidationError::ContentFieldMismatch { .. })
));
assert!(matches!(
validate_discriminator_parts("{}", &contract),
- Err(RadrootsContractValidationError::MissingContentField { .. })
+ Err(ContractValidationError::MissingContentField { .. })
));
}
- let contract = RadrootsEventContract {
- discriminator: RadrootsEventDiscriminator::KindOnly,
+ let contract = EventContract {
+ discriminator: EventDiscriminator::KindOnly,
..base
};
assert!(validate_discriminator_parts("not-json", &contract).is_ok());
@@ -1233,7 +1170,7 @@ fn supports_tag_equals_discriminators() {
let tags = vec![vec!["status".to_owned(), "accepted".to_owned()]];
assert!(discriminator_matches(
- &RadrootsEventDiscriminator::TagEquals {
+ &EventDiscriminator::TagEquals {
name: "status",
value: "accepted",
},
@@ -1241,7 +1178,7 @@ fn supports_tag_equals_discriminators() {
"{}"
));
assert!(!discriminator_matches(
- &RadrootsEventDiscriminator::TagEquals {
+ &EventDiscriminator::TagEquals {
name: "status",
value: "declined",
},
@@ -1278,7 +1215,7 @@ fn rejects_custom_knowledge_contract_tag_mismatch() {
assert_eq!(
validate_event_contract_shape(&event, "radroots.knowledge.claim.v1"),
- Err(RadrootsContractValidationError::TagValueMismatch {
+ Err(ContractValidationError::TagValueMismatch {
contract_id: "radroots.knowledge.claim.v1",
name: "contract",
expected: "radroots.knowledge.claim.v1".to_owned(),
@@ -1297,7 +1234,7 @@ fn rejects_custom_knowledge_schema_mismatch() {
assert_eq!(
validate_event_contract_shape(&event, "radroots.knowledge.claim.v1"),
- Err(RadrootsContractValidationError::ContentFieldMismatch {
+ Err(ContractValidationError::ContentFieldMismatch {
contract_id: "radroots.knowledge.claim.v1",
field: "schema",
expected: "radroots.knowledge.claim.v1".to_owned(),
@@ -1315,7 +1252,7 @@ fn rejects_custom_knowledge_missing_schema_version() {
assert_eq!(
validate_event_contract_shape(&event, "radroots.knowledge.claim.v1"),
- Err(RadrootsContractValidationError::MissingContentField {
+ Err(ContractValidationError::MissingContentField {
contract_id: "radroots.knowledge.claim.v1",
field: "schema_version",
})
@@ -1344,7 +1281,7 @@ fn rejects_authoritative_knowledge_status_fields() {
assert_eq!(
validate_event_contract_shape(&event, "radroots.knowledge.review.v1"),
- Err(RadrootsContractValidationError::ForbiddenContentField {
+ Err(ContractValidationError::ForbiddenContentField {
contract_id: "radroots.knowledge.review.v1",
field: "canon_status",
})
@@ -1356,13 +1293,13 @@ fn validate_event_contract_shape_reports_registry_kind_and_content_errors() {
let event = unsigned_event(KIND_POST, Vec::new(), "hello");
assert_eq!(
validate_event_contract_shape(&event, "missing.contract.v1"),
- Err(RadrootsContractValidationError::UnknownContract {
+ Err(ContractValidationError::UnknownContract {
contract_id: "missing.contract.v1".to_owned(),
})
);
assert_eq!(
validate_event_contract_shape(&event, "radroots.profile.metadata.v1"),
- Err(RadrootsContractValidationError::KindMismatch {
+ Err(ContractValidationError::KindMismatch {
expected: KIND_PROFILE,
actual: KIND_POST,
})
@@ -1375,7 +1312,7 @@ fn validate_event_contract_shape_reports_registry_kind_and_content_errors() {
);
assert_eq!(
validate_event_contract_shape(&invalid_json, "radroots.knowledge.claim.v1"),
- Err(RadrootsContractValidationError::InvalidJsonContent {
+ Err(ContractValidationError::InvalidJsonContent {
contract_id: "radroots.knowledge.claim.v1",
})
);
@@ -1398,7 +1335,7 @@ fn validate_contract_tags_reports_cardinality_errors() {
);
assert_eq!(
validate_event_contract_shape(&missing_required_one, "radroots.knowledge.claim.v1"),
- Err(RadrootsContractValidationError::MissingTag {
+ Err(ContractValidationError::MissingTag {
contract_id: "radroots.knowledge.claim.v1",
name: "contract",
})
@@ -1414,7 +1351,7 @@ fn validate_contract_tags_reports_cardinality_errors() {
);
assert_eq!(
validate_event_contract_shape(&duplicate_required_one, "radroots.knowledge.claim.v1"),
- Err(RadrootsContractValidationError::TagCardinalityMismatch {
+ Err(ContractValidationError::TagCardinalityMismatch {
contract_id: "radroots.knowledge.claim.v1",
name: "contract",
})
@@ -1424,7 +1361,7 @@ fn validate_contract_tags_reports_cardinality_errors() {
synthetic_event_contract("radroots.test.required_many.v1", REQUIRED_MANY_TEST_TAGS);
assert_eq!(
validate_contract_tags_parts(&[], &required_many),
- Err(RadrootsContractValidationError::MissingTag {
+ Err(ContractValidationError::MissingTag {
contract_id: "radroots.test.required_many.v1",
name: "test_many",
})
@@ -1448,7 +1385,7 @@ fn validate_contract_tags_reports_cardinality_errors() {
],
&optional_one,
),
- Err(RadrootsContractValidationError::TagCardinalityMismatch {
+ Err(ContractValidationError::TagCardinalityMismatch {
contract_id: "radroots.test.optional_one.v1",
name: "test_optional",
})
@@ -1501,7 +1438,7 @@ fn validate_contract_tags_enforces_declared_value_types() {
);
assert_eq!(
validate_event_contract_shape(&invalid_source, "radroots.knowledge.claim.v1"),
- Err(RadrootsContractValidationError::TagValueMismatch {
+ Err(ContractValidationError::TagValueMismatch {
contract_id: "radroots.knowledge.claim.v1",
name: "source",
expected: "event_pointer".to_owned(),
@@ -1519,7 +1456,7 @@ fn validate_contract_tags_enforces_declared_value_types() {
);
assert_eq!(
validate_event_contract_shape(&invalid_citation, "radroots.knowledge.claim.v1"),
- Err(RadrootsContractValidationError::TagValueMismatch {
+ Err(ContractValidationError::TagValueMismatch {
contract_id: "radroots.knowledge.claim.v1",
name: "citation",
expected: "sha256".to_owned(),
@@ -1537,7 +1474,7 @@ fn validate_contract_tags_enforces_declared_value_types() {
);
assert_eq!(
validate_event_contract_shape(&invalid_review, "radroots.knowledge.review.v1"),
- Err(RadrootsContractValidationError::TagValueMismatch {
+ Err(ContractValidationError::TagValueMismatch {
contract_id: "radroots.knowledge.review.v1",
name: "review_target",
expected: "event_pointer".to_owned(),
@@ -1555,7 +1492,7 @@ fn validate_contract_tags_enforces_declared_value_types() {
);
assert_eq!(
validate_event_contract_shape(&invalid_geohash, "radroots.knowledge.field_report.v1"),
- Err(RadrootsContractValidationError::TagValueMismatch {
+ Err(ContractValidationError::TagValueMismatch {
contract_id: "radroots.knowledge.field_report.v1",
name: "g",
expected: "geohash".to_owned(),
@@ -1570,7 +1507,7 @@ fn validate_contract_tags_enforces_declared_value_types() {
);
assert_eq!(
validate_event_contract_shape(&invalid_address, "radroots.wiki.redirect.v1"),
- Err(RadrootsContractValidationError::TagValueMismatch {
+ Err(ContractValidationError::TagValueMismatch {
contract_id: "radroots.wiki.redirect.v1",
name: "a",
expected: "addressable_coordinate".to_owned(),
@@ -1592,7 +1529,7 @@ fn validate_contract_tags_enforces_declared_value_types() {
);
assert_eq!(
validate_event_contract_shape(&invalid_event_id, "radroots.wiki.merge_request.v1"),
- Err(RadrootsContractValidationError::TagValueMismatch {
+ Err(ContractValidationError::TagValueMismatch {
contract_id: "radroots.wiki.merge_request.v1",
name: "e",
expected: "event_id".to_owned(),
@@ -1648,59 +1585,59 @@ fn tag_value_shape_helpers_cover_contract_registry_value_types() {
assert!(!tag_value_is_valid(
&owned_tag(&["source"]),
- RadrootsTagValueType::EventPointer
+ TagValueType::EventPointer
));
assert!(tag_value_is_valid(
&owned_tag(&["a", coordinate.as_str()]),
- RadrootsTagValueType::AddressableCoordinate
+ TagValueType::AddressableCoordinate
));
assert!(!tag_value_is_valid(
&owned_tag(&["a", "30818:not-hex:soil"]),
- RadrootsTagValueType::AddressableCoordinate
+ TagValueType::AddressableCoordinate
));
assert!(tag_value_is_valid(
&owned_tag(&["a", replaceable_coordinate.as_str()]),
- RadrootsTagValueType::Nip01Coordinate
+ TagValueType::Nip01Coordinate
));
assert!(!tag_value_is_valid(
&owned_tag(&["a", format!("0:{public_key}:profile").as_str()]),
- RadrootsTagValueType::Nip01Coordinate
+ TagValueType::Nip01Coordinate
));
assert!(tag_value_is_valid(
&owned_tag(&["contract", "radroots.knowledge.claim.v1"]),
- RadrootsTagValueType::ContractId
+ TagValueType::ContractId
));
assert!(!tag_value_is_valid(
&owned_tag(&["contract", "radroots.unknown.v1"]),
- RadrootsTagValueType::ContractId
+ TagValueType::ContractId
));
assert!(tag_value_is_valid(
&owned_tag(&["d", "soil"]),
- RadrootsTagValueType::DTag
+ TagValueType::DTag
));
assert!(!tag_value_is_valid(
&owned_tag(&["d", ""]),
- RadrootsTagValueType::DTag
+ TagValueType::DTag
));
assert!(tag_value_is_valid(
&owned_tag(&["e", event_id.as_str()]),
- RadrootsTagValueType::EventId
+ TagValueType::EventId
));
assert!(tag_value_is_valid(
&owned_tag(&["citation", event_id.as_str()]),
- RadrootsTagValueType::Sha256
+ TagValueType::Sha256
));
assert!(!tag_value_is_valid(
&owned_tag(&["e", "not-hex"]),
- RadrootsTagValueType::EventId
+ TagValueType::EventId
));
assert!(tag_value_is_valid(
&valid_pointer,
- RadrootsTagValueType::EventPointer
+ TagValueType::EventPointer
));
assert!(tag_value_is_valid(
&empty_d_pointer,
- RadrootsTagValueType::EventPointer
+ TagValueType::EventPointer
));
assert!(!event_pointer_tag_is_valid(&owned_tag(&[
"source",
@@ -1746,51 +1683,51 @@ fn tag_value_shape_helpers_cover_contract_registry_value_types() {
])));
assert!(tag_value_is_valid(
&owned_tag(&["g", "9q8yy"]),
- RadrootsTagValueType::Geohash
+ TagValueType::Geohash
));
assert!(tag_value_is_valid(
&owned_tag(&["g", "9Q8YY"]),
- RadrootsTagValueType::Geohash
+ TagValueType::Geohash
));
assert!(!tag_value_is_valid(
&owned_tag(&["g", ""]),
- RadrootsTagValueType::Geohash
+ TagValueType::Geohash
));
assert!(!tag_value_is_valid(
&owned_tag(&["g", "1234567890123"]),
- RadrootsTagValueType::Geohash
+ TagValueType::Geohash
));
assert!(!tag_value_is_valid(
&owned_tag(&["g", "aaaaa"]),
- RadrootsTagValueType::Geohash
+ TagValueType::Geohash
));
assert!(tag_value_is_valid(
&owned_tag(&["k", "30818"]),
- RadrootsTagValueType::Kind
+ TagValueType::Kind
));
assert!(!tag_value_is_valid(
&owned_tag(&["k", "not-a-kind"]),
- RadrootsTagValueType::Kind
+ TagValueType::Kind
));
assert!(tag_value_is_valid(
&owned_tag(&["p", public_key.as_str()]),
- RadrootsTagValueType::PublicKey
+ TagValueType::PublicKey
));
assert!(!tag_value_is_valid(
&owned_tag(&["p", "not-hex"]),
- RadrootsTagValueType::PublicKey
+ TagValueType::PublicKey
));
assert!(tag_value_is_valid(
&owned_tag(&["relay", "ws://relay.example.com"]),
- RadrootsTagValueType::RelayUrl
+ TagValueType::RelayUrl
));
assert!(tag_value_is_valid(
&owned_tag(&["relay", "wss://relay.example.com"]),
- RadrootsTagValueType::RelayUrl
+ TagValueType::RelayUrl
));
assert!(!tag_value_is_valid(
&owned_tag(&["relay", "http://relay.example.com"]),
- RadrootsTagValueType::RelayUrl
+ TagValueType::RelayUrl
));
assert!(relay_url_is_valid("ws://relay.example.com"));
assert!(relay_url_is_valid("wss://relay.example.com"));
@@ -1801,31 +1738,31 @@ fn tag_value_shape_helpers_cover_contract_registry_value_types() {
assert!(!relay_url_is_valid("wss://relay.example.com\nmiddle"));
assert!(tag_value_is_valid(
&owned_tag(&["title", "Soil Guide"]),
- RadrootsTagValueType::Text
+ TagValueType::Text
));
assert!(!tag_value_is_valid(
&owned_tag(&["title", " "]),
- RadrootsTagValueType::Text
+ TagValueType::Text
));
assert!(!tag_value_is_valid(
&owned_tag(&["title", "Soil\nGuide"]),
- RadrootsTagValueType::Text
+ TagValueType::Text
));
assert!(tag_value_is_valid(
&owned_tag(&["expiration", "1700000000"]),
- RadrootsTagValueType::UnixTimestamp
+ TagValueType::UnixTimestamp
));
assert!(!tag_value_is_valid(
&owned_tag(&["expiration", "not-time"]),
- RadrootsTagValueType::UnixTimestamp
+ TagValueType::UnixTimestamp
));
assert!(tag_value_is_valid(
&owned_tag(&["image", "https://example.com"]),
- RadrootsTagValueType::Url
+ TagValueType::Url
));
assert!(!tag_value_is_valid(
&owned_tag(&["image", "wss://example.com"]),
- RadrootsTagValueType::Url
+ TagValueType::Url
));
assert!(url_is_valid("http://example.com"));
assert!(url_is_valid("https://example.com"));
@@ -1836,11 +1773,11 @@ fn tag_value_shape_helpers_cover_contract_registry_value_types() {
assert!(!url_is_valid("https://example.com\nmiddle"));
assert!(tag_value_is_valid(
&owned_tag(&["uuid", "123e4567-e89b-12d3-a456-426614174000"]),
- RadrootsTagValueType::Uuid
+ TagValueType::Uuid
));
assert!(!tag_value_is_valid(
&owned_tag(&["uuid", "123e4567-e89b-12d3-a456-42661417400"]),
- RadrootsTagValueType::Uuid
+ TagValueType::Uuid
));
assert!(uuid_is_valid("123e4567-e89b-12d3-a456-426614174000"));
assert!(!uuid_is_valid("123e4567-e89b-12d3-a456-42661417400"));
@@ -1849,23 +1786,23 @@ fn tag_value_shape_helpers_cover_contract_registry_value_types() {
let expectations = [
(
- RadrootsTagValueType::AddressableCoordinate,
+ TagValueType::AddressableCoordinate,
"addressable_coordinate",
),
- (RadrootsTagValueType::ContractId, "contract_id"),
- (RadrootsTagValueType::DTag, "d_tag"),
- (RadrootsTagValueType::EventId, "event_id"),
- (RadrootsTagValueType::EventPointer, "event_pointer"),
- (RadrootsTagValueType::Geohash, "geohash"),
- (RadrootsTagValueType::Kind, "kind"),
- (RadrootsTagValueType::Nip01Coordinate, "nip01_coordinate"),
- (RadrootsTagValueType::PublicKey, "public_key"),
- (RadrootsTagValueType::RelayUrl, "relay_url"),
- (RadrootsTagValueType::Sha256, "sha256"),
- (RadrootsTagValueType::Text, "text"),
- (RadrootsTagValueType::UnixTimestamp, "unix_timestamp"),
- (RadrootsTagValueType::Url, "url"),
- (RadrootsTagValueType::Uuid, "uuid"),
+ (TagValueType::ContractId, "contract_id"),
+ (TagValueType::DTag, "d_tag"),
+ (TagValueType::EventId, "event_id"),
+ (TagValueType::EventPointer, "event_pointer"),
+ (TagValueType::Geohash, "geohash"),
+ (TagValueType::Kind, "kind"),
+ (TagValueType::Nip01Coordinate, "nip01_coordinate"),
+ (TagValueType::PublicKey, "public_key"),
+ (TagValueType::RelayUrl, "relay_url"),
+ (TagValueType::Sha256, "sha256"),
+ (TagValueType::Text, "text"),
+ (TagValueType::UnixTimestamp, "unix_timestamp"),
+ (TagValueType::Url, "url"),
+ (TagValueType::Uuid, "uuid"),
];
for (value_type, expected) in expectations {
assert_eq!(tag_value_type_expectation(value_type), expected);
@@ -1881,7 +1818,7 @@ fn validate_custom_knowledge_contract_rejects_missing_schema_and_bad_version() {
);
assert_eq!(
validate_event_contract_shape(&missing_schema, "radroots.knowledge.claim.v1"),
- Err(RadrootsContractValidationError::MissingContentField {
+ Err(ContractValidationError::MissingContentField {
contract_id: "radroots.knowledge.claim.v1",
field: "schema",
})
@@ -1894,7 +1831,7 @@ fn validate_custom_knowledge_contract_rejects_missing_schema_and_bad_version() {
);
assert_eq!(
validate_event_contract_shape(&bad_version, "radroots.knowledge.claim.v1"),
- Err(RadrootsContractValidationError::ContentFieldMismatch {
+ Err(ContractValidationError::ContentFieldMismatch {
contract_id: "radroots.knowledge.claim.v1",
field: "schema_version",
expected: "1".to_owned(),
@@ -1934,7 +1871,7 @@ fn validates_nip54_empty_redirect_content() {
);
assert_eq!(
validate_event_contract_shape(&invalid, "radroots.wiki.redirect.v1"),
- Err(RadrootsContractValidationError::ContentMustBeEmpty {
+ Err(ContractValidationError::ContentMustBeEmpty {
contract_id: "radroots.wiki.redirect.v1",
})
);
@@ -1944,58 +1881,58 @@ fn validates_nip54_empty_redirect_content() {
fn exposes_validation_error_codes() {
for (error, code) in [
(
- RadrootsContractValidationError::UnknownContract {
+ ContractValidationError::UnknownContract {
contract_id: "missing".to_owned(),
},
"unknown_contract",
),
(
- RadrootsContractValidationError::AdmissionRequired {
+ ContractValidationError::AdmissionRequired {
contract_id: "radroots.social.ask.v1",
},
"admission_required",
),
(
- RadrootsContractValidationError::ContractMatch {
- error: RadrootsContractMatchError::UnsupportedKind(999_999),
+ ContractValidationError::ContractMatch {
+ error: ContractMatchError::UnsupportedKind(999_999),
},
"contract_match",
),
(
- RadrootsContractValidationError::KindMismatch {
+ ContractValidationError::KindMismatch {
expected: KIND_PROFILE,
actual: KIND_POST,
},
"kind_mismatch",
),
(
- RadrootsContractValidationError::ContentMustBeEmpty {
+ ContractValidationError::ContentMustBeEmpty {
contract_id: "radroots.wiki.redirect.v1",
},
"content_must_be_empty",
),
(
- RadrootsContractValidationError::InvalidJsonContent {
+ ContractValidationError::InvalidJsonContent {
contract_id: "radroots.knowledge.claim.v1",
},
"invalid_json_content",
),
(
- RadrootsContractValidationError::MissingTag {
+ ContractValidationError::MissingTag {
contract_id: "radroots.knowledge.claim.v1",
name: "contract",
},
"missing_tag",
),
(
- RadrootsContractValidationError::TagCardinalityMismatch {
+ ContractValidationError::TagCardinalityMismatch {
contract_id: "radroots.knowledge.claim.v1",
name: "contract",
},
"tag_cardinality_mismatch",
),
(
- RadrootsContractValidationError::TagValueMismatch {
+ ContractValidationError::TagValueMismatch {
contract_id: "radroots.knowledge.claim.v1",
name: "contract",
expected: "radroots.knowledge.claim.v1".to_owned(),
@@ -2004,14 +1941,14 @@ fn exposes_validation_error_codes() {
"tag_value_mismatch",
),
(
- RadrootsContractValidationError::MissingContentField {
+ ContractValidationError::MissingContentField {
contract_id: "radroots.knowledge.claim.v1",
field: "schema",
},
"missing_content_field",
),
(
- RadrootsContractValidationError::ContentFieldMismatch {
+ ContractValidationError::ContentFieldMismatch {
contract_id: "radroots.knowledge.claim.v1",
field: "schema",
expected: "radroots.knowledge.claim.v1".to_owned(),
@@ -2019,7 +1956,7 @@ fn exposes_validation_error_codes() {
"content_field_mismatch",
),
(
- RadrootsContractValidationError::ForbiddenContentField {
+ ContractValidationError::ForbiddenContentField {
contract_id: "radroots.knowledge.claim.v1",
field: "review_status",
},
@@ -2043,16 +1980,16 @@ fn tag_helpers_cover_missing_names_and_cardinality_mismatches() {
let malformed = [
tag(
"d",
- RadrootsTagCardinality::OptionalOne,
- RadrootsTagSemantic::Identifier,
- RadrootsTagValueType::DTag,
+ TagCardinality::OptionalOne,
+ TagSemantic::Identifier,
+ TagValueType::DTag,
true,
),
tag(
"p",
- RadrootsTagCardinality::RequiredOne,
- RadrootsTagSemantic::Counterparty,
- RadrootsTagValueType::PublicKey,
+ TagCardinality::RequiredOne,
+ TagSemantic::Counterparty,
+ TagValueType::PublicKey,
true,
),
];
@@ -2060,7 +1997,7 @@ fn tag_helpers_cover_missing_names_and_cardinality_mismatches() {
assert!(
!malformed
.iter()
- .any(|tag| tag.name == "d" && tag.cardinality == RadrootsTagCardinality::RequiredOne)
+ .any(|tag| tag.name == "d" && tag.cardinality == TagCardinality::RequiredOne)
);
}
@@ -2078,7 +2015,7 @@ fn relay_indexed_tags_are_single_letter() {
#[test]
fn addressable_event_contracts_require_d_tags() {
for contract in all_event_contracts() {
- if contract.class == RadrootsEventClass::Addressable {
+ if contract.class == EventClass::Addressable {
let d_tag_cardinality = contract
.tags
.iter()
@@ -2086,7 +2023,7 @@ fn addressable_event_contracts_require_d_tags() {
.map(|tag| tag.cardinality);
assert_eq!(
d_tag_cardinality,
- Some(RadrootsTagCardinality::RequiredOne),
+ Some(TagCardinality::RequiredOne),
"{}",
contract.id
);
diff --git a/crates/event/src/coop.rs b/crates/event/src/coop.rs
@@ -1,6 +1,6 @@
#![forbid(unsafe_code)]
-use crate::farm::change_set::RadrootsGcsLocation;
+use crate::farm::change_set::GcsLocation;
#[cfg(not(feature = "std"))]
use alloc::{string::String, vec::Vec};
@@ -12,14 +12,14 @@ use alloc::{string::String, vec::Vec};
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsCoop {
+pub struct Coop {
pub d_tag: String,
pub name: String,
pub about: Option<String>,
pub website: Option<String>,
pub picture: Option<String>,
pub banner: Option<String>,
- pub location: Option<RadrootsCoopLocation>,
+ pub location: Option<CoopLocation>,
pub tags: Option<Vec<String>>,
}
@@ -30,7 +30,7 @@ pub struct RadrootsCoop {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsCoopRef {
+pub struct CoopRef {
pub pubkey: String,
pub d_tag: String,
}
@@ -42,10 +42,10 @@ pub struct RadrootsCoopRef {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsCoopLocation {
+pub struct CoopLocation {
pub primary: Option<String>,
pub city: Option<String>,
pub region: Option<String>,
pub country: Option<String>,
- pub gcs: RadrootsGcsLocation,
+ pub gcs: GcsLocation,
}
diff --git a/crates/event/src/deletion.rs b/crates/event/src/deletion.rs
@@ -11,10 +11,7 @@ use std::{string::String, vec::Vec};
use core::fmt;
use crate::{
- id::{
- RadrootsEventId, RadrootsIdParseError, RadrootsNip01Coordinate,
- RadrootsNip01CoordinateParseError,
- },
+ id::{EventId, Nip01Coordinate, Nip01CoordinateParseError, ParseError},
wire::{
DEFAULT_CONTENT_MAX_BYTES, DEFAULT_RAW_JSON_MAX_BYTES, DEFAULT_TAG_ELEMENT_MAX_BYTES,
DEFAULT_TAG_MAX_COUNT, DEFAULT_TAG_TOTAL_ELEMENT_MAX_COUNT, DEFAULT_TAG_TOTAL_MAX_BYTES,
@@ -44,10 +41,10 @@ const RADROOTS_NIP09_DELETION_SIGNED_EVENT_FIXED_MAX_BYTES: usize = "{\"id\":\""
#[non_exhaustive]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsNip09DeletionError {
+pub enum Nip09DeletionError {
ContentTooLarge { max: usize, actual: usize },
- EventIdInvalid(RadrootsIdParseError),
- CoordinateInvalid(RadrootsNip01CoordinateParseError),
+ EventIdInvalid(ParseError),
+ CoordinateInvalid(Nip01CoordinateParseError),
TargetKindOutOfRange { max: u32, actual: u32 },
DuplicateEventTarget { event_id: String },
DuplicateAddressTarget { coordinate: String },
@@ -58,7 +55,7 @@ pub enum RadrootsNip09DeletionError {
EventWireTooLarge { max: usize, actual: usize },
}
-impl RadrootsNip09DeletionError {
+impl Nip09DeletionError {
pub const fn code(&self) -> &'static str {
match self {
Self::ContentTooLarge { .. } => "deletion_content_too_large",
@@ -77,7 +74,7 @@ impl RadrootsNip09DeletionError {
}
}
-impl fmt::Display for RadrootsNip09DeletionError {
+impl fmt::Display for Nip09DeletionError {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::ContentTooLarge { max, actual } => write!(
@@ -132,7 +129,7 @@ impl fmt::Display for RadrootsNip09DeletionError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsNip09DeletionError {
+impl std::error::Error for Nip09DeletionError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
Self::EventIdInvalid(error) => Some(error),
@@ -147,18 +144,15 @@ impl std::error::Error for RadrootsNip09DeletionError {
/// The kind hint is required for canonical authored `k` tags. This type does
/// not prove that the target exists or actually has the asserted kind.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsNip09DeletionEventTarget {
- event_id: RadrootsEventId,
+pub struct Nip09DeletionEventTarget {
+ event_id: EventId,
kind_hint: u32,
}
-impl RadrootsNip09DeletionEventTarget {
- pub fn new(
- event_id: RadrootsEventId,
- kind_hint: u32,
- ) -> Result<Self, RadrootsNip09DeletionError> {
+impl Nip09DeletionEventTarget {
+ pub fn new(event_id: EventId, kind_hint: u32) -> Result<Self, Nip09DeletionError> {
if kind_hint > RADROOTS_NIP09_DELETION_TARGET_KIND_MAX {
- return Err(RadrootsNip09DeletionError::TargetKindOutOfRange {
+ return Err(Nip09DeletionError::TargetKindOutOfRange {
max: RADROOTS_NIP09_DELETION_TARGET_KIND_MAX,
actual: kind_hint,
});
@@ -169,18 +163,15 @@ impl RadrootsNip09DeletionEventTarget {
})
}
- pub fn parse(
- event_id: impl AsRef<str>,
- kind_hint: u32,
- ) -> Result<Self, RadrootsNip09DeletionError> {
+ pub fn parse(event_id: impl AsRef<str>, kind_hint: u32) -> Result<Self, Nip09DeletionError> {
Self::new(
- RadrootsEventId::parse(event_id).map_err(RadrootsNip09DeletionError::EventIdInvalid)?,
+ EventId::parse(event_id).map_err(Nip09DeletionError::EventIdInvalid)?,
kind_hint,
)
}
#[inline]
- pub const fn event_id(&self) -> &RadrootsEventId {
+ pub const fn event_id(&self) -> &EventId {
&self.event_id
}
@@ -192,30 +183,30 @@ impl RadrootsNip09DeletionEventTarget {
/// One NIP-01 replaceable or addressable coordinate target.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsNip09DeletionAddressTarget {
- coordinate: RadrootsNip01Coordinate,
+pub struct Nip09DeletionAddressTarget {
+ coordinate: Nip01Coordinate,
}
-impl RadrootsNip09DeletionAddressTarget {
- pub const fn new(coordinate: RadrootsNip01Coordinate) -> Self {
+impl Nip09DeletionAddressTarget {
+ pub const fn new(coordinate: Nip01Coordinate) -> Self {
Self { coordinate }
}
- pub fn parse(coordinate: impl AsRef<str>) -> Result<Self, RadrootsNip09DeletionError> {
+ pub fn parse(coordinate: impl AsRef<str>) -> Result<Self, Nip09DeletionError> {
let coordinate = coordinate.as_ref();
if coordinate.len() > RADROOTS_NIP09_DELETION_TAG_ELEMENT_MAX_BYTES {
- return Err(RadrootsNip09DeletionError::TagElementTooLarge {
+ return Err(Nip09DeletionError::TagElementTooLarge {
max: RADROOTS_NIP09_DELETION_TAG_ELEMENT_MAX_BYTES,
actual: coordinate.len(),
});
}
- RadrootsNip01Coordinate::parse(coordinate)
+ Nip01Coordinate::parse(coordinate)
.map(Self::new)
- .map_err(RadrootsNip09DeletionError::CoordinateInvalid)
+ .map_err(Nip09DeletionError::CoordinateInvalid)
}
#[inline]
- pub const fn coordinate(&self) -> &RadrootsNip01Coordinate {
+ pub const fn coordinate(&self) -> &Nip01Coordinate {
&self.coordinate
}
@@ -235,35 +226,35 @@ impl RadrootsNip09DeletionAddressTarget {
/// This type is opaque and has no Serde construction path.
///
/// ```compile_fail
-/// let _: radroots_event::post::deletion::RadrootsAuthoredNip09DeletionRequest =
+/// let _: radroots_event::post::deletion::AuthoredNip09DeletionRequest =
/// serde_json::from_str(
/// r#"{"content":"","event_targets":[],"address_targets":[]}"#
/// ).unwrap();
/// ```
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsAuthoredNip09DeletionRequest {
+pub struct AuthoredNip09DeletionRequest {
content: String,
- event_targets: Vec<RadrootsNip09DeletionEventTarget>,
- address_targets: Vec<RadrootsNip09DeletionAddressTarget>,
+ event_targets: Vec<Nip09DeletionEventTarget>,
+ address_targets: Vec<Nip09DeletionAddressTarget>,
kind_hints: Vec<u32>,
maximum_signed_event_wire_bytes: usize,
}
-impl RadrootsAuthoredNip09DeletionRequest {
+impl AuthoredNip09DeletionRequest {
pub fn new(
content: impl Into<String>,
- mut event_targets: Vec<RadrootsNip09DeletionEventTarget>,
- mut address_targets: Vec<RadrootsNip09DeletionAddressTarget>,
- ) -> Result<Self, RadrootsNip09DeletionError> {
+ mut event_targets: Vec<Nip09DeletionEventTarget>,
+ mut address_targets: Vec<Nip09DeletionAddressTarget>,
+ ) -> Result<Self, Nip09DeletionError> {
let content = content.into();
if content.len() > RADROOTS_NIP09_DELETION_CONTENT_MAX_BYTES {
- return Err(RadrootsNip09DeletionError::ContentTooLarge {
+ return Err(Nip09DeletionError::ContentTooLarge {
max: RADROOTS_NIP09_DELETION_CONTENT_MAX_BYTES,
actual: content.len(),
});
}
if event_targets.is_empty() && address_targets.is_empty() {
- return Err(RadrootsNip09DeletionError::TargetMissing);
+ return Err(Nip09DeletionError::TargetMissing);
}
let kind_hints = collect_authored_deletion_kind_hints(&event_targets, &address_targets)?;
@@ -280,7 +271,7 @@ impl RadrootsAuthoredNip09DeletionRequest {
.windows(2)
.find(|targets| targets[0].event_id == targets[1].event_id)
{
- return Err(RadrootsNip09DeletionError::DuplicateEventTarget {
+ return Err(Nip09DeletionError::DuplicateEventTarget {
event_id: duplicates[0].event_id.to_string(),
});
}
@@ -290,7 +281,7 @@ impl RadrootsAuthoredNip09DeletionRequest {
.windows(2)
.find(|targets| targets[0].coordinate == targets[1].coordinate)
{
- return Err(RadrootsNip09DeletionError::DuplicateAddressTarget {
+ return Err(Nip09DeletionError::DuplicateAddressTarget {
coordinate: duplicates[0].coordinate.to_string(),
});
}
@@ -310,12 +301,12 @@ impl RadrootsAuthoredNip09DeletionRequest {
}
#[inline]
- pub fn event_targets(&self) -> &[RadrootsNip09DeletionEventTarget] {
+ pub fn event_targets(&self) -> &[Nip09DeletionEventTarget] {
self.event_targets.as_slice()
}
#[inline]
- pub fn address_targets(&self) -> &[RadrootsNip09DeletionAddressTarget] {
+ pub fn address_targets(&self) -> &[Nip09DeletionAddressTarget] {
self.address_targets.as_slice()
}
@@ -339,9 +330,9 @@ impl RadrootsAuthoredNip09DeletionRequest {
}
fn collect_authored_deletion_kind_hints(
- event_targets: &[RadrootsNip09DeletionEventTarget],
- address_targets: &[RadrootsNip09DeletionAddressTarget],
-) -> Result<Vec<u32>, RadrootsNip09DeletionError> {
+ event_targets: &[Nip09DeletionEventTarget],
+ address_targets: &[Nip09DeletionAddressTarget],
+) -> Result<Vec<u32>, Nip09DeletionError> {
const WORD_BITS: usize = u64::BITS as usize;
const WORD_COUNT: usize = (RADROOTS_NIP09_DELETION_TARGET_KIND_MAX as usize + 1) / WORD_BITS;
@@ -364,7 +355,7 @@ fn collect_authored_deletion_kind_hints(
let target_count = event_targets.len().saturating_add(address_targets.len());
let tag_count = target_count.saturating_add(unique_kind_count);
if tag_count > RADROOTS_NIP09_DELETION_TAG_MAX_COUNT {
- return Err(RadrootsNip09DeletionError::TagCountExceeded {
+ return Err(Nip09DeletionError::TagCountExceeded {
max: RADROOTS_NIP09_DELETION_TAG_MAX_COUNT,
actual: tag_count,
});
@@ -384,16 +375,16 @@ fn collect_authored_deletion_kind_hints(
fn validate_authored_deletion_wire_size(
content: &str,
- event_targets: &[RadrootsNip09DeletionEventTarget],
- address_targets: &[RadrootsNip09DeletionAddressTarget],
+ event_targets: &[Nip09DeletionEventTarget],
+ address_targets: &[Nip09DeletionAddressTarget],
kind_hints: &[u32],
-) -> Result<usize, RadrootsNip09DeletionError> {
+) -> Result<usize, Nip09DeletionError> {
let tag_count = event_targets
.len()
.saturating_add(address_targets.len())
.saturating_add(kind_hints.len());
if tag_count > RADROOTS_NIP09_DELETION_TAG_MAX_COUNT {
- return Err(RadrootsNip09DeletionError::TagCountExceeded {
+ return Err(Nip09DeletionError::TagCountExceeded {
max: RADROOTS_NIP09_DELETION_TAG_MAX_COUNT,
actual: tag_count,
});
@@ -433,7 +424,7 @@ fn validate_authored_deletion_wire_size(
}
if tag_bytes > RADROOTS_NIP09_DELETION_TAG_TOTAL_MAX_BYTES {
- return Err(RadrootsNip09DeletionError::TagBytesExceeded {
+ return Err(Nip09DeletionError::TagBytesExceeded {
max: RADROOTS_NIP09_DELETION_TAG_TOTAL_MAX_BYTES,
actual: tag_bytes,
});
@@ -443,7 +434,7 @@ fn validate_authored_deletion_wire_size(
.saturating_add(tags_json_bytes)
.saturating_add(canonical_json_string_bytes(content));
if actual > RADROOTS_NIP09_DELETION_EVENT_WIRE_MAX_BYTES {
- return Err(RadrootsNip09DeletionError::EventWireTooLarge {
+ return Err(Nip09DeletionError::EventWireTooLarge {
max: RADROOTS_NIP09_DELETION_EVENT_WIRE_MAX_BYTES,
actual,
});
@@ -457,10 +448,10 @@ fn add_tag_size(
tag_count: &mut usize,
name: &str,
value: &str,
-) -> Result<(), RadrootsNip09DeletionError> {
+) -> Result<(), Nip09DeletionError> {
for element in [name, value] {
if element.len() > RADROOTS_NIP09_DELETION_TAG_ELEMENT_MAX_BYTES {
- return Err(RadrootsNip09DeletionError::TagElementTooLarge {
+ return Err(Nip09DeletionError::TagElementTooLarge {
max: RADROOTS_NIP09_DELETION_TAG_ELEMENT_MAX_BYTES,
actual: element.len(),
});
@@ -494,22 +485,18 @@ mod tests {
use super::*;
use crate::id::RADROOTS_NIP01_COORDINATE_MAX_BYTES;
- fn event_target(character: char, kind: u32) -> RadrootsNip09DeletionEventTarget {
- RadrootsNip09DeletionEventTarget::parse(character.to_string().repeat(64), kind)
+ fn event_target(character: char, kind: u32) -> Nip09DeletionEventTarget {
+ Nip09DeletionEventTarget::parse(character.to_string().repeat(64), kind)
.expect("event target")
}
- fn numeric_event_target(index: usize, kind: u32) -> RadrootsNip09DeletionEventTarget {
- RadrootsNip09DeletionEventTarget::parse(format!("{index:064x}"), kind)
+ fn numeric_event_target(index: usize, kind: u32) -> Nip09DeletionEventTarget {
+ Nip09DeletionEventTarget::parse(format!("{index:064x}"), kind)
.expect("numeric event target")
}
- fn address_target(
- kind: u32,
- character: char,
- identifier: &str,
- ) -> RadrootsNip09DeletionAddressTarget {
- RadrootsNip09DeletionAddressTarget::parse(format!(
+ fn address_target(kind: u32, character: char, identifier: &str) -> Nip09DeletionAddressTarget {
+ Nip09DeletionAddressTarget::parse(format!(
"{kind}:{}:{identifier}",
crate::test_valid_hex_64(character)
))
@@ -519,11 +506,11 @@ mod tests {
fn address_target_with_total_bytes(
total_bytes: usize,
index: usize,
- ) -> RadrootsNip09DeletionAddressTarget {
+ ) -> Nip09DeletionAddressTarget {
let prefix = format!("30000:{}:", crate::test_valid_hex_64('a'));
let suffix = format!("{index:04x}");
assert!(prefix.len() + suffix.len() <= total_bytes);
- RadrootsNip09DeletionAddressTarget::parse(format!(
+ Nip09DeletionAddressTarget::parse(format!(
"{prefix}{}{suffix}",
"x".repeat(total_bytes - prefix.len() - suffix.len())
))
@@ -532,39 +519,36 @@ mod tests {
#[test]
fn target_constructors_validate_identity_and_kind_hint() {
- let target = RadrootsNip09DeletionEventTarget::parse("A".repeat(64), u16::MAX as u32)
- .expect("event target");
+ let target =
+ Nip09DeletionEventTarget::parse("A".repeat(64), u16::MAX as u32).expect("event target");
assert_eq!(target.event_id().to_hex(), "a".repeat(64));
assert_eq!(target.kind_hint(), u16::MAX as u32);
assert_eq!(
- RadrootsNip09DeletionEventTarget::parse("5".repeat(64), 5)
+ Nip09DeletionEventTarget::parse("5".repeat(64), 5)
.expect("kind-5 target")
.kind_hint(),
5
);
assert!(matches!(
- RadrootsNip09DeletionEventTarget::parse("not-an-id", 1),
- Err(RadrootsNip09DeletionError::EventIdInvalid(
- RadrootsIdParseError::InvalidLength {
+ Nip09DeletionEventTarget::parse("not-an-id", 1),
+ Err(Nip09DeletionError::EventIdInvalid(
+ ParseError::InvalidLength {
expected: 64,
actual: 9
}
))
));
assert_eq!(
- RadrootsNip09DeletionEventTarget::parse("a".repeat(64), u16::MAX as u32 + 1)
- .unwrap_err(),
- RadrootsNip09DeletionError::TargetKindOutOfRange {
+ Nip09DeletionEventTarget::parse("a".repeat(64), u16::MAX as u32 + 1).unwrap_err(),
+ Nip09DeletionError::TargetKindOutOfRange {
max: u16::MAX as u32,
actual: u16::MAX as u32 + 1,
}
);
- let address = RadrootsNip09DeletionAddressTarget::parse(format!(
- "30000:{}:",
- crate::test_valid_hex_64('B')
- ))
- .expect("address target");
+ let address =
+ Nip09DeletionAddressTarget::parse(format!("30000:{}:", crate::test_valid_hex_64('B')))
+ .expect("address target");
assert_eq!(
address.coordinate().as_str(),
format!("30000:{}:", crate::test_valid_hex_64('b'))
@@ -577,8 +561,8 @@ mod tests {
"x".repeat(RADROOTS_NIP09_DELETION_TAG_ELEMENT_MAX_BYTES + 1 - coordinate_prefix.len())
);
assert_eq!(
- RadrootsNip09DeletionAddressTarget::parse(oversized_coordinate),
- Err(RadrootsNip09DeletionError::TagElementTooLarge {
+ Nip09DeletionAddressTarget::parse(oversized_coordinate),
+ Err(Nip09DeletionError::TagElementTooLarge {
max: RADROOTS_NIP09_DELETION_TAG_ELEMENT_MAX_BYTES,
actual: RADROOTS_NIP09_DELETION_TAG_ELEMENT_MAX_BYTES + 1,
})
@@ -588,12 +572,12 @@ mod tests {
#[test]
fn authored_request_allows_event_address_and_mixed_batches() {
let event_only =
- RadrootsAuthoredNip09DeletionRequest::new("", vec![event_target('a', 1)], Vec::new())
+ AuthoredNip09DeletionRequest::new("", vec![event_target('a', 1)], Vec::new())
.expect("event-only request");
assert_eq!(event_only.target_count(), 1);
assert_eq!(event_only.kind_hints(), &[1]);
- let address_only = RadrootsAuthoredNip09DeletionRequest::new(
+ let address_only = AuthoredNip09DeletionRequest::new(
"withdrawn",
Vec::new(),
vec![address_target(30_402, 'b', "victoria-kale")],
@@ -602,7 +586,7 @@ mod tests {
assert_eq!(address_only.target_count(), 1);
assert_eq!(address_only.kind_hints(), &[30_402]);
- let mixed = RadrootsAuthoredNip09DeletionRequest::new(
+ let mixed = AuthoredNip09DeletionRequest::new(
"\t撤回 🌱\n",
vec![event_target('c', 31_922)],
vec![address_target(30_402, 'd', "victoria-carrots")],
@@ -615,7 +599,7 @@ mod tests {
#[test]
fn authored_request_sorts_targets_and_deduplicates_kind_hints() {
- let request = RadrootsAuthoredNip09DeletionRequest::new(
+ let request = AuthoredNip09DeletionRequest::new(
"duplicate crop listing",
vec![event_target('f', 30_402), event_target('a', 1)],
vec![
@@ -647,30 +631,30 @@ mod tests {
#[test]
fn authored_request_rejects_canonical_duplicate_targets() {
let uppercase =
- RadrootsNip09DeletionEventTarget::parse("A".repeat(64), 1).expect("uppercase event");
- let lowercase = RadrootsNip09DeletionEventTarget::parse("a".repeat(64), 31_922)
- .expect("lowercase event");
+ Nip09DeletionEventTarget::parse("A".repeat(64), 1).expect("uppercase event");
+ let lowercase =
+ Nip09DeletionEventTarget::parse("a".repeat(64), 31_922).expect("lowercase event");
assert_eq!(
- RadrootsAuthoredNip09DeletionRequest::new("", vec![uppercase, lowercase], Vec::new(),)
+ AuthoredNip09DeletionRequest::new("", vec![uppercase, lowercase], Vec::new(),)
.unwrap_err(),
- RadrootsNip09DeletionError::DuplicateEventTarget {
+ Nip09DeletionError::DuplicateEventTarget {
event_id: "a".repeat(64)
}
);
- let uppercase_address = RadrootsNip09DeletionAddressTarget::parse(format!(
+ let uppercase_address = Nip09DeletionAddressTarget::parse(format!(
"030402:{}:produce",
crate::test_valid_hex_64('A')
))
.expect("uppercase address");
assert_eq!(
- RadrootsAuthoredNip09DeletionRequest::new(
+ AuthoredNip09DeletionRequest::new(
"",
Vec::new(),
vec![uppercase_address, address_target(30_402, 'a', "produce"),],
)
.unwrap_err(),
- RadrootsNip09DeletionError::DuplicateAddressTarget {
+ Nip09DeletionError::DuplicateAddressTarget {
coordinate: format!("30402:{}:produce", crate::test_valid_hex_64('a'))
}
);
@@ -679,23 +663,23 @@ mod tests {
#[test]
fn authored_request_requires_target_union_and_caps_content() {
assert_eq!(
- RadrootsAuthoredNip09DeletionRequest::new("", Vec::new(), Vec::new()).unwrap_err(),
- RadrootsNip09DeletionError::TargetMissing
+ AuthoredNip09DeletionRequest::new("", Vec::new(), Vec::new()).unwrap_err(),
+ Nip09DeletionError::TargetMissing
);
- RadrootsAuthoredNip09DeletionRequest::new(
+ AuthoredNip09DeletionRequest::new(
"x".repeat(RADROOTS_NIP09_DELETION_CONTENT_MAX_BYTES),
vec![event_target('a', 1)],
Vec::new(),
)
.expect("exact content byte limit");
assert_eq!(
- RadrootsAuthoredNip09DeletionRequest::new(
+ AuthoredNip09DeletionRequest::new(
"x".repeat(RADROOTS_NIP09_DELETION_CONTENT_MAX_BYTES + 1),
vec![event_target('a', 1)],
Vec::new(),
)
.unwrap_err(),
- RadrootsNip09DeletionError::ContentTooLarge {
+ Nip09DeletionError::ContentTooLarge {
max: RADROOTS_NIP09_DELETION_CONTENT_MAX_BYTES,
actual: RADROOTS_NIP09_DELETION_CONTENT_MAX_BYTES + 1,
}
@@ -707,16 +691,15 @@ mod tests {
let exact_targets = (0..RADROOTS_NIP09_DELETION_TAG_MAX_COUNT - 1)
.map(|index| numeric_event_target(index, 1))
.collect();
- RadrootsAuthoredNip09DeletionRequest::new("", exact_targets, Vec::new())
+ AuthoredNip09DeletionRequest::new("", exact_targets, Vec::new())
.expect("1023 targets plus one kind tag");
let overflow_targets = (0..RADROOTS_NIP09_DELETION_TAG_MAX_COUNT)
.map(|index| numeric_event_target(index, 1))
.collect();
assert_eq!(
- RadrootsAuthoredNip09DeletionRequest::new("", overflow_targets, Vec::new())
- .unwrap_err(),
- RadrootsNip09DeletionError::TagCountExceeded {
+ AuthoredNip09DeletionRequest::new("", overflow_targets, Vec::new()).unwrap_err(),
+ Nip09DeletionError::TagCountExceeded {
max: RADROOTS_NIP09_DELETION_TAG_MAX_COUNT,
actual: RADROOTS_NIP09_DELETION_TAG_MAX_COUNT + 1,
}
@@ -724,9 +707,8 @@ mod tests {
let duplicate_overflow = vec![event_target('a', 1); RADROOTS_NIP09_DELETION_TAG_MAX_COUNT];
assert_eq!(
- RadrootsAuthoredNip09DeletionRequest::new("", duplicate_overflow, Vec::new())
- .unwrap_err(),
- RadrootsNip09DeletionError::TagCountExceeded {
+ AuthoredNip09DeletionRequest::new("", duplicate_overflow, Vec::new()).unwrap_err(),
+ Nip09DeletionError::TagCountExceeded {
max: RADROOTS_NIP09_DELETION_TAG_MAX_COUNT,
actual: RADROOTS_NIP09_DELETION_TAG_MAX_COUNT + 1,
}
@@ -736,9 +718,8 @@ mod tests {
#[test]
fn duplicate_address_error_escapes_opaque_identifier_controls() {
let target = address_target(30_000, 'b', "line\nbreak");
- let error =
- RadrootsAuthoredNip09DeletionRequest::new("", Vec::new(), vec![target.clone(), target])
- .unwrap_err();
+ let error = AuthoredNip09DeletionRequest::new("", Vec::new(), vec![target.clone(), target])
+ .unwrap_err();
let rendered = error.to_string();
assert!(rendered.contains("\\n"));
assert!(!rendered.contains('\n'));
@@ -759,7 +740,7 @@ mod tests {
+ "k".len()
+ "30000".len();
assert_eq!(exact_tag_bytes, RADROOTS_NIP09_DELETION_TAG_TOTAL_MAX_BYTES);
- RadrootsAuthoredNip09DeletionRequest::new("", Vec::new(), exact_targets)
+ AuthoredNip09DeletionRequest::new("", Vec::new(), exact_targets)
.expect("exact aggregate tag byte limit");
let mut overflow_targets = (0..31)
@@ -769,9 +750,8 @@ mod tests {
.collect::<Vec<_>>();
overflow_targets.push(address_target_with_total_bytes(4_059, 31));
assert_eq!(
- RadrootsAuthoredNip09DeletionRequest::new("", Vec::new(), overflow_targets)
- .unwrap_err(),
- RadrootsNip09DeletionError::TagBytesExceeded {
+ AuthoredNip09DeletionRequest::new("", Vec::new(), overflow_targets).unwrap_err(),
+ Nip09DeletionError::TagBytesExceeded {
max: RADROOTS_NIP09_DELETION_TAG_TOTAL_MAX_BYTES,
actual: RADROOTS_NIP09_DELETION_TAG_TOTAL_MAX_BYTES + 1,
}
@@ -784,7 +764,7 @@ mod tests {
let mut upper = RADROOTS_NIP09_DELETION_CONTENT_MAX_BYTES;
while lower < upper {
let candidate = lower + (upper - lower).div_ceil(2);
- if RadrootsAuthoredNip09DeletionRequest::new(
+ if AuthoredNip09DeletionRequest::new(
"\u{0001}".repeat(candidate),
vec![event_target('a', 1)],
Vec::new(),
@@ -796,19 +776,19 @@ mod tests {
upper = candidate - 1;
}
}
- RadrootsAuthoredNip09DeletionRequest::new(
+ AuthoredNip09DeletionRequest::new(
"\u{0001}".repeat(lower),
vec![event_target('a', 1)],
Vec::new(),
)
.expect("largest escaped content fitting the wire budget");
assert!(matches!(
- RadrootsAuthoredNip09DeletionRequest::new(
+ AuthoredNip09DeletionRequest::new(
"\u{0001}".repeat(lower + 1),
vec![event_target('a', 1)],
Vec::new(),
),
- Err(RadrootsNip09DeletionError::EventWireTooLarge { max, .. })
+ Err(Nip09DeletionError::EventWireTooLarge { max, .. })
if max == RADROOTS_NIP09_DELETION_EVENT_WIRE_MAX_BYTES
));
}
@@ -816,23 +796,21 @@ mod tests {
#[test]
fn deletion_errors_expose_stable_codes_and_messages() {
let errors = [
- RadrootsNip09DeletionError::ContentTooLarge { max: 1, actual: 2 },
- RadrootsNip09DeletionError::EventIdInvalid(RadrootsIdParseError::InvalidFormat),
- RadrootsNip09DeletionError::TargetKindOutOfRange { max: 1, actual: 2 },
- RadrootsNip09DeletionError::CoordinateInvalid(
- RadrootsNip01CoordinateParseError::InvalidFormat,
- ),
- RadrootsNip09DeletionError::DuplicateEventTarget {
+ Nip09DeletionError::ContentTooLarge { max: 1, actual: 2 },
+ Nip09DeletionError::EventIdInvalid(ParseError::InvalidFormat),
+ Nip09DeletionError::TargetKindOutOfRange { max: 1, actual: 2 },
+ Nip09DeletionError::CoordinateInvalid(Nip01CoordinateParseError::InvalidFormat),
+ Nip09DeletionError::DuplicateEventTarget {
event_id: "a".repeat(64),
},
- RadrootsNip09DeletionError::DuplicateAddressTarget {
+ Nip09DeletionError::DuplicateAddressTarget {
coordinate: format!("30000:{}:", "a".repeat(64)),
},
- RadrootsNip09DeletionError::TargetMissing,
- RadrootsNip09DeletionError::TagCountExceeded { max: 1, actual: 2 },
- RadrootsNip09DeletionError::TagElementTooLarge { max: 1, actual: 2 },
- RadrootsNip09DeletionError::TagBytesExceeded { max: 1, actual: 2 },
- RadrootsNip09DeletionError::EventWireTooLarge { max: 1, actual: 2 },
+ Nip09DeletionError::TargetMissing,
+ Nip09DeletionError::TagCountExceeded { max: 1, actual: 2 },
+ Nip09DeletionError::TagElementTooLarge { max: 1, actual: 2 },
+ Nip09DeletionError::TagBytesExceeded { max: 1, actual: 2 },
+ Nip09DeletionError::EventWireTooLarge { max: 1, actual: 2 },
];
let expected = [
"deletion_content_too_large",
diff --git a/crates/event/src/document.rs b/crates/event/src/document.rs
@@ -10,7 +10,7 @@ use alloc::{string::String, vec::Vec};
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsDocumentSubject {
+pub struct DocumentSubject {
pub pubkey: String,
pub address: Option<String>,
}
@@ -22,7 +22,7 @@ pub struct RadrootsDocumentSubject {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsDocument {
+pub struct Document {
pub d_tag: String,
pub doc_type: String,
pub title: String,
@@ -30,6 +30,6 @@ pub struct RadrootsDocument {
pub summary: Option<String>,
pub effective_at: Option<u32>,
pub body_markdown: Option<String>,
- pub subject: RadrootsDocumentSubject,
+ pub subject: DocumentSubject,
pub tags: Option<Vec<String>>,
}
diff --git a/crates/event/src/draft.rs b/crates/event/src/draft.rs
@@ -7,23 +7,20 @@ use alloc::{borrow::ToOwned, string::String, vec::Vec};
use std::{borrow::ToOwned, string::String, vec::Vec};
use crate::contract::registry_v7::{
- RADROOTS_EVENT_CONTRACT_REGISTRY_VERSION, RadrootsContractValidationError,
- RadrootsEventContract, event_contract, validate_event_contract_parts,
+ ContractValidationError, EventContract, RADROOTS_EVENT_CONTRACT_REGISTRY_VERSION,
+ event_contract, validate_event_contract_parts,
};
-use crate::envelope::{
- RadrootsEventEnvelope, RadrootsEventEnvelopeError, RadrootsEventKind, RadrootsEventTags,
- RadrootsEventTimestamp,
-};
-use crate::id::{RadrootsEventId, RadrootsEventSignature, RadrootsIdParseError, parse_public_key};
+use crate::envelope::{EventEnvelope, EventEnvelopeError, EventKind, EventTags, EventTimestamp};
+use crate::id::{EventId, EventSignature, ParseError, parse_public_key};
use crate::wire::v1::{
- RadrootsCanonicalEventIdError, RadrootsEventWireError, RadrootsNip01EventWire,
- canonical_nip01_event_id_preimage, compute_canonical_nip01_event_id,
+ CanonicalEventIdError, EventWireError, Nip01EventWire, canonical_nip01_event_id_preimage,
+ compute_canonical_nip01_event_id,
};
use core::fmt;
use radroots_identity::PublicKey;
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsDraftError {
+pub enum DraftError {
UnknownContract(String),
ContractKindMismatch {
contract_id: String,
@@ -43,7 +40,7 @@ pub enum RadrootsDraftError {
},
ContractShape {
contract_id: String,
- error: RadrootsContractValidationError,
+ error: ContractValidationError,
},
SignedEventPubkeyMismatch {
expected_pubkey: String,
@@ -73,13 +70,13 @@ pub enum RadrootsDraftError {
expected_event_id: String,
computed_event_id: String,
},
- IdParse(RadrootsIdParseError),
- CanonicalEventId(RadrootsCanonicalEventIdError),
- Envelope(RadrootsEventEnvelopeError),
- SignedEvent(RadrootsSignedEventError),
+ IdParse(ParseError),
+ CanonicalEventId(CanonicalEventIdError),
+ Envelope(EventEnvelopeError),
+ SignedEvent(SignedEventError),
}
-impl fmt::Display for RadrootsDraftError {
+impl fmt::Display for DraftError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::UnknownContract(contract_id) => {
@@ -171,49 +168,49 @@ impl fmt::Display for RadrootsDraftError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsDraftError {}
+impl std::error::Error for DraftError {}
-impl From<RadrootsIdParseError> for RadrootsDraftError {
- fn from(value: RadrootsIdParseError) -> Self {
+impl From<ParseError> for DraftError {
+ fn from(value: ParseError) -> Self {
Self::IdParse(value)
}
}
-impl From<RadrootsCanonicalEventIdError> for RadrootsDraftError {
- fn from(value: RadrootsCanonicalEventIdError) -> Self {
+impl From<CanonicalEventIdError> for DraftError {
+ fn from(value: CanonicalEventIdError) -> Self {
match value {
- RadrootsCanonicalEventIdError::InvalidPubkey(error) => Self::IdParse(error),
+ CanonicalEventIdError::InvalidPubkey(error) => Self::IdParse(error),
error => Self::CanonicalEventId(error),
}
}
}
-impl From<RadrootsEventEnvelopeError> for RadrootsDraftError {
- fn from(value: RadrootsEventEnvelopeError) -> Self {
+impl From<EventEnvelopeError> for DraftError {
+ fn from(value: EventEnvelopeError) -> Self {
Self::Envelope(value)
}
}
-impl From<RadrootsSignedEventError> for RadrootsDraftError {
- fn from(value: RadrootsSignedEventError) -> Self {
+impl From<SignedEventError> for DraftError {
+ fn from(value: SignedEventError) -> Self {
Self::SignedEvent(value)
}
}
#[cfg_attr(any(feature = "serde", test), derive(serde::Serialize))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsEventDraft {
+pub struct EventDraft {
contract_id: String,
contract_registry_version: u32,
- kind: RadrootsEventKind,
- created_at: RadrootsEventTimestamp,
- tags: RadrootsEventTags,
+ kind: EventKind,
+ created_at: EventTimestamp,
+ tags: EventTags,
content: String,
expected_pubkey: PublicKey,
- expected_event_id: RadrootsEventId,
+ expected_event_id: EventId,
}
-impl RadrootsEventDraft {
+impl EventDraft {
pub fn new(
contract_id: impl Into<String>,
kind: u32,
@@ -221,14 +218,14 @@ impl RadrootsEventDraft {
tags: Vec<Vec<String>>,
content: impl Into<String>,
expected_pubkey: impl AsRef<str>,
- ) -> Result<Self, RadrootsDraftError> {
+ ) -> Result<Self, DraftError> {
let contract_id = contract_id.into();
let contract = match event_contract(&contract_id) {
Some(contract) => contract,
- None => return Err(RadrootsDraftError::UnknownContract(contract_id.clone())),
+ None => return Err(DraftError::UnknownContract(contract_id.clone())),
};
if contract.kind != kind {
- return Err(RadrootsDraftError::ContractKindMismatch {
+ return Err(DraftError::ContractKindMismatch {
contract_id,
expected_kind: contract.kind,
actual_kind: kind,
@@ -238,12 +235,12 @@ impl RadrootsEventDraft {
let expected_pubkey = parse_public_key(expected_pubkey.as_ref())?;
let content = content.into();
validate_event_contract_parts(kind, &tags, content.as_str(), contract.id).map_err(
- |error| RadrootsDraftError::ContractShape {
+ |error| DraftError::ContractShape {
contract_id: contract.id.to_owned(),
error,
},
)?;
- let typed_tags = RadrootsEventTags::new(tags)?;
+ let typed_tags = EventTags::new(tags)?;
let expected_pubkey_hex = expected_pubkey.to_hex();
let expected_event_id = compute_nip01_event_id_for_valid_pubkey(
expected_pubkey_hex.as_str(),
@@ -255,8 +252,8 @@ impl RadrootsEventDraft {
Ok(Self {
contract_id: contract.id.to_owned(),
contract_registry_version: RADROOTS_EVENT_CONTRACT_REGISTRY_VERSION,
- kind: RadrootsEventKind::new(kind),
- created_at: RadrootsEventTimestamp::new(created_at),
+ kind: EventKind::new(kind),
+ created_at: EventTimestamp::new(created_at),
tags: typed_tags,
content,
expected_pubkey,
@@ -264,7 +261,7 @@ impl RadrootsEventDraft {
})
}
- pub fn nip01_preimage(&self) -> Result<String, RadrootsDraftError> {
+ pub fn nip01_preimage(&self) -> Result<String, DraftError> {
let expected_pubkey = self.expected_pubkey.to_hex();
Ok(nip01_event_id_preimage_for_valid_pubkey(
expected_pubkey.as_str(),
@@ -279,17 +276,17 @@ impl RadrootsEventDraft {
///
/// Signing boundaries must call this even for a previously validated draft
/// so persisted data cannot bypass current registry authority.
- pub fn validate_for_signing(&self) -> Result<(), RadrootsDraftError> {
+ pub fn validate_for_signing(&self) -> Result<(), DraftError> {
if self.contract_registry_version != RADROOTS_EVENT_CONTRACT_REGISTRY_VERSION {
- return Err(RadrootsDraftError::ContractRegistryVersionMismatch {
+ return Err(DraftError::ContractRegistryVersionMismatch {
expected: RADROOTS_EVENT_CONTRACT_REGISTRY_VERSION,
actual: self.contract_registry_version,
});
}
let contract = event_contract(self.contract_id())
- .ok_or_else(|| RadrootsDraftError::UnknownContract(self.contract_id().to_owned()))?;
+ .ok_or_else(|| DraftError::UnknownContract(self.contract_id().to_owned()))?;
if contract.kind != self.kind_u32() {
- return Err(RadrootsDraftError::ContractKindMismatch {
+ return Err(DraftError::ContractKindMismatch {
contract_id: contract.id.to_owned(),
expected_kind: contract.kind,
actual_kind: self.kind_u32(),
@@ -302,7 +299,7 @@ impl RadrootsEventDraft {
self.content(),
contract.id,
)
- .map_err(|error| RadrootsDraftError::ContractShape {
+ .map_err(|error| DraftError::ContractShape {
contract_id: contract.id.to_owned(),
error,
})?;
@@ -315,7 +312,7 @@ impl RadrootsEventDraft {
self.content(),
);
if actual_event_id != self.expected_event_id {
- return Err(RadrootsDraftError::DraftExpectedEventIdMismatch {
+ return Err(DraftError::DraftExpectedEventIdMismatch {
expected_event_id: actual_event_id.to_hex(),
actual_event_id: self.expected_event_id.to_hex(),
});
@@ -334,7 +331,7 @@ impl RadrootsEventDraft {
}
#[inline]
- pub fn kind(&self) -> RadrootsEventKind {
+ pub fn kind(&self) -> EventKind {
self.kind
}
@@ -344,7 +341,7 @@ impl RadrootsEventDraft {
}
#[inline]
- pub fn created_at(&self) -> RadrootsEventTimestamp {
+ pub fn created_at(&self) -> EventTimestamp {
self.created_at
}
@@ -354,7 +351,7 @@ impl RadrootsEventDraft {
}
#[inline]
- pub fn tags(&self) -> &RadrootsEventTags {
+ pub fn tags(&self) -> &EventTags {
&self.tags
}
@@ -373,7 +370,7 @@ impl RadrootsEventDraft {
}
#[inline]
- pub fn expected_event_id(&self) -> &RadrootsEventId {
+ pub fn expected_event_id(&self) -> &EventId {
&self.expected_event_id
}
@@ -383,11 +380,9 @@ impl RadrootsEventDraft {
}
}
-fn ensure_generic_draft_authorable(
- contract: &RadrootsEventContract,
-) -> Result<(), RadrootsDraftError> {
+fn ensure_generic_draft_authorable(contract: &EventContract) -> Result<(), DraftError> {
if !contract.authoring_policy().permits_generic_draft() {
- return Err(RadrootsDraftError::ContractNotDraftAuthorable {
+ return Err(DraftError::ContractNotDraftAuthorable {
contract_id: contract.id.to_owned(),
});
}
@@ -395,7 +390,7 @@ fn ensure_generic_draft_authorable(
}
#[cfg(any(feature = "serde", test))]
-impl<'de> serde::Deserialize<'de> for RadrootsEventDraft {
+impl<'de> serde::Deserialize<'de> for EventDraft {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
@@ -405,18 +400,18 @@ impl<'de> serde::Deserialize<'de> for RadrootsEventDraft {
struct DraftSerde {
contract_id: String,
contract_registry_version: u32,
- kind: RadrootsEventKind,
- created_at: RadrootsEventTimestamp,
- tags: RadrootsEventTags,
+ kind: EventKind,
+ created_at: EventTimestamp,
+ tags: EventTags,
content: String,
expected_pubkey: PublicKey,
- expected_event_id: RadrootsEventId,
+ expected_event_id: EventId,
}
let value = DraftSerde::deserialize(deserializer)?;
if value.contract_registry_version != RADROOTS_EVENT_CONTRACT_REGISTRY_VERSION {
return Err(serde::de::Error::custom(
- RadrootsDraftError::ContractRegistryVersionMismatch {
+ DraftError::ContractRegistryVersionMismatch {
expected: RADROOTS_EVENT_CONTRACT_REGISTRY_VERSION,
actual: value.contract_registry_version,
},
@@ -433,7 +428,7 @@ impl<'de> serde::Deserialize<'de> for RadrootsEventDraft {
.map_err(serde::de::Error::custom)?;
if draft.expected_event_id != value.expected_event_id {
return Err(serde::de::Error::custom(
- RadrootsDraftError::DraftExpectedEventIdMismatch {
+ DraftError::DraftExpectedEventIdMismatch {
expected_event_id: draft.expected_event_id.to_hex(),
actual_event_id: value.expected_event_id.to_hex(),
},
@@ -448,7 +443,7 @@ impl<'de> serde::Deserialize<'de> for RadrootsEventDraft {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsSignedEventParts {
+pub struct SignedEventParts {
pub id: String,
pub pubkey: String,
pub created_at: u64,
@@ -460,21 +455,21 @@ pub struct RadrootsSignedEventParts {
}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsSignedEvent {
- envelope: RadrootsEventEnvelope,
- wire: RadrootsNip01EventWire,
+pub struct SignedEvent {
+ envelope: EventEnvelope,
+ wire: Nip01EventWire,
raw_json: String,
}
#[cfg(any(feature = "serde", test))]
-impl serde::Serialize for RadrootsSignedEvent {
+impl serde::Serialize for SignedEvent {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
- let mut state = serializer.serialize_struct("RadrootsSignedEvent", 2)?;
+ let mut state = serializer.serialize_struct("SignedEvent", 2)?;
state.serialize_field("wire", &self.wire)?;
state.serialize_field("raw_json", &self.raw_json)?;
state.end()
@@ -482,32 +477,32 @@ impl serde::Serialize for RadrootsSignedEvent {
}
#[cfg(any(feature = "serde", test))]
-impl<'de> serde::Deserialize<'de> for RadrootsSignedEvent {
+impl<'de> serde::Deserialize<'de> for SignedEvent {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
#[derive(serde::Deserialize)]
struct SignedEventSerde {
- wire: RadrootsNip01EventWire,
+ wire: Nip01EventWire,
raw_json: String,
}
let value = SignedEventSerde::deserialize(deserializer)?;
- RadrootsSignedEvent::from_wire_verified_id(value.wire, value.raw_json)
+ SignedEvent::from_wire_verified_id(value.wire, value.raw_json)
.map_err(serde::de::Error::custom)
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsSignedEventError {
- Wire(RadrootsEventWireError),
- RawJson(RadrootsEventWireError),
+pub enum SignedEventError {
+ Wire(EventWireError),
+ RawJson(EventWireError),
RawJsonMismatch,
- Envelope(RadrootsEventEnvelopeError),
+ Envelope(EventEnvelopeError),
}
-impl fmt::Display for RadrootsSignedEventError {
+impl fmt::Display for SignedEventError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Wire(error) => write!(f, "signed event wire is invalid: {error}"),
@@ -524,26 +519,26 @@ impl fmt::Display for RadrootsSignedEventError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsSignedEventError {}
+impl std::error::Error for SignedEventError {}
-impl From<RadrootsEventEnvelopeError> for RadrootsSignedEventError {
- fn from(value: RadrootsEventEnvelopeError) -> Self {
+impl From<EventEnvelopeError> for SignedEventError {
+ fn from(value: EventEnvelopeError) -> Self {
Self::Envelope(value)
}
}
-impl RadrootsSignedEvent {
- pub fn new(parts: RadrootsSignedEventParts) -> Result<Self, RadrootsSignedEventError> {
- let id = RadrootsEventId::parse(parts.id)
- .map_err(RadrootsEventEnvelopeError::InvalidId)?
+impl SignedEvent {
+ pub fn new(parts: SignedEventParts) -> Result<Self, SignedEventError> {
+ let id = EventId::parse(parts.id)
+ .map_err(EventEnvelopeError::InvalidId)?
.into_string();
let pubkey = parse_public_key(parts.pubkey)
- .map_err(RadrootsEventEnvelopeError::InvalidAuthor)?
+ .map_err(EventEnvelopeError::InvalidAuthor)?
.to_hex();
- let sig = RadrootsEventSignature::parse(parts.sig)
- .map_err(RadrootsEventEnvelopeError::InvalidSignature)?
+ let sig = EventSignature::parse(parts.sig)
+ .map_err(EventEnvelopeError::InvalidSignature)?
.into_string();
- let wire = RadrootsNip01EventWire {
+ let wire = Nip01EventWire {
id,
pubkey,
created_at: parts.created_at,
@@ -557,20 +552,20 @@ impl RadrootsSignedEvent {
}
pub fn from_wire_verified_id(
- wire: RadrootsNip01EventWire,
+ wire: Nip01EventWire,
raw_json: impl Into<String>,
- ) -> Result<Self, RadrootsSignedEventError> {
- wire.verify_id().map_err(RadrootsSignedEventError::Wire)?;
+ ) -> Result<Self, SignedEventError> {
+ wire.verify_id().map_err(SignedEventError::Wire)?;
let raw_json = raw_json.into();
- let parsed = RadrootsNip01EventWire::parse_json(raw_json.as_str())
- .map_err(RadrootsSignedEventError::RawJson)?;
+ let parsed =
+ Nip01EventWire::parse_json(raw_json.as_str()).map_err(SignedEventError::RawJson)?;
if parsed != wire {
- return Err(RadrootsSignedEventError::RawJsonMismatch);
+ return Err(SignedEventError::RawJsonMismatch);
}
let envelope = wire
.clone()
.into_envelope_unchecked_id()
- .map_err(RadrootsSignedEventError::Envelope)?;
+ .map_err(SignedEventError::Envelope)?;
Ok(Self {
envelope,
wire,
@@ -580,13 +575,13 @@ impl RadrootsSignedEvent {
#[cfg(test)]
fn from_wire_unchecked(
- wire: RadrootsNip01EventWire,
+ wire: Nip01EventWire,
raw_json: impl Into<String>,
- ) -> Result<Self, RadrootsSignedEventError> {
+ ) -> Result<Self, SignedEventError> {
let envelope = wire
.clone()
.into_envelope_unchecked_id()
- .map_err(RadrootsSignedEventError::Envelope)?;
+ .map_err(SignedEventError::Envelope)?;
Ok(Self {
envelope,
wire,
@@ -595,12 +590,12 @@ impl RadrootsSignedEvent {
}
#[inline]
- pub fn envelope(&self) -> &RadrootsEventEnvelope {
+ pub fn envelope(&self) -> &EventEnvelope {
&self.envelope
}
#[inline]
- pub fn wire(&self) -> &RadrootsNip01EventWire {
+ pub fn wire(&self) -> &Nip01EventWire {
&self.wire
}
@@ -610,7 +605,7 @@ impl RadrootsSignedEvent {
}
#[inline]
- pub fn id(&self) -> &RadrootsEventId {
+ pub fn id(&self) -> &EventId {
self.envelope.id()
}
@@ -650,7 +645,7 @@ impl RadrootsSignedEvent {
}
#[inline]
- pub fn sig(&self) -> &RadrootsEventSignature {
+ pub fn sig(&self) -> &EventSignature {
self.envelope.sig()
}
@@ -667,24 +662,24 @@ impl RadrootsSignedEvent {
}
pub fn validate_signed_nostr_event_matches_draft(
- signed_event: &RadrootsSignedEvent,
- draft: &RadrootsEventDraft,
-) -> Result<(), RadrootsDraftError> {
+ signed_event: &SignedEvent,
+ draft: &EventDraft,
+) -> Result<(), DraftError> {
draft.validate_for_signing()?;
if signed_event.pubkey() != draft.expected_pubkey() {
- return Err(RadrootsDraftError::SignedEventPubkeyMismatch {
+ return Err(DraftError::SignedEventPubkeyMismatch {
expected_pubkey: draft.expected_pubkey().to_hex(),
actual_pubkey: signed_event.pubkey().to_hex(),
});
}
if signed_event.created_at() != draft.created_at_u64() {
- return Err(RadrootsDraftError::SignedEventCreatedAtMismatch {
+ return Err(DraftError::SignedEventCreatedAtMismatch {
expected_created_at: draft.created_at_u64(),
actual_created_at: signed_event.created_at(),
});
}
if signed_event.kind() != draft.kind_u32() {
- return Err(RadrootsDraftError::SignedEventKindMismatch {
+ return Err(DraftError::SignedEventKindMismatch {
expected_kind: draft.kind_u32(),
actual_kind: signed_event.kind(),
});
@@ -692,19 +687,19 @@ pub fn validate_signed_nostr_event_matches_draft(
let signed_tags = signed_event.tags_as_vec();
let draft_tags = draft.tags_as_vec();
if signed_tags != draft_tags {
- return Err(RadrootsDraftError::SignedEventTagsMismatch {
+ return Err(DraftError::SignedEventTagsMismatch {
expected_len: draft_tags.len(),
actual_len: signed_tags.len(),
});
}
if signed_event.content() != draft.content() {
- return Err(RadrootsDraftError::SignedEventContentMismatch {
+ return Err(DraftError::SignedEventContentMismatch {
expected_len: draft.content().len(),
actual_len: signed_event.content().len(),
});
}
if signed_event.id() != draft.expected_event_id() {
- return Err(RadrootsDraftError::SignedEventIdMismatch {
+ return Err(DraftError::SignedEventIdMismatch {
expected_event_id: draft.expected_event_id.to_hex(),
actual_event_id: signed_event.id().to_hex(),
});
@@ -718,7 +713,7 @@ pub fn validate_signed_nostr_event_matches_draft(
signed_event.content(),
);
if computed_event_id != *signed_event.id() {
- return Err(RadrootsDraftError::SignedEventComputedIdMismatch {
+ return Err(DraftError::SignedEventComputedIdMismatch {
expected_event_id: signed_event.id().to_hex(),
computed_event_id: computed_event_id.to_hex(),
});
@@ -732,7 +727,7 @@ pub fn compute_nip01_event_id(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsEventId, RadrootsDraftError> {
+) -> Result<EventId, DraftError> {
parse_public_key(pubkey)?;
Ok(compute_nip01_event_id_for_valid_pubkey(
pubkey, created_at, kind, tags, content,
@@ -745,7 +740,7 @@ pub fn nip01_event_id_preimage(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<String, RadrootsDraftError> {
+) -> Result<String, DraftError> {
parse_public_key(pubkey)?;
Ok(nip01_event_id_preimage_for_valid_pubkey(
pubkey, created_at, kind, tags, content,
@@ -759,7 +754,7 @@ fn compute_nip01_event_id_for_valid_pubkey(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> RadrootsEventId {
+) -> EventId {
compute_canonical_nip01_event_id(pubkey, created_at, kind, tags, content)
.expect("a validated public key always produces a canonical event id")
}
@@ -792,7 +787,7 @@ mod tests {
core::iter::repeat_n(character, 128).collect()
}
- fn raw_json_for_wire(wire: &RadrootsNip01EventWire) -> String {
+ fn raw_json_for_wire(wire: &Nip01EventWire) -> String {
serde_json::to_string(&serde_json::json!({
"id": wire.id,
"pubkey": wire.pubkey,
@@ -812,7 +807,7 @@ mod tests {
tags: Vec<Vec<String>>,
content: String,
sig: String,
- ) -> RadrootsNip01EventWire {
+ ) -> Nip01EventWire {
let id = compute_canonical_nip01_event_id(
pubkey.as_str(),
created_at,
@@ -822,7 +817,7 @@ mod tests {
)
.expect("event id")
.into_string();
- RadrootsNip01EventWire {
+ Nip01EventWire {
id,
pubkey,
created_at,
@@ -842,8 +837,8 @@ mod tests {
tags: Vec<Vec<String>>,
content: String,
sig: String,
- ) -> RadrootsNip01EventWire {
- RadrootsNip01EventWire {
+ ) -> Nip01EventWire {
+ Nip01EventWire {
id,
pubkey,
created_at,
@@ -855,7 +850,7 @@ mod tests {
}
}
- fn signed_event_for_draft(draft: &RadrootsEventDraft) -> RadrootsSignedEvent {
+ fn signed_event_for_draft(draft: &EventDraft) -> SignedEvent {
let wire = verified_wire(
draft.expected_pubkey().to_hex(),
draft.created_at_u64(),
@@ -865,11 +860,11 @@ mod tests {
hex_128('b'),
);
let raw_json = raw_json_for_wire(&wire);
- RadrootsSignedEvent::from_wire_verified_id(wire, raw_json).expect("signed event")
+ SignedEvent::from_wire_verified_id(wire, raw_json).expect("signed event")
}
- fn generic_draft() -> RadrootsEventDraft {
- RadrootsEventDraft::new(
+ fn generic_draft() -> EventDraft {
+ EventDraft::new(
"radroots.social.geochat.v1",
KIND_GEOCHAT,
1_700_000_000,
@@ -886,7 +881,7 @@ mod tests {
#[test]
fn draft_computes_expected_event_id() {
- let draft = RadrootsEventDraft::new(
+ let draft = EventDraft::new(
"radroots.social.geochat.v1",
KIND_GEOCHAT,
1_700_000_000,
@@ -955,11 +950,11 @@ mod tests {
#[test]
fn draft_constructor_rejects_unknown_contract_and_kind_mismatch() {
- let unknown = RadrootsEventDraft::new("missing", KIND_POST, 1, Vec::new(), "", hex_64('a'))
+ let unknown = EventDraft::new("missing", KIND_POST, 1, Vec::new(), "", hex_64('a'))
.expect_err("unknown contract");
- assert!(matches!(unknown, RadrootsDraftError::UnknownContract(_)));
+ assert!(matches!(unknown, DraftError::UnknownContract(_)));
- let mismatch = RadrootsEventDraft::new(
+ let mismatch = EventDraft::new(
"radroots.social.post.v1",
KIND_PROFILE,
1,
@@ -968,12 +963,9 @@ mod tests {
hex_64('a'),
)
.expect_err("kind mismatch");
- assert!(matches!(
- mismatch,
- RadrootsDraftError::ContractKindMismatch { .. }
- ));
+ assert!(matches!(mismatch, DraftError::ContractKindMismatch { .. }));
- let invalid_pubkey = RadrootsEventDraft::new(
+ let invalid_pubkey = EventDraft::new(
"radroots.social.geochat.v1",
KIND_GEOCHAT,
1,
@@ -982,7 +974,7 @@ mod tests {
"not-hex",
)
.expect_err("invalid pubkey");
- assert!(matches!(invalid_pubkey, RadrootsDraftError::IdParse(_)));
+ assert!(matches!(invalid_pubkey, DraftError::IdParse(_)));
}
#[test]
@@ -997,12 +989,11 @@ mod tests {
("radroots.social.deletion_request.v1", KIND_DELETION_REQUEST),
("radroots.social.comment.v1", KIND_COMMENT),
] {
- let error =
- RadrootsEventDraft::new(contract_id, kind, 1, Vec::new(), "hello", hex_64('a'))
- .expect_err("governed typed or read-only contract must reject generic drafts");
+ let error = EventDraft::new(contract_id, kind, 1, Vec::new(), "hello", hex_64('a'))
+ .expect_err("governed typed or read-only contract must reject generic drafts");
assert_eq!(
error,
- RadrootsDraftError::ContractNotDraftAuthorable {
+ DraftError::ContractNotDraftAuthorable {
contract_id: contract_id.to_owned(),
}
);
@@ -1013,44 +1004,44 @@ mod tests {
fn draft_deserialization_revalidates_registry_policy_shape_and_event_id() {
let draft = generic_draft();
let value = serde_json::to_value(&draft).expect("draft json");
- let decoded: RadrootsEventDraft =
+ let decoded: EventDraft =
serde_json::from_value(value.clone()).expect("validated roundtrip");
assert_eq!(decoded, draft);
for stale_version in 1..RADROOTS_EVENT_CONTRACT_REGISTRY_VERSION {
let mut tampered = value.clone();
tampered["contract_registry_version"] = serde_json::json!(stale_version);
- let error = serde_json::from_value::<RadrootsEventDraft>(tampered)
+ let error = serde_json::from_value::<EventDraft>(tampered)
.expect_err("stale registry generation must fail");
assert!(error.to_string().contains("registry version mismatch"));
}
let mut tampered = value.clone();
tampered["expected_event_id"] = serde_json::Value::String(hex_64('f'));
- let error = serde_json::from_value::<RadrootsEventDraft>(tampered)
+ let error = serde_json::from_value::<EventDraft>(tampered)
.expect_err("tampered deterministic ID must fail");
assert!(error.to_string().contains("frozen draft event ID mismatch"));
let mut tampered = value.clone();
tampered["contract_id"] = serde_json::Value::String("missing".to_owned());
- let error = serde_json::from_value::<RadrootsEventDraft>(tampered)
+ let error = serde_json::from_value::<EventDraft>(tampered)
.expect_err("unknown persisted contract must fail");
assert!(error.to_string().contains("unknown event contract"));
let mut tampered = value.clone();
tampered["kind"] = serde_json::json!(KIND_PROFILE);
- let error = serde_json::from_value::<RadrootsEventDraft>(tampered)
+ let error = serde_json::from_value::<EventDraft>(tampered)
.expect_err("persisted contract kind mismatch must fail");
assert!(error.to_string().contains("expects kind"));
let mut tampered = value.clone();
tampered["contract_id"] = serde_json::Value::String("radroots.social.post.v1".to_owned());
tampered["kind"] = serde_json::json!(KIND_POST);
- let error = serde_json::from_value::<RadrootsEventDraft>(tampered)
+ let error = serde_json::from_value::<EventDraft>(tampered)
.expect_err("read-only persisted contract must fail");
assert!(error.to_string().contains("not authorable"));
- let json_draft = RadrootsEventDraft::new(
+ let json_draft = EventDraft::new(
"radroots.farm.crdt_change.v1",
KIND_FARM_CRDT_CHANGE,
1,
@@ -1061,20 +1052,20 @@ mod tests {
.expect("generic JSON draft");
let mut tampered = serde_json::to_value(json_draft).expect("JSON draft value");
tampered["content"] = serde_json::Value::String("not-json".to_owned());
- let error = serde_json::from_value::<RadrootsEventDraft>(tampered)
+ let error = serde_json::from_value::<EventDraft>(tampered)
.expect_err("persisted contract shape mismatch must fail");
assert!(error.to_string().contains("shape validation failed"));
let mut tampered = value;
tampered["unexpected"] = serde_json::json!(true);
- let error = serde_json::from_value::<RadrootsEventDraft>(tampered)
+ let error = serde_json::from_value::<EventDraft>(tampered)
.expect_err("unknown persisted draft field must fail");
assert!(error.to_string().contains("unknown field"));
}
#[test]
fn draft_constructor_rejects_contract_shape_errors() {
- let missing_contract = RadrootsEventDraft::new(
+ let missing_contract = EventDraft::new(
"radroots.knowledge.claim.v1",
KIND_KNOWLEDGE_CLAIM,
1,
@@ -1085,8 +1076,8 @@ mod tests {
.expect_err("missing contract tag");
assert!(matches!(
missing_contract,
- RadrootsDraftError::ContractShape {
- error: RadrootsContractValidationError::MissingTag {
+ DraftError::ContractShape {
+ error: ContractValidationError::MissingTag {
name: "contract",
..
},
@@ -1094,7 +1085,7 @@ mod tests {
}
));
- let invalid_event_pointer = RadrootsEventDraft::new(
+ let invalid_event_pointer = EventDraft::new(
"radroots.knowledge.claim.v1",
KIND_KNOWLEDGE_CLAIM,
1,
@@ -1117,13 +1108,13 @@ mod tests {
.expect_err("invalid event pointer");
assert!(matches!(
invalid_event_pointer,
- RadrootsDraftError::ContractShape {
- error: RadrootsContractValidationError::TagValueMismatch { name: "source", .. },
+ DraftError::ContractShape {
+ error: ContractValidationError::TagValueMismatch { name: "source", .. },
..
}
));
- let invalid_relay = RadrootsEventDraft::new(
+ let invalid_relay = EventDraft::new(
"radroots.knowledge.claim.v1",
KIND_KNOWLEDGE_CLAIM,
1,
@@ -1147,13 +1138,13 @@ mod tests {
.expect_err("invalid event pointer relay");
assert!(matches!(
invalid_relay,
- RadrootsDraftError::ContractShape {
- error: RadrootsContractValidationError::TagValueMismatch { name: "source", .. },
+ DraftError::ContractShape {
+ error: ContractValidationError::TagValueMismatch { name: "source", .. },
..
}
));
- let invalid_json = RadrootsEventDraft::new(
+ let invalid_json = EventDraft::new(
"radroots.knowledge.claim.v1",
KIND_KNOWLEDGE_CLAIM,
1,
@@ -1167,8 +1158,8 @@ mod tests {
.expect_err("invalid json");
assert!(matches!(
invalid_json,
- RadrootsDraftError::ContractShape {
- error: RadrootsContractValidationError::InvalidJsonContent { .. },
+ DraftError::ContractShape {
+ error: ContractValidationError::InvalidJsonContent { .. },
..
}
));
@@ -1185,7 +1176,7 @@ mod tests {
hex_128('f'),
);
let raw_json = raw_json_for_wire(&wire);
- let signed = RadrootsSignedEvent::new(RadrootsSignedEventParts {
+ let signed = SignedEvent::new(SignedEventParts {
id: wire.id.clone(),
pubkey: wire.pubkey.clone(),
created_at: wire.created_at,
@@ -1197,7 +1188,7 @@ mod tests {
})
.expect("signed event");
let json = serde_json::to_string(&signed).expect("serialize");
- let decoded: RadrootsSignedEvent = serde_json::from_str(&json).expect("deserialize");
+ let decoded: SignedEvent = serde_json::from_str(&json).expect("deserialize");
assert_eq!(decoded, signed);
assert_eq!(decoded.envelope().id_hex(), decoded.id_hex());
@@ -1223,7 +1214,7 @@ mod tests {
hex_128('3'),
);
let raw_json = raw_json_for_wire(&wire);
- let signed = RadrootsSignedEvent::from_wire_verified_id(wire.clone(), raw_json.clone())
+ let signed = SignedEvent::from_wire_verified_id(wire.clone(), raw_json.clone())
.expect("signed event");
assert_eq!(signed.id_hex(), wire.id);
@@ -1231,7 +1222,7 @@ mod tests {
assert_eq!(signed.signature_hex(), hex_128('3'));
assert_eq!(signed.raw_json(), raw_json);
- let invalid = RadrootsSignedEvent::new(RadrootsSignedEventParts {
+ let invalid = SignedEvent::new(SignedEventParts {
id: "not-hex".to_owned(),
pubkey: hex_64('e'),
created_at: 10,
@@ -1244,10 +1235,10 @@ mod tests {
.expect_err("invalid id");
assert!(matches!(
invalid,
- RadrootsSignedEventError::Envelope(RadrootsEventEnvelopeError::InvalidId(_))
+ SignedEventError::Envelope(EventEnvelopeError::InvalidId(_))
));
- let invalid = RadrootsSignedEvent::new(RadrootsSignedEventParts {
+ let invalid = SignedEvent::new(SignedEventParts {
id: hex_64('d'),
pubkey: "not-hex".to_owned(),
created_at: 10,
@@ -1260,10 +1251,10 @@ mod tests {
.expect_err("invalid pubkey");
assert!(matches!(
invalid,
- RadrootsSignedEventError::Envelope(RadrootsEventEnvelopeError::InvalidAuthor(_))
+ SignedEventError::Envelope(EventEnvelopeError::InvalidAuthor(_))
));
- let invalid = RadrootsSignedEvent::new(RadrootsSignedEventParts {
+ let invalid = SignedEvent::new(SignedEventParts {
id: hex_64('d'),
pubkey: hex_64('e'),
created_at: 10,
@@ -1276,15 +1267,12 @@ mod tests {
.expect_err("invalid sig");
assert!(matches!(
invalid,
- RadrootsSignedEventError::Envelope(RadrootsEventEnvelopeError::InvalidSignature(_))
+ SignedEventError::Envelope(EventEnvelopeError::InvalidSignature(_))
));
let mismatched_raw =
- RadrootsSignedEvent::from_wire_verified_id(wire, "{}").expect_err("raw mismatch");
- assert!(matches!(
- mismatched_raw,
- RadrootsSignedEventError::RawJson(_)
- ));
+ SignedEvent::from_wire_verified_id(wire, "{}").expect_err("raw mismatch");
+ assert!(matches!(mismatched_raw, SignedEventError::RawJson(_)));
}
#[test]
@@ -1299,7 +1287,7 @@ mod tests {
fn signed_event_validation_rejects_draft_mismatches() {
let draft = generic_draft();
- let signed = RadrootsSignedEvent::from_wire_unchecked(
+ let signed = SignedEvent::from_wire_unchecked(
unchecked_wire(
draft.expected_event_id_hex(),
hex_64('c'),
@@ -1316,10 +1304,10 @@ mod tests {
validate_signed_nostr_event_matches_draft(&signed, &draft).expect_err("mismatch");
assert!(matches!(
error,
- RadrootsDraftError::SignedEventPubkeyMismatch { .. }
+ DraftError::SignedEventPubkeyMismatch { .. }
));
- let signed = RadrootsSignedEvent::from_wire_unchecked(
+ let signed = SignedEvent::from_wire_unchecked(
unchecked_wire(
hex_64('d'),
draft.expected_pubkey().to_hex(),
@@ -1334,12 +1322,9 @@ mod tests {
.expect("unchecked signed event");
let error =
validate_signed_nostr_event_matches_draft(&signed, &draft).expect_err("mismatch");
- assert!(matches!(
- error,
- RadrootsDraftError::SignedEventIdMismatch { .. }
- ));
+ assert!(matches!(error, DraftError::SignedEventIdMismatch { .. }));
- let signed = RadrootsSignedEvent::from_wire_unchecked(
+ let signed = SignedEvent::from_wire_unchecked(
unchecked_wire(
draft.expected_event_id_hex(),
draft.expected_pubkey().to_hex(),
@@ -1356,10 +1341,10 @@ mod tests {
validate_signed_nostr_event_matches_draft(&signed, &draft).expect_err("mismatch");
assert!(matches!(
error,
- RadrootsDraftError::SignedEventCreatedAtMismatch { .. }
+ DraftError::SignedEventCreatedAtMismatch { .. }
));
- let signed = RadrootsSignedEvent::from_wire_unchecked(
+ let signed = SignedEvent::from_wire_unchecked(
unchecked_wire(
draft.expected_event_id_hex(),
draft.expected_pubkey().to_hex(),
@@ -1374,14 +1359,11 @@ mod tests {
.expect("unchecked signed event");
let error =
validate_signed_nostr_event_matches_draft(&signed, &draft).expect_err("mismatch");
- assert!(matches!(
- error,
- RadrootsDraftError::SignedEventKindMismatch { .. }
- ));
+ assert!(matches!(error, DraftError::SignedEventKindMismatch { .. }));
let mut tags = draft.tags_as_vec();
tags.push(vec!["p".to_owned(), hex_64('e')]);
- let signed = RadrootsSignedEvent::from_wire_unchecked(
+ let signed = SignedEvent::from_wire_unchecked(
unchecked_wire(
draft.expected_event_id_hex(),
draft.expected_pubkey().to_hex(),
@@ -1396,12 +1378,9 @@ mod tests {
.expect("unchecked signed event");
let error =
validate_signed_nostr_event_matches_draft(&signed, &draft).expect_err("mismatch");
- assert!(matches!(
- error,
- RadrootsDraftError::SignedEventTagsMismatch { .. }
- ));
+ assert!(matches!(error, DraftError::SignedEventTagsMismatch { .. }));
- let signed = RadrootsSignedEvent::from_wire_unchecked(
+ let signed = SignedEvent::from_wire_unchecked(
unchecked_wire(
draft.expected_event_id_hex(),
draft.expected_pubkey().to_hex(),
@@ -1418,73 +1397,71 @@ mod tests {
validate_signed_nostr_event_matches_draft(&signed, &draft).expect_err("mismatch");
assert!(matches!(
error,
- RadrootsDraftError::SignedEventContentMismatch { .. }
+ DraftError::SignedEventContentMismatch { .. }
));
}
#[test]
fn draft_errors_format_all_variants() {
let errors = [
- RadrootsDraftError::UnknownContract("missing".to_owned()),
- RadrootsDraftError::ContractKindMismatch {
+ DraftError::UnknownContract("missing".to_owned()),
+ DraftError::ContractKindMismatch {
contract_id: "radroots.social.post.v1".to_owned(),
expected_kind: KIND_POST,
actual_kind: KIND_PROFILE,
},
- RadrootsDraftError::ContractNotDraftAuthorable {
+ DraftError::ContractNotDraftAuthorable {
contract_id: "radroots.social.post.v1".to_owned(),
},
- RadrootsDraftError::ContractRegistryVersionMismatch {
+ DraftError::ContractRegistryVersionMismatch {
expected: RADROOTS_EVENT_CONTRACT_REGISTRY_VERSION,
actual: 1,
},
- RadrootsDraftError::DraftExpectedEventIdMismatch {
+ DraftError::DraftExpectedEventIdMismatch {
expected_event_id: hex_64('a'),
actual_event_id: hex_64('b'),
},
- RadrootsDraftError::ContractShape {
+ DraftError::ContractShape {
contract_id: "radroots.knowledge.claim.v1".to_owned(),
- error: RadrootsContractValidationError::MissingTag {
+ error: ContractValidationError::MissingTag {
contract_id: "radroots.knowledge.claim.v1",
name: "contract",
},
},
- RadrootsDraftError::SignedEventPubkeyMismatch {
+ DraftError::SignedEventPubkeyMismatch {
expected_pubkey: hex_64('a'),
actual_pubkey: hex_64('b'),
},
- RadrootsDraftError::SignedEventIdMismatch {
+ DraftError::SignedEventIdMismatch {
expected_event_id: hex_64('c'),
actual_event_id: hex_64('d'),
},
- RadrootsDraftError::SignedEventCreatedAtMismatch {
+ DraftError::SignedEventCreatedAtMismatch {
expected_created_at: 1,
actual_created_at: 2,
},
- RadrootsDraftError::SignedEventKindMismatch {
+ DraftError::SignedEventKindMismatch {
expected_kind: KIND_POST,
actual_kind: KIND_PROFILE,
},
- RadrootsDraftError::SignedEventTagsMismatch {
+ DraftError::SignedEventTagsMismatch {
expected_len: 1,
actual_len: 2,
},
- RadrootsDraftError::SignedEventContentMismatch {
+ DraftError::SignedEventContentMismatch {
expected_len: 5,
actual_len: 7,
},
- RadrootsDraftError::SignedEventComputedIdMismatch {
+ DraftError::SignedEventComputedIdMismatch {
expected_event_id: hex_64('e'),
computed_event_id: hex_64('f'),
},
- RadrootsDraftError::from(RadrootsIdParseError::Empty),
- RadrootsDraftError::CanonicalEventId(
- RadrootsCanonicalEventIdError::InvalidComputedEventId(
- RadrootsIdParseError::InvalidFormat,
- ),
- ),
- RadrootsDraftError::from(RadrootsEventEnvelopeError::NonCanonicalId),
- RadrootsDraftError::from(RadrootsSignedEventError::RawJsonMismatch),
+ DraftError::from(ParseError::Empty),
+ DraftError::CanonicalEventId(CanonicalEventIdError::InvalidComputedEventId(
+ ParseError::InvalidFormat,
+ )),
+ DraftError::from(EventEnvelopeError::NonCanonicalId),
+ DraftError::from(SignedEventError::RawJsonMismatch),
];
for error in errors {
@@ -1492,26 +1469,24 @@ mod tests {
}
assert!(
- RadrootsDraftError::CanonicalEventId(
- RadrootsCanonicalEventIdError::InvalidComputedEventId(
- RadrootsIdParseError::InvalidFormat,
- ),
- )
+ DraftError::CanonicalEventId(CanonicalEventIdError::InvalidComputedEventId(
+ ParseError::InvalidFormat,
+ ),)
.to_string()
.contains("canonical event id digest")
);
assert!(matches!(
- RadrootsDraftError::from(RadrootsCanonicalEventIdError::InvalidPubkey(
- RadrootsIdParseError::InvalidFormat,
+ DraftError::from(CanonicalEventIdError::InvalidPubkey(
+ ParseError::InvalidFormat,
)),
- RadrootsDraftError::IdParse(_)
+ DraftError::IdParse(_)
));
assert!(matches!(
- RadrootsDraftError::from(RadrootsCanonicalEventIdError::InvalidComputedEventId(
- RadrootsIdParseError::InvalidFormat,
+ DraftError::from(CanonicalEventIdError::InvalidComputedEventId(
+ ParseError::InvalidFormat,
)),
- RadrootsDraftError::CanonicalEventId(_)
+ DraftError::CanonicalEventId(_)
));
}
@@ -1541,14 +1516,10 @@ mod tests {
assert_eq!(signed.sig().to_hex(), signed.signature_hex());
for error in [
- RadrootsSignedEventError::Wire(RadrootsEventWireError::NonCanonicalIdentifier {
- field: "id",
- }),
- RadrootsSignedEventError::RawJson(RadrootsEventWireError::NonCanonicalIdentifier {
- field: "id",
- }),
- RadrootsSignedEventError::RawJsonMismatch,
- RadrootsSignedEventError::from(RadrootsEventEnvelopeError::NonCanonicalId),
+ SignedEventError::Wire(EventWireError::NonCanonicalIdentifier { field: "id" }),
+ SignedEventError::RawJson(EventWireError::NonCanonicalIdentifier { field: "id" }),
+ SignedEventError::RawJsonMismatch,
+ SignedEventError::from(EventEnvelopeError::NonCanonicalId),
] {
assert!(!error.to_string().is_empty());
}
@@ -1565,19 +1536,18 @@ mod tests {
)
.expect("different id")
.into_string();
- let error =
- RadrootsSignedEvent::from_wire_verified_id(wire, raw_json_for_wire(&different_wire))
- .expect_err("raw JSON mismatch");
- assert_eq!(error, RadrootsSignedEventError::RawJsonMismatch);
+ let error = SignedEvent::from_wire_verified_id(wire, raw_json_for_wire(&different_wire))
+ .expect_err("raw JSON mismatch");
+ assert_eq!(error, SignedEventError::RawJsonMismatch);
}
#[test]
fn event_id_computation_rejects_invalid_pubkeys() {
let error =
compute_nip01_event_id("not-hex", 1, KIND_POST, &[], "").expect_err("invalid pubkey");
- assert!(matches!(error, RadrootsDraftError::IdParse(_)));
+ assert!(matches!(error, DraftError::IdParse(_)));
let error = nip01_event_id_preimage("not-hex", 1, KIND_POST, &[], "")
.expect_err("invalid preimage pubkey");
- assert!(matches!(error, RadrootsDraftError::IdParse(_)));
+ assert!(matches!(error, DraftError::IdParse(_)));
}
}
diff --git a/crates/event/src/dto.rs b/crates/event/src/dto.rs
@@ -1,10 +1,10 @@
#![allow(dead_code, unused_imports)]
-use crate::envelope::RadrootsEventEnvelope;
+use crate::envelope::EventEnvelope;
#[derive(dto_bindgen::Dto)]
#[dto(export)]
-pub struct RadrootsNip01EventWireDto {
+pub struct Nip01EventWireDto {
pub id: String,
pub pubkey: String,
#[dto(int = "json_number")]
@@ -13,13 +13,13 @@ pub struct RadrootsNip01EventWireDto {
pub tags: Vec<Vec<String>>,
pub content: String,
pub sig: String,
- pub extra: RadrootsNip01EventExtraDto,
+ pub extra: Nip01EventExtraDto,
}
#[derive(dto_bindgen::Dto)]
#[dto(export)]
#[dto(as = "string_enum")]
-pub enum RadrootsSignedEventVerificationStateDto {
+pub enum SignedEventVerificationStateDto {
#[dto(rename = "id_verified")]
IdVerified,
}
@@ -27,30 +27,30 @@ pub enum RadrootsSignedEventVerificationStateDto {
#[derive(dto_bindgen::Dto)]
#[dto(export)]
#[dto(as = "string_enum")]
-pub enum RadrootsVerifiedSignedEventVerificationStateDto {
+pub enum VerifiedSignedEventVerificationStateDto {
#[dto(rename = "signature_verified")]
SignatureVerified,
}
#[derive(dto_bindgen::Dto)]
#[dto(export)]
-pub struct RadrootsSignedEventDto {
- pub state: RadrootsSignedEventVerificationStateDto,
- pub envelope: RadrootsEventEnvelope,
- pub wire: RadrootsNip01EventWireDto,
+pub struct SignedEventDto {
+ pub state: SignedEventVerificationStateDto,
+ pub envelope: EventEnvelope,
+ pub wire: Nip01EventWireDto,
pub raw_json: String,
}
#[derive(dto_bindgen::Dto)]
#[dto(export)]
-pub struct RadrootsVerifiedSignedEventDto {
- pub state: RadrootsVerifiedSignedEventVerificationStateDto,
- pub signed_event: RadrootsSignedEventDto,
+pub struct VerifiedSignedEventDto {
+ pub state: VerifiedSignedEventVerificationStateDto,
+ pub signed_event: SignedEventDto,
}
-pub struct RadrootsNip01EventExtraDto;
+pub struct Nip01EventExtraDto;
-impl dto_bindgen::Dto for RadrootsNip01EventExtraDto {
+impl dto_bindgen::Dto for Nip01EventExtraDto {
fn describe(_ctx: &mut dto_bindgen::__private::DescribeCtx) -> dto_bindgen::__private::TypeRef {
dto_bindgen::__private::TypeRef::Override(dto_bindgen::__private::TargetOverride::new(
dto_bindgen::__private::BackendId::TypeScript,
@@ -80,11 +80,11 @@ mod tests {
assert_eq!(registry.roots.len(), dto_roots().len());
let export_names = registry_export_names(®istry);
- assert!(export_names.contains("RadrootsEventEnvelope"));
- assert!(export_names.contains("RadrootsNip01EventWireDto"));
- assert!(export_names.contains("RadrootsSignedEventDto"));
- assert!(export_names.contains("RadrootsVerifiedSignedEventDto"));
- assert!(export_names.contains("RadrootsOperationalListingImageSize"));
+ assert!(export_names.contains("EventEnvelope"));
+ assert!(export_names.contains("Nip01EventWireDto"));
+ assert!(export_names.contains("SignedEventDto"));
+ assert!(export_names.contains("VerifiedSignedEventDto"));
+ assert!(export_names.contains("OperationalListingImageSize"));
}
#[test]
@@ -92,13 +92,13 @@ mod tests {
let registry = build_registry(dto_roots());
let summary = registry
- .struct_field_presence("RadrootsOperationalListingProduct", "summary")
+ .struct_field_presence("OperationalListingProduct", "summary")
.expect("summary field exists");
assert!(!summary.required_on_deserialize);
assert!(summary.nullable);
let d_tag = registry
- .struct_field_presence("RadrootsEventRef", "d_tag")
+ .struct_field_presence("EventRef", "d_tag")
.expect("d_tag field exists");
assert!(!d_tag.required_on_deserialize);
assert!(d_tag.nullable);
@@ -111,7 +111,7 @@ mod tests {
let rust_names = registry_rust_names(®istry);
for obsolete_export in [
- "RadrootsOrderEnvelope",
+ "OrderEnvelope",
"RadrootsCommercialEnvelope",
"RadrootsCommercialMessagePayload",
"RadrootsCommercialMessageType",
@@ -141,13 +141,13 @@ mod tests {
}
for source_root in [
- "RadrootsCommercialDomain",
- "RadrootsOrderEventType",
- "RadrootsOrderRequest",
- "RadrootsOrderDecision",
- "RadrootsOrderDecisionOutcome",
- "RadrootsOrderCancellation",
- "RadrootsOperationalListingParseError",
+ "CommercialDomain",
+ "OrderEventType",
+ "OrderRequest",
+ "OrderDecision",
+ "OrderDecisionOutcome",
+ "OrderCancellation",
+ "OperationalListingParseError",
] {
assert!(
rust_names.contains(source_root),
diff --git a/crates/event/src/envelope.rs b/crates/event/src/envelope.rs
@@ -11,18 +11,18 @@ use alloc::{string::String, vec::Vec};
#[cfg(any(feature = "std", test))]
use std::{string::String, vec::Vec};
-use crate::id::{RadrootsEventId, RadrootsEventSignature, RadrootsIdParseError, parse_public_key};
+use crate::id::{EventId, EventSignature, ParseError, parse_public_key};
use crate::wire::v1::{
DEFAULT_CONTENT_MAX_BYTES, DEFAULT_TAG_ELEMENT_MAX_BYTES, DEFAULT_TAG_MAX_COUNT,
- DEFAULT_TAG_TOTAL_ELEMENT_MAX_COUNT, DEFAULT_TAG_TOTAL_MAX_BYTES, RadrootsNip01EventWire,
+ DEFAULT_TAG_TOTAL_ELEMENT_MAX_COUNT, DEFAULT_TAG_TOTAL_MAX_BYTES, Nip01EventWire,
};
use core::fmt;
use radroots_identity::PublicKey;
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct RadrootsEventTimestamp(u64);
+pub struct EventTimestamp(u64);
-impl RadrootsEventTimestamp {
+impl EventTimestamp {
pub const fn new(value: u64) -> Self {
Self(value)
}
@@ -33,7 +33,7 @@ impl RadrootsEventTimestamp {
}
}
-impl From<u64> for RadrootsEventTimestamp {
+impl From<u64> for EventTimestamp {
#[inline]
fn from(value: u64) -> Self {
Self::new(value)
@@ -41,7 +41,7 @@ impl From<u64> for RadrootsEventTimestamp {
}
#[cfg(any(feature = "serde", test))]
-impl serde::Serialize for RadrootsEventTimestamp {
+impl serde::Serialize for EventTimestamp {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
@@ -51,7 +51,7 @@ impl serde::Serialize for RadrootsEventTimestamp {
}
#[cfg(any(feature = "serde", test))]
-impl<'de> serde::Deserialize<'de> for RadrootsEventTimestamp {
+impl<'de> serde::Deserialize<'de> for EventTimestamp {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
@@ -62,16 +62,16 @@ impl<'de> serde::Deserialize<'de> for RadrootsEventTimestamp {
}
#[cfg(all(test, feature = "std"))]
-impl dto_bindgen::Dto for RadrootsEventTimestamp {
+impl dto_bindgen::Dto for EventTimestamp {
fn describe(ctx: &mut dto_bindgen::__private::DescribeCtx) -> dto_bindgen::__private::TypeRef {
<u64 as dto_bindgen::Dto>::describe(ctx)
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct RadrootsEventKind(u32);
+pub struct EventKind(u32);
-impl RadrootsEventKind {
+impl EventKind {
pub const fn new(value: u32) -> Self {
Self(value)
}
@@ -81,18 +81,18 @@ impl RadrootsEventKind {
self.0
}
- pub const fn class(self) -> RadrootsEventKindClass {
+ pub const fn class(self) -> EventKindClass {
match self.0 {
- 0 | 3 => RadrootsEventKindClass::Replaceable,
- 10_000..=19_999 => RadrootsEventKindClass::Replaceable,
- 20_000..=29_999 => RadrootsEventKindClass::Ephemeral,
- 30_000..=39_999 => RadrootsEventKindClass::Addressable,
- _ => RadrootsEventKindClass::Regular,
+ 0 | 3 => EventKindClass::Replaceable,
+ 10_000..=19_999 => EventKindClass::Replaceable,
+ 20_000..=29_999 => EventKindClass::Ephemeral,
+ 30_000..=39_999 => EventKindClass::Addressable,
+ _ => EventKindClass::Regular,
}
}
}
-impl From<u32> for RadrootsEventKind {
+impl From<u32> for EventKind {
#[inline]
fn from(value: u32) -> Self {
Self::new(value)
@@ -100,7 +100,7 @@ impl From<u32> for RadrootsEventKind {
}
#[cfg(any(feature = "serde", test))]
-impl serde::Serialize for RadrootsEventKind {
+impl serde::Serialize for EventKind {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
@@ -110,7 +110,7 @@ impl serde::Serialize for RadrootsEventKind {
}
#[cfg(any(feature = "serde", test))]
-impl<'de> serde::Deserialize<'de> for RadrootsEventKind {
+impl<'de> serde::Deserialize<'de> for EventKind {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
@@ -121,14 +121,14 @@ impl<'de> serde::Deserialize<'de> for RadrootsEventKind {
}
#[cfg(all(test, feature = "std"))]
-impl dto_bindgen::Dto for RadrootsEventKind {
+impl dto_bindgen::Dto for EventKind {
fn describe(ctx: &mut dto_bindgen::__private::DescribeCtx) -> dto_bindgen::__private::TypeRef {
<u32 as dto_bindgen::Dto>::describe(ctx)
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub enum RadrootsEventKindClass {
+pub enum EventKindClass {
Regular,
Replaceable,
Ephemeral,
@@ -136,10 +136,10 @@ pub enum RadrootsEventKindClass {
}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsEventEnvelopeError {
- InvalidId(RadrootsIdParseError),
- InvalidAuthor(RadrootsIdParseError),
- InvalidSignature(RadrootsIdParseError),
+pub enum EventEnvelopeError {
+ InvalidId(ParseError),
+ InvalidAuthor(ParseError),
+ InvalidSignature(ParseError),
NonCanonicalId,
NonCanonicalAuthor,
NonCanonicalSignature,
@@ -176,7 +176,7 @@ pub enum RadrootsEventEnvelopeError {
},
}
-impl fmt::Display for RadrootsEventEnvelopeError {
+impl fmt::Display for EventEnvelopeError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::InvalidId(error) => write!(f, "event envelope id is invalid: {error}"),
@@ -231,10 +231,10 @@ impl fmt::Display for RadrootsEventEnvelopeError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsEventEnvelopeError {}
+impl std::error::Error for EventEnvelopeError {}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub struct RadrootsEventEnvelopeLimits {
+pub struct EventEnvelopeLimits {
pub max_content_bytes: usize,
pub max_tag_count: usize,
pub max_total_tag_elements: usize,
@@ -242,7 +242,7 @@ pub struct RadrootsEventEnvelopeLimits {
pub max_total_tag_bytes: usize,
}
-impl Default for RadrootsEventEnvelopeLimits {
+impl Default for EventEnvelopeLimits {
fn default() -> Self {
Self {
max_content_bytes: DEFAULT_CONTENT_MAX_BYTES,
@@ -255,29 +255,29 @@ impl Default for RadrootsEventEnvelopeLimits {
}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsEventTag(Vec<String>);
+pub struct EventTag(Vec<String>);
-impl RadrootsEventTag {
- pub fn new(index: usize, values: Vec<String>) -> Result<Self, RadrootsEventEnvelopeError> {
- Self::new_with_limits(index, values, RadrootsEventEnvelopeLimits::default())
+impl EventTag {
+ pub fn new(index: usize, values: Vec<String>) -> Result<Self, EventEnvelopeError> {
+ Self::new_with_limits(index, values, EventEnvelopeLimits::default())
}
pub fn new_with_limits(
index: usize,
values: Vec<String>,
- limits: RadrootsEventEnvelopeLimits,
- ) -> Result<Self, RadrootsEventEnvelopeError> {
+ limits: EventEnvelopeLimits,
+ ) -> Result<Self, EventEnvelopeError> {
validate_tag(index, &values)?;
let total_tag_elements = values.len();
if total_tag_elements > limits.max_total_tag_elements {
- return Err(RadrootsEventEnvelopeError::TooManyTagElements {
+ return Err(EventEnvelopeError::TooManyTagElements {
max: limits.max_total_tag_elements,
actual: total_tag_elements,
});
}
let total_bytes = validate_tag_elements(index, &values, limits)?;
if total_bytes > limits.max_total_tag_bytes {
- return Err(RadrootsEventEnvelopeError::TagsTooLarge {
+ return Err(EventEnvelopeError::TagsTooLarge {
max: limits.max_total_tag_bytes,
actual: total_bytes,
});
@@ -297,7 +297,7 @@ impl RadrootsEventTag {
}
#[cfg(any(feature = "serde", test))]
-impl serde::Serialize for RadrootsEventTag {
+impl serde::Serialize for EventTag {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
@@ -307,7 +307,7 @@ impl serde::Serialize for RadrootsEventTag {
}
#[cfg(any(feature = "serde", test))]
-impl<'de> serde::Deserialize<'de> for RadrootsEventTag {
+impl<'de> serde::Deserialize<'de> for EventTag {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
@@ -318,20 +318,20 @@ impl<'de> serde::Deserialize<'de> for RadrootsEventTag {
}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsEventTags(Vec<RadrootsEventTag>);
+pub struct EventTags(Vec<EventTag>);
-impl RadrootsEventTags {
- pub fn new(values: Vec<Vec<String>>) -> Result<Self, RadrootsEventEnvelopeError> {
- Self::new_with_limits(values, RadrootsEventEnvelopeLimits::default())
+impl EventTags {
+ pub fn new(values: Vec<Vec<String>>) -> Result<Self, EventEnvelopeError> {
+ Self::new_with_limits(values, EventEnvelopeLimits::default())
}
pub fn new_with_limits(
values: Vec<Vec<String>>,
- limits: RadrootsEventEnvelopeLimits,
- ) -> Result<Self, RadrootsEventEnvelopeError> {
+ limits: EventEnvelopeLimits,
+ ) -> Result<Self, EventEnvelopeError> {
let tag_count = values.len();
if tag_count > limits.max_tag_count {
- return Err(RadrootsEventEnvelopeError::TooManyTags {
+ return Err(EventEnvelopeError::TooManyTags {
max: limits.max_tag_count,
actual: tag_count,
});
@@ -340,7 +340,7 @@ impl RadrootsEventTags {
.iter()
.fold(0usize, |total, tag| total.saturating_add(tag.len()));
if total_tag_elements > limits.max_total_tag_elements {
- return Err(RadrootsEventEnvelopeError::TooManyTagElements {
+ return Err(EventEnvelopeError::TooManyTagElements {
max: limits.max_total_tag_elements,
actual: total_tag_elements,
});
@@ -352,18 +352,18 @@ impl RadrootsEventTags {
total_tag_bytes =
total_tag_bytes.saturating_add(validate_tag_elements(index, &tag, limits)?);
if total_tag_bytes > limits.max_total_tag_bytes {
- return Err(RadrootsEventEnvelopeError::TagsTooLarge {
+ return Err(EventEnvelopeError::TagsTooLarge {
max: limits.max_total_tag_bytes,
actual: total_tag_bytes,
});
}
- tags.push(RadrootsEventTag(tag));
+ tags.push(EventTag(tag));
}
Ok(Self(tags))
}
#[inline]
- pub fn as_slice(&self) -> &[RadrootsEventTag] {
+ pub fn as_slice(&self) -> &[EventTag] {
self.0.as_slice()
}
@@ -373,7 +373,7 @@ impl RadrootsEventTags {
#[inline]
pub fn into_vec(self) -> Vec<Vec<String>> {
- self.0.into_iter().map(RadrootsEventTag::into_vec).collect()
+ self.0.into_iter().map(EventTag::into_vec).collect()
}
#[inline]
@@ -388,7 +388,7 @@ impl RadrootsEventTags {
}
#[cfg(any(feature = "serde", test))]
-impl serde::Serialize for RadrootsEventTags {
+impl serde::Serialize for EventTags {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
@@ -398,7 +398,7 @@ impl serde::Serialize for RadrootsEventTags {
}
#[cfg(any(feature = "serde", test))]
-impl<'de> serde::Deserialize<'de> for RadrootsEventTags {
+impl<'de> serde::Deserialize<'de> for EventTags {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
@@ -409,14 +409,14 @@ impl<'de> serde::Deserialize<'de> for RadrootsEventTags {
}
#[cfg(all(test, feature = "std"))]
-impl dto_bindgen::Dto for RadrootsEventTags {
+impl dto_bindgen::Dto for EventTags {
fn describe(ctx: &mut dto_bindgen::__private::DescribeCtx) -> dto_bindgen::__private::TypeRef {
<Vec<Vec<String>> as dto_bindgen::Dto>::describe(ctx)
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsEventEnvelopeParts {
+pub struct EventEnvelopeParts {
pub id: String,
pub author: String,
pub created_at: u64,
@@ -434,55 +434,54 @@ pub struct RadrootsEventEnvelopeParts {
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[cfg_attr(all(test, feature = "std"), dto(ts(name = "RadrootsEventEnvelopeDto")))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsEventEnvelope {
- id: RadrootsEventId,
+pub struct EventEnvelope {
+ id: EventId,
#[cfg_attr(all(test, feature = "std"), dto(as = "string"))]
author: PublicKey,
#[cfg_attr(all(test, feature = "std"), dto(int = "json_number"))]
- created_at: RadrootsEventTimestamp,
- kind: RadrootsEventKind,
- tags: RadrootsEventTags,
+ created_at: EventTimestamp,
+ kind: EventKind,
+ tags: EventTags,
content: String,
- sig: RadrootsEventSignature,
+ sig: EventSignature,
}
-impl RadrootsEventEnvelope {
- pub fn new(parts: RadrootsEventEnvelopeParts) -> Result<Self, RadrootsEventEnvelopeError> {
- Self::new_with_limits(parts, RadrootsEventEnvelopeLimits::default())
+impl EventEnvelope {
+ pub fn new(parts: EventEnvelopeParts) -> Result<Self, EventEnvelopeError> {
+ Self::new_with_limits(parts, EventEnvelopeLimits::default())
}
pub fn new_with_limits(
- parts: RadrootsEventEnvelopeParts,
- limits: RadrootsEventEnvelopeLimits,
- ) -> Result<Self, RadrootsEventEnvelopeError> {
- let id = RadrootsEventId::parse(parts.id.as_str())
- .map_err(RadrootsEventEnvelopeError::InvalidId)?;
+ parts: EventEnvelopeParts,
+ limits: EventEnvelopeLimits,
+ ) -> Result<Self, EventEnvelopeError> {
+ let id = EventId::parse(parts.id.as_str()).map_err(EventEnvelopeError::InvalidId)?;
if id.to_hex() != parts.id {
- return Err(RadrootsEventEnvelopeError::NonCanonicalId);
+ return Err(EventEnvelopeError::NonCanonicalId);
}
- let author = parse_public_key(parts.author.as_str())
- .map_err(RadrootsEventEnvelopeError::InvalidAuthor)?;
+ let author =
+ parse_public_key(parts.author.as_str()).map_err(EventEnvelopeError::InvalidAuthor)?;
if author.to_hex() != parts.author {
- return Err(RadrootsEventEnvelopeError::NonCanonicalAuthor);
+ return Err(EventEnvelopeError::NonCanonicalAuthor);
}
- let sig = RadrootsEventSignature::parse(parts.sig.as_str())
- .map_err(RadrootsEventEnvelopeError::InvalidSignature)?;
+ let sig = EventSignature::parse(parts.sig.as_str())
+ .map_err(EventEnvelopeError::InvalidSignature)?;
if sig.to_hex() != parts.sig {
- return Err(RadrootsEventEnvelopeError::NonCanonicalSignature);
+ return Err(EventEnvelopeError::NonCanonicalSignature);
}
let content_len = parts.content.len();
if content_len > limits.max_content_bytes {
- return Err(RadrootsEventEnvelopeError::ContentTooLarge {
+ return Err(EventEnvelopeError::ContentTooLarge {
max: limits.max_content_bytes,
actual: content_len,
});
}
- let tags = RadrootsEventTags::new_with_limits(parts.tags, limits)?;
+ let tags = EventTags::new_with_limits(parts.tags, limits)?;
Ok(Self {
id,
author,
- created_at: RadrootsEventTimestamp::new(parts.created_at),
- kind: RadrootsEventKind::new(parts.kind),
+ created_at: EventTimestamp::new(parts.created_at),
+ kind: EventKind::new(parts.kind),
tags,
content: parts.content,
sig,
@@ -490,7 +489,7 @@ impl RadrootsEventEnvelope {
}
#[inline]
- pub fn id(&self) -> &RadrootsEventId {
+ pub fn id(&self) -> &EventId {
&self.id
}
@@ -505,7 +504,7 @@ impl RadrootsEventEnvelope {
}
#[inline]
- pub fn created_at(&self) -> RadrootsEventTimestamp {
+ pub fn created_at(&self) -> EventTimestamp {
self.created_at
}
@@ -515,7 +514,7 @@ impl RadrootsEventEnvelope {
}
#[inline]
- pub fn kind(&self) -> RadrootsEventKind {
+ pub fn kind(&self) -> EventKind {
self.kind
}
@@ -525,17 +524,17 @@ impl RadrootsEventEnvelope {
}
#[inline]
- pub fn kind_class(&self) -> RadrootsEventKindClass {
+ pub fn kind_class(&self) -> EventKindClass {
self.kind.class()
}
#[inline]
- pub fn tags(&self) -> &RadrootsEventTags {
+ pub fn tags(&self) -> &EventTags {
&self.tags
}
#[inline]
- pub fn tag_slices(&self) -> &[RadrootsEventTag] {
+ pub fn tag_slices(&self) -> &[EventTag] {
self.tags.as_slice()
}
@@ -549,7 +548,7 @@ impl RadrootsEventEnvelope {
}
#[inline]
- pub fn sig(&self) -> &RadrootsEventSignature {
+ pub fn sig(&self) -> &EventSignature {
&self.sig
}
@@ -558,8 +557,8 @@ impl RadrootsEventEnvelope {
self.sig.to_hex()
}
- pub fn to_nip01_wire(&self) -> RadrootsNip01EventWire {
- RadrootsNip01EventWire {
+ pub fn to_nip01_wire(&self) -> Nip01EventWire {
+ Nip01EventWire {
id: self.id.to_hex(),
pubkey: self.author.to_hex(),
created_at: self.created_at.as_u64(),
@@ -572,15 +571,15 @@ impl RadrootsEventEnvelope {
}
}
-fn validate_tag(index: usize, values: &[String]) -> Result<(), RadrootsEventEnvelopeError> {
+fn validate_tag(index: usize, values: &[String]) -> Result<(), EventEnvelopeError> {
let Some(key) = values.first() else {
- return Err(RadrootsEventEnvelopeError::EmptyTag { index });
+ return Err(EventEnvelopeError::EmptyTag { index });
};
if key.is_empty() {
- return Err(RadrootsEventEnvelopeError::EmptyTagKey { index });
+ return Err(EventEnvelopeError::EmptyTagKey { index });
}
if key.chars().any(char::is_control) {
- return Err(RadrootsEventEnvelopeError::ControlCharacterTagKey { index });
+ return Err(EventEnvelopeError::ControlCharacterTagKey { index });
}
Ok(())
}
@@ -588,13 +587,13 @@ fn validate_tag(index: usize, values: &[String]) -> Result<(), RadrootsEventEnve
fn validate_tag_elements(
tag_index: usize,
values: &[String],
- limits: RadrootsEventEnvelopeLimits,
-) -> Result<usize, RadrootsEventEnvelopeError> {
+ limits: EventEnvelopeLimits,
+) -> Result<usize, EventEnvelopeError> {
let mut total_tag_bytes = 0usize;
for (element_index, value) in values.iter().enumerate() {
let value_len = value.len();
if value_len > limits.max_tag_element_bytes {
- return Err(RadrootsEventEnvelopeError::TagElementTooLarge {
+ return Err(EventEnvelopeError::TagElementTooLarge {
tag_index,
element_index,
max: limits.max_tag_element_bytes,
@@ -618,8 +617,8 @@ mod tests {
core::iter::repeat_n(character, 128).collect()
}
- fn event_parts() -> RadrootsEventEnvelopeParts {
- RadrootsEventEnvelopeParts {
+ fn event_parts() -> EventEnvelopeParts {
+ EventEnvelopeParts {
id: hex_64('1'),
author: hex_64('a'),
created_at: u64::from(u32::MAX) + 1,
@@ -632,13 +631,13 @@ mod tests {
#[test]
fn envelope_uses_private_typed_state_and_getters() {
- let envelope = RadrootsEventEnvelope::new(event_parts()).expect("envelope");
+ let envelope = EventEnvelope::new(event_parts()).expect("envelope");
assert_eq!(envelope.id_hex(), hex_64('1'));
assert_eq!(envelope.author().to_hex(), hex_64('a'));
assert_eq!(envelope.created_at_u64(), u64::from(u32::MAX) + 1);
assert_eq!(envelope.kind_u32(), 30_023);
- assert_eq!(envelope.kind_class(), RadrootsEventKindClass::Addressable);
+ assert_eq!(envelope.kind_class(), EventKindClass::Addressable);
assert_eq!(envelope.content(), "hello");
assert_eq!(envelope.signature_hex(), hex_128('b'));
assert_eq!(
@@ -652,113 +651,80 @@ mod tests {
let mut parts = event_parts();
parts.id = "bad".to_owned();
assert!(matches!(
- RadrootsEventEnvelope::new(parts),
- Err(RadrootsEventEnvelopeError::InvalidId(_))
+ EventEnvelope::new(parts),
+ Err(EventEnvelopeError::InvalidId(_))
));
let mut parts = event_parts();
parts.tags = vec![Vec::new()];
assert_eq!(
- RadrootsEventEnvelope::new(parts),
- Err(RadrootsEventEnvelopeError::EmptyTag { index: 0 })
+ EventEnvelope::new(parts),
+ Err(EventEnvelopeError::EmptyTag { index: 0 })
);
}
#[test]
fn kind_classifies_nip01_ranges() {
- assert_eq!(
- RadrootsEventKind::new(0).class(),
- RadrootsEventKindClass::Replaceable
- );
- assert_eq!(
- RadrootsEventKind::new(1).class(),
- RadrootsEventKindClass::Regular
- );
- assert_eq!(
- RadrootsEventKind::new(3).class(),
- RadrootsEventKindClass::Replaceable
- );
- assert_eq!(
- RadrootsEventKind::new(9_999).class(),
- RadrootsEventKindClass::Regular
- );
- assert_eq!(
- RadrootsEventKind::new(10_000).class(),
- RadrootsEventKindClass::Replaceable
- );
- assert_eq!(
- RadrootsEventKind::new(19_999).class(),
- RadrootsEventKindClass::Replaceable
- );
- assert_eq!(
- RadrootsEventKind::new(20_000).class(),
- RadrootsEventKindClass::Ephemeral
- );
- assert_eq!(
- RadrootsEventKind::new(29_999).class(),
- RadrootsEventKindClass::Ephemeral
- );
- assert_eq!(
- RadrootsEventKind::new(30_000).class(),
- RadrootsEventKindClass::Addressable
- );
- assert_eq!(
- RadrootsEventKind::new(39_999).class(),
- RadrootsEventKindClass::Addressable
- );
- assert_eq!(
- RadrootsEventKind::new(40_000).class(),
- RadrootsEventKindClass::Regular
- );
+ assert_eq!(EventKind::new(0).class(), EventKindClass::Replaceable);
+ assert_eq!(EventKind::new(1).class(), EventKindClass::Regular);
+ assert_eq!(EventKind::new(3).class(), EventKindClass::Replaceable);
+ assert_eq!(EventKind::new(9_999).class(), EventKindClass::Regular);
+ assert_eq!(EventKind::new(10_000).class(), EventKindClass::Replaceable);
+ assert_eq!(EventKind::new(19_999).class(), EventKindClass::Replaceable);
+ assert_eq!(EventKind::new(20_000).class(), EventKindClass::Ephemeral);
+ assert_eq!(EventKind::new(29_999).class(), EventKindClass::Ephemeral);
+ assert_eq!(EventKind::new(30_000).class(), EventKindClass::Addressable);
+ assert_eq!(EventKind::new(39_999).class(), EventKindClass::Addressable);
+ assert_eq!(EventKind::new(40_000).class(), EventKindClass::Regular);
}
#[test]
fn envelope_rejects_domain_budget_violations() {
let mut parts = event_parts();
assert_eq!(
- RadrootsEventEnvelope::new_with_limits(
+ EventEnvelope::new_with_limits(
parts.clone(),
- RadrootsEventEnvelopeLimits {
+ EventEnvelopeLimits {
max_content_bytes: 4,
- ..RadrootsEventEnvelopeLimits::default()
+ ..EventEnvelopeLimits::default()
}
),
- Err(RadrootsEventEnvelopeError::ContentTooLarge { max: 4, actual: 5 })
+ Err(EventEnvelopeError::ContentTooLarge { max: 4, actual: 5 })
);
parts.tags = vec![vec!["d".to_owned()]];
assert_eq!(
- RadrootsEventEnvelope::new_with_limits(
+ EventEnvelope::new_with_limits(
parts.clone(),
- RadrootsEventEnvelopeLimits {
+ EventEnvelopeLimits {
max_tag_count: 0,
- ..RadrootsEventEnvelopeLimits::default()
+ ..EventEnvelopeLimits::default()
}
),
- Err(RadrootsEventEnvelopeError::TooManyTags { max: 0, actual: 1 })
+ Err(EventEnvelopeError::TooManyTags { max: 0, actual: 1 })
);
parts.tags = vec![vec!["d".to_owned(), "abcd".to_owned()]];
assert_eq!(
- RadrootsEventEnvelope::new_with_limits(
+ EventEnvelope::new_with_limits(
parts.clone(),
- RadrootsEventEnvelopeLimits {
+ EventEnvelopeLimits {
max_total_tag_elements: 1,
- ..RadrootsEventEnvelopeLimits::default()
+ ..EventEnvelopeLimits::default()
}
),
- Err(RadrootsEventEnvelopeError::TooManyTagElements { max: 1, actual: 2 })
+ Err(EventEnvelopeError::TooManyTagElements { max: 1, actual: 2 })
);
assert_eq!(
- RadrootsEventEnvelope::new_with_limits(
+ EventEnvelope::new_with_limits(
parts.clone(),
- RadrootsEventEnvelopeLimits {
+ EventEnvelopeLimits {
max_tag_element_bytes: 3,
- ..RadrootsEventEnvelopeLimits::default()
+ ..EventEnvelopeLimits::default()
}
),
- Err(RadrootsEventEnvelopeError::TagElementTooLarge {
+ Err(EventEnvelopeError::TagElementTooLarge {
tag_index: 0,
element_index: 1,
max: 3,
@@ -768,14 +734,14 @@ mod tests {
parts.tags = vec![vec!["d".to_owned(), "soil".to_owned()]];
assert_eq!(
- RadrootsEventEnvelope::new_with_limits(
+ EventEnvelope::new_with_limits(
parts,
- RadrootsEventEnvelopeLimits {
+ EventEnvelopeLimits {
max_total_tag_bytes: 4,
- ..RadrootsEventEnvelopeLimits::default()
+ ..EventEnvelopeLimits::default()
}
),
- Err(RadrootsEventEnvelopeError::TagsTooLarge { max: 4, actual: 5 })
+ Err(EventEnvelopeError::TagsTooLarge { max: 4, actual: 5 })
);
}
@@ -785,9 +751,9 @@ mod tests {
parts.content = "hello".to_owned();
parts.tags = vec![vec!["d".to_owned(), "soil".to_owned()]];
- let envelope = RadrootsEventEnvelope::new_with_limits(
+ let envelope = EventEnvelope::new_with_limits(
parts,
- RadrootsEventEnvelopeLimits {
+ EventEnvelopeLimits {
max_content_bytes: 5,
max_tag_count: 1,
max_total_tag_elements: 2,
@@ -806,7 +772,7 @@ mod tests {
#[test]
fn envelope_serializes_to_domain_shape() {
- let envelope = RadrootsEventEnvelope::new(event_parts()).expect("envelope");
+ let envelope = EventEnvelope::new(event_parts()).expect("envelope");
let encoded = serde_json::to_value(&envelope).expect("json");
assert_eq!(
@@ -831,17 +797,17 @@ mod tests {
#[allow(dead_code)]
#[derive(Debug, serde::Deserialize)]
struct MissingTimestamp {
- value: RadrootsEventTimestamp,
+ value: EventTimestamp,
}
#[allow(dead_code)]
#[derive(Debug, serde::Deserialize)]
struct MissingKind {
- value: RadrootsEventKind,
+ value: EventKind,
}
#[allow(dead_code)]
#[derive(Debug, serde::Deserialize)]
struct MissingTags {
- value: RadrootsEventTags,
+ value: EventTags,
}
for message in [
@@ -858,84 +824,81 @@ mod tests {
assert!(message.contains("missing field `value`"));
}
- let timestamp = RadrootsEventTimestamp::from(42);
+ let timestamp = EventTimestamp::from(42);
assert_eq!(timestamp.as_u64(), 42);
assert_eq!(
- serde_json::from_str::<RadrootsEventTimestamp>(
+ serde_json::from_str::<EventTimestamp>(
&serde_json::to_string(×tamp).expect("timestamp json"),
)
.expect("timestamp"),
timestamp
);
- let kind = RadrootsEventKind::from(30_023);
+ let kind = EventKind::from(30_023);
assert_eq!(kind.as_u32(), 30_023);
assert_eq!(
- serde_json::from_str::<RadrootsEventKind>(
- &serde_json::to_string(&kind).expect("kind json"),
- )
- .expect("kind"),
+ serde_json::from_str::<EventKind>(&serde_json::to_string(&kind).expect("kind json"),)
+ .expect("kind"),
kind
);
- let parse_error = RadrootsEventId::parse("bad").expect_err("invalid id");
+ let parse_error = EventId::parse("bad").expect_err("invalid id");
for error in [
- RadrootsEventEnvelopeError::InvalidId(parse_error.clone()),
- RadrootsEventEnvelopeError::InvalidAuthor(parse_error.clone()),
- RadrootsEventEnvelopeError::InvalidSignature(parse_error),
- RadrootsEventEnvelopeError::NonCanonicalId,
- RadrootsEventEnvelopeError::NonCanonicalAuthor,
- RadrootsEventEnvelopeError::NonCanonicalSignature,
- RadrootsEventEnvelopeError::EmptyTag { index: 1 },
- RadrootsEventEnvelopeError::EmptyTagKey { index: 1 },
- RadrootsEventEnvelopeError::ControlCharacterTagKey { index: 1 },
- RadrootsEventEnvelopeError::ContentTooLarge { max: 1, actual: 2 },
- RadrootsEventEnvelopeError::TooManyTags { max: 1, actual: 2 },
- RadrootsEventEnvelopeError::TooManyTagElements { max: 1, actual: 2 },
- RadrootsEventEnvelopeError::TagElementTooLarge {
+ EventEnvelopeError::InvalidId(parse_error.clone()),
+ EventEnvelopeError::InvalidAuthor(parse_error.clone()),
+ EventEnvelopeError::InvalidSignature(parse_error),
+ EventEnvelopeError::NonCanonicalId,
+ EventEnvelopeError::NonCanonicalAuthor,
+ EventEnvelopeError::NonCanonicalSignature,
+ EventEnvelopeError::EmptyTag { index: 1 },
+ EventEnvelopeError::EmptyTagKey { index: 1 },
+ EventEnvelopeError::ControlCharacterTagKey { index: 1 },
+ EventEnvelopeError::ContentTooLarge { max: 1, actual: 2 },
+ EventEnvelopeError::TooManyTags { max: 1, actual: 2 },
+ EventEnvelopeError::TooManyTagElements { max: 1, actual: 2 },
+ EventEnvelopeError::TagElementTooLarge {
tag_index: 1,
element_index: 2,
max: 3,
actual: 4,
},
- RadrootsEventEnvelopeError::TagsTooLarge { max: 1, actual: 2 },
+ EventEnvelopeError::TagsTooLarge { max: 1, actual: 2 },
] {
assert!(!error.to_string().is_empty());
}
- let tag = RadrootsEventTag::new(0, vec!["t".to_owned(), "soil".to_owned()]).expect("tag");
+ let tag = EventTag::new(0, vec!["t".to_owned(), "soil".to_owned()]).expect("tag");
assert_eq!(tag.clone().into_vec(), vec!["t", "soil"]);
let tag_json = serde_json::to_string(&tag).expect("tag json");
assert_eq!(
- serde_json::from_str::<RadrootsEventTag>(&tag_json).expect("tag"),
+ serde_json::from_str::<EventTag>(&tag_json).expect("tag"),
tag
);
- assert!(serde_json::from_str::<RadrootsEventTag>("[]").is_err());
+ assert!(serde_json::from_str::<EventTag>("[]").is_err());
assert!(
- RadrootsEventTag::new_with_limits(
+ EventTag::new_with_limits(
0,
vec!["tag".to_owned()],
- RadrootsEventEnvelopeLimits {
+ EventEnvelopeLimits {
max_total_tag_bytes: 2,
- ..RadrootsEventEnvelopeLimits::default()
+ ..EventEnvelopeLimits::default()
},
)
.is_err()
);
- let empty_tags = RadrootsEventTags::new(Vec::new()).expect("empty tags");
+ let empty_tags = EventTags::new(Vec::new()).expect("empty tags");
assert_eq!(empty_tags.len(), 0);
assert!(empty_tags.is_empty());
assert!(empty_tags.clone().into_vec().is_empty());
- let tags =
- RadrootsEventTags::new(vec![vec!["t".to_owned(), "soil".to_owned()]]).expect("tags");
+ let tags = EventTags::new(vec![vec!["t".to_owned(), "soil".to_owned()]]).expect("tags");
let tags_json = serde_json::to_string(&tags).expect("tags json");
assert_eq!(
- serde_json::from_str::<RadrootsEventTags>(&tags_json).expect("tags"),
+ serde_json::from_str::<EventTags>(&tags_json).expect("tags"),
tags
);
- assert!(serde_json::from_str::<RadrootsEventTags>("[[]]").is_err());
+ assert!(serde_json::from_str::<EventTags>("[[]]").is_err());
- let envelope = RadrootsEventEnvelope::new(event_parts()).expect("envelope");
+ let envelope = EventEnvelope::new(event_parts()).expect("envelope");
assert_eq!(envelope.id().to_hex(), envelope.id_hex());
assert_eq!(envelope.author().to_hex(), hex_64('a'));
assert_eq!(envelope.created_at().as_u64(), envelope.created_at_u64());
@@ -947,7 +910,7 @@ mod tests {
assert_eq!(wire.id, envelope.id_hex());
let encoded = serde_json::to_string(&envelope).expect("envelope json");
assert_eq!(
- serde_json::from_str::<RadrootsEventEnvelope>(&encoded).expect("envelope"),
+ serde_json::from_str::<EventEnvelope>(&encoded).expect("envelope"),
envelope
);
@@ -963,7 +926,7 @@ mod tests {
"sig" => parts.sig = value,
_ => unreachable!("fixture field"),
}
- assert!(RadrootsEventEnvelope::new(parts).is_err());
+ assert!(EventEnvelope::new(parts).is_err());
}
for tags in [
vec![vec![String::new()]],
@@ -971,7 +934,7 @@ mod tests {
] {
let mut parts = event_parts();
parts.tags = tags;
- assert!(RadrootsEventEnvelope::new(parts).is_err());
+ assert!(EventEnvelope::new(parts).is_err());
}
}
}
diff --git a/crates/event/src/event_head/v1.rs b/crates/event/src/event_head/v1.rs
@@ -6,15 +6,15 @@
use alloc::string::String;
use crate::contract::registry_v7::{
- RadrootsContractMatchError, RadrootsEventClass, RadrootsEventContract, identify_event_contract,
+ ContractMatchError, EventClass, EventContract, identify_event_contract,
};
-use crate::envelope::{RadrootsEventEnvelope, RadrootsEventKindClass, RadrootsEventTag};
-use crate::id::{RadrootsDTag, RadrootsEventId, RadrootsIdParseError};
+use crate::envelope::{EventEnvelope, EventKindClass, EventTag};
+use crate::id::{DTag, EventId, ParseError};
use crate::tag::name::TAG_D;
use radroots_identity::PublicKey;
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub enum RadrootsEventHeadCoordinate {
+pub enum EventHeadCoordinate {
Replaceable {
kind: u32,
pubkey: PublicKey,
@@ -27,21 +27,21 @@ pub enum RadrootsEventHeadCoordinate {
}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsEventHeadCandidate {
- pub coordinate: RadrootsEventHeadCoordinate,
- pub event_id: RadrootsEventId,
+pub struct EventHeadCandidate {
+ pub coordinate: EventHeadCoordinate,
+ pub event_id: EventId,
pub created_at: u64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsCurrentEventHead {
- pub coordinate: RadrootsEventHeadCoordinate,
- pub event_id: RadrootsEventId,
+pub struct CurrentEventHead {
+ pub coordinate: EventHeadCoordinate,
+ pub event_id: EventId,
pub created_at: u64,
}
-impl From<RadrootsEventHeadCandidate> for RadrootsCurrentEventHead {
- fn from(candidate: RadrootsEventHeadCandidate) -> Self {
+impl From<EventHeadCandidate> for CurrentEventHead {
+ fn from(candidate: EventHeadCandidate) -> Self {
Self {
coordinate: candidate.coordinate,
event_id: candidate.event_id,
@@ -51,24 +51,24 @@ impl From<RadrootsEventHeadCandidate> for RadrootsCurrentEventHead {
}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsEventHeadMalformed {
- InvalidEventId(RadrootsIdParseError),
- InvalidPubkey(RadrootsIdParseError),
+pub enum EventHeadMalformed {
+ InvalidEventId(ParseError),
+ InvalidPubkey(ParseError),
MissingDTag,
- InvalidDTag(RadrootsIdParseError),
+ InvalidDTag(ParseError),
}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsEventHeadCandidateResult {
- Candidate(RadrootsEventHeadCandidate),
+pub enum EventHeadCandidateResult {
+ Candidate(EventHeadCandidate),
NotHeadSelected,
NotPersisted,
- Malformed(RadrootsEventHeadMalformed),
+ Malformed(EventHeadMalformed),
}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsEventHeadDecision {
- Applied(RadrootsCurrentEventHead),
+pub enum EventHeadDecision {
+ Applied(CurrentEventHead),
SkippedDuplicate,
SkippedOlder,
SkippedSameTimestampHigherEventId,
@@ -76,41 +76,39 @@ pub enum RadrootsEventHeadDecision {
}
pub fn event_head_candidate_for_class(
- event: &RadrootsEventEnvelope,
- class: RadrootsEventClass,
-) -> RadrootsEventHeadCandidateResult {
+ event: &EventEnvelope,
+ class: EventClass,
+) -> EventHeadCandidateResult {
match class {
- RadrootsEventClass::Regular => RadrootsEventHeadCandidateResult::NotHeadSelected,
- RadrootsEventClass::Ephemeral => RadrootsEventHeadCandidateResult::NotPersisted,
- RadrootsEventClass::Replaceable | RadrootsEventClass::Addressable => {
+ EventClass::Regular => EventHeadCandidateResult::NotHeadSelected,
+ EventClass::Ephemeral => EventHeadCandidateResult::NotPersisted,
+ EventClass::Replaceable | EventClass::Addressable => {
let event_id = *event.id();
let pubkey = *event.author();
- let coordinate = if class == RadrootsEventClass::Replaceable {
- RadrootsEventHeadCoordinate::Replaceable {
+ let coordinate = if class == EventClass::Replaceable {
+ EventHeadCoordinate::Replaceable {
kind: event.kind_u32(),
pubkey,
}
} else {
let Some(d_tag) = first_tag_value(event.tag_slices(), TAG_D) else {
- return RadrootsEventHeadCandidateResult::Malformed(
- RadrootsEventHeadMalformed::MissingDTag,
- );
+ return EventHeadCandidateResult::Malformed(EventHeadMalformed::MissingDTag);
};
- let d_tag = match RadrootsDTag::parse(d_tag) {
+ let d_tag = match DTag::parse(d_tag) {
Ok(d_tag) => d_tag,
Err(error) => {
- return RadrootsEventHeadCandidateResult::Malformed(
- RadrootsEventHeadMalformed::InvalidDTag(error),
+ return EventHeadCandidateResult::Malformed(
+ EventHeadMalformed::InvalidDTag(error),
);
}
};
- RadrootsEventHeadCoordinate::Addressable {
+ EventHeadCoordinate::Addressable {
kind: event.kind_u32(),
pubkey,
d_tag: d_tag.into_string(),
}
};
- RadrootsEventHeadCandidateResult::Candidate(RadrootsEventHeadCandidate {
+ EventHeadCandidateResult::Candidate(EventHeadCandidate {
coordinate,
event_id,
created_at: event.created_at_u64(),
@@ -124,34 +122,30 @@ pub fn event_head_candidate_for_class(
/// This deliberately does not identify or validate a Radroots product
/// contract. Raw replacement ordering must include every signature-verified
/// replaceable or addressable event, including unsupported product shapes.
-pub fn event_head_candidate_for_nip01_event(
- event: &RadrootsEventEnvelope,
-) -> RadrootsEventHeadCandidateResult {
+pub fn event_head_candidate_for_nip01_event(event: &EventEnvelope) -> EventHeadCandidateResult {
event_head_candidate_for_nip01_event_v1(event)
}
/// Derives a raw head candidate with addressable-feed-v1 semantics.
-pub fn event_head_candidate_for_nip01_event_v1(
- event: &RadrootsEventEnvelope,
-) -> RadrootsEventHeadCandidateResult {
+pub fn event_head_candidate_for_nip01_event_v1(event: &EventEnvelope) -> EventHeadCandidateResult {
let coordinate = match event.kind_class() {
- RadrootsEventKindClass::Regular => {
- return RadrootsEventHeadCandidateResult::NotHeadSelected;
+ EventKindClass::Regular => {
+ return EventHeadCandidateResult::NotHeadSelected;
}
- RadrootsEventKindClass::Ephemeral => {
- return RadrootsEventHeadCandidateResult::NotPersisted;
+ EventKindClass::Ephemeral => {
+ return EventHeadCandidateResult::NotPersisted;
}
- RadrootsEventKindClass::Replaceable => RadrootsEventHeadCoordinate::Replaceable {
+ EventKindClass::Replaceable => EventHeadCoordinate::Replaceable {
kind: event.kind_u32(),
pubkey: *event.author(),
},
- RadrootsEventKindClass::Addressable => RadrootsEventHeadCoordinate::Addressable {
+ EventKindClass::Addressable => EventHeadCoordinate::Addressable {
kind: event.kind_u32(),
pubkey: *event.author(),
d_tag: String::from(first_tag_value(event.tag_slices(), TAG_D).unwrap_or("")),
},
};
- RadrootsEventHeadCandidateResult::Candidate(RadrootsEventHeadCandidate {
+ EventHeadCandidateResult::Candidate(EventHeadCandidate {
coordinate,
event_id: *event.id(),
created_at: event.created_at_u64(),
@@ -159,55 +153,55 @@ pub fn event_head_candidate_for_nip01_event_v1(
}
pub fn event_head_candidate_for_contract(
- event: &RadrootsEventEnvelope,
- contract: &RadrootsEventContract,
-) -> RadrootsEventHeadCandidateResult {
+ event: &EventEnvelope,
+ contract: &EventContract,
+) -> EventHeadCandidateResult {
event_head_candidate_for_class(event, contract.class)
}
pub fn event_head_candidate_for_event(
- event: &RadrootsEventEnvelope,
-) -> Result<RadrootsEventHeadCandidateResult, RadrootsContractMatchError> {
+ event: &EventEnvelope,
+) -> Result<EventHeadCandidateResult, ContractMatchError> {
let tags = event.tags_as_vec();
let contract = identify_event_contract(event.kind_u32(), &tags, event.content())?;
Ok(event_head_candidate_for_contract(event, contract))
}
pub fn select_event_head(
- candidate: RadrootsEventHeadCandidate,
- current: Option<&RadrootsCurrentEventHead>,
-) -> RadrootsEventHeadDecision {
+ candidate: EventHeadCandidate,
+ current: Option<&CurrentEventHead>,
+) -> EventHeadDecision {
select_event_head_v1(candidate, current)
}
/// Selects a raw head with addressable-feed-v1 ordering semantics.
pub fn select_event_head_v1(
- candidate: RadrootsEventHeadCandidate,
- current: Option<&RadrootsCurrentEventHead>,
-) -> RadrootsEventHeadDecision {
+ candidate: EventHeadCandidate,
+ current: Option<&CurrentEventHead>,
+) -> EventHeadDecision {
let Some(current) = current else {
- return RadrootsEventHeadDecision::Applied(candidate.into());
+ return EventHeadDecision::Applied(candidate.into());
};
if candidate.coordinate != current.coordinate {
- return RadrootsEventHeadDecision::CoordinateMismatch;
+ return EventHeadDecision::CoordinateMismatch;
}
if candidate.event_id == current.event_id {
- return RadrootsEventHeadDecision::SkippedDuplicate;
+ return EventHeadDecision::SkippedDuplicate;
}
if candidate.created_at > current.created_at {
- return RadrootsEventHeadDecision::Applied(candidate.into());
+ return EventHeadDecision::Applied(candidate.into());
}
if candidate.created_at < current.created_at {
- return RadrootsEventHeadDecision::SkippedOlder;
+ return EventHeadDecision::SkippedOlder;
}
if candidate.event_id < current.event_id {
- RadrootsEventHeadDecision::Applied(candidate.into())
+ EventHeadDecision::Applied(candidate.into())
} else {
- RadrootsEventHeadDecision::SkippedSameTimestampHigherEventId
+ EventHeadDecision::SkippedSameTimestampHigherEventId
}
}
-fn first_tag_value<'a>(tags: &'a [RadrootsEventTag], name: &str) -> Option<&'a str> {
+fn first_tag_value<'a>(tags: &'a [EventTag], name: &str) -> Option<&'a str> {
tags.iter()
.find(|tag| tag.as_slice().first().map(String::as_str) == Some(name))
.and_then(|tag| tag.as_slice().get(1))
diff --git a/crates/event/src/event_head/v1/tests.rs b/crates/event/src/event_head/v1/tests.rs
@@ -1,6 +1,6 @@
use super::*;
-use crate::contract::RadrootsContractMatchError;
-use crate::envelope::RadrootsEventEnvelopeParts;
+use crate::contract::ContractMatchError;
+use crate::envelope::EventEnvelopeParts;
use crate::envelope::kind::{
KIND_FOLLOW, KIND_LIST_SET_GENERIC, KIND_POST, KIND_PROFILE, KIND_TRADE_PROPOSAL,
};
@@ -20,8 +20,8 @@ fn event(
author: &str,
created_at: u64,
tags: Vec<Vec<String>>,
-) -> RadrootsEventEnvelope {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+) -> EventEnvelope {
+ EventEnvelope::new(EventEnvelopeParts {
id: id.to_string(),
author: author.to_string(),
created_at,
@@ -40,8 +40,8 @@ fn event_with_content(
created_at: u64,
tags: Vec<Vec<String>>,
content: &str,
-) -> RadrootsEventEnvelope {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+) -> EventEnvelope {
+ EventEnvelope::new(EventEnvelopeParts {
id: id.to_string(),
author: author.to_string(),
created_at,
@@ -53,16 +53,16 @@ fn event_with_content(
.expect("event envelope")
}
-fn candidate(id: char, created_at: u64) -> RadrootsEventHeadCandidate {
+fn candidate(id: char, created_at: u64) -> EventHeadCandidate {
expect_candidate(event_head_candidate_for_class(
&event(10002, &hex_64(id), &hex_64('a'), created_at, Vec::new()),
- RadrootsEventClass::Replaceable,
+ EventClass::Replaceable,
))
}
-fn expect_candidate(result: RadrootsEventHeadCandidateResult) -> RadrootsEventHeadCandidate {
+fn expect_candidate(result: EventHeadCandidateResult) -> EventHeadCandidate {
match result {
- RadrootsEventHeadCandidateResult::Candidate(candidate) => candidate,
+ EventHeadCandidateResult::Candidate(candidate) => candidate,
other => panic!("expected candidate: {other:?}"),
}
}
@@ -71,12 +71,12 @@ fn expect_candidate(result: RadrootsEventHeadCandidateResult) -> RadrootsEventHe
fn regular_and_ephemeral_events_do_not_create_heads() {
let event = event(1, &hex_64('1'), &hex_64('a'), 1, Vec::new());
assert_eq!(
- event_head_candidate_for_class(&event, RadrootsEventClass::Regular),
- RadrootsEventHeadCandidateResult::NotHeadSelected
+ event_head_candidate_for_class(&event, EventClass::Regular),
+ EventHeadCandidateResult::NotHeadSelected
);
assert_eq!(
- event_head_candidate_for_class(&event, RadrootsEventClass::Ephemeral),
- RadrootsEventHeadCandidateResult::NotPersisted
+ event_head_candidate_for_class(&event, EventClass::Ephemeral),
+ EventHeadCandidateResult::NotPersisted
);
}
@@ -85,11 +85,11 @@ fn replaceable_events_use_kind_and_pubkey_coordinates() {
let event = event(10002, &hex_64('1'), &hex_64('a'), 5, Vec::new());
let candidate = expect_candidate(event_head_candidate_for_class(
&event,
- RadrootsEventClass::Replaceable,
+ EventClass::Replaceable,
));
assert_eq!(
candidate.coordinate,
- RadrootsEventHeadCoordinate::Replaceable {
+ EventHeadCoordinate::Replaceable {
kind: 10002,
pubkey: parse_public_key(hex_64('a')).unwrap()
}
@@ -108,11 +108,11 @@ fn addressable_events_use_kind_pubkey_and_d_tag_coordinates() {
);
let candidate = expect_candidate(event_head_candidate_for_class(
&event,
- RadrootsEventClass::Addressable,
+ EventClass::Addressable,
));
assert_eq!(
candidate.coordinate,
- RadrootsEventHeadCoordinate::Addressable {
+ EventHeadCoordinate::Addressable {
kind: 30023,
pubkey: parse_public_key(hex_64('b')).unwrap(),
d_tag: "article-1".to_owned()
@@ -124,8 +124,8 @@ fn addressable_events_use_kind_pubkey_and_d_tag_coordinates() {
fn addressable_events_require_valid_d_tags() {
let missing = event(30023, &hex_64('2'), &hex_64('b'), 7, Vec::new());
assert_eq!(
- event_head_candidate_for_class(&missing, RadrootsEventClass::Addressable),
- RadrootsEventHeadCandidateResult::Malformed(RadrootsEventHeadMalformed::MissingDTag)
+ event_head_candidate_for_class(&missing, EventClass::Addressable),
+ EventHeadCandidateResult::Malformed(EventHeadMalformed::MissingDTag)
);
let invalid = event(
@@ -136,44 +136,44 @@ fn addressable_events_require_valid_d_tags() {
vec![vec![TAG_D.to_string(), "bad d".to_string()]],
);
assert!(matches!(
- event_head_candidate_for_class(&invalid, RadrootsEventClass::Addressable),
- RadrootsEventHeadCandidateResult::Malformed(RadrootsEventHeadMalformed::InvalidDTag(_))
+ event_head_candidate_for_class(&invalid, EventClass::Addressable),
+ EventHeadCandidateResult::Malformed(EventHeadMalformed::InvalidDTag(_))
));
}
#[test]
fn event_head_selection_uses_nip01_time_and_lowest_id_rules() {
- let current: RadrootsCurrentEventHead = candidate('3', 10).into();
+ let current: CurrentEventHead = candidate('3', 10).into();
assert!(matches!(
select_event_head(candidate('1', 1), None),
- RadrootsEventHeadDecision::Applied(_)
+ EventHeadDecision::Applied(_)
));
assert!(matches!(
select_event_head(candidate('4', 11), Some(¤t)),
- RadrootsEventHeadDecision::Applied(_)
+ EventHeadDecision::Applied(_)
));
assert_eq!(
select_event_head(candidate('2', 9), Some(¤t)),
- RadrootsEventHeadDecision::SkippedOlder
+ EventHeadDecision::SkippedOlder
);
assert_eq!(
select_event_head(candidate('3', 10), Some(¤t)),
- RadrootsEventHeadDecision::SkippedDuplicate
+ EventHeadDecision::SkippedDuplicate
);
assert!(matches!(
select_event_head(candidate('2', 10), Some(¤t)),
- RadrootsEventHeadDecision::Applied(_)
+ EventHeadDecision::Applied(_)
));
assert_eq!(
select_event_head(candidate('4', 10), Some(¤t)),
- RadrootsEventHeadDecision::SkippedSameTimestampHigherEventId
+ EventHeadDecision::SkippedSameTimestampHigherEventId
);
}
#[test]
fn event_head_selection_rejects_coordinate_mismatch() {
- let current: RadrootsCurrentEventHead = candidate('3', 10).into();
+ let current: CurrentEventHead = candidate('3', 10).into();
let other = event_head_candidate_for_class(
&event(
30023,
@@ -182,12 +182,12 @@ fn event_head_selection_rejects_coordinate_mismatch() {
11,
vec![vec![TAG_D.to_string(), "article".to_string()]],
),
- RadrootsEventClass::Addressable,
+ EventClass::Addressable,
);
let other = expect_candidate(other);
assert_eq!(
select_event_head(other, Some(¤t)),
- RadrootsEventHeadDecision::CoordinateMismatch
+ EventHeadDecision::CoordinateMismatch
);
}
@@ -197,7 +197,7 @@ fn contract_bridge_uses_replaceable_event_classes() {
let candidate = expect_candidate(event_head_candidate_for_event(&event).expect("contract"));
assert_eq!(
candidate.coordinate,
- RadrootsEventHeadCoordinate::Replaceable {
+ EventHeadCoordinate::Replaceable {
kind: KIND_FOLLOW,
pubkey: parse_public_key(hex_64('a')).unwrap()
}
@@ -210,7 +210,7 @@ fn raw_nip01_bridge_uses_numeric_kind_classes_without_contract_identification()
let replaceable = expect_candidate(event_head_candidate_for_nip01_event(&replaceable));
assert_eq!(
replaceable.coordinate,
- RadrootsEventHeadCoordinate::Replaceable {
+ EventHeadCoordinate::Replaceable {
kind: 19_999,
pubkey: parse_public_key(hex_64('a')).unwrap(),
}
@@ -226,7 +226,7 @@ fn raw_nip01_bridge_uses_numeric_kind_classes_without_contract_identification()
let addressable = expect_candidate(event_head_candidate_for_nip01_event(&addressable));
assert_eq!(
addressable.coordinate,
- RadrootsEventHeadCoordinate::Addressable {
+ EventHeadCoordinate::Addressable {
kind: 39_999,
pubkey: parse_public_key(hex_64('b')).unwrap(),
d_tag: "unsupported".to_owned(),
@@ -236,7 +236,7 @@ fn raw_nip01_bridge_uses_numeric_kind_classes_without_contract_identification()
let regular = event(40_000, &hex_64('3'), &hex_64('c'), 3, Vec::new());
assert_eq!(
event_head_candidate_for_nip01_event(®ular),
- RadrootsEventHeadCandidateResult::NotHeadSelected
+ EventHeadCandidateResult::NotHeadSelected
);
}
@@ -272,7 +272,7 @@ fn raw_nip01_addressable_coordinates_treat_d_as_opaque_protocol_data() {
let candidate = expect_candidate(event_head_candidate_for_nip01_event(&event));
assert_eq!(
candidate.coordinate,
- RadrootsEventHeadCoordinate::Addressable {
+ EventHeadCoordinate::Addressable {
kind: 39_999,
pubkey: parse_public_key(hex_64('b')).unwrap(),
d_tag: expected.to_owned(),
@@ -290,8 +290,8 @@ fn product_addressable_coordinates_retain_strict_d_validation() {
] {
let event = event(30_023, &hex_64('2'), &hex_64('b'), 2, tags);
assert!(matches!(
- event_head_candidate_for_class(&event, RadrootsEventClass::Addressable),
- RadrootsEventHeadCandidateResult::Malformed(_)
+ event_head_candidate_for_class(&event, EventClass::Addressable),
+ EventHeadCandidateResult::Malformed(_)
));
}
}
@@ -308,7 +308,7 @@ fn contract_bridge_uses_addressable_event_classes() {
let candidate = expect_candidate(event_head_candidate_for_event(&event).expect("contract"));
assert_eq!(
candidate.coordinate,
- RadrootsEventHeadCoordinate::Addressable {
+ EventHeadCoordinate::Addressable {
kind: KIND_LIST_SET_GENERIC,
pubkey: parse_public_key(hex_64('b')).unwrap(),
d_tag: "member_of.farms".to_owned()
@@ -330,7 +330,7 @@ fn contract_bridge_uses_profile_replaceable_heads() {
expect_candidate(event_head_candidate_for_event(&profile).expect("profile contract"));
assert_eq!(
candidate.coordinate,
- RadrootsEventHeadCoordinate::Replaceable {
+ EventHeadCoordinate::Replaceable {
kind: KIND_PROFILE,
pubkey: parse_public_key(hex_64('c')).unwrap()
}
@@ -359,7 +359,7 @@ fn contract_bridge_keeps_trade_mutations_out_of_head_selection() {
);
assert_eq!(
event_head_candidate_for_event(&trade).expect("trade contract"),
- RadrootsEventHeadCandidateResult::NotHeadSelected
+ EventHeadCandidateResult::NotHeadSelected
);
}
@@ -368,7 +368,7 @@ fn contract_bridge_reports_unsupported_and_malformed_shapes() {
let unsupported = event(999_999, &hex_64('5'), &hex_64('a'), 1, Vec::new());
assert_eq!(
event_head_candidate_for_event(&unsupported),
- Err(RadrootsContractMatchError::UnsupportedKind(999_999))
+ Err(ContractMatchError::UnsupportedKind(999_999))
);
let malformed_addressable = event(
@@ -380,9 +380,7 @@ fn contract_bridge_reports_unsupported_and_malformed_shapes() {
);
assert_eq!(
event_head_candidate_for_event(&malformed_addressable),
- Err(RadrootsContractMatchError::UnsupportedShape(
- KIND_LIST_SET_GENERIC
- ))
+ Err(ContractMatchError::UnsupportedShape(KIND_LIST_SET_GENERIC))
);
let regular_with_d_tag = event(
@@ -394,14 +392,14 @@ fn contract_bridge_reports_unsupported_and_malformed_shapes() {
);
assert_eq!(
event_head_candidate_for_event(®ular_with_d_tag).expect("post contract"),
- RadrootsEventHeadCandidateResult::NotHeadSelected
+ EventHeadCandidateResult::NotHeadSelected
);
}
#[test]
fn expect_candidate_reports_non_candidate_inputs() {
let result = std::panic::catch_unwind(|| {
- expect_candidate(RadrootsEventHeadCandidateResult::NotHeadSelected);
+ expect_candidate(EventHeadCandidateResult::NotHeadSelected);
});
assert!(result.is_err());
diff --git a/crates/event/src/farm.rs b/crates/event/src/farm.rs
@@ -10,14 +10,14 @@ use alloc::{string::String, vec::Vec};
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsFarm {
+pub struct Farm {
pub d_tag: String,
pub name: String,
pub about: Option<String>,
pub website: Option<String>,
pub picture: Option<String>,
pub banner: Option<String>,
- pub location: Option<RadrootsFarmPublicLocation>,
+ pub location: Option<FarmPublicLocation>,
pub tags: Option<Vec<String>>,
}
@@ -28,7 +28,7 @@ pub struct RadrootsFarm {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, Default)]
-pub struct RadrootsFarmRef {
+pub struct FarmRef {
pub pubkey: String,
pub d_tag: String,
}
@@ -40,7 +40,7 @@ pub struct RadrootsFarmRef {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsFarmPublicLocation {
+pub struct FarmPublicLocation {
pub primary: String,
pub city: Option<String>,
pub region: Option<String>,
diff --git a/crates/event/src/farm_crdt.rs b/crates/event/src/farm_crdt.rs
@@ -1,7 +1,7 @@
#![forbid(unsafe_code)]
use crate::envelope::kind::KIND_FARM_CRDT_CHANGE as KIND_FARM_CRDT_CHANGE_EVENT;
-use crate::farm::workspace::RadrootsFarmWorkspaceRef;
+use crate::farm::workspace::FarmWorkspaceRef;
#[cfg(not(feature = "std"))]
use alloc::{
@@ -18,19 +18,19 @@ pub const RADROOTS_FARM_CRDT_TAG: &str = "radroots:farm:crdt";
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsFarmCrdtChange {
+pub struct FarmCrdtChange {
pub schema: String,
- pub workspace: RadrootsFarmWorkspaceRef,
+ pub workspace: FarmWorkspaceRef,
pub farm_group_id: String,
pub document_id: String,
- pub document_kind: RadrootsFarmCrdtDocumentKind,
- pub crdt_backend: RadrootsCrdtBackend,
+ pub document_kind: FarmCrdtDocumentKind,
+ pub crdt_backend: CrdtBackend,
pub crdt_backend_version: Option<String>,
pub actor_id: String,
pub change_hash: String,
pub dependencies: Vec<String>,
pub encoded_change: String,
- pub semantic_kind: RadrootsFarmSemanticKind,
+ pub semantic_kind: FarmSemanticKind,
pub business_time_ms: u64,
pub author_member_id: Option<String>,
pub app_version: Option<String>,
@@ -42,7 +42,7 @@ pub struct RadrootsFarmCrdtChange {
)]
#[cfg_attr(any(feature = "serde", test), serde(from = "String", into = "String"))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsFarmCrdtDocumentKind {
+pub enum FarmCrdtDocumentKind {
FarmMembership,
FarmRolePolicy,
FarmTask,
@@ -66,7 +66,7 @@ pub enum RadrootsFarmCrdtDocumentKind {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsCrdtBackend {
+pub enum CrdtBackend {
Automerge,
Yjs,
Loro,
@@ -78,7 +78,7 @@ pub enum RadrootsCrdtBackend {
)]
#[cfg_attr(any(feature = "serde", test), serde(from = "String", into = "String"))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsFarmSemanticKind {
+pub enum FarmSemanticKind {
FarmTaskCreate,
FarmTaskAssign,
FarmTaskJoin,
@@ -124,7 +124,7 @@ pub enum RadrootsFarmSemanticKind {
Other { value: String },
}
-impl RadrootsFarmCrdtDocumentKind {
+impl FarmCrdtDocumentKind {
pub fn as_str(&self) -> &str {
match self {
Self::FarmMembership => "FarmMembership",
@@ -147,7 +147,7 @@ impl RadrootsFarmCrdtDocumentKind {
}
}
-impl From<String> for RadrootsFarmCrdtDocumentKind {
+impl From<String> for FarmCrdtDocumentKind {
fn from(value: String) -> Self {
match value.as_str() {
"FarmMembership" => Self::FarmMembership,
@@ -170,16 +170,16 @@ impl From<String> for RadrootsFarmCrdtDocumentKind {
}
}
-impl From<RadrootsFarmCrdtDocumentKind> for String {
- fn from(value: RadrootsFarmCrdtDocumentKind) -> Self {
+impl From<FarmCrdtDocumentKind> for String {
+ fn from(value: FarmCrdtDocumentKind) -> Self {
match value {
- RadrootsFarmCrdtDocumentKind::Other { value } => value,
+ FarmCrdtDocumentKind::Other { value } => value,
value => value.as_str().to_string(),
}
}
}
-impl RadrootsFarmSemanticKind {
+impl FarmSemanticKind {
pub fn as_str(&self) -> &str {
match self {
Self::FarmTaskCreate => "FarmTaskCreate",
@@ -229,7 +229,7 @@ impl RadrootsFarmSemanticKind {
}
}
-impl From<String> for RadrootsFarmSemanticKind {
+impl From<String> for FarmSemanticKind {
fn from(value: String) -> Self {
match value.as_str() {
"FarmTaskCreate" => Self::FarmTaskCreate,
@@ -279,10 +279,10 @@ impl From<String> for RadrootsFarmSemanticKind {
}
}
-impl From<RadrootsFarmSemanticKind> for String {
- fn from(value: RadrootsFarmSemanticKind) -> Self {
+impl From<FarmSemanticKind> for String {
+ fn from(value: FarmSemanticKind) -> Self {
match value {
- RadrootsFarmSemanticKind::Other { value } => value,
+ FarmSemanticKind::Other { value } => value,
value => value.as_str().to_string(),
}
}
@@ -305,13 +305,10 @@ mod tests {
assert_eq!(change.workspace.pubkey, "workspace_pubkey");
assert_eq!(change.farm_group_id, "BCDEFGHIJKLMNOPQRSTUVW");
assert_eq!(change.document_id, "DEFGHIJKLMNOPQRSTUVWXY");
- assert_eq!(change.document_kind, RadrootsFarmCrdtDocumentKind::FarmTask);
- assert_eq!(change.crdt_backend, RadrootsCrdtBackend::Automerge);
+ assert_eq!(change.document_kind, FarmCrdtDocumentKind::FarmTask);
+ assert_eq!(change.crdt_backend, CrdtBackend::Automerge);
assert_eq!(change.dependencies, Vec::<String>::new());
- assert_eq!(
- change.semantic_kind,
- RadrootsFarmSemanticKind::FarmTaskCreate
- );
+ assert_eq!(change.semantic_kind, FarmSemanticKind::FarmTaskCreate);
assert_eq!(change.business_time_ms, 1_780_000_000_000);
assert_eq!(change.author_member_id.as_deref(), Some("member_abc"));
assert_eq!(change.app_version.as_deref(), Some("0.1.0"));
@@ -332,52 +329,25 @@ mod tests {
#[test]
fn document_kinds_serialize_as_stable_strings() {
for (kind, expected) in [
- (
- RadrootsFarmCrdtDocumentKind::FarmMembership,
- "FarmMembership",
- ),
- (
- RadrootsFarmCrdtDocumentKind::FarmRolePolicy,
- "FarmRolePolicy",
- ),
- (RadrootsFarmCrdtDocumentKind::FarmTask, "FarmTask"),
- (
- RadrootsFarmCrdtDocumentKind::FarmWorkSession,
- "FarmWorkSession",
- ),
- (RadrootsFarmCrdtDocumentKind::FarmActivity, "FarmActivity"),
- (
- RadrootsFarmCrdtDocumentKind::FarmHarvestRecord,
- "FarmHarvestRecord",
- ),
- (RadrootsFarmCrdtDocumentKind::FarmLocation, "FarmLocation"),
- (RadrootsFarmCrdtDocumentKind::FarmCrop, "FarmCrop"),
- (
- RadrootsFarmCrdtDocumentKind::FarmCropVariety,
- "FarmCropVariety",
- ),
- (RadrootsFarmCrdtDocumentKind::FarmCropCycle, "FarmCropCycle"),
- (
- RadrootsFarmCrdtDocumentKind::FarmAttachment,
- "FarmAttachment",
- ),
- (RadrootsFarmCrdtDocumentKind::FarmPayPeriod, "FarmPayPeriod"),
- (
- RadrootsFarmCrdtDocumentKind::FarmInventoryItem,
- "FarmInventoryItem",
- ),
- (
- RadrootsFarmCrdtDocumentKind::FarmMediaAsset,
- "FarmMediaAsset",
- ),
- (
- RadrootsFarmCrdtDocumentKind::FarmObservation,
- "FarmObservation",
- ),
+ (FarmCrdtDocumentKind::FarmMembership, "FarmMembership"),
+ (FarmCrdtDocumentKind::FarmRolePolicy, "FarmRolePolicy"),
+ (FarmCrdtDocumentKind::FarmTask, "FarmTask"),
+ (FarmCrdtDocumentKind::FarmWorkSession, "FarmWorkSession"),
+ (FarmCrdtDocumentKind::FarmActivity, "FarmActivity"),
+ (FarmCrdtDocumentKind::FarmHarvestRecord, "FarmHarvestRecord"),
+ (FarmCrdtDocumentKind::FarmLocation, "FarmLocation"),
+ (FarmCrdtDocumentKind::FarmCrop, "FarmCrop"),
+ (FarmCrdtDocumentKind::FarmCropVariety, "FarmCropVariety"),
+ (FarmCrdtDocumentKind::FarmCropCycle, "FarmCropCycle"),
+ (FarmCrdtDocumentKind::FarmAttachment, "FarmAttachment"),
+ (FarmCrdtDocumentKind::FarmPayPeriod, "FarmPayPeriod"),
+ (FarmCrdtDocumentKind::FarmInventoryItem, "FarmInventoryItem"),
+ (FarmCrdtDocumentKind::FarmMediaAsset, "FarmMediaAsset"),
+ (FarmCrdtDocumentKind::FarmObservation, "FarmObservation"),
] {
let encoded = serde_json::to_string(&kind).unwrap();
assert_eq!(encoded, format!("\"{expected}\""));
- let decoded: RadrootsFarmCrdtDocumentKind = serde_json::from_str(&encoded).unwrap();
+ let decoded: FarmCrdtDocumentKind = serde_json::from_str(&encoded).unwrap();
assert_eq!(decoded, kind);
}
}
@@ -385,180 +355,134 @@ mod tests {
#[test]
fn semantic_kinds_serialize_as_stable_strings() {
for (kind, expected) in [
- (RadrootsFarmSemanticKind::FarmTaskCreate, "FarmTaskCreate"),
- (RadrootsFarmSemanticKind::FarmTaskAssign, "FarmTaskAssign"),
- (RadrootsFarmSemanticKind::FarmTaskJoin, "FarmTaskJoin"),
- (
- RadrootsFarmSemanticKind::FarmTaskStatusSet,
- "FarmTaskStatusSet",
- ),
+ (FarmSemanticKind::FarmTaskCreate, "FarmTaskCreate"),
+ (FarmSemanticKind::FarmTaskAssign, "FarmTaskAssign"),
+ (FarmSemanticKind::FarmTaskJoin, "FarmTaskJoin"),
+ (FarmSemanticKind::FarmTaskStatusSet, "FarmTaskStatusSet"),
(
- RadrootsFarmSemanticKind::FarmTaskChecklistItemAdd,
+ FarmSemanticKind::FarmTaskChecklistItemAdd,
"FarmTaskChecklistItemAdd",
),
+ (FarmSemanticKind::FarmTaskCommentAdd, "FarmTaskCommentAdd"),
(
- RadrootsFarmSemanticKind::FarmTaskCommentAdd,
- "FarmTaskCommentAdd",
- ),
- (
- RadrootsFarmSemanticKind::FarmTaskAttachmentAttach,
+ FarmSemanticKind::FarmTaskAttachmentAttach,
"FarmTaskAttachmentAttach",
),
(
- RadrootsFarmSemanticKind::FarmTaskFollowUpCreate,
+ FarmSemanticKind::FarmTaskFollowUpCreate,
"FarmTaskFollowUpCreate",
),
- (RadrootsFarmSemanticKind::FarmTaskUpdate, "FarmTaskUpdate"),
- (
- RadrootsFarmSemanticKind::FarmTaskComplete,
- "FarmTaskComplete",
- ),
+ (FarmSemanticKind::FarmTaskUpdate, "FarmTaskUpdate"),
+ (FarmSemanticKind::FarmTaskComplete, "FarmTaskComplete"),
(
- RadrootsFarmSemanticKind::FarmWorkSessionStart,
+ FarmSemanticKind::FarmWorkSessionStart,
"FarmWorkSessionStart",
),
+ (FarmSemanticKind::FarmWorkSessionStop, "FarmWorkSessionStop"),
(
- RadrootsFarmSemanticKind::FarmWorkSessionStop,
- "FarmWorkSessionStop",
- ),
- (
- RadrootsFarmSemanticKind::FarmWorkSessionSubmit,
+ FarmSemanticKind::FarmWorkSessionSubmit,
"FarmWorkSessionSubmit",
),
(
- RadrootsFarmSemanticKind::FarmWorkSessionManualEntryCreate,
+ FarmSemanticKind::FarmWorkSessionManualEntryCreate,
"FarmWorkSessionManualEntryCreate",
),
(
- RadrootsFarmSemanticKind::FarmWorkSessionApprove,
+ FarmSemanticKind::FarmWorkSessionApprove,
"FarmWorkSessionApprove",
),
(
- RadrootsFarmSemanticKind::FarmWorkSessionReject,
+ FarmSemanticKind::FarmWorkSessionReject,
"FarmWorkSessionReject",
),
(
- RadrootsFarmSemanticKind::FarmWorkSessionCorrect,
+ FarmSemanticKind::FarmWorkSessionCorrect,
"FarmWorkSessionCorrect",
),
(
- RadrootsFarmSemanticKind::FarmWorkSessionUpdate,
+ FarmSemanticKind::FarmWorkSessionUpdate,
"FarmWorkSessionUpdate",
),
+ (FarmSemanticKind::FarmWorkSessionEnd, "FarmWorkSessionEnd"),
(
- RadrootsFarmSemanticKind::FarmWorkSessionEnd,
- "FarmWorkSessionEnd",
- ),
- (
- RadrootsFarmSemanticKind::FarmHarvestRecordCreate,
+ FarmSemanticKind::FarmHarvestRecordCreate,
"FarmHarvestRecordCreate",
),
+ (FarmSemanticKind::FarmHarvestLineAdd, "FarmHarvestLineAdd"),
(
- RadrootsFarmSemanticKind::FarmHarvestLineAdd,
- "FarmHarvestLineAdd",
- ),
- (
- RadrootsFarmSemanticKind::FarmHarvestLineCorrect,
+ FarmSemanticKind::FarmHarvestLineCorrect,
"FarmHarvestLineCorrect",
),
+ (FarmSemanticKind::FarmHarvestLineVoid, "FarmHarvestLineVoid"),
(
- RadrootsFarmSemanticKind::FarmHarvestLineVoid,
- "FarmHarvestLineVoid",
- ),
- (
- RadrootsFarmSemanticKind::FarmHarvestAttachmentAttach,
+ FarmSemanticKind::FarmHarvestAttachmentAttach,
"FarmHarvestAttachmentAttach",
),
(
- RadrootsFarmSemanticKind::FarmHarvestRecordUpdate,
+ FarmSemanticKind::FarmHarvestRecordUpdate,
"FarmHarvestRecordUpdate",
),
+ (FarmSemanticKind::FarmActivityCreate, "FarmActivityCreate"),
+ (FarmSemanticKind::FarmNoteCreate, "FarmNoteCreate"),
+ (FarmSemanticKind::FarmLocationCreate, "FarmLocationCreate"),
+ (FarmSemanticKind::FarmCropCreate, "FarmCropCreate"),
(
- RadrootsFarmSemanticKind::FarmActivityCreate,
- "FarmActivityCreate",
- ),
- (RadrootsFarmSemanticKind::FarmNoteCreate, "FarmNoteCreate"),
- (
- RadrootsFarmSemanticKind::FarmLocationCreate,
- "FarmLocationCreate",
- ),
- (RadrootsFarmSemanticKind::FarmCropCreate, "FarmCropCreate"),
- (
- RadrootsFarmSemanticKind::FarmCropVarietyCreate,
+ FarmSemanticKind::FarmCropVarietyCreate,
"FarmCropVarietyCreate",
),
+ (FarmSemanticKind::FarmCropCycleCreate, "FarmCropCycleCreate"),
(
- RadrootsFarmSemanticKind::FarmCropCycleCreate,
- "FarmCropCycleCreate",
- ),
- (
- RadrootsFarmSemanticKind::FarmMemberInviteCreate,
+ FarmSemanticKind::FarmMemberInviteCreate,
"FarmMemberInviteCreate",
),
+ (FarmSemanticKind::FarmMemberApprove, "FarmMemberApprove"),
+ (FarmSemanticKind::FarmMemberRoleSet, "FarmMemberRoleSet"),
(
- RadrootsFarmSemanticKind::FarmMemberApprove,
- "FarmMemberApprove",
- ),
- (
- RadrootsFarmSemanticKind::FarmMemberRoleSet,
- "FarmMemberRoleSet",
- ),
- (
- RadrootsFarmSemanticKind::FarmMemberDeactivate,
+ FarmSemanticKind::FarmMemberDeactivate,
"FarmMemberDeactivate",
),
+ (FarmSemanticKind::FarmPayPeriodOpen, "FarmPayPeriodOpen"),
+ (FarmSemanticKind::FarmPayPeriodClose, "FarmPayPeriodClose"),
(
- RadrootsFarmSemanticKind::FarmPayPeriodOpen,
- "FarmPayPeriodOpen",
- ),
- (
- RadrootsFarmSemanticKind::FarmPayPeriodClose,
- "FarmPayPeriodClose",
- ),
- (
- RadrootsFarmSemanticKind::FarmReportExportMark,
+ FarmSemanticKind::FarmReportExportMark,
"FarmReportExportMark",
),
(
- RadrootsFarmSemanticKind::FarmInventoryItemUpdate,
+ FarmSemanticKind::FarmInventoryItemUpdate,
"FarmInventoryItemUpdate",
),
(
- RadrootsFarmSemanticKind::FarmMediaAssetAttach,
+ FarmSemanticKind::FarmMediaAssetAttach,
"FarmMediaAssetAttach",
),
(
- RadrootsFarmSemanticKind::FarmObservationCreate,
+ FarmSemanticKind::FarmObservationCreate,
"FarmObservationCreate",
),
- (
- RadrootsFarmSemanticKind::FarmWorkspaceUpdate,
- "FarmWorkspaceUpdate",
- ),
+ (FarmSemanticKind::FarmWorkspaceUpdate, "FarmWorkspaceUpdate"),
] {
let encoded = serde_json::to_string(&kind).unwrap();
assert_eq!(encoded, format!("\"{expected}\""));
- let decoded: RadrootsFarmSemanticKind = serde_json::from_str(&encoded).unwrap();
+ let decoded: FarmSemanticKind = serde_json::from_str(&encoded).unwrap();
assert_eq!(decoded, kind);
}
}
#[test]
fn unknown_crdt_kinds_roundtrip_as_other_strings() {
- let document_kind: RadrootsFarmCrdtDocumentKind =
- serde_json::from_str("\"FarmSoilTest\"").unwrap();
- let semantic_kind: RadrootsFarmSemanticKind =
+ let document_kind: FarmCrdtDocumentKind = serde_json::from_str("\"FarmSoilTest\"").unwrap();
+ let semantic_kind: FarmSemanticKind =
serde_json::from_str("\"FarmSoilTestCreate\"").unwrap();
assert_eq!(
document_kind,
- RadrootsFarmCrdtDocumentKind::Other {
+ FarmCrdtDocumentKind::Other {
value: "FarmSoilTest".to_string()
}
);
assert_eq!(
semantic_kind,
- RadrootsFarmSemanticKind::Other {
+ FarmSemanticKind::Other {
value: "FarmSoilTestCreate".to_string()
}
);
@@ -574,23 +498,23 @@ mod tests {
);
}
- fn sample_change() -> RadrootsFarmCrdtChange {
- RadrootsFarmCrdtChange {
+ fn sample_change() -> FarmCrdtChange {
+ FarmCrdtChange {
schema: RADROOTS_FARM_CRDT_CHANGE_SCHEMA.to_string(),
- workspace: RadrootsFarmWorkspaceRef {
+ workspace: FarmWorkspaceRef {
pubkey: "workspace_pubkey".to_string(),
d_tag: "ABCDEFGHIJKLMNOPQRSTUV".to_string(),
},
farm_group_id: "BCDEFGHIJKLMNOPQRSTUVW".to_string(),
document_id: "DEFGHIJKLMNOPQRSTUVWXY".to_string(),
- document_kind: RadrootsFarmCrdtDocumentKind::FarmTask,
- crdt_backend: RadrootsCrdtBackend::Automerge,
+ document_kind: FarmCrdtDocumentKind::FarmTask,
+ crdt_backend: CrdtBackend::Automerge,
crdt_backend_version: Some("0.x".to_string()),
actor_id: "actor_abc".to_string(),
change_hash: "crdt_hash_abc".to_string(),
dependencies: Vec::new(),
encoded_change: "base64url-encoded-change".to_string(),
- semantic_kind: RadrootsFarmSemanticKind::FarmTaskCreate,
+ semantic_kind: FarmSemanticKind::FarmTaskCreate,
business_time_ms: 1_780_000_000_000,
author_member_id: Some("member_abc".to_string()),
app_version: Some("0.1.0".to_string()),
diff --git a/crates/event/src/farm_file.rs b/crates/event/src/farm_file.rs
@@ -1,8 +1,8 @@
#![forbid(unsafe_code)]
use crate::envelope::kind::KIND_FARM_FILE_METADATA as KIND_FARM_FILE_METADATA_EVENT;
-use crate::farm::crdt::RadrootsFarmCrdtDocumentKind;
-use crate::farm::workspace::RadrootsFarmWorkspaceRef;
+use crate::farm::crdt::FarmCrdtDocumentKind;
+use crate::farm::workspace::FarmWorkspaceRef;
#[cfg(not(feature = "std"))]
use alloc::{string::String, vec::Vec};
@@ -14,22 +14,22 @@ pub const KIND_FARM_FILE_METADATA: u32 = KIND_FARM_FILE_METADATA_EVENT;
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsFarmFileMetadata {
+pub struct FarmFileMetadata {
pub d_tag: String,
- pub workspace: RadrootsFarmWorkspaceRef,
+ pub workspace: FarmWorkspaceRef,
pub farm_group_id: String,
pub owner_document_id: String,
- pub owner_document_kind: RadrootsFarmCrdtDocumentKind,
+ pub owner_document_kind: FarmCrdtDocumentKind,
pub caption: Option<String>,
pub url: String,
pub mime_type: String,
pub sha256: String,
pub original_sha256: Option<String>,
pub size_bytes: Option<u64>,
- pub dimensions: Option<RadrootsFarmFileDimensions>,
+ pub dimensions: Option<FarmFileDimensions>,
pub blurhash: Option<String>,
- pub thumb: Option<RadrootsFarmFileSource>,
- pub image: Option<RadrootsFarmFileSource>,
+ pub thumb: Option<FarmFileSource>,
+ pub image: Option<FarmFileSource>,
pub alt: Option<String>,
pub fallbacks: Vec<String>,
}
@@ -39,7 +39,7 @@ pub struct RadrootsFarmFileMetadata {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub struct RadrootsFarmFileDimensions {
+pub struct FarmFileDimensions {
pub w: u32,
pub h: u32,
}
@@ -49,10 +49,10 @@ pub struct RadrootsFarmFileDimensions {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsFarmFileSource {
+pub struct FarmFileSource {
pub url: String,
pub mime_type: Option<String>,
- pub dimensions: Option<RadrootsFarmFileDimensions>,
+ pub dimensions: Option<FarmFileDimensions>,
}
#[cfg(all(test, feature = "serde"))]
@@ -70,10 +70,7 @@ mod tests {
assert_eq!(metadata.d_tag, "EFGHIJKLMNOPQRSTUVWXYZ");
assert_eq!(metadata.owner_document_id, "DEFGHIJKLMNOPQRSTUVWXY");
- assert_eq!(
- metadata.owner_document_kind,
- RadrootsFarmCrdtDocumentKind::FarmTask
- );
+ assert_eq!(metadata.owner_document_kind, FarmCrdtDocumentKind::FarmTask);
assert_eq!(
metadata.caption.as_deref(),
Some("Tomatoes harvested from Patch Y.")
@@ -81,7 +78,7 @@ mod tests {
assert_eq!(metadata.mime_type, "image/jpeg");
assert_eq!(
metadata.dimensions,
- Some(RadrootsFarmFileDimensions { w: 1600, h: 1200 })
+ Some(FarmFileDimensions { w: 1600, h: 1200 })
);
assert_eq!(metadata.fallbacks.len(), 1);
}
@@ -103,16 +100,16 @@ mod tests {
assert_eq!(value["dimensions"]["h"], 1200);
}
- fn sample_file_metadata() -> RadrootsFarmFileMetadata {
- RadrootsFarmFileMetadata {
+ fn sample_file_metadata() -> FarmFileMetadata {
+ FarmFileMetadata {
d_tag: "EFGHIJKLMNOPQRSTUVWXYZ".to_string(),
- workspace: RadrootsFarmWorkspaceRef {
+ workspace: FarmWorkspaceRef {
pubkey: "workspace_pubkey".to_string(),
d_tag: "ABCDEFGHIJKLMNOPQRSTUV".to_string(),
},
farm_group_id: "BCDEFGHIJKLMNOPQRSTUVW".to_string(),
owner_document_id: "DEFGHIJKLMNOPQRSTUVWXY".to_string(),
- owner_document_kind: RadrootsFarmCrdtDocumentKind::FarmTask,
+ owner_document_kind: FarmCrdtDocumentKind::FarmTask,
caption: Some("Tomatoes harvested from Patch Y.".to_string()),
url: "https://media.example.invalid/blob/sha256".to_string(),
mime_type: "image/jpeg".to_string(),
@@ -121,12 +118,12 @@ mod tests {
"abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789".to_string(),
),
size_bytes: Some(123_456),
- dimensions: Some(RadrootsFarmFileDimensions { w: 1600, h: 1200 }),
+ dimensions: Some(FarmFileDimensions { w: 1600, h: 1200 }),
blurhash: Some("LEHV6nWB2yk8pyo0adR*.7kCMdnj".to_string()),
- thumb: Some(RadrootsFarmFileSource {
+ thumb: Some(FarmFileSource {
url: "https://media.example.invalid/thumb/sha256".to_string(),
mime_type: Some("image/jpeg".to_string()),
- dimensions: Some(RadrootsFarmFileDimensions { w: 320, h: 240 }),
+ dimensions: Some(FarmFileDimensions { w: 320, h: 240 }),
}),
image: None,
alt: Some("Harvested tomatoes in a crate".to_string()),
diff --git a/crates/event/src/farm_workspace.rs b/crates/event/src/farm_workspace.rs
@@ -1,7 +1,7 @@
#![forbid(unsafe_code)]
use crate::envelope::kind::KIND_FARM_WORKSPACE_MANIFEST as KIND_FARM_WORKSPACE_MANIFEST_EVENT;
-use crate::farm::RadrootsFarmRef;
+use crate::farm::FarmRef;
#[cfg(not(feature = "std"))]
use alloc::{string::String, vec::Vec};
@@ -16,15 +16,15 @@ pub const RADROOTS_FARM_WORKSPACE_TAG: &str = "radroots:farm:workspace";
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsFarmWorkspaceManifest {
+pub struct FarmWorkspaceManifest {
pub d_tag: String,
pub schema: String,
pub farm_group_id: String,
pub name: String,
pub owner_pubkey: String,
- pub farm: Option<RadrootsFarmRef>,
- pub relays: Vec<RadrootsFarmWorkspaceRelay>,
- pub media_servers: Vec<RadrootsFarmWorkspaceMediaServer>,
+ pub farm: Option<FarmRef>,
+ pub relays: Vec<FarmWorkspaceRelay>,
+ pub media_servers: Vec<FarmWorkspaceMediaServer>,
pub supported_kinds: Vec<u32>,
pub protocol_version: String,
pub created_at_ms: u64,
@@ -36,7 +36,7 @@ pub struct RadrootsFarmWorkspaceManifest {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
-pub struct RadrootsFarmWorkspaceRef {
+pub struct FarmWorkspaceRef {
pub pubkey: String,
pub d_tag: String,
}
@@ -46,9 +46,9 @@ pub struct RadrootsFarmWorkspaceRef {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsFarmWorkspaceRelay {
+pub struct FarmWorkspaceRelay {
pub url: String,
- pub mode: RadrootsFarmWorkspaceRelayMode,
+ pub mode: FarmWorkspaceRelayMode,
}
#[cfg_attr(
@@ -56,7 +56,7 @@ pub struct RadrootsFarmWorkspaceRelay {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsFarmWorkspaceRelayMode {
+pub enum FarmWorkspaceRelayMode {
Read,
Write,
ReadWrite,
@@ -67,7 +67,7 @@ pub enum RadrootsFarmWorkspaceRelayMode {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsFarmWorkspaceMediaServer {
+pub struct FarmWorkspaceMediaServer {
pub url: String,
pub service: String,
}
@@ -122,22 +122,22 @@ mod tests {
assert_eq!(value["supported_kinds"][1], KIND_FARM_WORKSPACE_MANIFEST);
}
- fn sample_manifest() -> RadrootsFarmWorkspaceManifest {
- RadrootsFarmWorkspaceManifest {
+ fn sample_manifest() -> FarmWorkspaceManifest {
+ FarmWorkspaceManifest {
d_tag: "ABCDEFGHIJKLMNOPQRSTUV".to_string(),
schema: RADROOTS_FARM_WORKSPACE_SCHEMA.to_string(),
farm_group_id: "BCDEFGHIJKLMNOPQRSTUVW".to_string(),
name: "Small Regen Farm".to_string(),
owner_pubkey: "owner_pubkey".to_string(),
- farm: Some(RadrootsFarmRef {
+ farm: Some(FarmRef {
pubkey: "farm_pubkey".to_string(),
d_tag: "CDEFGHIJKLMNOPQRSTUVWX".to_string(),
}),
- relays: vec![RadrootsFarmWorkspaceRelay {
+ relays: vec![FarmWorkspaceRelay {
url: "wss://relay.example.invalid/farm/ABCDEFGHIJKLMNOPQRSTUV".to_string(),
- mode: RadrootsFarmWorkspaceRelayMode::ReadWrite,
+ mode: FarmWorkspaceRelayMode::ReadWrite,
}],
- media_servers: vec![RadrootsFarmWorkspaceMediaServer {
+ media_servers: vec![FarmWorkspaceMediaServer {
url: "https://media.example.invalid/farm/ABCDEFGHIJKLMNOPQRSTUV".to_string(),
service: "RadrootsPrivateMedia".to_string(),
}],
diff --git a/crates/event/src/file_metadata.rs b/crates/event/src/file_metadata.rs
@@ -1,14 +1,14 @@
#[cfg(not(feature = "std"))]
use alloc::{string::String, vec::Vec};
-use crate::social::{RadrootsSocialMediaDimensions, RadrootsSocialMediaThumbnail};
+use crate::social::{SocialMediaDimensions, SocialMediaThumbnail};
#[cfg_attr(
any(feature = "serde", test),
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsFileMetadata {
+pub struct FileMetadata {
pub url: String,
pub mime_type: String,
pub sha256: String,
@@ -26,7 +26,7 @@ pub struct RadrootsFileMetadata {
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
- pub dimensions: Option<RadrootsSocialMediaDimensions>,
+ pub dimensions: Option<SocialMediaDimensions>,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
@@ -36,7 +36,7 @@ pub struct RadrootsFileMetadata {
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
- pub thumbnails: Option<Vec<RadrootsSocialMediaThumbnail>>,
+ pub thumbnails: Option<Vec<SocialMediaThumbnail>>,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
@@ -80,13 +80,13 @@ mod tests {
#[test]
fn file_metadata_represents_required_nip94_fields() {
- let metadata = RadrootsFileMetadata {
+ let metadata = FileMetadata {
url: "https://example.test/file.jpg".to_string(),
mime_type: "image/jpeg".to_string(),
sha256: "a".repeat(64),
original_sha256: Some("b".repeat(64)),
size: Some(1024),
- dimensions: Some(RadrootsSocialMediaDimensions {
+ dimensions: Some(SocialMediaDimensions {
width: 640,
height: 480,
}),
diff --git a/crates/event/src/follow.rs b/crates/event/src/follow.rs
@@ -8,8 +8,8 @@ use alloc::{string::String, vec::Vec};
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsFollow {
- pub list: Vec<RadrootsFollowProfile>,
+pub struct Follow {
+ pub list: Vec<FollowProfile>,
}
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
@@ -19,7 +19,7 @@ pub struct RadrootsFollow {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsFollowProfile {
+pub struct FollowProfile {
#[cfg_attr(all(test, feature = "std"), dto(int = "json_number"))]
pub published_at: u64,
pub public_key: String,
diff --git a/crates/event/src/food_availability.rs b/crates/event/src/food_availability.rs
@@ -8,7 +8,7 @@ use radroots_blossom::hash::{HashPath, Sha256};
use unicode_general_category::{GeneralCategory, get_general_category};
use url_nostd::{Host, Url};
-use crate::media::RadrootsAuthoredImage;
+use crate::media::AuthoredImage;
pub const RADROOTS_FOOD_CONTENT_MAX_BYTES: usize = 128 * 1024;
pub const RADROOTS_FOOD_IDENTIFIER_MAX_BYTES: usize = 512;
@@ -20,7 +20,7 @@ pub const RADROOTS_FOOD_AVAILABILITY_CONTRACT_ID: &str = "radroots.food.availabi
/// Errors raised while constructing strict FoodAvailability details.
#[non_exhaustive]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsFoodAvailabilityError {
+pub enum FoodAvailabilityError {
ContentMissing,
ContentTooLarge { max: usize, actual: usize },
IdentifierInvalid,
@@ -41,7 +41,7 @@ pub enum RadrootsFoodAvailabilityError {
ImageDuplicateDigest,
}
-impl RadrootsFoodAvailabilityError {
+impl FoodAvailabilityError {
pub const fn code(&self) -> &'static str {
match self {
Self::ContentMissing => "food_content_missing",
@@ -64,7 +64,7 @@ impl RadrootsFoodAvailabilityError {
}
}
-impl fmt::Display for RadrootsFoodAvailabilityError {
+impl fmt::Display for FoodAvailabilityError {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::ContentMissing => {
@@ -134,19 +134,19 @@ impl fmt::Display for RadrootsFoodAvailabilityError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsFoodAvailabilityError {}
+impl std::error::Error for FoodAvailabilityError {}
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct RadrootsFoodContent(String);
+pub struct FoodContent(String);
-impl RadrootsFoodContent {
- pub fn new(value: impl Into<String>) -> Result<Self, RadrootsFoodAvailabilityError> {
+impl FoodContent {
+ pub fn new(value: impl Into<String>) -> Result<Self, FoodAvailabilityError> {
let value = value.into();
if value.chars().all(is_food_contract_whitespace) {
- return Err(RadrootsFoodAvailabilityError::ContentMissing);
+ return Err(FoodAvailabilityError::ContentMissing);
}
if value.len() > RADROOTS_FOOD_CONTENT_MAX_BYTES {
- return Err(RadrootsFoodAvailabilityError::ContentTooLarge {
+ return Err(FoodAvailabilityError::ContentTooLarge {
max: RADROOTS_FOOD_CONTENT_MAX_BYTES,
actual: value.len(),
});
@@ -163,33 +163,33 @@ impl RadrootsFoodContent {
}
}
-impl AsRef<str> for RadrootsFoodContent {
+impl AsRef<str> for FoodContent {
fn as_ref(&self) -> &str {
self.as_str()
}
}
-impl fmt::Display for RadrootsFoodContent {
+impl fmt::Display for FoodContent {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
formatter.write_str(self.as_str())
}
}
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct RadrootsFoodIdentifier(String);
+pub struct FoodIdentifier(String);
-impl RadrootsFoodIdentifier {
- pub fn parse(value: impl AsRef<str>) -> Result<Self, RadrootsFoodAvailabilityError> {
+impl FoodIdentifier {
+ pub fn parse(value: impl AsRef<str>) -> Result<Self, FoodAvailabilityError> {
let value = value.as_ref();
if value.is_empty()
|| value
.chars()
.any(|character| character.is_whitespace() || is_control_or_format(character))
{
- return Err(RadrootsFoodAvailabilityError::IdentifierInvalid);
+ return Err(FoodAvailabilityError::IdentifierInvalid);
}
if value.len() > RADROOTS_FOOD_IDENTIFIER_MAX_BYTES {
- return Err(RadrootsFoodAvailabilityError::IdentifierTooLarge {
+ return Err(FoodAvailabilityError::IdentifierTooLarge {
max: RADROOTS_FOOD_IDENTIFIER_MAX_BYTES,
actual: value.len(),
});
@@ -206,20 +206,20 @@ impl RadrootsFoodIdentifier {
}
}
-impl AsRef<str> for RadrootsFoodIdentifier {
+impl AsRef<str> for FoodIdentifier {
fn as_ref(&self) -> &str {
self.as_str()
}
}
-impl fmt::Display for RadrootsFoodIdentifier {
+impl fmt::Display for FoodIdentifier {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
formatter.write_str(self.as_str())
}
}
-impl FromStr for RadrootsFoodIdentifier {
- type Err = RadrootsFoodAvailabilityError;
+impl FromStr for FoodIdentifier {
+ type Err = FoodAvailabilityError;
fn from_str(value: &str) -> Result<Self, Self::Err> {
Self::parse(value)
@@ -227,16 +227,16 @@ impl FromStr for RadrootsFoodIdentifier {
}
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct RadrootsFoodText(String);
+pub struct FoodText(String);
-impl RadrootsFoodText {
- pub fn new(value: impl Into<String>) -> Result<Self, RadrootsFoodAvailabilityError> {
+impl FoodText {
+ pub fn new(value: impl Into<String>) -> Result<Self, FoodAvailabilityError> {
let value = value.into();
if value.is_empty() || value.trim() != value || value.chars().any(is_control_or_format) {
- return Err(RadrootsFoodAvailabilityError::TextInvalid);
+ return Err(FoodAvailabilityError::TextInvalid);
}
if value.len() > RADROOTS_FOOD_TEXT_MAX_BYTES {
- return Err(RadrootsFoodAvailabilityError::TextTooLarge {
+ return Err(FoodAvailabilityError::TextTooLarge {
max: RADROOTS_FOOD_TEXT_MAX_BYTES,
actual: value.len(),
});
@@ -253,50 +253,47 @@ impl RadrootsFoodText {
}
}
-impl AsRef<str> for RadrootsFoodText {
+impl AsRef<str> for FoodText {
fn as_ref(&self) -> &str {
self.as_str()
}
}
-impl fmt::Display for RadrootsFoodText {
+impl fmt::Display for FoodText {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
formatter.write_str(self.as_str())
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct RadrootsFoodPublishedAt(u64);
+pub struct FoodPublishedAt(u64);
-impl RadrootsFoodPublishedAt {
- pub const fn new(value: u64) -> Result<Self, RadrootsFoodAvailabilityError> {
+impl FoodPublishedAt {
+ pub const fn new(value: u64) -> Result<Self, FoodAvailabilityError> {
if value == 0 {
- return Err(RadrootsFoodAvailabilityError::PublishedAtInvalid);
+ return Err(FoodAvailabilityError::PublishedAtInvalid);
}
Ok(Self(value))
}
- pub fn parse(value: &str) -> Result<Self, RadrootsFoodAvailabilityError> {
+ pub fn parse(value: &str) -> Result<Self, FoodAvailabilityError> {
if !canonical_unsigned_integer(value) {
- return Err(RadrootsFoodAvailabilityError::PublishedAtInvalid);
+ return Err(FoodAvailabilityError::PublishedAtInvalid);
}
value
.parse::<u64>()
.ok()
.and_then(|parsed| Self::new(parsed).ok())
- .ok_or(RadrootsFoodAvailabilityError::PublishedAtInvalid)
+ .ok_or(FoodAvailabilityError::PublishedAtInvalid)
}
pub const fn as_u64(self) -> u64 {
self.0
}
- pub const fn validate_created_at(
- self,
- created_at: u64,
- ) -> Result<(), RadrootsFoodAvailabilityError> {
+ pub const fn validate_created_at(self, created_at: u64) -> Result<(), FoodAvailabilityError> {
if self.0 > created_at {
- return Err(RadrootsFoodAvailabilityError::PublishedAtFuture {
+ return Err(FoodAvailabilityError::PublishedAtFuture {
published_at: self.0,
created_at,
});
@@ -305,14 +302,14 @@ impl RadrootsFoodPublishedAt {
}
}
-impl fmt::Display for RadrootsFoodPublishedAt {
+impl fmt::Display for FoodPublishedAt {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(formatter, "{}", self.0)
}
}
-impl FromStr for RadrootsFoodPublishedAt {
- type Err = RadrootsFoodAvailabilityError;
+impl FromStr for FoodPublishedAt {
+ type Err = FoodAvailabilityError;
fn from_str(value: &str) -> Result<Self, Self::Err> {
Self::parse(value)
@@ -320,13 +317,13 @@ impl FromStr for RadrootsFoodPublishedAt {
}
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct RadrootsFoodCurrency(String);
+pub struct FoodCurrency(String);
-impl RadrootsFoodCurrency {
- pub fn parse(value: impl AsRef<str>) -> Result<Self, RadrootsFoodAvailabilityError> {
+impl FoodCurrency {
+ pub fn parse(value: impl AsRef<str>) -> Result<Self, FoodAvailabilityError> {
let value = value.as_ref();
if value.len() != 3 || !value.bytes().all(|byte| byte.is_ascii_uppercase()) {
- return Err(RadrootsFoodAvailabilityError::PriceCurrencyInvalid);
+ return Err(FoodAvailabilityError::PriceCurrencyInvalid);
}
Ok(Self(value.into()))
}
@@ -340,20 +337,20 @@ impl RadrootsFoodCurrency {
}
}
-impl AsRef<str> for RadrootsFoodCurrency {
+impl AsRef<str> for FoodCurrency {
fn as_ref(&self) -> &str {
self.as_str()
}
}
-impl fmt::Display for RadrootsFoodCurrency {
+impl fmt::Display for FoodCurrency {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
formatter.write_str(self.as_str())
}
}
-impl FromStr for RadrootsFoodCurrency {
- type Err = RadrootsFoodAvailabilityError;
+impl FromStr for FoodCurrency {
+ type Err = FoodAvailabilityError;
fn from_str(value: &str) -> Result<Self, Self::Err> {
Self::parse(value)
@@ -361,7 +358,7 @@ impl FromStr for RadrootsFoodCurrency {
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub enum RadrootsFoodUnit {
+pub enum FoodUnit {
Gram,
Kilogram,
Pound,
@@ -374,7 +371,7 @@ pub enum RadrootsFoodUnit {
Basket,
}
-impl RadrootsFoodUnit {
+impl FoodUnit {
pub const fn as_str(self) -> &'static str {
match self {
Self::Gram => "g",
@@ -390,7 +387,7 @@ impl RadrootsFoodUnit {
}
}
- pub fn parse(value: &str) -> Result<Self, RadrootsFoodAvailabilityError> {
+ pub fn parse(value: &str) -> Result<Self, FoodAvailabilityError> {
match value {
"g" => Ok(Self::Gram),
"kg" => Ok(Self::Kilogram),
@@ -402,19 +399,19 @@ impl RadrootsFoodUnit {
"punnet" => Ok(Self::Punnet),
"bag" => Ok(Self::Bag),
"basket" => Ok(Self::Basket),
- _ => Err(RadrootsFoodAvailabilityError::PriceUnitInvalid),
+ _ => Err(FoodAvailabilityError::PriceUnitInvalid),
}
}
}
-impl fmt::Display for RadrootsFoodUnit {
+impl fmt::Display for FoodUnit {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
formatter.write_str(self.as_str())
}
}
-impl FromStr for RadrootsFoodUnit {
- type Err = RadrootsFoodAvailabilityError;
+impl FromStr for FoodUnit {
+ type Err = FoodAvailabilityError;
fn from_str(value: &str) -> Result<Self, Self::Err> {
Self::parse(value)
@@ -422,22 +419,22 @@ impl FromStr for RadrootsFoodUnit {
}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsFoodPrice {
+pub struct FoodPrice {
amount: String,
- currency: RadrootsFoodCurrency,
- unit: RadrootsFoodUnit,
+ currency: FoodCurrency,
+ unit: FoodUnit,
}
-impl RadrootsFoodPrice {
+impl FoodPrice {
pub fn new(
amount: impl Into<String>,
- currency: RadrootsFoodCurrency,
- unit: RadrootsFoodUnit,
- ) -> Result<Self, RadrootsFoodAvailabilityError> {
+ currency: FoodCurrency,
+ unit: FoodUnit,
+ ) -> Result<Self, FoodAvailabilityError> {
let amount = amount.into();
validate_canonical_decimal(&amount)
.then_some(())
- .ok_or(RadrootsFoodAvailabilityError::PriceInvalid)?;
+ .ok_or(FoodAvailabilityError::PriceInvalid)?;
Ok(Self {
amount,
currency,
@@ -449,32 +446,29 @@ impl RadrootsFoodPrice {
self.amount.as_str()
}
- pub fn currency(&self) -> &RadrootsFoodCurrency {
+ pub fn currency(&self) -> &FoodCurrency {
&self.currency
}
- pub const fn unit(&self) -> RadrootsFoodUnit {
+ pub const fn unit(&self) -> FoodUnit {
self.unit
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsFoodQuantity {
+pub struct FoodQuantity {
amount: String,
- unit: RadrootsFoodUnit,
+ unit: FoodUnit,
}
-impl RadrootsFoodQuantity {
- pub fn new(
- amount: impl Into<String>,
- unit: RadrootsFoodUnit,
- ) -> Result<Self, RadrootsFoodAvailabilityError> {
+impl FoodQuantity {
+ pub fn new(amount: impl Into<String>, unit: FoodUnit) -> Result<Self, FoodAvailabilityError> {
let amount = amount.into();
if !validate_canonical_decimal(&amount) {
- return Err(RadrootsFoodAvailabilityError::QuantityInvalid);
+ return Err(FoodAvailabilityError::QuantityInvalid);
}
if !amount.bytes().any(|byte| matches!(byte, b'1'..=b'9')) {
- return Err(RadrootsFoodAvailabilityError::QuantityZero);
+ return Err(FoodAvailabilityError::QuantityZero);
}
Ok(Self { amount, unit })
}
@@ -483,18 +477,18 @@ impl RadrootsFoodQuantity {
self.amount.as_str()
}
- pub const fn unit(&self) -> RadrootsFoodUnit {
+ pub const fn unit(&self) -> FoodUnit {
self.unit
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub enum RadrootsFoodAvailabilityStatus {
+pub enum FoodAvailabilityStatus {
Active,
Sold,
}
-impl RadrootsFoodAvailabilityStatus {
+impl FoodAvailabilityStatus {
pub const fn as_str(self) -> &'static str {
match self {
Self::Active => "active",
@@ -502,23 +496,23 @@ impl RadrootsFoodAvailabilityStatus {
}
}
- pub fn parse(value: &str) -> Result<Self, RadrootsFoodAvailabilityError> {
+ pub fn parse(value: &str) -> Result<Self, FoodAvailabilityError> {
match value {
"active" => Ok(Self::Active),
"sold" => Ok(Self::Sold),
- _ => Err(RadrootsFoodAvailabilityError::StatusInvalid),
+ _ => Err(FoodAvailabilityError::StatusInvalid),
}
}
}
-impl fmt::Display for RadrootsFoodAvailabilityStatus {
+impl fmt::Display for FoodAvailabilityStatus {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
formatter.write_str(self.as_str())
}
}
-impl FromStr for RadrootsFoodAvailabilityStatus {
- type Err = RadrootsFoodAvailabilityError;
+impl FromStr for FoodAvailabilityStatus {
+ type Err = FoodAvailabilityError;
fn from_str(value: &str) -> Result<Self, Self::Err> {
Self::parse(value)
@@ -526,35 +520,35 @@ impl FromStr for RadrootsFoodAvailabilityStatus {
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct RadrootsFoodImageDimensions {
+pub struct FoodImageDimensions {
width: u32,
height: u32,
}
-impl RadrootsFoodImageDimensions {
- pub const fn new(width: u32, height: u32) -> Result<Self, RadrootsFoodAvailabilityError> {
+impl FoodImageDimensions {
+ pub const fn new(width: u32, height: u32) -> Result<Self, FoodAvailabilityError> {
if width == 0 || height == 0 {
- return Err(RadrootsFoodAvailabilityError::ImageDimensionsInvalid);
+ return Err(FoodAvailabilityError::ImageDimensionsInvalid);
}
Ok(Self { width, height })
}
- pub fn parse(value: &str) -> Result<Self, RadrootsFoodAvailabilityError> {
+ pub fn parse(value: &str) -> Result<Self, FoodAvailabilityError> {
let Some((width, height)) = value.split_once('x') else {
- return Err(RadrootsFoodAvailabilityError::ImageDimensionsInvalid);
+ return Err(FoodAvailabilityError::ImageDimensionsInvalid);
};
if height.contains('x')
|| !canonical_unsigned_integer(width)
|| !canonical_unsigned_integer(height)
{
- return Err(RadrootsFoodAvailabilityError::ImageDimensionsInvalid);
+ return Err(FoodAvailabilityError::ImageDimensionsInvalid);
}
let width = width
.parse::<u32>()
- .map_err(|_| RadrootsFoodAvailabilityError::ImageDimensionsInvalid)?;
+ .map_err(|_| FoodAvailabilityError::ImageDimensionsInvalid)?;
let height = height
.parse::<u32>()
- .map_err(|_| RadrootsFoodAvailabilityError::ImageDimensionsInvalid)?;
+ .map_err(|_| FoodAvailabilityError::ImageDimensionsInvalid)?;
Self::new(width, height)
}
@@ -567,14 +561,14 @@ impl RadrootsFoodImageDimensions {
}
}
-impl fmt::Display for RadrootsFoodImageDimensions {
+impl fmt::Display for FoodImageDimensions {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(formatter, "{}x{}", self.width, self.height)
}
}
-impl FromStr for RadrootsFoodImageDimensions {
- type Err = RadrootsFoodAvailabilityError;
+impl FromStr for FoodImageDimensions {
+ type Err = FoodAvailabilityError;
fn from_str(value: &str) -> Result<Self, Self::Err> {
Self::parse(value)
@@ -586,24 +580,21 @@ impl FromStr for RadrootsFoodImageDimensions {
/// This state proves descriptor-to-byte agreement and an `image/*` media type.
/// It does not prove upload completion, raster decoding, or network availability.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsFoodAvailabilityImage {
- image: RadrootsAuthoredImage,
- dimensions: RadrootsFoodImageDimensions,
+pub struct FoodAvailabilityImage {
+ image: AuthoredImage,
+ dimensions: FoodImageDimensions,
}
-impl RadrootsFoodAvailabilityImage {
- pub const fn new(
- image: RadrootsAuthoredImage,
- dimensions: RadrootsFoodImageDimensions,
- ) -> Self {
+impl FoodAvailabilityImage {
+ pub const fn new(image: AuthoredImage, dimensions: FoodImageDimensions) -> Self {
Self { image, dimensions }
}
- pub fn image(&self) -> &RadrootsAuthoredImage {
+ pub fn image(&self) -> &AuthoredImage {
&self.image
}
- pub const fn dimensions(&self) -> RadrootsFoodImageDimensions {
+ pub const fn dimensions(&self) -> FoodImageDimensions {
self.dimensions
}
@@ -619,47 +610,45 @@ impl RadrootsFoodAvailabilityImage {
/// and bind these details to a per-revision `created_at` before signing.
///
/// ```compile_fail
-/// let _: radroots_event::food::availability::RadrootsFoodAvailabilityDetails =
+/// let _: radroots_event::food::availability::FoodAvailabilityDetails =
/// serde_json::from_str(r#"{"content":"carrots"}"#).unwrap();
/// ```
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsFoodAvailabilityDetails {
- content: RadrootsFoodContent,
- identifier: RadrootsFoodIdentifier,
- title: RadrootsFoodText,
- summary: RadrootsFoodText,
- published_at: RadrootsFoodPublishedAt,
- location: RadrootsFoodText,
- price: RadrootsFoodPrice,
- quantity: Option<RadrootsFoodQuantity>,
- status: RadrootsFoodAvailabilityStatus,
- images: Vec<RadrootsFoodAvailabilityImage>,
+pub struct FoodAvailabilityDetails {
+ content: FoodContent,
+ identifier: FoodIdentifier,
+ title: FoodText,
+ summary: FoodText,
+ published_at: FoodPublishedAt,
+ location: FoodText,
+ price: FoodPrice,
+ quantity: Option<FoodQuantity>,
+ status: FoodAvailabilityStatus,
+ images: Vec<FoodAvailabilityImage>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsFoodAvailabilityDetailsParts {
- pub content: RadrootsFoodContent,
- pub identifier: RadrootsFoodIdentifier,
- pub title: RadrootsFoodText,
- pub summary: RadrootsFoodText,
- pub published_at: RadrootsFoodPublishedAt,
- pub location: RadrootsFoodText,
- pub price: RadrootsFoodPrice,
- pub quantity: Option<RadrootsFoodQuantity>,
- pub status: RadrootsFoodAvailabilityStatus,
- pub images: Vec<RadrootsFoodAvailabilityImage>,
+pub struct FoodAvailabilityDetailsParts {
+ pub content: FoodContent,
+ pub identifier: FoodIdentifier,
+ pub title: FoodText,
+ pub summary: FoodText,
+ pub published_at: FoodPublishedAt,
+ pub location: FoodText,
+ pub price: FoodPrice,
+ pub quantity: Option<FoodQuantity>,
+ pub status: FoodAvailabilityStatus,
+ pub images: Vec<FoodAvailabilityImage>,
}
-impl RadrootsFoodAvailabilityDetails {
- pub fn new(
- parts: RadrootsFoodAvailabilityDetailsParts,
- ) -> Result<Self, RadrootsFoodAvailabilityError> {
+impl FoodAvailabilityDetails {
+ pub fn new(parts: FoodAvailabilityDetailsParts) -> Result<Self, FoodAvailabilityError> {
if parts
.quantity
.as_ref()
.is_some_and(|quantity| quantity.unit() != parts.price.unit())
{
- return Err(RadrootsFoodAvailabilityError::QuantityInvalid);
+ return Err(FoodAvailabilityError::QuantityInvalid);
}
validate_images(&parts.images)?;
Ok(Self {
@@ -676,59 +665,54 @@ impl RadrootsFoodAvailabilityDetails {
})
}
- pub fn validate_created_at(
- &self,
- created_at: u64,
- ) -> Result<(), RadrootsFoodAvailabilityError> {
+ pub fn validate_created_at(&self, created_at: u64) -> Result<(), FoodAvailabilityError> {
self.published_at.validate_created_at(created_at)
}
- pub fn content(&self) -> &RadrootsFoodContent {
+ pub fn content(&self) -> &FoodContent {
&self.content
}
- pub fn identifier(&self) -> &RadrootsFoodIdentifier {
+ pub fn identifier(&self) -> &FoodIdentifier {
&self.identifier
}
- pub fn title(&self) -> &RadrootsFoodText {
+ pub fn title(&self) -> &FoodText {
&self.title
}
- pub fn summary(&self) -> &RadrootsFoodText {
+ pub fn summary(&self) -> &FoodText {
&self.summary
}
- pub const fn published_at(&self) -> RadrootsFoodPublishedAt {
+ pub const fn published_at(&self) -> FoodPublishedAt {
self.published_at
}
- pub fn location(&self) -> &RadrootsFoodText {
+ pub fn location(&self) -> &FoodText {
&self.location
}
- pub fn price(&self) -> &RadrootsFoodPrice {
+ pub fn price(&self) -> &FoodPrice {
&self.price
}
- pub fn quantity(&self) -> Option<&RadrootsFoodQuantity> {
+ pub fn quantity(&self) -> Option<&FoodQuantity> {
self.quantity.as_ref()
}
- pub const fn status(&self) -> RadrootsFoodAvailabilityStatus {
+ pub const fn status(&self) -> FoodAvailabilityStatus {
self.status
}
- pub fn images(&self) -> &[RadrootsFoodAvailabilityImage] {
+ pub fn images(&self) -> &[FoodAvailabilityImage] {
&self.images
}
}
-fn validate_images(
- images: &[RadrootsFoodAvailabilityImage],
-) -> Result<(), RadrootsFoodAvailabilityError> {
+fn validate_images(images: &[FoodAvailabilityImage]) -> Result<(), FoodAvailabilityError> {
if images.len() > RADROOTS_FOOD_IMAGE_MAX_COUNT {
- return Err(RadrootsFoodAvailabilityError::ImageCountExceeded {
+ return Err(FoodAvailabilityError::ImageCountExceeded {
max: RADROOTS_FOOD_IMAGE_MAX_COUNT,
actual: images.len(),
});
@@ -738,14 +722,14 @@ fn validate_images(
.iter()
.any(|candidate| candidate.url() == image.url())
{
- return Err(RadrootsFoodAvailabilityError::ImageDuplicateUrl);
+ return Err(FoodAvailabilityError::ImageDuplicateUrl);
}
let digest = image.image().descriptor().sha256();
if images[..index]
.iter()
.any(|candidate| candidate.image().descriptor().sha256() == digest)
{
- return Err(RadrootsFoodAvailabilityError::ImageDuplicateDigest);
+ return Err(FoodAvailabilityError::ImageDuplicateDigest);
}
}
Ok(())
@@ -902,72 +886,63 @@ mod tests {
fn error_codes_and_messages_are_stable_for_every_variant() {
let cases = [
(
- RadrootsFoodAvailabilityError::ContentMissing,
+ FoodAvailabilityError::ContentMissing,
"food_content_missing",
),
(
- RadrootsFoodAvailabilityError::ContentTooLarge { max: 1, actual: 2 },
+ FoodAvailabilityError::ContentTooLarge { max: 1, actual: 2 },
"food_content_too_large",
),
(
- RadrootsFoodAvailabilityError::IdentifierInvalid,
+ FoodAvailabilityError::IdentifierInvalid,
"food_identifier_invalid",
),
(
- RadrootsFoodAvailabilityError::IdentifierTooLarge { max: 1, actual: 2 },
+ FoodAvailabilityError::IdentifierTooLarge { max: 1, actual: 2 },
"food_identifier_invalid",
),
+ (FoodAvailabilityError::TextInvalid, "food_text_invalid"),
(
- RadrootsFoodAvailabilityError::TextInvalid,
+ FoodAvailabilityError::TextTooLarge { max: 1, actual: 2 },
"food_text_invalid",
),
(
- RadrootsFoodAvailabilityError::TextTooLarge { max: 1, actual: 2 },
- "food_text_invalid",
- ),
- (
- RadrootsFoodAvailabilityError::PublishedAtInvalid,
+ FoodAvailabilityError::PublishedAtInvalid,
"food_published_at_invalid",
),
(
- RadrootsFoodAvailabilityError::PublishedAtFuture {
+ FoodAvailabilityError::PublishedAtFuture {
published_at: 2,
created_at: 1,
},
"food_published_at_future",
),
- (RadrootsFoodAvailabilityError::PriceInvalid, "price_invalid"),
+ (FoodAvailabilityError::PriceInvalid, "price_invalid"),
(
- RadrootsFoodAvailabilityError::PriceCurrencyInvalid,
+ FoodAvailabilityError::PriceCurrencyInvalid,
"price_currency_invalid",
),
(
- RadrootsFoodAvailabilityError::PriceUnitInvalid,
+ FoodAvailabilityError::PriceUnitInvalid,
"price_unit_invalid",
),
+ (FoodAvailabilityError::QuantityInvalid, "quantity_invalid"),
+ (FoodAvailabilityError::QuantityZero, "quantity_zero"),
+ (FoodAvailabilityError::StatusInvalid, "food_status_invalid"),
(
- RadrootsFoodAvailabilityError::QuantityInvalid,
- "quantity_invalid",
- ),
- (RadrootsFoodAvailabilityError::QuantityZero, "quantity_zero"),
- (
- RadrootsFoodAvailabilityError::StatusInvalid,
- "food_status_invalid",
- ),
- (
- RadrootsFoodAvailabilityError::ImageDimensionsInvalid,
+ FoodAvailabilityError::ImageDimensionsInvalid,
"food_image_dimensions_invalid",
),
(
- RadrootsFoodAvailabilityError::ImageCountExceeded { max: 1, actual: 2 },
+ FoodAvailabilityError::ImageCountExceeded { max: 1, actual: 2 },
"food_image_count_exceeded",
),
(
- RadrootsFoodAvailabilityError::ImageDuplicateUrl,
+ FoodAvailabilityError::ImageDuplicateUrl,
"food_image_duplicate_url",
),
(
- RadrootsFoodAvailabilityError::ImageDuplicateDigest,
+ FoodAvailabilityError::ImageDuplicateDigest,
"food_image_duplicate_digest",
),
];
@@ -990,28 +965,25 @@ mod tests {
"\u{1c}\u{2003}\t",
] {
assert_eq!(
- RadrootsFoodContent::new(invalid).unwrap_err(),
- RadrootsFoodAvailabilityError::ContentMissing,
+ FoodContent::new(invalid).unwrap_err(),
+ FoodAvailabilityError::ContentMissing,
"{invalid:?}"
);
}
let exact = "é".repeat(RADROOTS_FOOD_CONTENT_MAX_BYTES / 2);
assert_eq!(
- RadrootsFoodContent::new(exact.clone())
- .unwrap()
- .as_str()
- .len(),
+ FoodContent::new(exact.clone()).unwrap().as_str().len(),
RADROOTS_FOOD_CONTENT_MAX_BYTES
);
assert_eq!(
- RadrootsFoodContent::new(exact + "a").unwrap_err(),
- RadrootsFoodAvailabilityError::ContentTooLarge {
+ FoodContent::new(exact + "a").unwrap_err(),
+ FoodAvailabilityError::ContentTooLarge {
max: RADROOTS_FOOD_CONTENT_MAX_BYTES,
actual: RADROOTS_FOOD_CONTENT_MAX_BYTES + 1,
}
);
- assert!(RadrootsFoodContent::new(" harvest\nnotes ").is_ok());
- assert!(RadrootsFoodContent::new("carrots\u{1c}").is_ok());
+ assert!(FoodContent::new(" harvest\nnotes ").is_ok());
+ assert!(FoodContent::new("carrots\u{1c}").is_ok());
}
#[test]
@@ -1049,13 +1021,10 @@ mod tests {
#[test]
fn identifier_enforces_bytes_whitespace_and_unicode_categories() {
let exact = "a".repeat(RADROOTS_FOOD_IDENTIFIER_MAX_BYTES);
- assert_eq!(
- RadrootsFoodIdentifier::parse(&exact).unwrap().as_str(),
- exact
- );
+ assert_eq!(FoodIdentifier::parse(&exact).unwrap().as_str(), exact);
assert!(matches!(
- RadrootsFoodIdentifier::parse(exact + "a"),
- Err(RadrootsFoodAvailabilityError::IdentifierTooLarge { .. })
+ FoodIdentifier::parse(exact + "a"),
+ Err(FoodAvailabilityError::IdentifierTooLarge { .. })
));
for invalid in [
"",
@@ -1066,7 +1035,7 @@ mod tests {
"carrots\u{2060}",
] {
assert_eq!(
- RadrootsFoodIdentifier::parse(invalid).unwrap_err().code(),
+ FoodIdentifier::parse(invalid).unwrap_err().code(),
"food_identifier_invalid"
);
}
@@ -1075,13 +1044,10 @@ mod tests {
#[test]
fn text_enforces_trim_bytes_and_unicode_categories() {
let exact = "é".repeat(RADROOTS_FOOD_TEXT_MAX_BYTES / 2);
- assert_eq!(
- RadrootsFoodText::new(exact.clone()).unwrap().as_str(),
- exact
- );
+ assert_eq!(FoodText::new(exact.clone()).unwrap().as_str(), exact);
assert!(matches!(
- RadrootsFoodText::new(exact + "a"),
- Err(RadrootsFoodAvailabilityError::TextTooLarge { .. })
+ FoodText::new(exact + "a"),
+ Err(FoodAvailabilityError::TextTooLarge { .. })
));
for invalid in [
"",
@@ -1093,7 +1059,7 @@ mod tests {
"Car\u{2060}rots",
] {
assert_eq!(
- RadrootsFoodText::new(invalid).unwrap_err().code(),
+ FoodText::new(invalid).unwrap_err().code(),
"food_text_invalid"
);
}
@@ -1102,24 +1068,24 @@ mod tests {
#[test]
fn published_at_is_nonzero_canonical_u64_and_not_in_the_future() {
assert_eq!(
- RadrootsFoodPublishedAt::new(0).unwrap_err(),
- RadrootsFoodAvailabilityError::PublishedAtInvalid
+ FoodPublishedAt::new(0).unwrap_err(),
+ FoodAvailabilityError::PublishedAtInvalid
);
for invalid in ["", "0", "01", "+1", "18446744073709551616"] {
assert_eq!(
- RadrootsFoodPublishedAt::parse(invalid).unwrap_err(),
- RadrootsFoodAvailabilityError::PublishedAtInvalid
+ FoodPublishedAt::parse(invalid).unwrap_err(),
+ FoodAvailabilityError::PublishedAtInvalid
);
}
- let timestamp = RadrootsFoodPublishedAt::parse("18446744073709551615").unwrap();
+ let timestamp = FoodPublishedAt::parse("18446744073709551615").unwrap();
assert_eq!(timestamp.as_u64(), u64::MAX);
assert_eq!(timestamp.to_string(), u64::MAX.to_string());
assert_eq!(
- RadrootsFoodPublishedAt::new(11)
+ FoodPublishedAt::new(11)
.unwrap()
.validate_created_at(10)
.unwrap_err(),
- RadrootsFoodAvailabilityError::PublishedAtFuture {
+ FoodAvailabilityError::PublishedAtFuture {
published_at: 11,
created_at: 10,
}
@@ -1129,36 +1095,35 @@ mod tests {
#[test]
fn food_units_are_exact_and_closed() {
let cases = [
- ("g", RadrootsFoodUnit::Gram),
- ("kg", RadrootsFoodUnit::Kilogram),
- ("lb", RadrootsFoodUnit::Pound),
- ("oz", RadrootsFoodUnit::Ounce),
- ("each", RadrootsFoodUnit::Each),
- ("dozen", RadrootsFoodUnit::Dozen),
- ("bunch", RadrootsFoodUnit::Bunch),
- ("punnet", RadrootsFoodUnit::Punnet),
- ("bag", RadrootsFoodUnit::Bag),
- ("basket", RadrootsFoodUnit::Basket),
+ ("g", FoodUnit::Gram),
+ ("kg", FoodUnit::Kilogram),
+ ("lb", FoodUnit::Pound),
+ ("oz", FoodUnit::Ounce),
+ ("each", FoodUnit::Each),
+ ("dozen", FoodUnit::Dozen),
+ ("bunch", FoodUnit::Bunch),
+ ("punnet", FoodUnit::Punnet),
+ ("bag", FoodUnit::Bag),
+ ("basket", FoodUnit::Basket),
];
for (wire, unit) in cases {
- assert_eq!(RadrootsFoodUnit::parse(wire).unwrap(), unit);
+ assert_eq!(FoodUnit::parse(wire).unwrap(), unit);
assert_eq!(unit.as_str(), wire);
assert_eq!(unit.to_string(), wire);
}
for invalid in ["", "G", "lbs", "crate", " each"] {
assert_eq!(
- RadrootsFoodUnit::parse(invalid).unwrap_err(),
- RadrootsFoodAvailabilityError::PriceUnitInvalid
+ FoodUnit::parse(invalid).unwrap_err(),
+ FoodAvailabilityError::PriceUnitInvalid
);
}
}
#[test]
fn price_decimal_is_canonical_bounded_and_may_be_zero() {
- let currency = RadrootsFoodCurrency::parse("CAD").unwrap();
+ let currency = FoodCurrency::parse("CAD").unwrap();
for valid in ["0", "1", "0.1", "10.25", "1234567890123456789012345678"] {
- let price =
- RadrootsFoodPrice::new(valid, currency.clone(), RadrootsFoodUnit::Pound).unwrap();
+ let price = FoodPrice::new(valid, currency.clone(), FoodUnit::Pound).unwrap();
assert_eq!(price.amount(), valid);
}
for invalid in [
@@ -1177,9 +1142,8 @@ mod tests {
"12345678901234567890123456789",
] {
assert_eq!(
- RadrootsFoodPrice::new(invalid, currency.clone(), RadrootsFoodUnit::Pound)
- .unwrap_err(),
- RadrootsFoodAvailabilityError::PriceInvalid
+ FoodPrice::new(invalid, currency.clone(), FoodUnit::Pound).unwrap_err(),
+ FoodAvailabilityError::PriceInvalid
);
}
}
@@ -1187,58 +1151,58 @@ mod tests {
#[test]
fn currency_is_three_uppercase_ascii_letters_without_registry_semantics() {
for valid in ["CAD", "USD", "ZZZ"] {
- assert_eq!(RadrootsFoodCurrency::parse(valid).unwrap().as_str(), valid);
+ assert_eq!(FoodCurrency::parse(valid).unwrap().as_str(), valid);
}
for invalid in ["", "CA", "CADD", "cad", "C1D", "CÁD"] {
assert_eq!(
- RadrootsFoodCurrency::parse(invalid).unwrap_err(),
- RadrootsFoodAvailabilityError::PriceCurrencyInvalid
+ FoodCurrency::parse(invalid).unwrap_err(),
+ FoodAvailabilityError::PriceCurrencyInvalid
);
}
}
#[test]
fn quantity_is_positive_canonical_and_retains_its_unit() {
- let quantity = RadrootsFoodQuantity::new("20.5", RadrootsFoodUnit::Pound).unwrap();
+ let quantity = FoodQuantity::new("20.5", FoodUnit::Pound).unwrap();
assert_eq!(quantity.amount(), "20.5");
- assert_eq!(quantity.unit(), RadrootsFoodUnit::Pound);
+ assert_eq!(quantity.unit(), FoodUnit::Pound);
assert_eq!(
- RadrootsFoodQuantity::new("0", RadrootsFoodUnit::Pound).unwrap_err(),
- RadrootsFoodAvailabilityError::QuantityZero
+ FoodQuantity::new("0", FoodUnit::Pound).unwrap_err(),
+ FoodAvailabilityError::QuantityZero
);
assert_eq!(
- RadrootsFoodQuantity::new("01", RadrootsFoodUnit::Pound).unwrap_err(),
- RadrootsFoodAvailabilityError::QuantityInvalid
+ FoodQuantity::new("01", FoodUnit::Pound).unwrap_err(),
+ FoodAvailabilityError::QuantityInvalid
);
}
#[test]
fn status_is_exact_and_withdrawal_is_not_a_status() {
assert_eq!(
- RadrootsFoodAvailabilityStatus::parse("active").unwrap(),
- RadrootsFoodAvailabilityStatus::Active
+ FoodAvailabilityStatus::parse("active").unwrap(),
+ FoodAvailabilityStatus::Active
);
assert_eq!(
- RadrootsFoodAvailabilityStatus::parse("sold").unwrap(),
- RadrootsFoodAvailabilityStatus::Sold
+ FoodAvailabilityStatus::parse("sold").unwrap(),
+ FoodAvailabilityStatus::Sold
);
for invalid in ["", "Active", "withdrawn"] {
assert_eq!(
- RadrootsFoodAvailabilityStatus::parse(invalid).unwrap_err(),
- RadrootsFoodAvailabilityError::StatusInvalid
+ FoodAvailabilityStatus::parse(invalid).unwrap_err(),
+ FoodAvailabilityError::StatusInvalid
);
}
}
#[test]
fn image_dimensions_are_canonical_nonzero_u32_values() {
- let dimensions = RadrootsFoodImageDimensions::new(u32::MAX, 1).unwrap();
+ let dimensions = FoodImageDimensions::new(u32::MAX, 1).unwrap();
assert_eq!(dimensions.width(), u32::MAX);
assert_eq!(dimensions.height(), 1);
assert_eq!(dimensions.to_string(), "4294967295x1");
assert_eq!(
- RadrootsFoodImageDimensions::parse("800x600").unwrap(),
- RadrootsFoodImageDimensions::new(800, 600).unwrap()
+ FoodImageDimensions::parse("800x600").unwrap(),
+ FoodImageDimensions::new(800, 600).unwrap()
);
for invalid in [
"",
@@ -1251,8 +1215,8 @@ mod tests {
"4294967296x1",
] {
assert_eq!(
- RadrootsFoodImageDimensions::parse(invalid).unwrap_err(),
- RadrootsFoodAvailabilityError::ImageDimensionsInvalid
+ FoodImageDimensions::parse(invalid).unwrap_err(),
+ FoodAvailabilityError::ImageDimensionsInvalid
);
}
}
@@ -1260,13 +1224,13 @@ mod tests {
#[test]
fn details_enforce_quantity_unit_and_created_at() {
let mut parts = details_parts(Vec::new());
- parts.quantity = Some(RadrootsFoodQuantity::new("12", RadrootsFoodUnit::Kilogram).unwrap());
+ parts.quantity = Some(FoodQuantity::new("12", FoodUnit::Kilogram).unwrap());
assert_eq!(
- RadrootsFoodAvailabilityDetails::new(parts).unwrap_err(),
- RadrootsFoodAvailabilityError::QuantityInvalid
+ FoodAvailabilityDetails::new(parts).unwrap_err(),
+ FoodAvailabilityError::QuantityInvalid
);
- let details = RadrootsFoodAvailabilityDetails::new(details_parts(Vec::new())).unwrap();
+ let details = FoodAvailabilityDetails::new(details_parts(Vec::new())).unwrap();
details.validate_created_at(100).unwrap();
assert_eq!(details.identifier().as_str(), "nantes-carrots");
assert_eq!(details.title().as_str(), "Nantes Carrots");
@@ -1279,7 +1243,7 @@ mod tests {
assert_eq!(details.price().amount(), "4");
assert_eq!(details.price().currency().as_str(), "CAD");
assert_eq!(details.quantity().unwrap().amount(), "24");
- assert_eq!(details.status(), RadrootsFoodAvailabilityStatus::Active);
+ assert_eq!(details.status(), FoodAvailabilityStatus::Active);
assert!(details.images().is_empty());
assert_eq!(
details.validate_created_at(99).unwrap_err().code(),
@@ -1289,7 +1253,7 @@ mod tests {
#[test]
fn details_bound_images_and_apply_url_before_digest_duplicate_precedence() {
- let dimensions = RadrootsFoodImageDimensions::new(800, 600).unwrap();
+ let dimensions = FoodImageDimensions::new(800, 600).unwrap();
let images = (0..RADROOTS_FOOD_IMAGE_MAX_COUNT)
.map(|index| {
food_image(
@@ -1300,7 +1264,7 @@ mod tests {
})
.collect::<Vec<_>>();
assert_eq!(
- RadrootsFoodAvailabilityDetails::new(details_parts(images))
+ FoodAvailabilityDetails::new(details_parts(images))
.unwrap()
.images()
.len(),
@@ -1316,8 +1280,8 @@ mod tests {
})
.collect::<Vec<_>>();
assert_eq!(
- RadrootsFoodAvailabilityDetails::new(details_parts(too_many)).unwrap_err(),
- RadrootsFoodAvailabilityError::ImageCountExceeded {
+ FoodAvailabilityDetails::new(details_parts(too_many)).unwrap_err(),
+ FoodAvailabilityError::ImageCountExceeded {
max: RADROOTS_FOOD_IMAGE_MAX_COUNT,
actual: RADROOTS_FOOD_IMAGE_MAX_COUNT + 1,
}
@@ -1325,38 +1289,31 @@ mod tests {
let image = food_image("https://media.example", b"carrot", dimensions);
assert_eq!(
- RadrootsFoodAvailabilityDetails::new(details_parts(vec![image.clone(), image]))
- .unwrap_err(),
- RadrootsFoodAvailabilityError::ImageDuplicateUrl
+ FoodAvailabilityDetails::new(details_parts(vec![image.clone(), image])).unwrap_err(),
+ FoodAvailabilityError::ImageDuplicateUrl
);
assert_eq!(
- RadrootsFoodAvailabilityDetails::new(details_parts(vec![
+ FoodAvailabilityDetails::new(details_parts(vec![
food_image("https://media.example", b"same", dimensions),
food_image("https://cache.example", b"same", dimensions),
]))
.unwrap_err(),
- RadrootsFoodAvailabilityError::ImageDuplicateDigest
+ FoodAvailabilityError::ImageDuplicateDigest
);
}
- fn details_parts(
- images: Vec<RadrootsFoodAvailabilityImage>,
- ) -> RadrootsFoodAvailabilityDetailsParts {
- RadrootsFoodAvailabilityDetailsParts {
- content: RadrootsFoodContent::new("Nantes carrots available this week.").unwrap(),
- identifier: RadrootsFoodIdentifier::parse("nantes-carrots").unwrap(),
- title: RadrootsFoodText::new("Nantes Carrots").unwrap(),
- summary: RadrootsFoodText::new("Fresh bunches").unwrap(),
- published_at: RadrootsFoodPublishedAt::new(100).unwrap(),
- location: RadrootsFoodText::new("Central Saanich, BC").unwrap(),
- price: RadrootsFoodPrice::new(
- "4",
- RadrootsFoodCurrency::parse("CAD").unwrap(),
- RadrootsFoodUnit::Pound,
- )
- .unwrap(),
- quantity: Some(RadrootsFoodQuantity::new("24", RadrootsFoodUnit::Pound).unwrap()),
- status: RadrootsFoodAvailabilityStatus::Active,
+ fn details_parts(images: Vec<FoodAvailabilityImage>) -> FoodAvailabilityDetailsParts {
+ FoodAvailabilityDetailsParts {
+ content: FoodContent::new("Nantes carrots available this week.").unwrap(),
+ identifier: FoodIdentifier::parse("nantes-carrots").unwrap(),
+ title: FoodText::new("Nantes Carrots").unwrap(),
+ summary: FoodText::new("Fresh bunches").unwrap(),
+ published_at: FoodPublishedAt::new(100).unwrap(),
+ location: FoodText::new("Central Saanich, BC").unwrap(),
+ price: FoodPrice::new("4", FoodCurrency::parse("CAD").unwrap(), FoodUnit::Pound)
+ .unwrap(),
+ quantity: Some(FoodQuantity::new("24", FoodUnit::Pound).unwrap()),
+ status: FoodAvailabilityStatus::Active,
images,
}
}
@@ -1364,8 +1321,8 @@ mod tests {
fn food_image(
origin: &str,
bytes: &[u8],
- dimensions: RadrootsFoodImageDimensions,
- ) -> RadrootsFoodAvailabilityImage {
+ dimensions: FoodImageDimensions,
+ ) -> FoodAvailabilityImage {
let hash = Sha256::digest(bytes);
let media_type = MediaType::parse("image/webp").unwrap();
let descriptor = BlobDescriptor::new(
@@ -1380,9 +1337,6 @@ mod tests {
.unwrap()
.verify_bytes(bytes, &media_type)
.unwrap();
- RadrootsFoodAvailabilityImage::new(
- RadrootsAuthoredImage::try_from(descriptor).unwrap(),
- dimensions,
- )
+ FoodAvailabilityImage::new(AuthoredImage::try_from(descriptor).unwrap(), dimensions)
}
}
diff --git a/crates/event/src/gcs.rs b/crates/event/src/gcs.rs
@@ -8,7 +8,7 @@ use alloc::{string::String, vec::Vec};
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsGeoJsonPoint {
+pub struct GeoJsonPoint {
#[cfg_attr(any(feature = "serde", test), serde(rename = "type"))]
pub r#type: String,
pub coordinates: [f64; 2],
@@ -21,7 +21,7 @@ pub struct RadrootsGeoJsonPoint {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsGeoJsonPolygon {
+pub struct GeoJsonPolygon {
#[cfg_attr(any(feature = "serde", test), serde(rename = "type"))]
pub r#type: String,
pub coordinates: Vec<Vec<[f64; 2]>>,
@@ -34,12 +34,12 @@ pub struct RadrootsGeoJsonPolygon {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsGcsLocation {
+pub struct GcsLocation {
pub lat: f64,
pub lng: f64,
pub geohash: String,
- pub point: RadrootsGeoJsonPoint,
- pub polygon: RadrootsGeoJsonPolygon,
+ pub point: GeoJsonPoint,
+ pub polygon: GeoJsonPolygon,
pub accuracy: Option<f64>,
pub altitude: Option<f64>,
pub tag_0: Option<String>,
diff --git a/crates/event/src/generated/dto_roots.rs b/crates/event/src/generated/dto_roots.rs
@@ -3,203 +3,152 @@
pub fn dto_bindgen_roots() -> ::std::vec::Vec<::dto_bindgen::export::RootDescriptor> {
::std::vec![
- ::dto_bindgen::export::RootDescriptor::new::<crate::dto::RadrootsNip01EventWireDto>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::dto::RadrootsSignedEventDto>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::dto::Nip01EventWireDto>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::dto::SignedEventDto>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::dto::SignedEventVerificationStateDto>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::dto::VerifiedSignedEventDto>(),
::dto_bindgen::export::RootDescriptor::new::<
- crate::dto::RadrootsSignedEventVerificationStateDto,
+ crate::dto::VerifiedSignedEventVerificationStateDto,
>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::dto::RadrootsVerifiedSignedEventDto>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::envelope::EventEnvelope>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::farm::Farm>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::farm::FarmPublicLocation>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::farm::FarmRef>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::farm::change_set::GcsLocation>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::farm::change_set::GeoJsonPoint>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::farm::change_set::GeoJsonPolygon>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::farm::coop::Coop>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::farm::coop::CoopLocation>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::farm::coop::CoopRef>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::farm::plot::Plot>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::farm::plot::PlotLocation>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::farm::plot::PlotRef>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::farm::resource_area::ResourceArea>(),
::dto_bindgen::export::RootDescriptor::new::<
- crate::dto::RadrootsVerifiedSignedEventVerificationStateDto,
+ crate::farm::resource_area::ResourceAreaLocation,
>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::envelope::RadrootsEventEnvelope>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::farm::RadrootsFarm>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::farm::RadrootsFarmPublicLocation>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::farm::RadrootsFarmRef>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::farm::change_set::RadrootsGcsLocation>(
+ ::dto_bindgen::export::RootDescriptor::new::<crate::farm::resource_area::ResourceAreaRef>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::farm::resource_cap::ResourceHarvestCap>(
),
- ::dto_bindgen::export::RootDescriptor::new::<crate::farm::change_set::RadrootsGeoJsonPoint>(
- ),
- ::dto_bindgen::export::RootDescriptor::new::<crate::farm::change_set::RadrootsGeoJsonPolygon>(
- ),
- ::dto_bindgen::export::RootDescriptor::new::<crate::farm::coop::RadrootsCoop>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::farm::coop::RadrootsCoopLocation>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::farm::coop::RadrootsCoopRef>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::farm::plot::RadrootsPlot>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::farm::plot::RadrootsPlotLocation>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::farm::plot::RadrootsPlotRef>(),
- ::dto_bindgen::export::RootDescriptor::new::<
- crate::farm::resource_area::RadrootsResourceArea,
- >(),
- ::dto_bindgen::export::RootDescriptor::new::<
- crate::farm::resource_area::RadrootsResourceAreaLocation,
- >(),
- ::dto_bindgen::export::RootDescriptor::new::<
- crate::farm::resource_area::RadrootsResourceAreaRef,
- >(),
- ::dto_bindgen::export::RootDescriptor::new::<
- crate::farm::resource_cap::RadrootsResourceHarvestCap,
- >(),
- ::dto_bindgen::export::RootDescriptor::new::<
- crate::farm::resource_cap::RadrootsResourceHarvestProduct,
- >(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::RadrootsAddressableRef>(),
- ::dto_bindgen::export::RootDescriptor::new::<
- crate::knowledge::RadrootsContributionAttestation,
- >(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::RadrootsEvidenceBounty>(),
::dto_bindgen::export::RootDescriptor::new::<
- crate::knowledge::RadrootsKnowledgeChangeProposal,
+ crate::farm::resource_cap::ResourceHarvestProduct,
>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::RadrootsKnowledgeCitationSpan>(
- ),
- ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::RadrootsKnowledgeClaim>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::RadrootsKnowledgeFieldContext>(
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::AddressableRef>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::ContributionAttestation>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::EvidenceBounty>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::KnowledgeChangeProposal>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::KnowledgeCitationSpan>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::KnowledgeClaim>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::KnowledgeFieldContext>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::KnowledgeFieldReport>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::KnowledgeLocation>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::KnowledgeLocationPrecision>(
),
- ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::RadrootsKnowledgeFieldReport>(
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::KnowledgeNodeRef>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::KnowledgeObservation>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::KnowledgeObservationValue>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::KnowledgeRelation>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::KnowledgeReview>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::KnowledgeReviewScope>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::KnowledgeReviewScore>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::KnowledgeReviewTarget>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::KnowledgeSource>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::RightsAssertion>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::WikiArticle>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::WikiArticleVersionRef>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::WikiMergeRequest>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::WikiRedirect>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::listing::operational::OperationalListing>(
),
- ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::RadrootsKnowledgeLocation>(),
- ::dto_bindgen::export::RootDescriptor::new::<
- crate::knowledge::RadrootsKnowledgeLocationPrecision,
- >(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::RadrootsKnowledgeNodeRef>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::RadrootsKnowledgeObservation>(
- ),
- ::dto_bindgen::export::RootDescriptor::new::<
- crate::knowledge::RadrootsKnowledgeObservationValue,
- >(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::RadrootsKnowledgeRelation>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::RadrootsKnowledgeReview>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::RadrootsKnowledgeReviewScope>(
- ),
- ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::RadrootsKnowledgeReviewScore>(
- ),
- ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::RadrootsKnowledgeReviewTarget>(
- ),
- ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::RadrootsKnowledgeSource>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::RadrootsRightsAssertion>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::RadrootsWikiArticle>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::RadrootsWikiArticleVersionRef>(
- ),
- ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::RadrootsWikiMergeRequest>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::knowledge::RadrootsWikiRedirect>(),
- ::dto_bindgen::export::RootDescriptor::new::<
- crate::listing::operational::RadrootsOperationalListing,
- >(),
::dto_bindgen::export::RootDescriptor::new::<
- crate::listing::operational::RadrootsOperationalListingAvailability,
+ crate::listing::operational::OperationalListingAvailability,
>(),
::dto_bindgen::export::RootDescriptor::new::<
- crate::listing::operational::RadrootsOperationalListingBin,
+ crate::listing::operational::OperationalListingBin,
>(),
::dto_bindgen::export::RootDescriptor::new::<
- crate::listing::operational::RadrootsOperationalListingDeliveryMethod,
+ crate::listing::operational::OperationalListingDeliveryMethod,
>(),
::dto_bindgen::export::RootDescriptor::new::<
- crate::listing::operational::RadrootsOperationalListingImage,
+ crate::listing::operational::OperationalListingImage,
>(),
::dto_bindgen::export::RootDescriptor::new::<
- crate::listing::operational::RadrootsOperationalListingParseError,
+ crate::listing::operational::OperationalListingParseError,
>(),
::dto_bindgen::export::RootDescriptor::new::<
- crate::listing::operational::RadrootsOperationalListingProduct,
+ crate::listing::operational::OperationalListingProduct,
>(),
::dto_bindgen::export::RootDescriptor::new::<
- crate::listing::operational::RadrootsOperationalListingPublicLocation,
+ crate::listing::operational::OperationalListingPublicLocation,
>(),
::dto_bindgen::export::RootDescriptor::new::<
- crate::listing::operational::RadrootsOperationalListingStatus,
- >(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::post::RadrootsPost>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::post::document::RadrootsDocument>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::post::document::RadrootsDocumentSubject>(
- ),
- ::dto_bindgen::export::RootDescriptor::new::<crate::post::reaction::RadrootsReaction>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::profile::RadrootsProfileType>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::profile::account::RadrootsAccountClaim>(
- ),
- ::dto_bindgen::export::RootDescriptor::new::<crate::social::app_data::RadrootsAppData>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::social::follow::RadrootsFollow>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::social::follow::RadrootsFollowProfile>(
- ),
- ::dto_bindgen::export::RootDescriptor::new::<crate::social::geochat::RadrootsGeoChat>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::social::gift_wrap::RadrootsGiftWrap>(),
- ::dto_bindgen::export::RootDescriptor::new::<
- crate::social::gift_wrap::RadrootsGiftWrapRecipient,
+ crate::listing::operational::OperationalListingStatus,
>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::post::document::Document>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::post::document::DocumentSubject>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::post::reaction::Reaction>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::profile::ProfileType>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::profile::account::AccountClaim>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::social::app_data::AppData>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::social::follow::Follow>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::social::follow::FollowProfile>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::social::geochat::GeoChat>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::social::gift_wrap::GiftWrap>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::social::gift_wrap::GiftWrapRecipient>(),
::dto_bindgen::export::RootDescriptor::new::<crate::social::job::JobFeedbackStatus>(),
::dto_bindgen::export::RootDescriptor::new::<crate::social::job::JobInputType>(),
::dto_bindgen::export::RootDescriptor::new::<crate::social::job::JobPaymentRequest>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::social::job_feedback::JobFeedback>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::social::job_request::JobInput>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::social::job_request::JobParam>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::social::job_request::JobRequest>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::social::job_result::JobResult>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::social::list::List>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::social::list::ListEntry>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::social::list_set::ListSet>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::social::message::Message>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::social::message::MessageRecipient>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::social::message_file::MessageFile>(),
::dto_bindgen::export::RootDescriptor::new::<
- crate::social::job_feedback::RadrootsJobFeedback,
- >(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::social::job_request::RadrootsJobInput>(
- ),
- ::dto_bindgen::export::RootDescriptor::new::<crate::social::job_request::RadrootsJobParam>(
- ),
- ::dto_bindgen::export::RootDescriptor::new::<crate::social::job_request::RadrootsJobRequest>(
- ),
- ::dto_bindgen::export::RootDescriptor::new::<crate::social::job_result::RadrootsJobResult>(
- ),
- ::dto_bindgen::export::RootDescriptor::new::<crate::social::list::RadrootsList>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::social::list::RadrootsListEntry>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::social::list_set::RadrootsListSet>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::social::message::RadrootsMessage>(),
- ::dto_bindgen::export::RootDescriptor::new::<
- crate::social::message::RadrootsMessageRecipient,
- >(),
- ::dto_bindgen::export::RootDescriptor::new::<
- crate::social::message_file::RadrootsMessageFile,
+ crate::social::message_file::MessageFileDimensions,
>(),
- ::dto_bindgen::export::RootDescriptor::new::<
- crate::social::message_file::RadrootsMessageFileDimensions,
- >(),
- ::dto_bindgen::export::RootDescriptor::new::<
- crate::social::relay_document::RadrootsRelayDocument,
- >(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::social::seal::RadrootsSeal>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::trade::order::RadrootsCommercialDomain>(
+ ::dto_bindgen::export::RootDescriptor::new::<crate::social::relay_document::RelayDocument>(
),
- ::dto_bindgen::export::RootDescriptor::new::<crate::trade::order::RadrootsOrderCancellation>(
+ ::dto_bindgen::export::RootDescriptor::new::<crate::social::seal::Seal>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::trade::order::CommercialDomain>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::trade::order::OrderCancellation>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::trade::order::OrderDecision>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::trade::order::OrderDecisionOutcome>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::trade::order::OrderEventType>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::trade::order::OrderInventoryCommitment>(
),
- ::dto_bindgen::export::RootDescriptor::new::<crate::trade::order::RadrootsOrderDecision>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::trade::order::OrderRequest>(),
::dto_bindgen::export::RootDescriptor::new::<
- crate::trade::order::RadrootsOrderDecisionOutcome,
+ crate::trade::order_economics::OrderEconomicActor,
>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::trade::order::RadrootsOrderEventType>(),
::dto_bindgen::export::RootDescriptor::new::<
- crate::trade::order::RadrootsOrderInventoryCommitment,
+ crate::trade::order_economics::OrderEconomicEffect,
>(),
- ::dto_bindgen::export::RootDescriptor::new::<crate::trade::order::RadrootsOrderRequest>(),
::dto_bindgen::export::RootDescriptor::new::<
- crate::trade::order_economics::RadrootsOrderEconomicActor,
+ crate::trade::order_economics::OrderEconomicItem,
>(),
::dto_bindgen::export::RootDescriptor::new::<
- crate::trade::order_economics::RadrootsOrderEconomicEffect,
+ crate::trade::order_economics::OrderEconomicLine,
>(),
::dto_bindgen::export::RootDescriptor::new::<
- crate::trade::order_economics::RadrootsOrderEconomicItem,
+ crate::trade::order_economics::OrderEconomicLineKind,
>(),
::dto_bindgen::export::RootDescriptor::new::<
- crate::trade::order_economics::RadrootsOrderEconomicLine,
- >(),
- ::dto_bindgen::export::RootDescriptor::new::<
- crate::trade::order_economics::RadrootsOrderEconomicLineKind,
- >(),
- ::dto_bindgen::export::RootDescriptor::new::<
- crate::trade::order_economics::RadrootsOrderEconomicTotals,
- >(),
- ::dto_bindgen::export::RootDescriptor::new::<
- crate::trade::order_economics::RadrootsOrderEconomics,
- >(),
- ::dto_bindgen::export::RootDescriptor::new::<
- crate::trade::order_economics::RadrootsOrderItem,
+ crate::trade::order_economics::OrderEconomicTotals,
>(),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::trade::order_economics::OrderEconomics>(
+ ),
+ ::dto_bindgen::export::RootDescriptor::new::<crate::trade::order_economics::OrderItem>(),
::dto_bindgen::export::RootDescriptor::new::<
- crate::trade::order_economics::RadrootsOrderPricingBasis,
+ crate::trade::order_economics::OrderPricingBasis,
>(),
::dto_bindgen::export::RootDescriptor::new::<
- crate::trade::validation::RadrootsOperationalListingValidationError,
+ crate::trade::validation::OperationalListingValidationError,
>(),
]
}
diff --git a/crates/event/src/geochat.rs b/crates/event/src/geochat.rs
@@ -10,7 +10,7 @@ use alloc::string::String;
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsGeoChat {
+pub struct GeoChat {
pub geohash: String,
pub content: String,
pub nickname: Option<String>,
diff --git a/crates/event/src/gift_wrap.rs b/crates/event/src/gift_wrap.rs
@@ -10,8 +10,8 @@ use alloc::string::String;
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsGiftWrap {
- pub recipient: RadrootsGiftWrapRecipient,
+pub struct GiftWrap {
+ pub recipient: GiftWrapRecipient,
pub content: String,
pub expiration: Option<u32>,
}
@@ -23,7 +23,7 @@ pub struct RadrootsGiftWrap {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsGiftWrapRecipient {
+pub struct GiftWrapRecipient {
pub public_key: String,
pub relay_url: Option<String>,
}
diff --git a/crates/event/src/group.rs b/crates/event/src/group.rs
@@ -38,7 +38,7 @@ pub const KIND_GROUP_ROLES: u32 = KIND_GROUP_ROLES_EVENT;
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsGroupPutUser {
+pub struct GroupPutUser {
pub group_id: String,
pub message: Option<String>,
pub pubkey: String,
@@ -50,7 +50,7 @@ pub struct RadrootsGroupPutUser {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsGroupRemoveUser {
+pub struct GroupRemoveUser {
pub group_id: String,
pub message: Option<String>,
pub pubkey: String,
@@ -61,10 +61,10 @@ pub struct RadrootsGroupRemoveUser {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsGroupCreateGroup {
+pub struct GroupCreateGroup {
pub group_id: String,
pub message: Option<String>,
- pub metadata: RadrootsGroupEditableMetadata,
+ pub metadata: GroupEditableMetadata,
}
#[cfg_attr(
@@ -72,10 +72,10 @@ pub struct RadrootsGroupCreateGroup {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsGroupEditMetadata {
+pub struct GroupEditMetadata {
pub group_id: String,
pub message: Option<String>,
- pub metadata: RadrootsGroupEditableMetadata,
+ pub metadata: GroupEditableMetadata,
}
#[cfg_attr(
@@ -83,7 +83,7 @@ pub struct RadrootsGroupEditMetadata {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsGroupDeleteGroup {
+pub struct GroupDeleteGroup {
pub group_id: String,
pub message: Option<String>,
}
@@ -93,7 +93,7 @@ pub struct RadrootsGroupDeleteGroup {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsGroupDeleteEvent {
+pub struct GroupDeleteEvent {
pub group_id: String,
pub message: Option<String>,
pub event_id: String,
@@ -104,7 +104,7 @@ pub struct RadrootsGroupDeleteEvent {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsGroupCreateInvite {
+pub struct GroupCreateInvite {
pub group_id: String,
pub message: Option<String>,
pub code: String,
@@ -115,7 +115,7 @@ pub struct RadrootsGroupCreateInvite {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsGroupJoinRequest {
+pub struct GroupJoinRequest {
pub group_id: String,
pub message: Option<String>,
pub code: Option<String>,
@@ -126,7 +126,7 @@ pub struct RadrootsGroupJoinRequest {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsGroupLeaveRequest {
+pub struct GroupLeaveRequest {
pub group_id: String,
pub message: Option<String>,
}
@@ -136,9 +136,9 @@ pub struct RadrootsGroupLeaveRequest {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsGroupMetadata {
+pub struct GroupMetadata {
pub d_tag: String,
- pub metadata: RadrootsGroupEditableMetadata,
+ pub metadata: GroupEditableMetadata,
}
#[cfg_attr(
@@ -146,10 +146,10 @@ pub struct RadrootsGroupMetadata {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsGroupAdmins {
+pub struct GroupAdmins {
pub d_tag: String,
pub description: Option<String>,
- pub admins: Vec<RadrootsGroupUserRef>,
+ pub admins: Vec<GroupUserRef>,
}
#[cfg_attr(
@@ -157,10 +157,10 @@ pub struct RadrootsGroupAdmins {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsGroupMembers {
+pub struct GroupMembers {
pub d_tag: String,
pub description: Option<String>,
- pub members: Vec<RadrootsGroupUserRef>,
+ pub members: Vec<GroupUserRef>,
}
#[cfg_attr(
@@ -168,10 +168,10 @@ pub struct RadrootsGroupMembers {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsGroupRoles {
+pub struct GroupRoles {
pub d_tag: String,
pub description: Option<String>,
- pub roles: Vec<RadrootsGroupRole>,
+ pub roles: Vec<GroupRole>,
}
#[cfg_attr(
@@ -179,7 +179,7 @@ pub struct RadrootsGroupRoles {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
-pub struct RadrootsGroupEditableMetadata {
+pub struct GroupEditableMetadata {
pub name: Option<String>,
pub about: Option<String>,
pub picture: Option<String>,
@@ -195,7 +195,7 @@ pub struct RadrootsGroupEditableMetadata {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsGroupUserRef {
+pub struct GroupUserRef {
pub pubkey: String,
pub roles: Vec<String>,
}
@@ -205,7 +205,7 @@ pub struct RadrootsGroupUserRef {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsGroupRole {
+pub struct GroupRole {
pub name: String,
pub description: Option<String>,
pub permissions: Vec<String>,
@@ -217,18 +217,18 @@ mod tests {
#[test]
fn group_user_and_moderation_models_use_h_group_id_semantics() {
- let put = RadrootsGroupPutUser {
+ let put = GroupPutUser {
group_id: "field-group".to_string(),
message: Some("add member".to_string()),
pubkey: "member_pubkey".to_string(),
roles: vec!["member".to_string()],
};
- let delete = RadrootsGroupDeleteEvent {
+ let delete = GroupDeleteEvent {
group_id: "field-group".to_string(),
message: Some("remove duplicate event".to_string()),
event_id: "event_id".to_string(),
};
- let join = RadrootsGroupJoinRequest {
+ let join = GroupJoinRequest {
group_id: "field-group".to_string(),
message: Some("requesting access".to_string()),
code: Some("invite-code".to_string()),
@@ -244,19 +244,19 @@ mod tests {
#[test]
fn group_metadata_and_lists_use_d_tag_semantics() {
- let metadata = RadrootsGroupMetadata {
+ let metadata = GroupMetadata {
d_tag: "field-group".to_string(),
metadata: sample_metadata(),
};
- let members = RadrootsGroupMembers {
+ let members = GroupMembers {
d_tag: "field-group".to_string(),
description: Some("group members".to_string()),
members: vec![sample_user_ref()],
};
- let roles = RadrootsGroupRoles {
+ let roles = GroupRoles {
d_tag: "field-group".to_string(),
description: Some("group roles".to_string()),
- roles: vec![RadrootsGroupRole {
+ roles: vec![GroupRole {
name: "member".to_string(),
description: Some("can read and write group events".to_string()),
permissions: vec!["read".to_string(), "write".to_string()],
@@ -273,7 +273,7 @@ mod tests {
#[test]
fn group_models_are_infrastructure_not_field_business_authorization() {
- let admins = RadrootsGroupAdmins {
+ let admins = GroupAdmins {
d_tag: "field-group".to_string(),
description: Some("group admins".to_string()),
admins: vec![sample_user_ref()],
@@ -285,12 +285,12 @@ mod tests {
#[test]
fn group_models_serialize_stable_shapes() {
- let create = RadrootsGroupCreateGroup {
+ let create = GroupCreateGroup {
group_id: "field-group".to_string(),
message: None,
metadata: sample_metadata(),
};
- let invite = RadrootsGroupCreateInvite {
+ let invite = GroupCreateInvite {
group_id: "field-group".to_string(),
message: Some("join the field group".to_string()),
code: "invite-code".to_string(),
@@ -307,8 +307,8 @@ mod tests {
assert_eq!(KIND_GROUP_CREATE_INVITE, 9009);
}
- fn sample_metadata() -> RadrootsGroupEditableMetadata {
- RadrootsGroupEditableMetadata {
+ fn sample_metadata() -> GroupEditableMetadata {
+ GroupEditableMetadata {
name: Some("Small Regen Farm".to_string()),
about: Some("Field app group".to_string()),
picture: Some("https://media.example.invalid/group.png".to_string()),
@@ -320,8 +320,8 @@ mod tests {
}
}
- fn sample_user_ref() -> RadrootsGroupUserRef {
- RadrootsGroupUserRef {
+ fn sample_user_ref() -> GroupUserRef {
+ GroupUserRef {
pubkey: "admin_pubkey".to_string(),
roles: vec!["admin".to_string()],
}
diff --git a/crates/event/src/http_auth.rs b/crates/event/src/http_auth.rs
@@ -12,7 +12,7 @@ pub const KIND_HTTP_AUTH: u32 = KIND_HTTP_AUTH_EVENT;
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsHttpAuth {
+pub struct HttpAuth {
pub url: String,
pub method: String,
pub payload_sha256: Option<String>,
@@ -29,7 +29,7 @@ mod tests {
#[test]
fn http_auth_serializes_optional_payload_hash() {
- let value = serde_json::to_value(RadrootsHttpAuth {
+ let value = serde_json::to_value(HttpAuth {
url: "https://media.example.invalid/upload".to_string(),
method: "POST".to_string(),
payload_sha256: Some(
@@ -48,7 +48,7 @@ mod tests {
#[test]
fn http_auth_allows_absent_payload_hash() {
- let auth = RadrootsHttpAuth {
+ let auth = HttpAuth {
url: "https://media.example.invalid/download".to_string(),
method: "GET".to_string(),
payload_sha256: None,
diff --git a/crates/event/src/id.rs b/crates/event/src/id.rs
@@ -16,7 +16,7 @@ use url_nostd::Url;
use crate::envelope::kind::KIND_CLASSIFIED_LISTING;
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsIdParseError {
+pub enum ParseError {
Empty,
InvalidFormat,
InvalidLength { expected: usize, actual: usize },
@@ -26,7 +26,7 @@ pub enum RadrootsIdParseError {
TooLong { max: usize, actual: usize },
}
-impl fmt::Display for RadrootsIdParseError {
+impl fmt::Display for ParseError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Empty => write!(f, "identifier is empty"),
@@ -55,7 +55,7 @@ impl fmt::Display for RadrootsIdParseError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsIdParseError {}
+impl std::error::Error for ParseError {}
macro_rules! validated_string_id {
($name:ident, $validator:ident) => {
@@ -65,7 +65,7 @@ macro_rules! validated_string_id {
pub struct $name(String);
impl $name {
- pub fn parse(value: impl AsRef<str>) -> Result<Self, RadrootsIdParseError> {
+ pub fn parse(value: impl AsRef<str>) -> Result<Self, ParseError> {
$validator(value.as_ref()).map(Self)
}
@@ -101,7 +101,7 @@ macro_rules! validated_string_id {
}
impl FromStr for $name {
- type Err = RadrootsIdParseError;
+ type Err = ParseError;
fn from_str(value: &str) -> Result<Self, Self::Err> {
Self::parse(value)
@@ -109,7 +109,7 @@ macro_rules! validated_string_id {
}
impl TryFrom<&str> for $name {
- type Error = RadrootsIdParseError;
+ type Error = ParseError;
fn try_from(value: &str) -> Result<Self, Self::Error> {
Self::parse(value)
@@ -117,7 +117,7 @@ macro_rules! validated_string_id {
}
impl TryFrom<String> for $name {
- type Error = RadrootsIdParseError;
+ type Error = ParseError;
fn try_from(value: String) -> Result<Self, Self::Error> {
Self::parse(value)
@@ -155,7 +155,7 @@ macro_rules! validated_hex_id {
pub struct $name([u8; $byte_len]);
impl $name {
- pub fn parse(value: impl AsRef<str>) -> Result<Self, RadrootsIdParseError> {
+ pub fn parse(value: impl AsRef<str>) -> Result<Self, ParseError> {
decode_hex::<$byte_len>(value.as_ref()).map(Self)
}
@@ -212,7 +212,7 @@ macro_rules! validated_hex_id {
}
impl FromStr for $name {
- type Err = RadrootsIdParseError;
+ type Err = ParseError;
fn from_str(value: &str) -> Result<Self, Self::Err> {
Self::parse(value)
@@ -220,7 +220,7 @@ macro_rules! validated_hex_id {
}
impl TryFrom<&str> for $name {
- type Error = RadrootsIdParseError;
+ type Error = ParseError;
fn try_from(value: &str) -> Result<Self, Self::Error> {
Self::parse(value)
@@ -228,7 +228,7 @@ macro_rules! validated_hex_id {
}
impl TryFrom<String> for $name {
- type Error = RadrootsIdParseError;
+ type Error = ParseError;
fn try_from(value: String) -> Result<Self, Self::Error> {
Self::parse(value)
@@ -258,37 +258,32 @@ macro_rules! validated_hex_id {
};
}
-validated_hex_id!(RadrootsEventId, 32);
-validated_hex_id!(RadrootsEventSignature, 64);
-validated_hex_id!(RadrootsTradeId, 16);
-validated_hex_id!(RadrootsTradeCandidateId, 32);
-validated_hex_id!(RadrootsTradeMutationId, 32);
-validated_string_id!(RadrootsDTag, validate_d_tag);
+validated_hex_id!(EventId, 32);
+validated_hex_id!(EventSignature, 64);
+validated_hex_id!(TradeId, 16);
+validated_hex_id!(CandidateId, 32);
+validated_hex_id!(MutationId, 32);
+validated_string_id!(DTag, validate_d_tag);
+validated_string_id!(AddressableCoordinate, validate_addressable_coordinate);
validated_string_id!(
- RadrootsAddressableCoordinate,
- validate_addressable_coordinate
-);
-validated_string_id!(
- RadrootsClassifiedListingAddress,
+ ClassifiedListingAddress,
validate_classified_listing_address
);
-validated_string_id!(RadrootsOrderId, validate_commercial_id);
-validated_string_id!(RadrootsOrderQuoteId, validate_commercial_id);
-validated_string_id!(RadrootsInventoryBinId, validate_commercial_id);
-validated_string_id!(RadrootsEconomicsDigest, validate_economics_digest);
-validated_hex_id!(RadrootsEventPointer, 32);
-validated_string_id!(RadrootsRelayUrl, validate_relay_url);
-
-pub(crate) fn parse_public_key(value: impl AsRef<str>) -> Result<PublicKey, RadrootsIdParseError> {
+validated_string_id!(OrderId, validate_commercial_id);
+validated_string_id!(OrderQuoteId, validate_commercial_id);
+validated_string_id!(InventoryBinId, validate_commercial_id);
+validated_string_id!(EconomicsDigest, validate_economics_digest);
+validated_hex_id!(EventPointer, 32);
+validated_string_id!(RelayUrl, validate_relay_url);
+
+pub(crate) fn parse_public_key(value: impl AsRef<str>) -> Result<PublicKey, ParseError> {
PublicKey::from_hex(value.as_ref()).map_err(|error| match error {
radroots_identity::Error::InvalidHexLength { expected, actual }
| radroots_identity::Error::InvalidByteLength { expected, actual } => {
- RadrootsIdParseError::InvalidLength { expected, actual }
- }
- radroots_identity::Error::InvalidHexCharacter { .. } => {
- RadrootsIdParseError::InvalidCharacter
+ ParseError::InvalidLength { expected, actual }
}
- _ => RadrootsIdParseError::InvalidPublicKey,
+ radroots_identity::Error::InvalidHexCharacter { .. } => ParseError::InvalidCharacter,
+ _ => ParseError::InvalidPublicKey,
})
}
@@ -300,16 +295,16 @@ pub const RADROOTS_NIP01_COORDINATE_MAX_BYTES: usize =
#[non_exhaustive]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsNip01CoordinateParseError {
+pub enum Nip01CoordinateParseError {
Empty,
InvalidFormat,
- Pubkey(RadrootsIdParseError),
+ Pubkey(ParseError),
UnsupportedKind { actual: u32 },
IdentifierMustBeEmpty { kind: u32 },
TooLong { max: usize, actual: usize },
}
-impl fmt::Display for RadrootsNip01CoordinateParseError {
+impl fmt::Display for Nip01CoordinateParseError {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Empty => formatter.write_str("NIP-01 coordinate is empty"),
@@ -334,7 +329,7 @@ impl fmt::Display for RadrootsNip01CoordinateParseError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsNip01CoordinateParseError {
+impl std::error::Error for Nip01CoordinateParseError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
Self::Pubkey(error) => Some(error),
@@ -344,15 +339,15 @@ impl std::error::Error for RadrootsNip01CoordinateParseError {
}
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct RadrootsNip01CoordinateParts {
+pub struct Nip01CoordinateParts {
pub kind: u32,
pub pubkey: PublicKey,
pub identifier: String,
}
-impl RadrootsNip01CoordinateParts {
- pub fn parse(value: impl AsRef<str>) -> Result<Self, RadrootsNip01CoordinateParseError> {
- RadrootsNip01Coordinate::parse(value).map(RadrootsNip01Coordinate::into_parts)
+impl Nip01CoordinateParts {
+ pub fn parse(value: impl AsRef<str>) -> Result<Self, Nip01CoordinateParseError> {
+ Nip01Coordinate::parse(value).map(Nip01Coordinate::into_parts)
}
}
@@ -361,21 +356,21 @@ impl RadrootsNip01CoordinateParts {
/// Parsing splits only the first two `:` delimiters. The remaining identifier
/// is opaque protocol data and is preserved byte-for-byte.
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct RadrootsNip01Coordinate {
+pub struct Nip01Coordinate {
canonical: String,
kind: u32,
pubkey: PublicKey,
identifier: String,
}
-impl RadrootsNip01Coordinate {
- pub fn parse(value: impl AsRef<str>) -> Result<Self, RadrootsNip01CoordinateParseError> {
+impl Nip01Coordinate {
+ pub fn parse(value: impl AsRef<str>) -> Result<Self, Nip01CoordinateParseError> {
let value = value.as_ref();
if value.is_empty() {
- return Err(RadrootsNip01CoordinateParseError::Empty);
+ return Err(Nip01CoordinateParseError::Empty);
}
if value.len() > RADROOTS_NIP01_COORDINATE_MAX_BYTES {
- return Err(RadrootsNip01CoordinateParseError::TooLong {
+ return Err(Nip01CoordinateParseError::TooLong {
max: RADROOTS_NIP01_COORDINATE_MAX_BYTES,
actual: value.len(),
});
@@ -383,22 +378,22 @@ impl RadrootsNip01Coordinate {
let (kind, remainder) = value
.split_once(':')
- .ok_or(RadrootsNip01CoordinateParseError::InvalidFormat)?;
+ .ok_or(Nip01CoordinateParseError::InvalidFormat)?;
let (pubkey, identifier) = remainder
.split_once(':')
- .ok_or(RadrootsNip01CoordinateParseError::InvalidFormat)?;
+ .ok_or(Nip01CoordinateParseError::InvalidFormat)?;
let kind = kind
.parse::<u32>()
- .map_err(|_| RadrootsNip01CoordinateParseError::InvalidFormat)?;
+ .map_err(|_| Nip01CoordinateParseError::InvalidFormat)?;
let requires_empty_identifier = matches!(kind, 0 | 3) || (10_000..=19_999).contains(&kind);
if !requires_empty_identifier && !(30_000..=39_999).contains(&kind) {
- return Err(RadrootsNip01CoordinateParseError::UnsupportedKind { actual: kind });
+ return Err(Nip01CoordinateParseError::UnsupportedKind { actual: kind });
}
if requires_empty_identifier && !identifier.is_empty() {
- return Err(RadrootsNip01CoordinateParseError::IdentifierMustBeEmpty { kind });
+ return Err(Nip01CoordinateParseError::IdentifierMustBeEmpty { kind });
}
- let pubkey = parse_public_key(pubkey).map_err(RadrootsNip01CoordinateParseError::Pubkey)?;
+ let pubkey = parse_public_key(pubkey).map_err(Nip01CoordinateParseError::Pubkey)?;
let identifier = identifier.to_string();
let canonical = format!("{kind}:{pubkey}:{identifier}");
Ok(Self {
@@ -430,8 +425,8 @@ impl RadrootsNip01Coordinate {
}
#[inline]
- pub fn parts(&self) -> RadrootsNip01CoordinateParts {
- RadrootsNip01CoordinateParts {
+ pub fn parts(&self) -> Nip01CoordinateParts {
+ Nip01CoordinateParts {
kind: self.kind,
pubkey: self.pubkey,
identifier: self.identifier.clone(),
@@ -439,8 +434,8 @@ impl RadrootsNip01Coordinate {
}
#[inline]
- pub fn into_parts(self) -> RadrootsNip01CoordinateParts {
- RadrootsNip01CoordinateParts {
+ pub fn into_parts(self) -> Nip01CoordinateParts {
+ Nip01CoordinateParts {
kind: self.kind,
pubkey: self.pubkey,
identifier: self.identifier,
@@ -453,44 +448,44 @@ impl RadrootsNip01Coordinate {
}
}
-impl AsRef<str> for RadrootsNip01Coordinate {
+impl AsRef<str> for Nip01Coordinate {
#[inline]
fn as_ref(&self) -> &str {
self.as_str()
}
}
-impl From<RadrootsNip01Coordinate> for String {
+impl From<Nip01Coordinate> for String {
#[inline]
- fn from(value: RadrootsNip01Coordinate) -> Self {
+ fn from(value: Nip01Coordinate) -> Self {
value.into_string()
}
}
-impl fmt::Display for RadrootsNip01Coordinate {
+impl fmt::Display for Nip01Coordinate {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
formatter.write_str(self.as_str())
}
}
-impl FromStr for RadrootsNip01Coordinate {
- type Err = RadrootsNip01CoordinateParseError;
+impl FromStr for Nip01Coordinate {
+ type Err = Nip01CoordinateParseError;
fn from_str(value: &str) -> Result<Self, Self::Err> {
Self::parse(value)
}
}
-impl TryFrom<&str> for RadrootsNip01Coordinate {
- type Error = RadrootsNip01CoordinateParseError;
+impl TryFrom<&str> for Nip01Coordinate {
+ type Error = Nip01CoordinateParseError;
fn try_from(value: &str) -> Result<Self, Self::Error> {
Self::parse(value)
}
}
-impl TryFrom<String> for RadrootsNip01Coordinate {
- type Error = RadrootsNip01CoordinateParseError;
+impl TryFrom<String> for Nip01Coordinate {
+ type Error = Nip01CoordinateParseError;
fn try_from(value: String) -> Result<Self, Self::Error> {
Self::parse(value)
@@ -498,7 +493,7 @@ impl TryFrom<String> for RadrootsNip01Coordinate {
}
#[cfg(any(feature = "serde", test))]
-impl serde::Serialize for RadrootsNip01Coordinate {
+impl serde::Serialize for Nip01Coordinate {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
@@ -508,7 +503,7 @@ impl serde::Serialize for RadrootsNip01Coordinate {
}
#[cfg(any(feature = "serde", test))]
-impl<'de> serde::Deserialize<'de> for RadrootsNip01Coordinate {
+impl<'de> serde::Deserialize<'de> for Nip01Coordinate {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
@@ -519,26 +514,26 @@ impl<'de> serde::Deserialize<'de> for RadrootsNip01Coordinate {
}
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct RadrootsAddressableCoordinateParts {
+pub struct AddressableCoordinateParts {
pub kind: u32,
pub pubkey: PublicKey,
- pub d_tag: RadrootsDTag,
+ pub d_tag: DTag,
}
-impl RadrootsAddressableCoordinateParts {
- pub fn parse(value: impl AsRef<str>) -> Result<Self, RadrootsIdParseError> {
+impl AddressableCoordinateParts {
+ pub fn parse(value: impl AsRef<str>) -> Result<Self, ParseError> {
parse_addressable_coordinate_parts(value.as_ref())
}
}
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct RadrootsEventEnvelopePointer {
- pub event_id: RadrootsEventId,
+pub struct EventEnvelopePointer {
+ pub event_id: EventId,
pub relays: Vec<String>,
}
-impl RadrootsEventEnvelopePointer {
- pub fn new<I, S>(event_id: RadrootsEventId, relays: I) -> Result<Self, RadrootsIdParseError>
+impl EventEnvelopePointer {
+ pub fn new<I, S>(event_id: EventId, relays: I) -> Result<Self, ParseError>
where
I: IntoIterator<Item = S>,
S: Into<String>,
@@ -546,7 +541,7 @@ impl RadrootsEventEnvelopePointer {
let mut canonical_relays = Vec::new();
for relay in relays {
let relay = relay.into();
- RadrootsRelayUrl::parse(relay.as_str())?;
+ RelayUrl::parse(relay.as_str())?;
canonical_relays.push(relay);
}
Ok(Self {
@@ -556,10 +551,10 @@ impl RadrootsEventEnvelopePointer {
}
}
-fn decode_hex<const N: usize>(value: &str) -> Result<[u8; N], RadrootsIdParseError> {
+fn decode_hex<const N: usize>(value: &str) -> Result<[u8; N], ParseError> {
let expected = N * 2;
if value.len() != expected {
- return Err(RadrootsIdParseError::InvalidLength {
+ return Err(ParseError::InvalidLength {
expected,
actual: value.len(),
});
@@ -572,12 +567,12 @@ fn decode_hex<const N: usize>(value: &str) -> Result<[u8; N], RadrootsIdParseErr
Ok(decoded)
}
-fn decode_hex_nibble(value: u8) -> Result<u8, RadrootsIdParseError> {
+fn decode_hex_nibble(value: u8) -> Result<u8, ParseError> {
match value {
b'0'..=b'9' => Ok(value - b'0'),
b'a'..=b'f' => Ok(value - b'a' + 10),
b'A'..=b'F' => Ok(value - b'A' + 10),
- _ => Err(RadrootsIdParseError::InvalidCharacter),
+ _ => Err(ParseError::InvalidCharacter),
}
}
@@ -606,9 +601,9 @@ const fn lower_hex_digit(value: u8) -> char {
}
}
-fn validate_hex(value: &str, expected_len: usize) -> Result<String, RadrootsIdParseError> {
+fn validate_hex(value: &str, expected_len: usize) -> Result<String, ParseError> {
if value.len() != expected_len {
- return Err(RadrootsIdParseError::InvalidLength {
+ return Err(ParseError::InvalidLength {
expected: expected_len,
actual: value.len(),
});
@@ -620,21 +615,21 @@ fn validate_hex(value: &str, expected_len: usize) -> Result<String, RadrootsIdPa
b'0'..=b'9' => canonical.push(byte as char),
b'a'..=b'f' => canonical.push(byte as char),
b'A'..=b'F' => canonical.push((byte + 32) as char),
- _ => return Err(RadrootsIdParseError::InvalidCharacter),
+ _ => return Err(ParseError::InvalidCharacter),
}
}
Ok(canonical)
}
-fn validate_d_tag(value: &str) -> Result<String, RadrootsIdParseError> {
+fn validate_d_tag(value: &str) -> Result<String, ParseError> {
validate_visible_token(value, 512)
}
-fn validate_commercial_id(value: &str) -> Result<String, RadrootsIdParseError> {
+fn validate_commercial_id(value: &str) -> Result<String, ParseError> {
validate_visible_token(value, 128)
}
-fn validate_economics_digest(value: &str) -> Result<String, RadrootsIdParseError> {
+fn validate_economics_digest(value: &str) -> Result<String, ParseError> {
if let Some(hex) = value.strip_prefix("sha256:") {
validate_hex(hex, 64)?;
return Ok(value.to_string());
@@ -642,15 +637,15 @@ fn validate_economics_digest(value: &str) -> Result<String, RadrootsIdParseError
validate_visible_token(value, 128)
}
-fn validate_addressable_coordinate(value: &str) -> Result<String, RadrootsIdParseError> {
+fn validate_addressable_coordinate(value: &str) -> Result<String, ParseError> {
parse_addressable_coordinate_parts(value)?;
Ok(value.to_string())
}
-fn validate_classified_listing_address(value: &str) -> Result<String, RadrootsIdParseError> {
+fn validate_classified_listing_address(value: &str) -> Result<String, ParseError> {
let parts = parse_addressable_coordinate_parts(value)?;
if parts.kind != KIND_CLASSIFIED_LISTING {
- return Err(RadrootsIdParseError::UnexpectedKind {
+ return Err(ParseError::UnexpectedKind {
expected: KIND_CLASSIFIED_LISTING,
actual: parts.kind,
});
@@ -663,31 +658,25 @@ fn validate_classified_listing_address(value: &str) -> Result<String, RadrootsId
fn parse_addressable_coordinate_parts(
value: &str,
-) -> Result<RadrootsAddressableCoordinateParts, RadrootsIdParseError> {
- let (kind, remainder) = value
- .split_once(':')
- .ok_or(RadrootsIdParseError::InvalidFormat)?;
- let (pubkey, d_tag) = remainder
- .split_once(':')
- .ok_or(RadrootsIdParseError::InvalidFormat)?;
- let kind = kind
- .parse::<u32>()
- .map_err(|_| RadrootsIdParseError::InvalidFormat)?;
+) -> Result<AddressableCoordinateParts, ParseError> {
+ let (kind, remainder) = value.split_once(':').ok_or(ParseError::InvalidFormat)?;
+ let (pubkey, d_tag) = remainder.split_once(':').ok_or(ParseError::InvalidFormat)?;
+ let kind = kind.parse::<u32>().map_err(|_| ParseError::InvalidFormat)?;
let pubkey = parse_public_key(pubkey)?;
- let d_tag = RadrootsDTag::parse(d_tag)?;
- Ok(RadrootsAddressableCoordinateParts {
+ let d_tag = DTag::parse(d_tag)?;
+ Ok(AddressableCoordinateParts {
kind,
pubkey,
d_tag,
})
}
-fn validate_visible_token(value: &str, max_len: usize) -> Result<String, RadrootsIdParseError> {
+fn validate_visible_token(value: &str, max_len: usize) -> Result<String, ParseError> {
if value.is_empty() {
- return Err(RadrootsIdParseError::Empty);
+ return Err(ParseError::Empty);
}
if value.len() > max_len {
- return Err(RadrootsIdParseError::TooLong {
+ return Err(ParseError::TooLong {
max: max_len,
actual: value.len(),
});
@@ -697,7 +686,7 @@ fn validate_visible_token(value: &str, max_len: usize) -> Result<String, Radroot
.chars()
.any(|character| character.is_control() || character.is_whitespace())
{
- return Err(RadrootsIdParseError::InvalidCharacter);
+ return Err(ParseError::InvalidCharacter);
}
Ok(value.to_string())
}
@@ -706,33 +695,21 @@ pub fn relay_url_is_valid(value: &str) -> bool {
validate_relay_url(value).is_ok()
}
-pub use self::{
- RadrootsAddressableCoordinate as AddressableCoordinate,
- RadrootsAddressableCoordinateParts as AddressableCoordinateParts,
- RadrootsClassifiedListingAddress as ClassifiedListingAddress, RadrootsDTag as DTag,
- RadrootsEventEnvelopePointer as EventEnvelopePointer, RadrootsEventId as EventId,
- RadrootsEventPointer as EventPointer, RadrootsEventSignature as EventSignature,
- RadrootsIdParseError as ParseError, RadrootsNip01Coordinate as Nip01Coordinate,
- RadrootsNip01CoordinateParseError as Nip01CoordinateParseError,
- RadrootsNip01CoordinateParts as Nip01CoordinateParts, RadrootsTradeCandidateId as CandidateId,
- RadrootsTradeId as TradeId, RadrootsTradeMutationId as MutationId,
-};
-
-fn validate_relay_url(value: &str) -> Result<String, RadrootsIdParseError> {
+fn validate_relay_url(value: &str) -> Result<String, ParseError> {
if value.is_empty() {
- return Err(RadrootsIdParseError::Empty);
+ return Err(ParseError::Empty);
}
if value
.chars()
.any(|character| character.is_control() || character.is_whitespace())
{
- return Err(RadrootsIdParseError::InvalidCharacter);
+ return Err(ParseError::InvalidCharacter);
}
if !(value.starts_with("ws://") || value.starts_with("wss://")) {
- return Err(RadrootsIdParseError::InvalidFormat);
+ return Err(ParseError::InvalidFormat);
}
- let parsed = Url::parse(value).map_err(|_| RadrootsIdParseError::InvalidFormat)?;
+ let parsed = Url::parse(value).map_err(|_| ParseError::InvalidFormat)?;
if !matches!(parsed.scheme(), "ws" | "wss")
|| parsed.host_str().is_none_or(str::is_empty)
|| !parsed.username().is_empty()
@@ -740,16 +717,16 @@ fn validate_relay_url(value: &str) -> Result<String, RadrootsIdParseError> {
|| parsed.fragment().is_some()
|| parsed.port() == Some(0)
{
- return Err(RadrootsIdParseError::InvalidFormat);
+ return Err(ParseError::InvalidFormat);
}
// `Url::username` cannot distinguish absent userinfo from an empty userinfo field.
let authority = value
.split_once("://")
.map(|(_, remainder)| remainder.split(['/', '?', '#']).next().unwrap_or(remainder))
- .ok_or(RadrootsIdParseError::InvalidFormat)?;
+ .ok_or(ParseError::InvalidFormat)?;
if authority.contains('@') {
- return Err(RadrootsIdParseError::InvalidFormat);
+ return Err(ParseError::InvalidFormat);
}
Ok(value.to_string())
@@ -852,15 +829,15 @@ mod tests {
"585591529da0bab31b3b1b1f986611cf5f435dca84f978c89ee8a40cca7103df"
);
- let event_id = RadrootsEventId::parse(hex_64('f')).expect("event id");
+ let event_id = EventId::parse(hex_64('f')).expect("event id");
assert_eq!(event_id.to_hex(), hex_64('f'));
assert_eq!(
- RadrootsEventId::parse(" ".repeat(64)).unwrap_err(),
- RadrootsIdParseError::InvalidCharacter
+ EventId::parse(" ".repeat(64)).unwrap_err(),
+ ParseError::InvalidCharacter
);
assert_eq!(
- RadrootsEventId::parse("a".repeat(63)).unwrap_err(),
- RadrootsIdParseError::InvalidLength {
+ EventId::parse("a".repeat(63)).unwrap_err(),
+ ParseError::InvalidLength {
expected: 64,
actual: 63
}
@@ -870,19 +847,19 @@ mod tests {
#[test]
fn id_parse_errors_have_stable_display_messages() {
let errors = [
- RadrootsIdParseError::Empty,
- RadrootsIdParseError::InvalidFormat,
- RadrootsIdParseError::InvalidLength {
+ ParseError::Empty,
+ ParseError::InvalidFormat,
+ ParseError::InvalidLength {
expected: 64,
actual: 7,
},
- RadrootsIdParseError::InvalidCharacter,
- RadrootsIdParseError::InvalidPublicKey,
- RadrootsIdParseError::UnexpectedKind {
+ ParseError::InvalidCharacter,
+ ParseError::InvalidPublicKey,
+ ParseError::UnexpectedKind {
expected: KIND_CLASSIFIED_LISTING,
actual: 30023,
},
- RadrootsIdParseError::TooLong {
+ ParseError::TooLong {
max: 128,
actual: 129,
},
@@ -892,7 +869,7 @@ mod tests {
assert!(!error.to_string().is_empty());
}
assert_eq!(
- RadrootsIdParseError::UnexpectedKind {
+ ParseError::UnexpectedKind {
expected: KIND_CLASSIFIED_LISTING,
actual: 30023,
}
@@ -903,11 +880,11 @@ mod tests {
#[test]
fn signatures_require_128_hex_chars() {
- let signature = RadrootsEventSignature::parse(hex_128('B')).expect("signature");
+ let signature = EventSignature::parse(hex_128('B')).expect("signature");
assert_eq!(signature.to_hex(), "b".repeat(128));
assert_eq!(
- RadrootsEventSignature::parse(hex_64('b')).unwrap_err(),
- RadrootsIdParseError::InvalidLength {
+ EventSignature::parse(hex_64('b')).unwrap_err(),
+ ParseError::InvalidLength {
expected: 128,
actual: 64
}
@@ -916,38 +893,33 @@ mod tests {
#[test]
fn trade_semantic_ids_use_protocol_sized_hex() {
- let trade_id = RadrootsTradeId::parse(hex_32('A')).expect("trade id");
+ let trade_id = TradeId::parse(hex_32('A')).expect("trade id");
assert_eq!(trade_id.to_hex(), hex_32('a'));
assert_eq!(
- RadrootsTradeId::parse(hex_64('a')).unwrap_err(),
- RadrootsIdParseError::InvalidLength {
+ TradeId::parse(hex_64('a')).unwrap_err(),
+ ParseError::InvalidLength {
expected: 32,
actual: 64
}
);
- assert_hex_identifier_impls!(RadrootsTradeId, &hex_32('a'), 16);
- assert_hex_identifier_impls!(RadrootsTradeCandidateId, &hex_64('b'), 32);
- assert_hex_identifier_impls!(RadrootsTradeMutationId, &hex_64('c'), 32);
+ assert_hex_identifier_impls!(TradeId, &hex_32('a'), 16);
+ assert_hex_identifier_impls!(CandidateId, &hex_64('b'), 32);
+ assert_hex_identifier_impls!(MutationId, &hex_64('c'), 32);
}
#[test]
fn d_tags_reject_empty_control_and_whitespace() {
+ assert_eq!(DTag::parse("").unwrap_err(), ParseError::Empty);
assert_eq!(
- RadrootsDTag::parse("").unwrap_err(),
- RadrootsIdParseError::Empty
+ DTag::parse(" listing").unwrap_err(),
+ ParseError::InvalidCharacter
);
assert_eq!(
- RadrootsDTag::parse(" listing").unwrap_err(),
- RadrootsIdParseError::InvalidCharacter
+ DTag::parse("listing\none").unwrap_err(),
+ ParseError::InvalidCharacter
);
assert_eq!(
- RadrootsDTag::parse("listing\none").unwrap_err(),
- RadrootsIdParseError::InvalidCharacter
- );
- assert_eq!(
- RadrootsDTag::parse("farm:farm-1:members")
- .expect("d tag")
- .as_str(),
+ DTag::parse("farm:farm-1:members").expect("d tag").as_str(),
"farm:farm-1:members"
);
}
@@ -956,22 +928,22 @@ mod tests {
fn addressable_coordinates_validate_kind_pubkey_and_d_tag() {
let addr = format!("30402:{}:listing-1", hex_64('0'));
assert_eq!(
- RadrootsAddressableCoordinate::parse(&addr)
+ AddressableCoordinate::parse(&addr)
.expect("coordinate")
.as_str(),
addr
);
assert_eq!(
- RadrootsClassifiedListingAddress::parse("30402:not_hex:listing-1").unwrap_err(),
- RadrootsIdParseError::InvalidLength {
+ ClassifiedListingAddress::parse("30402:not_hex:listing-1").unwrap_err(),
+ ParseError::InvalidLength {
expected: 64,
actual: 7
}
);
assert_eq!(
- RadrootsClassifiedListingAddress::parse(format!("30023:{}:listing-1", hex_64('0')))
+ ClassifiedListingAddress::parse(format!("30023:{}:listing-1", hex_64('0')))
.unwrap_err(),
- RadrootsIdParseError::UnexpectedKind {
+ ParseError::UnexpectedKind {
expected: KIND_CLASSIFIED_LISTING,
actual: 30023,
}
@@ -979,7 +951,7 @@ mod tests {
let canonical_pubkey = hex_64('a');
for noncanonical_kind in ["030402", "+30402"] {
assert_eq!(
- RadrootsClassifiedListingAddress::parse(format!(
+ ClassifiedListingAddress::parse(format!(
"{noncanonical_kind}:{}:listing-1",
hex_64('A')
))
@@ -989,23 +961,21 @@ mod tests {
);
}
assert_eq!(
- RadrootsAddressableCoordinate::parse("30402").unwrap_err(),
- RadrootsIdParseError::InvalidFormat
+ AddressableCoordinate::parse("30402").unwrap_err(),
+ ParseError::InvalidFormat
);
assert_eq!(
- RadrootsAddressableCoordinate::parse(format!("bad:{}:listing-1", hex_64('a')))
- .unwrap_err(),
- RadrootsIdParseError::InvalidFormat
+ AddressableCoordinate::parse(format!("bad:{}:listing-1", hex_64('a'))).unwrap_err(),
+ ParseError::InvalidFormat
);
assert_eq!(
- RadrootsAddressableCoordinate::parse(format!("30402:{}:bad d", hex_64('0')))
- .unwrap_err(),
- RadrootsIdParseError::InvalidCharacter
+ AddressableCoordinate::parse(format!("30402:{}:bad d", hex_64('0'))).unwrap_err(),
+ ParseError::InvalidCharacter
);
let noncanonical = format!("030402:{}:listing-1", hex_64('A'));
assert_eq!(
- RadrootsAddressableCoordinate::parse(&noncanonical)
+ AddressableCoordinate::parse(&noncanonical)
.expect("validated addressable coordinate")
.as_str(),
noncanonical
@@ -1014,10 +984,10 @@ mod tests {
#[test]
fn binary_identifier_order_matches_canonical_hex_order() {
- let lower = RadrootsEventId::from_bytes([0_u8; 32]);
+ let lower = EventId::from_bytes([0_u8; 32]);
let mut upper_bytes = [0_u8; 32];
upper_bytes[31] = 1;
- let upper = RadrootsEventId::from_bytes(upper_bytes);
+ let upper = EventId::from_bytes(upper_bytes);
assert!(lower < upper);
assert!(lower.to_hex() < upper.to_hex());
@@ -1030,7 +1000,7 @@ mod tests {
#[test]
fn addressable_coordinate_parts_parse_kind_pubkey_and_d_tag() {
let addr = format!("30402:{}:farm:farm-1:members", hex_64('A'));
- let parts = RadrootsAddressableCoordinateParts::parse(&addr).expect("coordinate parts");
+ let parts = AddressableCoordinateParts::parse(&addr).expect("coordinate parts");
assert_eq!(parts.kind, 30402);
assert_eq!(parts.pubkey.to_hex(), hex_64('a'));
assert_eq!(parts.d_tag.as_str(), "farm:farm-1:members");
@@ -1039,7 +1009,7 @@ mod tests {
#[test]
fn nip01_coordinates_cover_replaceable_and_addressable_kinds() {
for kind in [0, 3, 10_000, 19_999] {
- let coordinate = RadrootsNip01Coordinate::parse(format!("+0{kind}:{}:", hex_64('A')))
+ let coordinate = Nip01Coordinate::parse(format!("+0{kind}:{}:", hex_64('A')))
.expect("replaceable coordinate");
assert_eq!(coordinate.kind(), kind);
assert_eq!(coordinate.pubkey().to_hex(), hex_64('a'));
@@ -1048,7 +1018,7 @@ mod tests {
}
for kind in [30_000, 39_999] {
- let coordinate = RadrootsNip01Coordinate::parse(format!("{kind}:{}:", hex_64('b')))
+ let coordinate = Nip01Coordinate::parse(format!("{kind}:{}:", hex_64('b')))
.expect("empty addressable coordinate");
assert_eq!(coordinate.kind(), kind);
assert_eq!(coordinate.identifier(), "");
@@ -1058,9 +1028,8 @@ mod tests {
#[test]
fn nip01_coordinate_identifier_is_opaque_after_second_colon() {
let identifier = " victoria:\u{0000}seed:\u{2603}\n";
- let coordinate =
- RadrootsNip01Coordinate::parse(format!("030402:{}:{identifier}", hex_64('A')))
- .expect("opaque addressable coordinate");
+ let coordinate = Nip01Coordinate::parse(format!("030402:{}:{identifier}", hex_64('A')))
+ .expect("opaque addressable coordinate");
assert_eq!(coordinate.kind(), 30_402);
assert_eq!(coordinate.pubkey().to_hex(), hex_64('a'));
@@ -1074,7 +1043,7 @@ mod tests {
assert_eq!(parts.pubkey.to_hex(), hex_64('a'));
assert_eq!(parts.identifier.as_bytes(), identifier.as_bytes());
assert_eq!(
- RadrootsNip01CoordinateParts::parse(coordinate.as_str()).expect("parts"),
+ Nip01CoordinateParts::parse(coordinate.as_str()).expect("parts"),
parts
);
}
@@ -1083,35 +1052,35 @@ mod tests {
fn nip01_coordinates_reject_unsupported_shapes_and_kinds() {
let pubkey = hex_64('a');
assert_eq!(
- RadrootsNip01Coordinate::parse("").unwrap_err(),
- RadrootsNip01CoordinateParseError::Empty
+ Nip01Coordinate::parse("").unwrap_err(),
+ Nip01CoordinateParseError::Empty
);
assert_eq!(
- RadrootsNip01Coordinate::parse("30000").unwrap_err(),
- RadrootsNip01CoordinateParseError::InvalidFormat
+ Nip01Coordinate::parse("30000").unwrap_err(),
+ Nip01CoordinateParseError::InvalidFormat
);
assert_eq!(
- RadrootsNip01Coordinate::parse("30000:bad:identifier").unwrap_err(),
- RadrootsNip01CoordinateParseError::Pubkey(RadrootsIdParseError::InvalidLength {
+ Nip01Coordinate::parse("30000:bad:identifier").unwrap_err(),
+ Nip01CoordinateParseError::Pubkey(ParseError::InvalidLength {
expected: 64,
actual: 3
})
);
for kind in [1, 9_999, 20_000, 29_999, 40_000, u32::MAX] {
assert_eq!(
- RadrootsNip01Coordinate::parse(format!("{kind}:{pubkey}:")).unwrap_err(),
- RadrootsNip01CoordinateParseError::UnsupportedKind { actual: kind }
+ Nip01Coordinate::parse(format!("{kind}:{pubkey}:")).unwrap_err(),
+ Nip01CoordinateParseError::UnsupportedKind { actual: kind }
);
}
for kind in [0, 3, 10_000, 19_999] {
assert_eq!(
- RadrootsNip01Coordinate::parse(format!("{kind}:{pubkey}:not-empty")).unwrap_err(),
- RadrootsNip01CoordinateParseError::IdentifierMustBeEmpty { kind }
+ Nip01Coordinate::parse(format!("{kind}:{pubkey}:not-empty")).unwrap_err(),
+ Nip01CoordinateParseError::IdentifierMustBeEmpty { kind }
);
}
assert_eq!(
- RadrootsNip01Coordinate::parse(format!("30000:{pubkey}")).unwrap_err(),
- RadrootsNip01CoordinateParseError::InvalidFormat
+ Nip01Coordinate::parse(format!("30000:{pubkey}")).unwrap_err(),
+ Nip01CoordinateParseError::InvalidFormat
);
}
@@ -1122,12 +1091,12 @@ mod tests {
crate::wire::v1::DEFAULT_TAG_ELEMENT_MAX_BYTES
);
let errors = [
- RadrootsNip01CoordinateParseError::Empty,
- RadrootsNip01CoordinateParseError::InvalidFormat,
- RadrootsNip01CoordinateParseError::Pubkey(RadrootsIdParseError::InvalidCharacter),
- RadrootsNip01CoordinateParseError::UnsupportedKind { actual: 20_000 },
- RadrootsNip01CoordinateParseError::IdentifierMustBeEmpty { kind: 10_000 },
- RadrootsNip01CoordinateParseError::TooLong {
+ Nip01CoordinateParseError::Empty,
+ Nip01CoordinateParseError::InvalidFormat,
+ Nip01CoordinateParseError::Pubkey(ParseError::InvalidCharacter),
+ Nip01CoordinateParseError::UnsupportedKind { actual: 20_000 },
+ Nip01CoordinateParseError::IdentifierMustBeEmpty { kind: 10_000 },
+ Nip01CoordinateParseError::TooLong {
max: RADROOTS_NIP01_COORDINATE_MAX_BYTES,
actual: RADROOTS_NIP01_COORDINATE_MAX_BYTES + 1,
},
@@ -1144,16 +1113,15 @@ mod tests {
"{prefix}{}",
"x".repeat(RADROOTS_NIP01_COORDINATE_MAX_BYTES - prefix.len())
);
- let coordinate =
- RadrootsNip01Coordinate::parse(&exact).expect("exact coordinate byte limit");
+ let coordinate = Nip01Coordinate::parse(&exact).expect("exact coordinate byte limit");
assert_eq!(
coordinate.as_str().len(),
RADROOTS_NIP01_COORDINATE_MAX_BYTES
);
assert_eq!(
- RadrootsNip01Coordinate::parse(format!("{exact}x")).unwrap_err(),
- RadrootsNip01CoordinateParseError::TooLong {
+ Nip01Coordinate::parse(format!("{exact}x")).unwrap_err(),
+ Nip01CoordinateParseError::TooLong {
max: RADROOTS_NIP01_COORDINATE_MAX_BYTES,
actual: RADROOTS_NIP01_COORDINATE_MAX_BYTES + 1,
}
@@ -1167,12 +1135,12 @@ mod tests {
let identifier = format!("{}x", "\u{00e9}".repeat((remaining - 1) / 2));
let exact = format!("{prefix}{identifier}");
assert_eq!(exact.len(), RADROOTS_NIP01_COORDINATE_MAX_BYTES);
- RadrootsNip01Coordinate::parse(&exact).expect("exact multibyte coordinate limit");
+ Nip01Coordinate::parse(&exact).expect("exact multibyte coordinate limit");
let overflow = format!("{exact}x");
assert_eq!(
- RadrootsNip01Coordinate::parse(&overflow).unwrap_err(),
- RadrootsNip01CoordinateParseError::TooLong {
+ Nip01Coordinate::parse(&overflow).unwrap_err(),
+ Nip01CoordinateParseError::TooLong {
max: RADROOTS_NIP01_COORDINATE_MAX_BYTES,
actual: RADROOTS_NIP01_COORDINATE_MAX_BYTES + 1,
}
@@ -1182,38 +1150,36 @@ mod tests {
#[test]
fn nip01_coordinate_exposes_explicit_text_and_validating_serde() {
let value = format!("30000:{}:farm:victoria", hex_64('a'));
- let coordinate = RadrootsNip01Coordinate::parse(&value).expect("coordinate");
+ let coordinate = Nip01Coordinate::parse(&value).expect("coordinate");
assert_eq!(coordinate.as_ref(), value);
assert_eq!(coordinate.to_string(), value);
assert_eq!(
- RadrootsNip01Coordinate::from_str(&value).expect("from str"),
+ Nip01Coordinate::from_str(&value).expect("from str"),
coordinate
);
assert_eq!(
- RadrootsNip01Coordinate::try_from(value.clone()).expect("try from string"),
+ Nip01Coordinate::try_from(value.clone()).expect("try from string"),
coordinate
);
assert_eq!(String::from(coordinate.clone()), value);
let encoded = serde_json::to_string(&coordinate).expect("serialize");
assert_eq!(
- serde_json::from_str::<RadrootsNip01Coordinate>(&encoded).expect("deserialize"),
+ serde_json::from_str::<Nip01Coordinate>(&encoded).expect("deserialize"),
coordinate
);
- assert!(serde_json::from_str::<RadrootsNip01Coordinate>("\"1:bad:\"").is_err());
+ assert!(serde_json::from_str::<Nip01Coordinate>("\"1:bad:\"").is_err());
}
#[test]
fn commercial_ids_reject_empty_whitespace_control_and_long_values() {
assert_eq!(
- RadrootsOrderId::parse("order-1")
- .expect("order id")
- .as_str(),
+ OrderId::parse("order-1").expect("order id").as_str(),
"order-1"
);
assert_eq!(
- RadrootsInventoryBinId::parse("a".repeat(129)).unwrap_err(),
- RadrootsIdParseError::TooLong {
+ InventoryBinId::parse("a".repeat(129)).unwrap_err(),
+ ParseError::TooLong {
max: 128,
actual: 129
}
@@ -1224,20 +1190,18 @@ mod tests {
fn economics_digest_accepts_sha256_and_existing_wire_tokens() {
let digest = format!("sha256:{}", hex_64('c'));
assert_eq!(
- RadrootsEconomicsDigest::parse(&digest)
- .expect("digest")
- .as_str(),
+ EconomicsDigest::parse(&digest).expect("digest").as_str(),
digest
);
assert_eq!(
- RadrootsEconomicsDigest::parse("digest-1")
+ EconomicsDigest::parse("digest-1")
.expect("wire v1 digest")
.as_str(),
"digest-1"
);
assert_eq!(
- RadrootsEconomicsDigest::parse("sha256:not-hex").unwrap_err(),
- RadrootsIdParseError::InvalidLength {
+ EconomicsDigest::parse("sha256:not-hex").unwrap_err(),
+ ParseError::InvalidLength {
expected: 64,
actual: 7
}
@@ -1246,9 +1210,9 @@ mod tests {
#[test]
fn validated_types_do_not_offer_infallible_string_conversion() {
- let id = RadrootsOrderQuoteId::try_from(String::from("quote-1")).expect("quote id");
+ let id = OrderQuoteId::try_from(String::from("quote-1")).expect("quote id");
assert_eq!(id.as_ref(), "quote-1");
- let parsed: RadrootsEventPointer = hex_64('d').parse().expect("event pointer");
+ let parsed: EventPointer = hex_64('d').parse().expect("event pointer");
assert_eq!(parsed.to_hex(), hex_64('d'));
}
@@ -1256,80 +1220,77 @@ mod tests {
fn validated_identifier_wrappers_expose_consistent_traits() {
let addressable = format!("30402:{}:listing-1", hex_64('0'));
- assert_hex_identifier_impls!(RadrootsEventId, hex_64('b').as_str(), 32);
- assert_hex_identifier_impls!(RadrootsEventSignature, hex_128('c').as_str(), 64);
- assert_string_identifier_impls!(RadrootsDTag, "listing-1");
- assert_string_identifier_impls!(RadrootsAddressableCoordinate, addressable.as_str());
- assert_string_identifier_impls!(RadrootsClassifiedListingAddress, addressable.as_str());
- assert_string_identifier_impls!(RadrootsOrderId, "order-1");
- assert_string_identifier_impls!(RadrootsOrderQuoteId, "quote-1");
- assert_string_identifier_impls!(RadrootsInventoryBinId, "bin-1");
- assert_string_identifier_impls!(RadrootsEconomicsDigest, "digest-1");
- assert_hex_identifier_impls!(RadrootsEventPointer, hex_64('d').as_str(), 32);
- assert_string_identifier_impls!(RadrootsRelayUrl, "wss://relay.example.com");
+ assert_hex_identifier_impls!(EventId, hex_64('b').as_str(), 32);
+ assert_hex_identifier_impls!(EventSignature, hex_128('c').as_str(), 64);
+ assert_string_identifier_impls!(DTag, "listing-1");
+ assert_string_identifier_impls!(AddressableCoordinate, addressable.as_str());
+ assert_string_identifier_impls!(ClassifiedListingAddress, addressable.as_str());
+ assert_string_identifier_impls!(OrderId, "order-1");
+ assert_string_identifier_impls!(OrderQuoteId, "quote-1");
+ assert_string_identifier_impls!(InventoryBinId, "bin-1");
+ assert_string_identifier_impls!(EconomicsDigest, "digest-1");
+ assert_hex_identifier_impls!(EventPointer, hex_64('d').as_str(), 32);
+ assert_string_identifier_impls!(RelayUrl, "wss://relay.example.com");
}
#[test]
fn relay_urls_require_valid_websocket_urls() {
assert_eq!(
- RadrootsRelayUrl::parse("ws://relay.example.com")
+ RelayUrl::parse("ws://relay.example.com")
.expect("relay url")
.as_str(),
"ws://relay.example.com"
);
assert_eq!(
- RadrootsRelayUrl::parse("wss://relay.example.com")
+ RelayUrl::parse("wss://relay.example.com")
.expect("relay url")
.as_str(),
"wss://relay.example.com"
);
assert!(relay_url_is_valid("wss://relay.example.com"));
+ assert_eq!(RelayUrl::parse("").unwrap_err(), ParseError::Empty);
assert_eq!(
- RadrootsRelayUrl::parse("").unwrap_err(),
- RadrootsIdParseError::Empty
- );
- assert_eq!(
- RadrootsRelayUrl::parse("http://relay.example.com").unwrap_err(),
- RadrootsIdParseError::InvalidFormat
+ RelayUrl::parse("http://relay.example.com").unwrap_err(),
+ ParseError::InvalidFormat
);
assert_eq!(
- RadrootsRelayUrl::parse("WSS://relay.example.com").unwrap_err(),
- RadrootsIdParseError::InvalidFormat
+ RelayUrl::parse("WSS://relay.example.com").unwrap_err(),
+ ParseError::InvalidFormat
);
assert_eq!(
- RadrootsRelayUrl::parse("ws://").unwrap_err(),
- RadrootsIdParseError::InvalidFormat
+ RelayUrl::parse("ws://").unwrap_err(),
+ ParseError::InvalidFormat
);
assert_eq!(
- RadrootsRelayUrl::parse("wss://").unwrap_err(),
- RadrootsIdParseError::InvalidFormat
+ RelayUrl::parse("wss://").unwrap_err(),
+ ParseError::InvalidFormat
);
assert_eq!(
- RadrootsRelayUrl::parse(" wss://relay.example.com").unwrap_err(),
- RadrootsIdParseError::InvalidCharacter
+ RelayUrl::parse(" wss://relay.example.com").unwrap_err(),
+ ParseError::InvalidCharacter
);
assert_eq!(
- RadrootsRelayUrl::parse("wss://relay.example.com\nmiddle").unwrap_err(),
- RadrootsIdParseError::InvalidCharacter
+ RelayUrl::parse("wss://relay.example.com\nmiddle").unwrap_err(),
+ ParseError::InvalidCharacter
);
assert_eq!(
- RadrootsRelayUrl::parse("wss://user@relay.example.com").unwrap_err(),
- RadrootsIdParseError::InvalidFormat
+ RelayUrl::parse("wss://user@relay.example.com").unwrap_err(),
+ ParseError::InvalidFormat
);
assert_eq!(
- RadrootsRelayUrl::parse("wss://user:secret@relay.example.com").unwrap_err(),
- RadrootsIdParseError::InvalidFormat
+ RelayUrl::parse("wss://user:secret@relay.example.com").unwrap_err(),
+ ParseError::InvalidFormat
);
assert_eq!(
- RadrootsRelayUrl::parse("wss://relay.example.com#read").unwrap_err(),
- RadrootsIdParseError::InvalidFormat
+ RelayUrl::parse("wss://relay.example.com#read").unwrap_err(),
+ ParseError::InvalidFormat
);
assert_eq!(
- RadrootsRelayUrl::parse("wss://relay.example.com:0").unwrap_err(),
- RadrootsIdParseError::InvalidFormat
+ RelayUrl::parse("wss://relay.example.com:0").unwrap_err(),
+ ParseError::InvalidFormat
);
assert_eq!(
- RadrootsRelayUrl::parse("wss://relay.example.com/nostr/v1?region=ca-bc")
+ RelayUrl::parse("wss://relay.example.com/nostr/v1?region=ca-bc")
.expect("relay URL with path and query")
.as_str(),
"wss://relay.example.com/nostr/v1?region=ca-bc"
@@ -1338,8 +1299,8 @@ mod tests {
#[test]
fn nostr_event_pointers_validate_relay_values() {
- let event_id = RadrootsEventId::parse(hex_64('e')).expect("event id");
- let pointer = RadrootsEventEnvelopePointer::new(
+ let event_id = EventId::parse(hex_64('e')).expect("event id");
+ let pointer = EventEnvelopePointer::new(
event_id,
["wss://relay.one.example", "wss://relay.two.example"],
)
@@ -1355,36 +1316,33 @@ mod tests {
);
assert_eq!(
- RadrootsEventEnvelopePointer::new(
- RadrootsEventId::parse(hex_64('e')).expect("event id"),
- [""],
- )
- .unwrap_err(),
- RadrootsIdParseError::Empty
+ EventEnvelopePointer::new(EventId::parse(hex_64('e')).expect("event id"), [""],)
+ .unwrap_err(),
+ ParseError::Empty
);
assert_eq!(
- RadrootsEventEnvelopePointer::new(
- RadrootsEventId::parse(hex_64('e')).expect("event id"),
+ EventEnvelopePointer::new(
+ EventId::parse(hex_64('e')).expect("event id"),
["http://relay.example"],
)
.unwrap_err(),
- RadrootsIdParseError::InvalidFormat
+ ParseError::InvalidFormat
);
assert_eq!(
- RadrootsEventEnvelopePointer::new(
- RadrootsEventId::parse(hex_64('e')).expect("event id"),
+ EventEnvelopePointer::new(
+ EventId::parse(hex_64('e')).expect("event id"),
[" wss://relay.example"],
)
.unwrap_err(),
- RadrootsIdParseError::InvalidCharacter
+ ParseError::InvalidCharacter
);
assert_eq!(
- RadrootsEventEnvelopePointer::new(
- RadrootsEventId::parse(hex_64('e')).expect("event id"),
+ EventEnvelopePointer::new(
+ EventId::parse(hex_64('e')).expect("event id"),
["wss://relay.example\n"],
)
.unwrap_err(),
- RadrootsIdParseError::InvalidCharacter
+ ParseError::InvalidCharacter
);
}
@@ -1392,10 +1350,10 @@ mod tests {
#[test]
fn serde_deserialization_validates_identifiers() {
let encoded = format!("\"{}\"", hex_64('E'));
- let event_id: RadrootsEventId = serde_json::from_str(&encoded).expect("event id");
+ let event_id: EventId = serde_json::from_str(&encoded).expect("event id");
assert_eq!(event_id.to_hex(), hex_64('e'));
- let invalid = serde_json::from_str::<RadrootsOrderId>("\"bad id\"");
+ let invalid = serde_json::from_str::<OrderId>("\"bad id\"");
assert!(invalid.is_err());
assert_eq!(
serde_json::to_string(&event_id).expect("json"),
@@ -1414,57 +1372,57 @@ mod tests {
#[allow(dead_code)]
#[derive(Debug, serde::Deserialize)]
struct MissingEventId {
- value: RadrootsEventId,
+ value: EventId,
}
#[allow(dead_code)]
#[derive(Debug, serde::Deserialize)]
struct MissingEventSignature {
- value: RadrootsEventSignature,
+ value: EventSignature,
}
#[allow(dead_code)]
#[derive(Debug, serde::Deserialize)]
struct MissingTradeId {
- value: RadrootsTradeId,
+ value: TradeId,
}
#[allow(dead_code)]
#[derive(Debug, serde::Deserialize)]
struct MissingTradeCandidateId {
- value: RadrootsTradeCandidateId,
+ value: CandidateId,
}
#[allow(dead_code)]
#[derive(Debug, serde::Deserialize)]
struct MissingTradeMutationId {
- value: RadrootsTradeMutationId,
+ value: MutationId,
}
#[allow(dead_code)]
#[derive(Debug, serde::Deserialize)]
struct MissingDTag {
- value: RadrootsDTag,
+ value: DTag,
}
#[allow(dead_code)]
#[derive(Debug, serde::Deserialize)]
struct MissingClassifiedListingAddress {
- value: RadrootsClassifiedListingAddress,
+ value: ClassifiedListingAddress,
}
#[allow(dead_code)]
#[derive(Debug, serde::Deserialize)]
struct MissingAddressableCoordinate {
- value: RadrootsAddressableCoordinate,
+ value: AddressableCoordinate,
}
#[allow(dead_code)]
#[derive(Debug, serde::Deserialize)]
struct MissingOrderId {
- value: RadrootsOrderId,
+ value: OrderId,
}
#[allow(dead_code)]
#[derive(Debug, serde::Deserialize)]
struct MissingOrderQuoteId {
- value: RadrootsOrderQuoteId,
+ value: OrderQuoteId,
}
#[allow(dead_code)]
#[derive(Debug, serde::Deserialize)]
struct MissingInventoryBinId {
- value: RadrootsInventoryBinId,
+ value: InventoryBinId,
}
fn missing_field_message<T>() -> String
@@ -1496,13 +1454,14 @@ mod tests {
assert_eq!(missing_field_message::<MissingOrderQuoteId>(), missing);
assert_eq!(missing_field_message::<MissingInventoryBinId>(), missing);
- let order: RadrootsOrderId =
+ let order: OrderId =
serde_json::from_value(serde_json::json!("order-1")).expect("order from value");
- let listing: RadrootsClassifiedListingAddress = serde_json::from_value(serde_json::json!(
- format!("30402:{}:listing-1", hex_64('a'))
- ))
+ let listing: ClassifiedListingAddress = serde_json::from_value(serde_json::json!(format!(
+ "30402:{}:listing-1",
+ hex_64('a')
+ )))
.expect("listing from value");
- let quote: RadrootsOrderQuoteId =
+ let quote: OrderQuoteId =
serde_json::from_value(serde_json::json!("quote-1")).expect("quote from value");
assert_eq!(order.as_str(), "order-1");
assert_eq!(listing.as_str().split(':').next(), Some("30402"));
diff --git a/crates/event/src/job_feedback.rs b/crates/event/src/job_feedback.rs
@@ -1,6 +1,6 @@
use crate::{
social::job::{JobFeedbackStatus, JobPaymentRequest},
- tag::RadrootsEventPtr,
+ tag::EventPtr,
};
#[cfg(not(feature = "std"))]
@@ -13,11 +13,11 @@ use alloc::string::String;
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsJobFeedback {
+pub struct JobFeedback {
pub kind: u16,
pub status: JobFeedbackStatus,
pub extra_info: Option<String>,
- pub request_event: RadrootsEventPtr,
+ pub request_event: EventPtr,
pub customer_pubkey: Option<String>,
pub payment: Option<JobPaymentRequest>,
pub content: Option<String>,
diff --git a/crates/event/src/job_request.rs b/crates/event/src/job_request.rs
@@ -10,7 +10,7 @@ use alloc::{string::String, vec::Vec};
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsJobInput {
+pub struct JobInput {
pub data: String,
pub input_type: JobInputType,
pub relay: Option<String>,
@@ -24,7 +24,7 @@ pub struct RadrootsJobInput {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsJobParam {
+pub struct JobParam {
pub key: String,
pub value: String,
}
@@ -36,11 +36,11 @@ pub struct RadrootsJobParam {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsJobRequest {
+pub struct JobRequest {
pub kind: u16,
- pub inputs: Vec<RadrootsJobInput>,
+ pub inputs: Vec<JobInput>,
pub output: Option<String>,
- pub params: Vec<RadrootsJobParam>,
+ pub params: Vec<JobParam>,
pub bid_sat: Option<u32>,
pub relays: Vec<String>,
pub providers: Vec<String>,
diff --git a/crates/event/src/job_result.rs b/crates/event/src/job_result.rs
@@ -1,6 +1,6 @@
use crate::{
- social::{job::JobPaymentRequest, job_request::RadrootsJobInput},
- tag::RadrootsEventPtr,
+ social::{job::JobPaymentRequest, job_request::JobInput},
+ tag::EventPtr,
};
#[cfg(not(feature = "std"))]
@@ -13,11 +13,11 @@ use alloc::{string::String, vec::Vec};
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsJobResult {
+pub struct JobResult {
pub kind: u16,
- pub request_event: RadrootsEventPtr,
+ pub request_event: EventPtr,
pub request_json: Option<String>,
- pub inputs: Vec<RadrootsJobInput>,
+ pub inputs: Vec<JobInput>,
pub customer_pubkey: Option<String>,
pub payment: Option<JobPaymentRequest>,
pub content: Option<String>,
diff --git a/crates/event/src/knowledge.rs b/crates/event/src/knowledge.rs
@@ -6,11 +6,8 @@ use alloc::{string::String, vec::Vec};
use core::fmt;
use crate::envelope::kind::KIND_WIKI_ARTICLE;
-use crate::id::{
- RadrootsAddressableCoordinate, RadrootsDTag, RadrootsEventId, RadrootsRelayUrl,
- parse_public_key,
-};
-use crate::tag::RadrootsEventRef;
+use crate::id::{AddressableCoordinate, DTag, EventId, RelayUrl, parse_public_key};
+use crate::tag::EventRef;
pub const RADROOTS_KNOWLEDGE_SCHEMA_VERSION: u16 = 1;
pub const RADROOTS_WIKI_D_TAG_MAX_LEN: usize = 512;
@@ -25,13 +22,13 @@ pub const RADROOTS_CONTRIBUTION_ATTESTATION_SCHEMA: &str =
"radroots.knowledge.contribution_attestation.v1";
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsWikiDTagError {
+pub enum WikiDTagError {
Empty,
TooLong { max: usize, actual: usize },
NotNormalized { normalized: String },
}
-impl RadrootsWikiDTagError {
+impl WikiDTagError {
pub const fn code(&self) -> &'static str {
match self {
Self::Empty => "empty",
@@ -41,7 +38,7 @@ impl RadrootsWikiDTagError {
}
}
-impl fmt::Display for RadrootsWikiDTagError {
+impl fmt::Display for WikiDTagError {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Empty => formatter.write_str("wiki d tag must not be empty"),
@@ -62,7 +59,7 @@ impl fmt::Display for RadrootsWikiDTagError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsWikiDTagError {}
+impl std::error::Error for WikiDTagError {}
pub fn normalize_wiki_d_tag(input: &str) -> String {
let mut normalized = String::new();
@@ -85,14 +82,14 @@ pub fn normalize_wiki_d_tag(input: &str) -> String {
normalized
}
-pub fn validate_wiki_d_tag(value: &str) -> Result<(), RadrootsWikiDTagError> {
+pub fn validate_wiki_d_tag(value: &str) -> Result<(), WikiDTagError> {
if value.is_empty() {
- return Err(RadrootsWikiDTagError::Empty);
+ return Err(WikiDTagError::Empty);
}
let actual = value.chars().count();
if actual > RADROOTS_WIKI_D_TAG_MAX_LEN {
- return Err(RadrootsWikiDTagError::TooLong {
+ return Err(WikiDTagError::TooLong {
max: RADROOTS_WIKI_D_TAG_MAX_LEN,
actual,
});
@@ -100,19 +97,19 @@ pub fn validate_wiki_d_tag(value: &str) -> Result<(), RadrootsWikiDTagError> {
let normalized = normalize_wiki_d_tag(value);
if normalized != value {
- return Err(RadrootsWikiDTagError::NotNormalized { normalized });
+ return Err(WikiDTagError::NotNormalized { normalized });
}
Ok(())
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsKnowledgeValidationError {
+pub enum KnowledgeValidationError {
EmptyField(&'static str),
InvalidField(&'static str),
}
-impl RadrootsKnowledgeValidationError {
+impl KnowledgeValidationError {
pub const fn code(self) -> &'static str {
match self {
Self::EmptyField(_) => "empty_field",
@@ -127,7 +124,7 @@ impl RadrootsKnowledgeValidationError {
}
}
-impl fmt::Display for RadrootsKnowledgeValidationError {
+impl fmt::Display for KnowledgeValidationError {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::EmptyField(field) => write!(formatter, "empty knowledge field: {field}"),
@@ -137,14 +134,11 @@ impl fmt::Display for RadrootsKnowledgeValidationError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsKnowledgeValidationError {}
+impl std::error::Error for KnowledgeValidationError {}
-fn require_non_empty(
- value: &str,
- field: &'static str,
-) -> Result<(), RadrootsKnowledgeValidationError> {
+fn require_non_empty(value: &str, field: &'static str) -> Result<(), KnowledgeValidationError> {
if value.trim().is_empty() {
- Err(RadrootsKnowledgeValidationError::EmptyField(field))
+ Err(KnowledgeValidationError::EmptyField(field))
} else {
Ok(())
}
@@ -154,63 +148,52 @@ fn require_schema(
schema: &str,
schema_version: u16,
expected_schema: &'static str,
-) -> Result<(), RadrootsKnowledgeValidationError> {
+) -> Result<(), KnowledgeValidationError> {
if schema != expected_schema {
- return Err(RadrootsKnowledgeValidationError::InvalidField("schema"));
+ return Err(KnowledgeValidationError::InvalidField("schema"));
}
if schema_version != RADROOTS_KNOWLEDGE_SCHEMA_VERSION {
- return Err(RadrootsKnowledgeValidationError::InvalidField(
- "schema_version",
- ));
+ return Err(KnowledgeValidationError::InvalidField("schema_version"));
}
Ok(())
}
-fn validate_event_id(
- value: &str,
- field: &'static str,
-) -> Result<(), RadrootsKnowledgeValidationError> {
+fn validate_event_id(value: &str, field: &'static str) -> Result<(), KnowledgeValidationError> {
if value.trim().is_empty() {
- return Err(RadrootsKnowledgeValidationError::EmptyField(field));
+ return Err(KnowledgeValidationError::EmptyField(field));
}
- RadrootsEventId::parse(value)
+ EventId::parse(value)
.map(|_| ())
- .map_err(|_| RadrootsKnowledgeValidationError::InvalidField(field))
+ .map_err(|_| KnowledgeValidationError::InvalidField(field))
}
-fn validate_pubkey(
- value: &str,
- field: &'static str,
-) -> Result<(), RadrootsKnowledgeValidationError> {
+fn validate_pubkey(value: &str, field: &'static str) -> Result<(), KnowledgeValidationError> {
if value.trim().is_empty() {
- return Err(RadrootsKnowledgeValidationError::EmptyField(field));
+ return Err(KnowledgeValidationError::EmptyField(field));
}
parse_public_key(value)
.map(|_| ())
- .map_err(|_| RadrootsKnowledgeValidationError::InvalidField(field))
+ .map_err(|_| KnowledgeValidationError::InvalidField(field))
}
-fn validate_relays(
- relays: &[String],
- field: &'static str,
-) -> Result<(), RadrootsKnowledgeValidationError> {
+fn validate_relays(relays: &[String], field: &'static str) -> Result<(), KnowledgeValidationError> {
for relay in relays {
- RadrootsRelayUrl::parse(relay)
+ RelayUrl::parse(relay)
.map(|_| ())
- .map_err(|_| RadrootsKnowledgeValidationError::InvalidField(field))?;
+ .map_err(|_| KnowledgeValidationError::InvalidField(field))?;
}
Ok(())
}
fn validate_event_ref(
- event_ref: &RadrootsEventRef,
+ event_ref: &EventRef,
field: &'static str,
-) -> Result<(), RadrootsKnowledgeValidationError> {
+) -> Result<(), KnowledgeValidationError> {
validate_event_id(&event_ref.id, field)?;
if let Some(d_tag) = event_ref.d_tag.as_deref() {
- RadrootsDTag::parse(d_tag)
+ DTag::parse(d_tag)
.map(|_| ())
- .map_err(|_| RadrootsKnowledgeValidationError::InvalidField(field))?;
+ .map_err(|_| KnowledgeValidationError::InvalidField(field))?;
}
if let Some(relays) = event_ref.relays.as_deref() {
validate_relays(relays, field)?;
@@ -219,9 +202,9 @@ fn validate_event_ref(
}
fn validate_event_refs(
- refs: &[RadrootsEventRef],
+ refs: &[EventRef],
field: &'static str,
-) -> Result<(), RadrootsKnowledgeValidationError> {
+) -> Result<(), KnowledgeValidationError> {
for event_ref in refs {
validate_event_ref(event_ref, field)?;
}
@@ -229,45 +212,45 @@ fn validate_event_refs(
}
fn validate_address_ref(
- address: &RadrootsAddressableRef,
+ address: &AddressableRef,
field: &'static str,
-) -> Result<(), RadrootsKnowledgeValidationError> {
+) -> Result<(), KnowledgeValidationError> {
if address.kind == 0 {
- return Err(RadrootsKnowledgeValidationError::InvalidField(field));
+ return Err(KnowledgeValidationError::InvalidField(field));
}
validate_pubkey(&address.pubkey, field)?;
- RadrootsDTag::parse(address.d_tag.as_str())
+ DTag::parse(address.d_tag.as_str())
.map(|_| ())
- .map_err(|_| RadrootsKnowledgeValidationError::InvalidField(field))?;
+ .map_err(|_| KnowledgeValidationError::InvalidField(field))?;
validate_relays(&address.relays, field)
}
fn validate_wiki_article_address_ref(
- address: &RadrootsAddressableRef,
+ address: &AddressableRef,
field: &'static str,
-) -> Result<(), RadrootsKnowledgeValidationError> {
+) -> Result<(), KnowledgeValidationError> {
if address.kind != KIND_WIKI_ARTICLE {
- return Err(RadrootsKnowledgeValidationError::InvalidField(field));
+ return Err(KnowledgeValidationError::InvalidField(field));
}
validate_pubkey(&address.pubkey, field)?;
validate_wiki_d_tag(address.d_tag.as_str())
.map(|_| ())
- .map_err(|_| RadrootsKnowledgeValidationError::InvalidField(field))?;
+ .map_err(|_| KnowledgeValidationError::InvalidField(field))?;
validate_relays(&address.relays, field)
}
fn validate_wiki_article_version_ref(
- version_ref: &RadrootsWikiArticleVersionRef,
+ version_ref: &WikiArticleVersionRef,
field: &'static str,
-) -> Result<(), RadrootsKnowledgeValidationError> {
+) -> Result<(), KnowledgeValidationError> {
validate_event_id(&version_ref.event_id, field)?;
validate_wiki_article_address_ref(&version_ref.address_ref, field)
}
fn validate_node_ref(
- node_ref: &RadrootsKnowledgeNodeRef,
+ node_ref: &KnowledgeNodeRef,
field: &'static str,
-) -> Result<(), RadrootsKnowledgeValidationError> {
+) -> Result<(), KnowledgeValidationError> {
let mut populated = 0u8;
if let Some(event_ref) = &node_ref.event_ref {
populated += 1;
@@ -284,16 +267,14 @@ fn validate_node_ref(
if populated == 1 {
Ok(())
} else {
- Err(RadrootsKnowledgeValidationError::InvalidField(field))
+ Err(KnowledgeValidationError::InvalidField(field))
}
}
-pub fn validate_wiki_article(
- article: &RadrootsWikiArticle,
-) -> Result<(), RadrootsKnowledgeValidationError> {
+pub fn validate_wiki_article(article: &WikiArticle) -> Result<(), KnowledgeValidationError> {
validate_wiki_d_tag(article.d_tag.as_str())
.map(|_| ())
- .map_err(|_| RadrootsKnowledgeValidationError::InvalidField("d_tag"))?;
+ .map_err(|_| KnowledgeValidationError::InvalidField("d_tag"))?;
if let Some(title) = article.title.as_deref() {
require_non_empty(title, "title")?;
}
@@ -308,18 +289,16 @@ pub fn validate_wiki_article(
Ok(())
}
-pub fn validate_wiki_redirect(
- redirect: &RadrootsWikiRedirect,
-) -> Result<(), RadrootsKnowledgeValidationError> {
+pub fn validate_wiki_redirect(redirect: &WikiRedirect) -> Result<(), KnowledgeValidationError> {
validate_wiki_d_tag(redirect.d_tag.as_str())
.map(|_| ())
- .map_err(|_| RadrootsKnowledgeValidationError::InvalidField("d_tag"))?;
+ .map_err(|_| KnowledgeValidationError::InvalidField("d_tag"))?;
validate_wiki_article_address_ref(&redirect.target, "wiki_redirect.target")
}
pub fn validate_wiki_merge_request(
- request: &RadrootsWikiMergeRequest,
-) -> Result<(), RadrootsKnowledgeValidationError> {
+ request: &WikiMergeRequest,
+) -> Result<(), KnowledgeValidationError> {
validate_wiki_article_address_ref(&request.target_article, "target_article")?;
validate_pubkey(&request.destination_pubkey, "destination_pubkey")?;
if let Some(base) = request.base_version_event_id.as_deref() {
@@ -331,9 +310,7 @@ pub fn validate_wiki_merge_request(
)
}
-pub fn validate_knowledge_source(
- source: &RadrootsKnowledgeSource,
-) -> Result<(), RadrootsKnowledgeValidationError> {
+pub fn validate_knowledge_source(source: &KnowledgeSource) -> Result<(), KnowledgeValidationError> {
require_schema(
source.schema.as_str(),
source.schema_version,
@@ -341,7 +318,7 @@ pub fn validate_knowledge_source(
)?;
validate_wiki_d_tag(source.d_tag.as_str())
.map(|_| ())
- .map_err(|_| RadrootsKnowledgeValidationError::InvalidField("d_tag"))?;
+ .map_err(|_| KnowledgeValidationError::InvalidField("d_tag"))?;
require_non_empty(source.title.as_str(), "title")?;
require_non_empty(source.source_type.as_str(), "source_type")?;
for author in &source.authors {
@@ -354,9 +331,7 @@ pub fn is_uncited_knowledge_claim_type(claim_type: &str) -> bool {
matches!(claim_type, "hypothesis" | "observation" | "question")
}
-pub fn validate_knowledge_claim(
- claim: &RadrootsKnowledgeClaim,
-) -> Result<(), RadrootsKnowledgeValidationError> {
+pub fn validate_knowledge_claim(claim: &KnowledgeClaim) -> Result<(), KnowledgeValidationError> {
require_schema(
claim.schema.as_str(),
claim.schema_version,
@@ -367,15 +342,11 @@ pub fn validate_knowledge_claim(
if claim.citation_spans.is_empty()
&& !is_uncited_knowledge_claim_type(claim.claim_type.as_str())
{
- return Err(RadrootsKnowledgeValidationError::EmptyField(
- "citation_spans",
- ));
+ return Err(KnowledgeValidationError::EmptyField("citation_spans"));
}
for citation in &claim.citation_spans {
if citation.source_ref.kind != crate::envelope::kind::KIND_KNOWLEDGE_SOURCE {
- return Err(RadrootsKnowledgeValidationError::InvalidField(
- "citation_spans",
- ));
+ return Err(KnowledgeValidationError::InvalidField("citation_spans"));
}
validate_event_ref(&citation.source_ref, "citation_spans")?;
if let Some(artifact_ref) = &citation.artifact_ref {
@@ -389,8 +360,8 @@ pub fn validate_knowledge_claim(
}
pub fn validate_knowledge_relation(
- relation: &RadrootsKnowledgeRelation,
-) -> Result<(), RadrootsKnowledgeValidationError> {
+ relation: &KnowledgeRelation,
+) -> Result<(), KnowledgeValidationError> {
require_schema(
relation.schema.as_str(),
relation.schema_version,
@@ -403,9 +374,7 @@ pub fn validate_knowledge_relation(
validate_event_refs(&relation.supersedes, "supersedes")
}
-pub fn validate_knowledge_review(
- review: &RadrootsKnowledgeReview,
-) -> Result<(), RadrootsKnowledgeValidationError> {
+pub fn validate_knowledge_review(review: &KnowledgeReview) -> Result<(), KnowledgeValidationError> {
require_schema(
review.schema.as_str(),
review.schema_version,
@@ -414,14 +383,12 @@ pub fn validate_knowledge_review(
validate_event_id(review.target.event_id.as_str(), "review_target")?;
validate_pubkey(review.target.author_pubkey.as_str(), "review_target")?;
if review.target.kind == 0 {
- return Err(RadrootsKnowledgeValidationError::InvalidField(
- "review_target",
- ));
+ return Err(KnowledgeValidationError::InvalidField("review_target"));
}
if let Some(address) = review.target.address.as_deref() {
- RadrootsAddressableCoordinate::parse(address)
+ AddressableCoordinate::parse(address)
.map(|_| ())
- .map_err(|_| RadrootsKnowledgeValidationError::InvalidField("review_target"))?;
+ .map_err(|_| KnowledgeValidationError::InvalidField("review_target"))?;
}
validate_relays(&review.target.relays, "review_target")?;
require_non_empty(review.reviewer_role.as_str(), "reviewer_role")?;
@@ -434,8 +401,8 @@ pub fn validate_knowledge_review(
}
pub fn validate_knowledge_field_report(
- report: &RadrootsKnowledgeFieldReport,
-) -> Result<(), RadrootsKnowledgeValidationError> {
+ report: &KnowledgeFieldReport,
+) -> Result<(), KnowledgeValidationError> {
require_schema(
report.schema.as_str(),
report.schema_version,
@@ -443,19 +410,16 @@ pub fn validate_knowledge_field_report(
)?;
require_non_empty(report.report_type.as_str(), "report_type")?;
require_non_empty(report.title.as_str(), "title")?;
- if report.context.location_precision
- == RadrootsKnowledgeLocationPrecision::ExactPrivateReference
+ if report.context.location_precision == KnowledgeLocationPrecision::ExactPrivateReference
&& report.context.private_location_ref.is_none()
{
- return Err(RadrootsKnowledgeValidationError::EmptyField(
- "private_location_ref",
- ));
+ return Err(KnowledgeValidationError::EmptyField("private_location_ref"));
}
if let Some(private_location_ref) = &report.context.private_location_ref {
validate_event_ref(private_location_ref, "private_location_ref")?;
}
if report.observations.is_empty() {
- return Err(RadrootsKnowledgeValidationError::EmptyField("observations"));
+ return Err(KnowledgeValidationError::EmptyField("observations"));
}
for observation in &report.observations {
require_non_empty(observation.observation_type.as_str(), "observations")?;
@@ -469,9 +433,7 @@ pub fn validate_knowledge_field_report(
validate_event_refs(&report.related_refs, "related_refs")
}
-pub fn validate_evidence_bounty(
- bounty: &RadrootsEvidenceBounty,
-) -> Result<(), RadrootsKnowledgeValidationError> {
+pub fn validate_evidence_bounty(bounty: &EvidenceBounty) -> Result<(), KnowledgeValidationError> {
require_schema(
bounty.schema.as_str(),
bounty.schema_version,
@@ -479,17 +441,17 @@ pub fn validate_evidence_bounty(
)?;
validate_wiki_d_tag(bounty.d_tag.as_str())
.map(|_| ())
- .map_err(|_| RadrootsKnowledgeValidationError::InvalidField("d_tag"))?;
+ .map_err(|_| KnowledgeValidationError::InvalidField("d_tag"))?;
require_non_empty(bounty.title.as_str(), "title")?;
if bounty.target_refs.is_empty() {
- return Err(RadrootsKnowledgeValidationError::EmptyField("target_refs"));
+ return Err(KnowledgeValidationError::EmptyField("target_refs"));
}
validate_event_refs(&bounty.target_refs, "target_refs")
}
pub fn validate_knowledge_change_proposal(
- proposal: &RadrootsKnowledgeChangeProposal,
-) -> Result<(), RadrootsKnowledgeValidationError> {
+ proposal: &KnowledgeChangeProposal,
+) -> Result<(), KnowledgeValidationError> {
require_schema(
proposal.schema.as_str(),
proposal.schema_version,
@@ -503,8 +465,8 @@ pub fn validate_knowledge_change_proposal(
}
pub fn validate_contribution_attestation(
- attestation: &RadrootsContributionAttestation,
-) -> Result<(), RadrootsKnowledgeValidationError> {
+ attestation: &ContributionAttestation,
+) -> Result<(), KnowledgeValidationError> {
require_schema(
attestation.schema.as_str(),
attestation.schema_version,
@@ -517,7 +479,7 @@ pub fn validate_contribution_attestation(
require_non_empty(attestation.contribution_type.as_str(), "contribution_type")?;
require_non_empty(attestation.summary.as_str(), "summary")?;
if attestation.subject_refs.is_empty() {
- return Err(RadrootsKnowledgeValidationError::EmptyField("subject_refs"));
+ return Err(KnowledgeValidationError::EmptyField("subject_refs"));
}
validate_event_refs(&attestation.subject_refs, "subject_refs")?;
validate_event_refs(&attestation.evidence_refs, "evidence_refs")
@@ -530,7 +492,7 @@ pub fn validate_contribution_attestation(
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsAddressableRef {
+pub struct AddressableRef {
pub kind: u32,
pub pubkey: String,
pub d_tag: String,
@@ -544,7 +506,7 @@ pub struct RadrootsAddressableRef {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsRightsAssertion {
+pub struct RightsAssertion {
pub assertion: String,
pub holder: Option<String>,
pub license: Option<String>,
@@ -558,15 +520,15 @@ pub struct RadrootsRightsAssertion {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsWikiArticle {
+pub struct WikiArticle {
pub d_tag: String,
pub title: Option<String>,
pub content_djot: String,
pub summary: Option<String>,
pub topics: Vec<String>,
- pub references: Vec<RadrootsEventRef>,
- pub forked_from: Vec<RadrootsWikiArticleVersionRef>,
- pub deferred_to: Option<RadrootsWikiArticleVersionRef>,
+ pub references: Vec<EventRef>,
+ pub forked_from: Vec<WikiArticleVersionRef>,
+ pub deferred_to: Option<WikiArticleVersionRef>,
}
#[cfg_attr(
@@ -576,9 +538,9 @@ pub struct RadrootsWikiArticle {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsWikiArticleVersionRef {
+pub struct WikiArticleVersionRef {
pub event_id: String,
- pub address_ref: RadrootsAddressableRef,
+ pub address_ref: AddressableRef,
}
#[cfg_attr(
@@ -588,9 +550,9 @@ pub struct RadrootsWikiArticleVersionRef {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsWikiRedirect {
+pub struct WikiRedirect {
pub d_tag: String,
- pub target: RadrootsAddressableRef,
+ pub target: AddressableRef,
}
#[cfg_attr(
@@ -600,8 +562,8 @@ pub struct RadrootsWikiRedirect {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsWikiMergeRequest {
- pub target_article: RadrootsAddressableRef,
+pub struct WikiMergeRequest {
+ pub target_article: AddressableRef,
pub destination_pubkey: String,
pub base_version_event_id: Option<String>,
pub source_version_event_id: String,
@@ -615,7 +577,7 @@ pub struct RadrootsWikiMergeRequest {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsKnowledgeSource {
+pub struct KnowledgeSource {
pub schema: String,
pub schema_version: u16,
pub d_tag: String,
@@ -626,8 +588,8 @@ pub struct RadrootsKnowledgeSource {
pub publication_year: Option<u16>,
pub edition: Option<String>,
pub canonical_url: Option<String>,
- pub artifact_refs: Vec<RadrootsEventRef>,
- pub author_asserted_rights: Option<RadrootsRightsAssertion>,
+ pub artifact_refs: Vec<EventRef>,
+ pub author_asserted_rights: Option<RightsAssertion>,
pub topics: Vec<String>,
pub summary: Option<String>,
}
@@ -639,16 +601,16 @@ pub struct RadrootsKnowledgeSource {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsKnowledgeClaim {
+pub struct KnowledgeClaim {
pub schema: String,
pub schema_version: u16,
pub claim_type: String,
pub text: String,
- pub citation_spans: Vec<RadrootsKnowledgeCitationSpan>,
+ pub citation_spans: Vec<KnowledgeCitationSpan>,
pub topics: Vec<String>,
pub applies_to: Vec<String>,
pub author_asserted_confidence: Option<String>,
- pub supersedes: Vec<RadrootsEventRef>,
+ pub supersedes: Vec<EventRef>,
}
#[cfg_attr(
@@ -658,9 +620,9 @@ pub struct RadrootsKnowledgeClaim {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsKnowledgeCitationSpan {
- pub source_ref: RadrootsEventRef,
- pub artifact_ref: Option<RadrootsEventRef>,
+pub struct KnowledgeCitationSpan {
+ pub source_ref: EventRef,
+ pub artifact_ref: Option<EventRef>,
pub page_start: Option<u32>,
pub page_end: Option<u32>,
pub section_path: Vec<String>,
@@ -675,10 +637,10 @@ pub struct RadrootsKnowledgeCitationSpan {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsKnowledgeNodeRef {
+pub struct KnowledgeNodeRef {
pub node_type: String,
- pub event_ref: Option<RadrootsEventRef>,
- pub address_ref: Option<RadrootsAddressableRef>,
+ pub event_ref: Option<EventRef>,
+ pub address_ref: Option<AddressableRef>,
pub external_id: Option<String>,
pub label: Option<String>,
}
@@ -690,15 +652,15 @@ pub struct RadrootsKnowledgeNodeRef {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsKnowledgeRelation {
+pub struct KnowledgeRelation {
pub schema: String,
pub schema_version: u16,
- pub subject: RadrootsKnowledgeNodeRef,
+ pub subject: KnowledgeNodeRef,
pub predicate: String,
- pub object: RadrootsKnowledgeNodeRef,
- pub support_refs: Vec<RadrootsEventRef>,
+ pub object: KnowledgeNodeRef,
+ pub support_refs: Vec<EventRef>,
pub author_asserted_confidence: Option<String>,
- pub supersedes: Vec<RadrootsEventRef>,
+ pub supersedes: Vec<EventRef>,
}
#[cfg_attr(
@@ -708,15 +670,15 @@ pub struct RadrootsKnowledgeRelation {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsKnowledgeReview {
+pub struct KnowledgeReview {
pub schema: String,
pub schema_version: u16,
- pub target: RadrootsKnowledgeReviewTarget,
+ pub target: KnowledgeReviewTarget,
pub reviewer_role: String,
pub verdict: String,
- pub scores: Vec<RadrootsKnowledgeReviewScore>,
+ pub scores: Vec<KnowledgeReviewScore>,
pub notes: Option<String>,
- pub evidence_refs: Vec<RadrootsEventRef>,
+ pub evidence_refs: Vec<EventRef>,
}
#[cfg_attr(
@@ -726,13 +688,13 @@ pub struct RadrootsKnowledgeReview {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsKnowledgeReviewTarget {
+pub struct KnowledgeReviewTarget {
pub event_id: String,
pub author_pubkey: String,
pub kind: u32,
pub address: Option<String>,
pub relays: Vec<String>,
- pub review_scope: RadrootsKnowledgeReviewScope,
+ pub review_scope: KnowledgeReviewScope,
}
#[cfg_attr(
@@ -743,7 +705,7 @@ pub struct RadrootsKnowledgeReviewTarget {
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[cfg_attr(any(feature = "serde", test), serde(rename_all = "snake_case"))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsKnowledgeReviewScope {
+pub enum KnowledgeReviewScope {
SpecificVersion,
AddressableCoordinateAtPublishedAt,
PolicyLatest,
@@ -756,7 +718,7 @@ pub enum RadrootsKnowledgeReviewScope {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsKnowledgeReviewScore {
+pub struct KnowledgeReviewScore {
pub dimension: String,
pub value: String,
pub note: Option<String>,
@@ -769,16 +731,16 @@ pub struct RadrootsKnowledgeReviewScore {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsKnowledgeFieldReport {
+pub struct KnowledgeFieldReport {
pub schema: String,
pub schema_version: u16,
pub report_type: String,
pub title: String,
pub summary: Option<String>,
- pub context: RadrootsKnowledgeFieldContext,
- pub observations: Vec<RadrootsKnowledgeObservation>,
- pub artifact_refs: Vec<RadrootsEventRef>,
- pub related_refs: Vec<RadrootsEventRef>,
+ pub context: KnowledgeFieldContext,
+ pub observations: Vec<KnowledgeObservation>,
+ pub artifact_refs: Vec<EventRef>,
+ pub related_refs: Vec<EventRef>,
pub limitations: Vec<String>,
}
@@ -789,10 +751,10 @@ pub struct RadrootsKnowledgeFieldReport {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsKnowledgeFieldContext {
- pub location_precision: RadrootsKnowledgeLocationPrecision,
- pub public_location: Option<RadrootsKnowledgeLocation>,
- pub private_location_ref: Option<RadrootsEventRef>,
+pub struct KnowledgeFieldContext {
+ pub location_precision: KnowledgeLocationPrecision,
+ pub public_location: Option<KnowledgeLocation>,
+ pub private_location_ref: Option<EventRef>,
pub topics: Vec<String>,
pub context_tags: Vec<String>,
}
@@ -805,7 +767,7 @@ pub struct RadrootsKnowledgeFieldContext {
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[cfg_attr(any(feature = "serde", test), serde(rename_all = "snake_case"))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsKnowledgeLocationPrecision {
+pub enum KnowledgeLocationPrecision {
None,
Region,
Locality,
@@ -821,7 +783,7 @@ pub enum RadrootsKnowledgeLocationPrecision {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsKnowledgeLocation {
+pub struct KnowledgeLocation {
pub label: Option<String>,
pub region: Option<String>,
pub locality: Option<String>,
@@ -835,11 +797,11 @@ pub struct RadrootsKnowledgeLocation {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsKnowledgeObservation {
+pub struct KnowledgeObservation {
pub observation_type: String,
pub text: String,
pub observed_at: Option<String>,
- pub values: Vec<RadrootsKnowledgeObservationValue>,
+ pub values: Vec<KnowledgeObservationValue>,
}
#[cfg_attr(
@@ -849,7 +811,7 @@ pub struct RadrootsKnowledgeObservation {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsKnowledgeObservationValue {
+pub struct KnowledgeObservationValue {
pub key: String,
pub value: String,
pub unit: Option<String>,
@@ -862,14 +824,14 @@ pub struct RadrootsKnowledgeObservationValue {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsEvidenceBounty {
+pub struct EvidenceBounty {
pub schema: String,
pub schema_version: u16,
pub d_tag: String,
pub title: String,
pub summary: Option<String>,
pub topics: Vec<String>,
- pub target_refs: Vec<RadrootsEventRef>,
+ pub target_refs: Vec<EventRef>,
pub reward_note: Option<String>,
pub closes_at: Option<String>,
}
@@ -881,15 +843,15 @@ pub struct RadrootsEvidenceBounty {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsKnowledgeChangeProposal {
+pub struct KnowledgeChangeProposal {
pub schema: String,
pub schema_version: u16,
- pub target: RadrootsEventRef,
+ pub target: EventRef,
pub proposal_type: String,
pub summary: String,
pub rationale: Option<String>,
- pub evidence_refs: Vec<RadrootsEventRef>,
- pub supersedes: Vec<RadrootsEventRef>,
+ pub evidence_refs: Vec<EventRef>,
+ pub supersedes: Vec<EventRef>,
}
#[cfg_attr(
@@ -899,14 +861,14 @@ pub struct RadrootsKnowledgeChangeProposal {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsContributionAttestation {
+pub struct ContributionAttestation {
pub schema: String,
pub schema_version: u16,
pub contributor_pubkey: String,
pub contribution_type: String,
- pub subject_refs: Vec<RadrootsEventRef>,
+ pub subject_refs: Vec<EventRef>,
pub summary: String,
- pub evidence_refs: Vec<RadrootsEventRef>,
+ pub evidence_refs: Vec<EventRef>,
}
#[cfg(test)]
@@ -917,12 +879,12 @@ mod tests {
crate::test_valid_hex_64(character)
}
- fn event_ref() -> RadrootsEventRef {
+ fn event_ref() -> EventRef {
event_ref_with_kind(1)
}
- fn event_ref_with_kind(kind: u32) -> RadrootsEventRef {
- RadrootsEventRef {
+ fn event_ref_with_kind(kind: u32) -> EventRef {
+ EventRef {
id: "0".repeat(64),
author: radroots_identity::PublicKey::from_hex(&crate::test_valid_hex_64('1'))
.expect("fixture public key"),
@@ -932,8 +894,8 @@ mod tests {
}
}
- fn article_address_ref() -> RadrootsAddressableRef {
- RadrootsAddressableRef {
+ fn article_address_ref() -> AddressableRef {
+ AddressableRef {
kind: KIND_WIKI_ARTICLE,
pubkey: hex_64('a'),
d_tag: "soil-health".to_string(),
@@ -941,15 +903,15 @@ mod tests {
}
}
- fn article_version_ref() -> RadrootsWikiArticleVersionRef {
- RadrootsWikiArticleVersionRef {
+ fn article_version_ref() -> WikiArticleVersionRef {
+ WikiArticleVersionRef {
event_id: hex_64('b'),
address_ref: article_address_ref(),
}
}
- fn wiki_article() -> RadrootsWikiArticle {
- RadrootsWikiArticle {
+ fn wiki_article() -> WikiArticle {
+ WikiArticle {
d_tag: "soil-health".to_string(),
title: Some("Soil health".to_string()),
content_djot: "# Soil health".to_string(),
@@ -965,8 +927,8 @@ mod tests {
"http://relay.radroots.example".to_string()
}
- fn knowledge_source() -> RadrootsKnowledgeSource {
- RadrootsKnowledgeSource {
+ fn knowledge_source() -> KnowledgeSource {
+ KnowledgeSource {
schema: RADROOTS_KNOWLEDGE_SOURCE_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
d_tag: "soil-source".to_string(),
@@ -984,8 +946,8 @@ mod tests {
}
}
- fn citation_span() -> RadrootsKnowledgeCitationSpan {
- RadrootsKnowledgeCitationSpan {
+ fn citation_span() -> KnowledgeCitationSpan {
+ KnowledgeCitationSpan {
source_ref: event_ref_with_kind(crate::envelope::kind::KIND_KNOWLEDGE_SOURCE),
artifact_ref: Some(event_ref()),
page_start: None,
@@ -996,8 +958,8 @@ mod tests {
}
}
- fn knowledge_claim() -> RadrootsKnowledgeClaim {
- RadrootsKnowledgeClaim {
+ fn knowledge_claim() -> KnowledgeClaim {
+ KnowledgeClaim {
schema: RADROOTS_KNOWLEDGE_CLAIM_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
claim_type: "practice_effect".to_string(),
@@ -1010,8 +972,8 @@ mod tests {
}
}
- fn node_ref() -> RadrootsKnowledgeNodeRef {
- RadrootsKnowledgeNodeRef {
+ fn node_ref() -> KnowledgeNodeRef {
+ KnowledgeNodeRef {
node_type: "event".to_string(),
event_ref: Some(event_ref()),
address_ref: None,
@@ -1020,8 +982,8 @@ mod tests {
}
}
- fn knowledge_relation() -> RadrootsKnowledgeRelation {
- RadrootsKnowledgeRelation {
+ fn knowledge_relation() -> KnowledgeRelation {
+ KnowledgeRelation {
schema: RADROOTS_KNOWLEDGE_RELATION_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
subject: node_ref(),
@@ -1033,21 +995,21 @@ mod tests {
}
}
- fn knowledge_review() -> RadrootsKnowledgeReview {
- RadrootsKnowledgeReview {
+ fn knowledge_review() -> KnowledgeReview {
+ KnowledgeReview {
schema: RADROOTS_KNOWLEDGE_REVIEW_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
- target: RadrootsKnowledgeReviewTarget {
+ target: KnowledgeReviewTarget {
event_id: hex_64('d'),
author_pubkey: hex_64('a'),
kind: crate::envelope::kind::KIND_KNOWLEDGE_CLAIM,
address: None,
relays: Vec::new(),
- review_scope: RadrootsKnowledgeReviewScope::SpecificVersion,
+ review_scope: KnowledgeReviewScope::SpecificVersion,
},
reviewer_role: "peer".to_string(),
verdict: "needs_more_evidence".to_string(),
- scores: vec![RadrootsKnowledgeReviewScore {
+ scores: vec![KnowledgeReviewScore {
dimension: "evidence".to_string(),
value: "partial".to_string(),
note: None,
@@ -1057,25 +1019,25 @@ mod tests {
}
}
- fn field_report() -> RadrootsKnowledgeFieldReport {
- RadrootsKnowledgeFieldReport {
+ fn field_report() -> KnowledgeFieldReport {
+ KnowledgeFieldReport {
schema: RADROOTS_KNOWLEDGE_FIELD_REPORT_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
report_type: "observation".to_string(),
title: "Field observation".to_string(),
summary: None,
- context: RadrootsKnowledgeFieldContext {
- location_precision: RadrootsKnowledgeLocationPrecision::CoarseGeohash,
+ context: KnowledgeFieldContext {
+ location_precision: KnowledgeLocationPrecision::CoarseGeohash,
public_location: None,
private_location_ref: None,
topics: Vec::new(),
context_tags: Vec::new(),
},
- observations: vec![RadrootsKnowledgeObservation {
+ observations: vec![KnowledgeObservation {
observation_type: "residue".to_string(),
text: "Residue was visible.".to_string(),
observed_at: None,
- values: vec![RadrootsKnowledgeObservationValue {
+ values: vec![KnowledgeObservationValue {
key: "coverage".to_string(),
value: "medium".to_string(),
unit: None,
@@ -1087,8 +1049,8 @@ mod tests {
}
}
- fn evidence_bounty() -> RadrootsEvidenceBounty {
- RadrootsEvidenceBounty {
+ fn evidence_bounty() -> EvidenceBounty {
+ EvidenceBounty {
schema: RADROOTS_EVIDENCE_BOUNTY_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
d_tag: "soil-bounty".to_string(),
@@ -1101,8 +1063,8 @@ mod tests {
}
}
- fn knowledge_change_proposal() -> RadrootsKnowledgeChangeProposal {
- RadrootsKnowledgeChangeProposal {
+ fn knowledge_change_proposal() -> KnowledgeChangeProposal {
+ KnowledgeChangeProposal {
schema: RADROOTS_KNOWLEDGE_CHANGE_PROPOSAL_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
target: event_ref(),
@@ -1114,8 +1076,8 @@ mod tests {
}
}
- fn contribution_attestation() -> RadrootsContributionAttestation {
- RadrootsContributionAttestation {
+ fn contribution_attestation() -> ContributionAttestation {
+ ContributionAttestation {
schema: RADROOTS_CONTRIBUTION_ATTESTATION_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
contributor_pubkey: hex_64('a'),
@@ -1127,8 +1089,8 @@ mod tests {
}
fn assert_validation_error(
- result: Result<(), RadrootsKnowledgeValidationError>,
- expected: RadrootsKnowledgeValidationError,
+ result: Result<(), KnowledgeValidationError>,
+ expected: KnowledgeValidationError,
) {
assert_eq!(result, Err(expected));
}
@@ -1166,10 +1128,10 @@ mod tests {
#[test]
fn validates_normalized_wiki_d_tags() {
assert_eq!(validate_wiki_d_tag("soil-health-basics"), Ok(()));
- assert_eq!(validate_wiki_d_tag(""), Err(RadrootsWikiDTagError::Empty));
+ assert_eq!(validate_wiki_d_tag(""), Err(WikiDTagError::Empty));
assert_eq!(
validate_wiki_d_tag("Soil Health"),
- Err(RadrootsWikiDTagError::NotNormalized {
+ Err(WikiDTagError::NotNormalized {
normalized: "soil-health".to_string()
})
);
@@ -1181,7 +1143,7 @@ mod tests {
assert_eq!(
validate_wiki_d_tag(&value),
- Err(RadrootsWikiDTagError::TooLong {
+ Err(WikiDTagError::TooLong {
max: RADROOTS_WIKI_D_TAG_MAX_LEN,
actual: RADROOTS_WIKI_D_TAG_MAX_LEN + 1,
})
@@ -1227,7 +1189,7 @@ mod tests {
#[test]
fn models_wiki_article_as_djot_payload() {
- let article = RadrootsWikiArticle {
+ let article = WikiArticle {
d_tag: "soil-health".to_string(),
title: Some("Soil health".to_string()),
content_djot: "# Soil health".to_string(),
@@ -1245,7 +1207,7 @@ mod tests {
#[test]
fn models_author_asserted_rights_without_trusted_status() {
- let source = RadrootsKnowledgeSource {
+ let source = KnowledgeSource {
schema: RADROOTS_KNOWLEDGE_SOURCE_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
d_tag: "soil-source".to_string(),
@@ -1257,7 +1219,7 @@ mod tests {
edition: None,
canonical_url: None,
artifact_refs: Vec::new(),
- author_asserted_rights: Some(RadrootsRightsAssertion {
+ author_asserted_rights: Some(RightsAssertion {
assertion: "author_asserted_public_domain".to_string(),
holder: None,
license: None,
@@ -1280,9 +1242,9 @@ mod tests {
#[test]
fn models_field_context_without_exact_private_coordinates() {
- let context = RadrootsKnowledgeFieldContext {
- location_precision: RadrootsKnowledgeLocationPrecision::ExactPrivateReference,
- public_location: Some(RadrootsKnowledgeLocation {
+ let context = KnowledgeFieldContext {
+ location_precision: KnowledgeLocationPrecision::ExactPrivateReference,
+ public_location: Some(KnowledgeLocation {
label: Some("watershed edge".to_string()),
region: Some("sample-region".to_string()),
locality: None,
@@ -1295,7 +1257,7 @@ mod tests {
assert_eq!(
context.location_precision,
- RadrootsKnowledgeLocationPrecision::ExactPrivateReference
+ KnowledgeLocationPrecision::ExactPrivateReference
);
assert!(context.private_location_ref.is_some());
assert_eq!(
@@ -1308,14 +1270,14 @@ mod tests {
fn knowledge_validators_accept_valid_models() {
assert_eq!(validate_wiki_article(&wiki_article()), Ok(()));
assert_eq!(
- validate_wiki_redirect(&RadrootsWikiRedirect {
+ validate_wiki_redirect(&WikiRedirect {
d_tag: "soil".to_string(),
target: article_address_ref(),
}),
Ok(())
);
assert_eq!(
- validate_wiki_merge_request(&RadrootsWikiMergeRequest {
+ validate_wiki_merge_request(&WikiMergeRequest {
target_article: article_address_ref(),
destination_pubkey: hex_64('a'),
base_version_event_id: Some(hex_64('e')),
@@ -1346,14 +1308,14 @@ mod tests {
article.references[0].relays = Some(vec![invalid_relay()]);
assert_validation_error(
validate_wiki_article(&article),
- RadrootsKnowledgeValidationError::InvalidField("references"),
+ KnowledgeValidationError::InvalidField("references"),
);
let mut article = wiki_article();
article.forked_from[0].address_ref.relays = vec![invalid_relay()];
assert_validation_error(
validate_wiki_article(&article),
- RadrootsKnowledgeValidationError::InvalidField("forked_from"),
+ KnowledgeValidationError::InvalidField("forked_from"),
);
let mut article = wiki_article();
@@ -1365,20 +1327,20 @@ mod tests {
.relays = vec![invalid_relay()];
assert_validation_error(
validate_wiki_article(&article),
- RadrootsKnowledgeValidationError::InvalidField("deferred_to"),
+ KnowledgeValidationError::InvalidField("deferred_to"),
);
- let mut redirect = RadrootsWikiRedirect {
+ let mut redirect = WikiRedirect {
d_tag: "soil".to_string(),
target: article_address_ref(),
};
redirect.target.relays = vec![invalid_relay()];
assert_validation_error(
validate_wiki_redirect(&redirect),
- RadrootsKnowledgeValidationError::InvalidField("wiki_redirect.target"),
+ KnowledgeValidationError::InvalidField("wiki_redirect.target"),
);
- let mut merge = RadrootsWikiMergeRequest {
+ let mut merge = WikiMergeRequest {
target_article: article_address_ref(),
destination_pubkey: hex_64('a'),
base_version_event_id: Some(hex_64('e')),
@@ -1388,73 +1350,72 @@ mod tests {
merge.target_article.relays = vec![invalid_relay()];
assert_validation_error(
validate_wiki_merge_request(&merge),
- RadrootsKnowledgeValidationError::InvalidField("target_article"),
+ KnowledgeValidationError::InvalidField("target_article"),
);
let mut source = knowledge_source();
source.artifact_refs[0].relays = Some(vec![invalid_relay()]);
assert_validation_error(
validate_knowledge_source(&source),
- RadrootsKnowledgeValidationError::InvalidField("artifact_refs"),
+ KnowledgeValidationError::InvalidField("artifact_refs"),
);
let mut claim = knowledge_claim();
claim.citation_spans[0].source_ref.relays = Some(vec![invalid_relay()]);
assert_validation_error(
validate_knowledge_claim(&claim),
- RadrootsKnowledgeValidationError::InvalidField("citation_spans"),
+ KnowledgeValidationError::InvalidField("citation_spans"),
);
let mut relation = knowledge_relation();
relation.support_refs[0].relays = Some(vec![invalid_relay()]);
assert_validation_error(
validate_knowledge_relation(&relation),
- RadrootsKnowledgeValidationError::InvalidField("support_refs"),
+ KnowledgeValidationError::InvalidField("support_refs"),
);
let mut review = knowledge_review();
review.target.relays = vec![invalid_relay()];
assert_validation_error(
validate_knowledge_review(&review),
- RadrootsKnowledgeValidationError::InvalidField("review_target"),
+ KnowledgeValidationError::InvalidField("review_target"),
);
let mut report = field_report();
- report.context.location_precision =
- RadrootsKnowledgeLocationPrecision::ExactPrivateReference;
+ report.context.location_precision = KnowledgeLocationPrecision::ExactPrivateReference;
let mut private_location_ref = event_ref();
private_location_ref.relays = Some(vec![invalid_relay()]);
report.context.private_location_ref = Some(private_location_ref);
assert_validation_error(
validate_knowledge_field_report(&report),
- RadrootsKnowledgeValidationError::InvalidField("private_location_ref"),
+ KnowledgeValidationError::InvalidField("private_location_ref"),
);
let mut bounty = evidence_bounty();
bounty.target_refs[0].relays = Some(vec![invalid_relay()]);
assert_validation_error(
validate_evidence_bounty(&bounty),
- RadrootsKnowledgeValidationError::InvalidField("target_refs"),
+ KnowledgeValidationError::InvalidField("target_refs"),
);
let mut proposal = knowledge_change_proposal();
proposal.target.relays = Some(vec![invalid_relay()]);
assert_validation_error(
validate_knowledge_change_proposal(&proposal),
- RadrootsKnowledgeValidationError::InvalidField("target"),
+ KnowledgeValidationError::InvalidField("target"),
);
let mut attestation = contribution_attestation();
attestation.subject_refs[0].relays = Some(vec![invalid_relay()]);
assert_validation_error(
validate_contribution_attestation(&attestation),
- RadrootsKnowledgeValidationError::InvalidField("subject_refs"),
+ KnowledgeValidationError::InvalidField("subject_refs"),
);
}
#[test]
fn wiki_article_title_is_optional_but_not_blank() {
- let mut article = RadrootsWikiArticle {
+ let mut article = WikiArticle {
d_tag: "soil-health".to_string(),
title: None,
content_djot: "# Soil health".to_string(),
@@ -1469,7 +1430,7 @@ mod tests {
article.title = Some(" ".to_string());
assert_validation_error(
validate_wiki_article(&article),
- RadrootsKnowledgeValidationError::EmptyField("title"),
+ KnowledgeValidationError::EmptyField("title"),
);
}
@@ -1479,7 +1440,7 @@ mod tests {
claim.citation_spans.clear();
assert_validation_error(
validate_knowledge_claim(&claim),
- RadrootsKnowledgeValidationError::EmptyField("citation_spans"),
+ KnowledgeValidationError::EmptyField("citation_spans"),
);
claim.citation_spans.push(citation_span());
@@ -1498,14 +1459,14 @@ mod tests {
capitalized.citation_spans.clear();
assert_validation_error(
validate_knowledge_claim(&capitalized),
- RadrootsKnowledgeValidationError::EmptyField("citation_spans"),
+ KnowledgeValidationError::EmptyField("citation_spans"),
);
assert!(!is_uncited_knowledge_claim_type("Hypothesis"));
}
#[test]
fn knowledge_validators_reject_representative_invalid_models() {
- let mut article = RadrootsWikiArticle {
+ let mut article = WikiArticle {
d_tag: "soil-health".to_string(),
title: Some("Soil health".to_string()),
content_djot: " ".to_string(),
@@ -1517,29 +1478,29 @@ mod tests {
};
assert_validation_error(
validate_wiki_article(&article),
- RadrootsKnowledgeValidationError::EmptyField("content_djot"),
+ KnowledgeValidationError::EmptyField("content_djot"),
);
article.content_djot = "# Soil health".to_string();
- article.forked_from.push(RadrootsWikiArticleVersionRef {
+ article.forked_from.push(WikiArticleVersionRef {
event_id: "bad".to_string(),
address_ref: article_address_ref(),
});
assert_validation_error(
validate_wiki_article(&article),
- RadrootsKnowledgeValidationError::InvalidField("forked_from"),
+ KnowledgeValidationError::InvalidField("forked_from"),
);
- let mut redirect = RadrootsWikiRedirect {
+ let mut redirect = WikiRedirect {
d_tag: "soil".to_string(),
target: article_address_ref(),
};
redirect.target.kind = 30023;
assert_validation_error(
validate_wiki_redirect(&redirect),
- RadrootsKnowledgeValidationError::InvalidField("wiki_redirect.target"),
+ KnowledgeValidationError::InvalidField("wiki_redirect.target"),
);
- let mut merge = RadrootsWikiMergeRequest {
+ let mut merge = WikiMergeRequest {
target_article: article_address_ref(),
destination_pubkey: "bad".to_string(),
base_version_event_id: None,
@@ -1548,76 +1509,75 @@ mod tests {
};
assert_validation_error(
validate_wiki_merge_request(&merge),
- RadrootsKnowledgeValidationError::InvalidField("destination_pubkey"),
+ KnowledgeValidationError::InvalidField("destination_pubkey"),
);
merge.destination_pubkey = hex_64('a');
merge.source_version_event_id = String::new();
assert_validation_error(
validate_wiki_merge_request(&merge),
- RadrootsKnowledgeValidationError::EmptyField("source_version_event_id"),
+ KnowledgeValidationError::EmptyField("source_version_event_id"),
);
let mut source = knowledge_source();
source.authors.push(" ".to_string());
assert_validation_error(
validate_knowledge_source(&source),
- RadrootsKnowledgeValidationError::EmptyField("authors"),
+ KnowledgeValidationError::EmptyField("authors"),
);
let mut claim = knowledge_claim();
claim.citation_spans[0].quote_hash = Some("bad".to_string());
assert_validation_error(
validate_knowledge_claim(&claim),
- RadrootsKnowledgeValidationError::InvalidField("citation_spans"),
+ KnowledgeValidationError::InvalidField("citation_spans"),
);
let mut relation = knowledge_relation();
relation.subject.external_id = Some("external".to_string());
assert_validation_error(
validate_knowledge_relation(&relation),
- RadrootsKnowledgeValidationError::InvalidField("subject"),
+ KnowledgeValidationError::InvalidField("subject"),
);
let mut review = knowledge_review();
review.target.kind = 0;
assert_validation_error(
validate_knowledge_review(&review),
- RadrootsKnowledgeValidationError::InvalidField("review_target"),
+ KnowledgeValidationError::InvalidField("review_target"),
);
let mut report = field_report();
- report.context.location_precision =
- RadrootsKnowledgeLocationPrecision::ExactPrivateReference;
+ report.context.location_precision = KnowledgeLocationPrecision::ExactPrivateReference;
assert_validation_error(
validate_knowledge_field_report(&report),
- RadrootsKnowledgeValidationError::EmptyField("private_location_ref"),
+ KnowledgeValidationError::EmptyField("private_location_ref"),
);
- report.context.location_precision = RadrootsKnowledgeLocationPrecision::CoarseGeohash;
+ report.context.location_precision = KnowledgeLocationPrecision::CoarseGeohash;
report.observations[0].values[0].value = String::new();
assert_validation_error(
validate_knowledge_field_report(&report),
- RadrootsKnowledgeValidationError::EmptyField("observation_values"),
+ KnowledgeValidationError::EmptyField("observation_values"),
);
let mut bounty = evidence_bounty();
bounty.target_refs.clear();
assert_validation_error(
validate_evidence_bounty(&bounty),
- RadrootsKnowledgeValidationError::EmptyField("target_refs"),
+ KnowledgeValidationError::EmptyField("target_refs"),
);
let mut proposal = knowledge_change_proposal();
proposal.summary = " ".to_string();
assert_validation_error(
validate_knowledge_change_proposal(&proposal),
- RadrootsKnowledgeValidationError::EmptyField("summary"),
+ KnowledgeValidationError::EmptyField("summary"),
);
let mut attestation = contribution_attestation();
attestation.contributor_pubkey = "bad".to_string();
assert_validation_error(
validate_contribution_attestation(&attestation),
- RadrootsKnowledgeValidationError::InvalidField("contributor_pubkey"),
+ KnowledgeValidationError::InvalidField("contributor_pubkey"),
);
}
}
diff --git a/crates/event/src/lib.rs b/crates/event/src/lib.rs
@@ -60,9 +60,7 @@ pub mod trade;
mod verification;
pub mod wire;
-pub use draft::{RadrootsEventDraft as EventDraft, RadrootsSignedEvent as SignedEvent};
-pub use envelope::{
- RadrootsEventEnvelope as Event, RadrootsEventKind as EventKind, RadrootsEventTag as EventTag,
-};
+pub use draft::{EventDraft, SignedEvent};
+pub use envelope::{EventEnvelope as Event, EventKind, EventTag};
pub use id::EventId;
pub use verification::{Error, SignatureVerifiedEvent as VerifiedEvent};
diff --git a/crates/event/src/list.rs b/crates/event/src/list.rs
@@ -8,9 +8,9 @@ use alloc::{string::String, vec::Vec};
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsList {
+pub struct List {
pub content: String,
- pub entries: Vec<RadrootsListEntry>,
+ pub entries: Vec<ListEntry>,
}
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
@@ -20,7 +20,7 @@ pub struct RadrootsList {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsListEntry {
+pub struct ListEntry {
pub tag: String,
pub values: Vec<String>,
}
@@ -32,14 +32,14 @@ mod tests {
#[test]
fn generic_list_model_covers_nip65_relay_entries() {
- let list = RadrootsList {
+ let list = List {
content: String::new(),
entries: vec![
- RadrootsListEntry {
+ ListEntry {
tag: "r".to_string(),
values: vec!["wss://read.example".to_string(), "read".to_string()],
},
- RadrootsListEntry {
+ ListEntry {
tag: "r".to_string(),
values: vec!["wss://write.example".to_string(), "write".to_string()],
},
diff --git a/crates/event/src/list_set.rs b/crates/event/src/list_set.rs
@@ -1,4 +1,4 @@
-use crate::social::list::RadrootsListEntry;
+use crate::social::list::ListEntry;
#[cfg(not(feature = "std"))]
use alloc::{string::String, vec::Vec};
@@ -10,10 +10,10 @@ use alloc::{string::String, vec::Vec};
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsListSet {
+pub struct ListSet {
pub d_tag: String,
pub content: String,
- pub entries: Vec<RadrootsListEntry>,
+ pub entries: Vec<ListEntry>,
pub title: Option<String>,
pub description: Option<String>,
pub image: Option<String>,
diff --git a/crates/event/src/media.rs b/crates/event/src/media.rs
@@ -8,11 +8,11 @@ use radroots_blossom::ByteVerifiedDescriptor;
/// Errors raised while constructing strict authored image media.
#[non_exhaustive]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsAuthoredImageError {
+pub enum AuthoredImageError {
MediaTypeNotImage,
}
-impl RadrootsAuthoredImageError {
+impl AuthoredImageError {
pub const fn code(&self) -> &'static str {
match self {
Self::MediaTypeNotImage => "media_type_not_image",
@@ -20,7 +20,7 @@ impl RadrootsAuthoredImageError {
}
}
-impl fmt::Display for RadrootsAuthoredImageError {
+impl fmt::Display for AuthoredImageError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::MediaTypeNotImage => {
@@ -31,7 +31,7 @@ impl fmt::Display for RadrootsAuthoredImageError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsAuthoredImageError {}
+impl std::error::Error for AuthoredImageError {}
/// A byte-verified Blossom descriptor whose declared media type is `image/*`.
///
@@ -39,14 +39,14 @@ impl std::error::Error for RadrootsAuthoredImageError {}
/// This typestate does not prove upload completion, network availability, or
/// image format safety. Owning runtimes remain responsible for those policies.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsAuthoredImage(ByteVerifiedDescriptor);
+pub struct AuthoredImage(ByteVerifiedDescriptor);
-impl RadrootsAuthoredImage {
+impl AuthoredImage {
pub fn try_from_verified_descriptor(
descriptor: ByteVerifiedDescriptor,
- ) -> Result<Self, RadrootsAuthoredImageError> {
+ ) -> Result<Self, AuthoredImageError> {
if !descriptor.media_type().as_str().starts_with("image/") {
- return Err(RadrootsAuthoredImageError::MediaTypeNotImage);
+ return Err(AuthoredImageError::MediaTypeNotImage);
}
Ok(Self(descriptor))
}
@@ -56,8 +56,8 @@ impl RadrootsAuthoredImage {
}
}
-impl TryFrom<ByteVerifiedDescriptor> for RadrootsAuthoredImage {
- type Error = RadrootsAuthoredImageError;
+impl TryFrom<ByteVerifiedDescriptor> for AuthoredImage {
+ type Error = AuthoredImageError;
fn try_from(value: ByteVerifiedDescriptor) -> Result<Self, Self::Error> {
Self::try_from_verified_descriptor(value)
@@ -73,20 +73,18 @@ mod tests {
fn authored_image_requires_a_byte_verified_image_descriptor() {
let descriptor = verified_descriptor("image/webp", "webp");
let expected_url = descriptor.url().as_str().to_owned();
- let image = RadrootsAuthoredImage::try_from(descriptor).unwrap();
+ let image = AuthoredImage::try_from(descriptor).unwrap();
assert_eq!(image.descriptor().url().as_str(), expected_url);
}
#[test]
fn authored_image_rejects_non_image_media_types_with_a_stable_error() {
- let error = RadrootsAuthoredImage::try_from_verified_descriptor(verified_descriptor(
- "text/plain",
- "txt",
- ))
- .unwrap_err();
+ let error =
+ AuthoredImage::try_from_verified_descriptor(verified_descriptor("text/plain", "txt"))
+ .unwrap_err();
- assert_eq!(error, RadrootsAuthoredImageError::MediaTypeNotImage);
+ assert_eq!(error, AuthoredImageError::MediaTypeNotImage);
assert_eq!(error.code(), "media_type_not_image");
assert_eq!(
error.to_string(),
diff --git a/crates/event/src/message.rs b/crates/event/src/message.rs
@@ -1,6 +1,6 @@
#![forbid(unsafe_code)]
-use crate::tag::RadrootsEventPtr;
+use crate::tag::EventPtr;
#[cfg(not(feature = "std"))]
use alloc::{string::String, vec::Vec};
@@ -12,10 +12,10 @@ use alloc::{string::String, vec::Vec};
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsMessage {
- pub recipients: Vec<RadrootsMessageRecipient>,
+pub struct Message {
+ pub recipients: Vec<MessageRecipient>,
pub content: String,
- pub reply_to: Option<RadrootsEventPtr>,
+ pub reply_to: Option<EventPtr>,
pub subject: Option<String>,
}
@@ -26,7 +26,7 @@ pub struct RadrootsMessage {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsMessageRecipient {
+pub struct MessageRecipient {
pub public_key: String,
pub relay_url: Option<String>,
}
diff --git a/crates/event/src/message_file.rs b/crates/event/src/message_file.rs
@@ -1,7 +1,7 @@
#![forbid(unsafe_code)]
-use crate::social::message::RadrootsMessageRecipient;
-use crate::tag::RadrootsEventPtr;
+use crate::social::message::MessageRecipient;
+use crate::tag::EventPtr;
#[cfg(not(feature = "std"))]
use alloc::{string::String, vec::Vec};
@@ -13,10 +13,10 @@ use alloc::{string::String, vec::Vec};
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsMessageFile {
- pub recipients: Vec<RadrootsMessageRecipient>,
+pub struct MessageFile {
+ pub recipients: Vec<MessageRecipient>,
pub file_url: String,
- pub reply_to: Option<RadrootsEventPtr>,
+ pub reply_to: Option<EventPtr>,
pub subject: Option<String>,
pub file_type: String,
pub encryption_algorithm: String,
@@ -26,7 +26,7 @@ pub struct RadrootsMessageFile {
pub original_hash: Option<String>,
#[cfg_attr(all(test, feature = "std"), dto(int = "json_string"))]
pub size: Option<u64>,
- pub dimensions: Option<RadrootsMessageFileDimensions>,
+ pub dimensions: Option<MessageFileDimensions>,
pub blurhash: Option<String>,
pub thumb: Option<String>,
pub fallbacks: Vec<String>,
@@ -39,7 +39,7 @@ pub struct RadrootsMessageFile {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub struct RadrootsMessageFileDimensions {
+pub struct MessageFileDimensions {
pub w: u32,
pub h: u32,
}
diff --git a/crates/event/src/operational_listing.rs b/crates/event/src/operational_listing.rs
@@ -1,10 +1,10 @@
use radroots_core::pricing::Discount;
use radroots_core::{Decimal, Money, Quantity, QuantityPrice, Unit};
-use crate::farm::RadrootsFarmRef;
-use crate::farm::plot::RadrootsPlotRef;
-use crate::farm::resource_area::RadrootsResourceAreaRef;
-use crate::id::{RadrootsDTag, RadrootsInventoryBinId};
+use crate::farm::FarmRef;
+use crate::farm::plot::PlotRef;
+use crate::farm::resource_area::ResourceAreaRef;
+use crate::id::{DTag, InventoryBinId};
#[cfg(not(feature = "std"))]
use alloc::{string::String, vec::Vec};
@@ -16,7 +16,7 @@ use alloc::{string::String, vec::Vec};
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsOperationalListingParseError {
+pub enum OperationalListingParseError {
InvalidKind(u32),
MissingTag(String),
InvalidTag(String),
@@ -27,7 +27,7 @@ pub enum RadrootsOperationalListingParseError {
InvalidDiscount(String),
}
-impl core::fmt::Display for RadrootsOperationalListingParseError {
+impl core::fmt::Display for OperationalListingParseError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::InvalidKind(kind) => write!(f, "invalid operational listing kind: {kind}"),
@@ -43,7 +43,7 @@ impl core::fmt::Display for RadrootsOperationalListingParseError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsOperationalListingParseError {}
+impl std::error::Error for OperationalListingParseError {}
#[cfg_attr(
any(feature = "serde", test),
@@ -56,7 +56,7 @@ impl std::error::Error for RadrootsOperationalListingParseError {}
serde(rename_all = "snake_case", tag = "kind", content = "amount")
)]
#[derive(Clone, Debug)]
-pub enum RadrootsOperationalListingAvailability {
+pub enum OperationalListingAvailability {
Window {
#[cfg_attr(all(test, feature = "std"), dto(int = "json_string"))]
start: Option<u64>,
@@ -64,7 +64,7 @@ pub enum RadrootsOperationalListingAvailability {
end: Option<u64>,
},
Status {
- status: RadrootsOperationalListingStatus,
+ status: OperationalListingStatus,
},
}
@@ -79,7 +79,7 @@ pub enum RadrootsOperationalListingAvailability {
serde(rename_all = "snake_case", tag = "kind", content = "amount")
)]
#[derive(Clone, Debug)]
-pub enum RadrootsOperationalListingStatus {
+pub enum OperationalListingStatus {
Active,
Sold,
Other { value: String },
@@ -96,7 +96,7 @@ pub enum RadrootsOperationalListingStatus {
serde(rename_all = "snake_case", tag = "kind", content = "amount")
)]
#[derive(Clone, Debug)]
-pub enum RadrootsOperationalListingDeliveryMethod {
+pub enum OperationalListingDeliveryMethod {
Pickup,
LocalDelivery,
Shipping,
@@ -110,8 +110,8 @@ pub enum RadrootsOperationalListingDeliveryMethod {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug)]
-pub struct RadrootsOperationalListing {
- pub d_tag: RadrootsDTag,
+pub struct OperationalListing {
+ pub d_tag: DTag,
#[cfg_attr(all(test, feature = "std"), dto(int = "json_string"))]
#[cfg_attr(
feature = "serde",
@@ -119,20 +119,20 @@ pub struct RadrootsOperationalListing {
)]
pub published_at: Option<u64>,
#[cfg_attr(any(feature = "serde", test), serde(default))]
- pub farm: RadrootsFarmRef,
- pub product: RadrootsOperationalListingProduct,
- pub primary_bin_id: RadrootsInventoryBinId,
- pub bins: Vec<RadrootsOperationalListingBin>,
- pub resource_area: Option<RadrootsResourceAreaRef>,
- pub plot: Option<RadrootsPlotRef>,
+ pub farm: FarmRef,
+ pub product: OperationalListingProduct,
+ pub primary_bin_id: InventoryBinId,
+ pub bins: Vec<OperationalListingBin>,
+ pub resource_area: Option<ResourceAreaRef>,
+ pub plot: Option<PlotRef>,
#[cfg_attr(all(test, feature = "std"), dto(ts(type = "Array<Discount>")))]
pub discounts: Option<Vec<Discount>>,
#[cfg_attr(all(test, feature = "std"), dto(ts(type = "Decimal")))]
pub inventory_available: Option<Decimal>,
- pub availability: Option<RadrootsOperationalListingAvailability>,
- pub delivery_method: Option<RadrootsOperationalListingDeliveryMethod>,
- pub location: Option<RadrootsOperationalListingPublicLocation>,
- pub images: Option<Vec<RadrootsOperationalListingImage>>,
+ pub availability: Option<OperationalListingAvailability>,
+ pub delivery_method: Option<OperationalListingDeliveryMethod>,
+ pub location: Option<OperationalListingPublicLocation>,
+ pub images: Option<Vec<OperationalListingImage>>,
}
#[cfg_attr(
@@ -142,7 +142,7 @@ pub struct RadrootsOperationalListing {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug)]
-pub struct RadrootsOperationalListingProduct {
+pub struct OperationalListingProduct {
pub key: String,
pub title: String,
pub category: String,
@@ -158,7 +158,7 @@ pub const RADROOTS_OPERATIONAL_LISTING_PRODUCT_TAG_KEYS: [&str; 9] = [
"key", "title", "category", "summary", "process", "lot", "location", "profile", "year",
];
-pub struct RadrootsOperationalListingProductTagKeys;
+pub struct OperationalListingProductTagKeys;
#[cfg_attr(
any(feature = "serde", test),
@@ -167,8 +167,8 @@ pub struct RadrootsOperationalListingProductTagKeys;
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug)]
-pub struct RadrootsOperationalListingBin {
- pub bin_id: RadrootsInventoryBinId,
+pub struct OperationalListingBin {
+ pub bin_id: InventoryBinId,
#[cfg_attr(all(test, feature = "std"), dto(ts(type = "Quantity")))]
pub quantity: Quantity,
#[cfg_attr(all(test, feature = "std"), dto(ts(type = "QuantityPrice")))]
@@ -191,7 +191,7 @@ pub struct RadrootsOperationalListingBin {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsOperationalListingPublicLocation {
+pub struct OperationalListingPublicLocation {
pub primary: String,
pub city: Option<String>,
pub region: Option<String>,
@@ -206,9 +206,9 @@ pub struct RadrootsOperationalListingPublicLocation {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug)]
-pub struct RadrootsOperationalListingImage {
+pub struct OperationalListingImage {
pub url: String,
- pub size: Option<RadrootsOperationalListingImageSize>,
+ pub size: Option<OperationalListingImageSize>,
}
#[cfg_attr(
@@ -217,18 +217,18 @@ pub struct RadrootsOperationalListingImage {
)]
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[derive(Clone, Debug)]
-pub struct RadrootsOperationalListingImageSize {
+pub struct OperationalListingImageSize {
pub w: u32,
pub h: u32,
}
#[cfg(all(test, feature = "std"))]
mod tests {
- use crate::farm::RadrootsFarmRef;
+ use crate::farm::FarmRef;
#[test]
fn defaults_listing_farm_ref_to_empty_values() {
- let farm_ref = RadrootsFarmRef::default();
+ let farm_ref = FarmRef::default();
assert!(farm_ref.pubkey.is_empty());
assert!(farm_ref.d_tag.is_empty());
}
@@ -237,11 +237,11 @@ mod tests {
fn listing_model_covers_published_metadata() {
use crate::envelope::kind::{KIND_CLASSIFIED_LISTING, is_classified_listing_kind};
- let listing = super::RadrootsOperationalListing {
+ let listing = super::OperationalListing {
d_tag: "listing-draft".parse().unwrap(),
published_at: Some(1_700_000_000),
- farm: RadrootsFarmRef::default(),
- product: super::RadrootsOperationalListingProduct {
+ farm: FarmRef::default(),
+ product: super::OperationalListingProduct {
key: "lettuce".to_string(),
title: "lettuce".to_string(),
category: "produce".to_string(),
@@ -271,14 +271,14 @@ mod tests {
#[test]
#[cfg(feature = "serde")]
fn listing_deserializes_missing_farm_to_default_ref() {
- let listing = super::RadrootsOperationalListing {
+ let listing = super::OperationalListing {
d_tag: "listing-draft".parse().unwrap(),
published_at: Some(1_700_000_000),
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: "farm-pubkey".to_string(),
d_tag: "farm-d-tag".to_string(),
},
- product: super::RadrootsOperationalListingProduct {
+ product: super::OperationalListingProduct {
key: "lettuce".to_string(),
title: "lettuce".to_string(),
category: "produce".to_string(),
@@ -303,7 +303,7 @@ mod tests {
let mut json = serde_json::to_value(&listing).unwrap();
json.as_object_mut().unwrap().remove("farm");
- let parsed: super::RadrootsOperationalListing = serde_json::from_value(json).unwrap();
+ let parsed: super::OperationalListing = serde_json::from_value(json).unwrap();
assert!(parsed.farm.pubkey.is_empty());
assert!(parsed.farm.d_tag.is_empty());
diff --git a/crates/event/src/order.rs b/crates/event/src/order.rs
@@ -8,20 +8,20 @@ use alloc::{
use crate::envelope::kind::*;
#[cfg(test)]
-use crate::id::RadrootsOrderQuoteId;
-use crate::id::{RadrootsClassifiedListingAddress, RadrootsInventoryBinId, RadrootsOrderId};
+use crate::id::OrderQuoteId;
+use crate::id::{ClassifiedListingAddress, InventoryBinId, OrderId};
#[cfg(test)]
-use crate::listing::operational::RadrootsOperationalListingParseError;
+use crate::listing::operational::OperationalListingParseError;
pub use crate::trade::order_economics::*;
#[cfg(test)]
-use crate::trade::validation::RadrootsOperationalListingValidationError;
+use crate::trade::validation::OperationalListingValidationError;
use radroots_core::{Currency, Decimal, Money};
use radroots_identity::PublicKey;
pub const RADROOTS_COMMERCIAL_LISTING_DOMAIN: &str = "trade:listing";
pub const RADROOTS_ORDER_ENVELOPE_VERSION: u16 = 1;
-impl RadrootsOrderEconomics {
+impl OrderEconomics {
pub fn canonicalize(&mut self) {
self.items
.sort_by(|left, right| left.bin_id.cmp(&right.bin_id));
@@ -42,9 +42,9 @@ impl RadrootsOrderEconomics {
economics
}
- pub fn derived_totals(&self) -> Result<RadrootsOrderEconomicTotals, RadrootsOrderPayloadError> {
+ pub fn derived_totals(&self) -> Result<OrderEconomicTotals, OrderPayloadError> {
if self.items.is_empty() {
- return Err(RadrootsOrderPayloadError::MissingEconomicItems);
+ return Err(OrderPayloadError::MissingEconomicItems);
}
let mut subtotal = Money::zero(self.currency);
@@ -56,14 +56,14 @@ impl RadrootsOrderEconomics {
let mut discount_total = Money::zero(self.currency);
for (index, line) in self.discounts.iter().enumerate() {
validate_economic_line(line, self.currency, "discounts", index)?;
- if line.kind != RadrootsOrderEconomicLineKind::ListingDiscount {
- return Err(RadrootsOrderPayloadError::InvalidEconomicLineKind {
+ if line.kind != OrderEconomicLineKind::ListingDiscount {
+ return Err(OrderPayloadError::InvalidEconomicLineKind {
field: "discounts",
index,
});
}
- if line.effect != RadrootsOrderEconomicEffect::Decrease {
- return Err(RadrootsOrderPayloadError::InvalidEconomicLineEffect {
+ if line.effect != OrderEconomicEffect::Decrease {
+ return Err(OrderPayloadError::InvalidEconomicLineEffect {
field: "discounts",
index,
});
@@ -75,8 +75,8 @@ impl RadrootsOrderEconomics {
let mut total = checked_money_sub_non_negative(&subtotal, &discount_total, "total")?;
for (index, line) in self.adjustments.iter().enumerate() {
validate_economic_line(line, self.currency, "adjustments", index)?;
- if line.kind == RadrootsOrderEconomicLineKind::ListingDiscount {
- return Err(RadrootsOrderPayloadError::InvalidEconomicLineKind {
+ if line.kind == OrderEconomicLineKind::ListingDiscount {
+ return Err(OrderPayloadError::InvalidEconomicLineKind {
field: "adjustments",
index,
});
@@ -84,16 +84,14 @@ impl RadrootsOrderEconomics {
adjustment_total =
checked_money_add(&adjustment_total, &line.amount, "adjustment_total")?;
total = match line.effect {
- RadrootsOrderEconomicEffect::Increase => {
- checked_money_add(&total, &line.amount, "total")?
- }
- RadrootsOrderEconomicEffect::Decrease => {
+ OrderEconomicEffect::Increase => checked_money_add(&total, &line.amount, "total")?,
+ OrderEconomicEffect::Decrease => {
checked_money_sub_non_negative(&total, &line.amount, "total")?
}
};
}
- Ok(RadrootsOrderEconomicTotals {
+ Ok(OrderEconomicTotals {
subtotal,
discount_total,
adjustment_total,
@@ -101,10 +99,10 @@ impl RadrootsOrderEconomics {
})
}
- pub fn validate(&self) -> Result<(), RadrootsOrderPayloadError> {
+ pub fn validate(&self) -> Result<(), OrderPayloadError> {
validate_required_field(self.quote_id.as_str(), "quote_id")?;
if self.quote_version == 0 {
- return Err(RadrootsOrderPayloadError::InvalidQuoteVersion);
+ return Err(OrderPayloadError::InvalidQuoteVersion);
}
let totals = self.derived_totals()?;
@@ -132,25 +130,25 @@ impl RadrootsOrderEconomics {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
-#[cfg_attr(all(test, feature = "std"), dto(ts(name = "RadrootsOrderRequest")))]
+#[cfg_attr(all(test, feature = "std"), dto(ts(name = "OrderRequest")))]
#[cfg_attr(
any(feature = "serde", test),
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsOrderRequest {
- pub order_id: RadrootsOrderId,
- pub listing_addr: RadrootsClassifiedListingAddress,
+pub struct OrderRequest {
+ pub order_id: OrderId,
+ pub listing_addr: ClassifiedListingAddress,
#[cfg_attr(all(test, feature = "std"), dto(as = "string"))]
pub buyer_pubkey: PublicKey,
#[cfg_attr(all(test, feature = "std"), dto(as = "string"))]
pub seller_pubkey: PublicKey,
- pub items: Vec<RadrootsOrderItem>,
- pub economics: RadrootsOrderEconomics,
+ pub items: Vec<OrderItem>,
+ pub economics: OrderEconomics,
}
-impl RadrootsOrderRequest {
- pub fn validate(&self) -> Result<(), RadrootsOrderPayloadError> {
+impl OrderRequest {
+ pub fn validate(&self) -> Result<(), OrderPayloadError> {
validate_required_field(self.order_id.as_str(), "order_id")?;
validate_required_field(self.listing_addr.as_str(), "listing_addr")?;
validate_order_items(&self.items)?;
@@ -161,26 +159,20 @@ impl RadrootsOrderRequest {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
-#[cfg_attr(
- all(test, feature = "std"),
- dto(ts(name = "RadrootsOrderInventoryCommitment"))
-)]
+#[cfg_attr(all(test, feature = "std"), dto(ts(name = "OrderInventoryCommitment")))]
#[cfg_attr(
any(feature = "serde", test),
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsOrderInventoryCommitment {
- pub bin_id: RadrootsInventoryBinId,
+pub struct OrderInventoryCommitment {
+ pub bin_id: InventoryBinId,
pub bin_count: u32,
}
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
-#[cfg_attr(
- all(test, feature = "std"),
- dto(ts(name = "RadrootsOrderDecisionOutcome"))
-)]
+#[cfg_attr(all(test, feature = "std"), dto(ts(name = "OrderDecisionOutcome")))]
#[cfg_attr(
any(feature = "serde", test),
derive(serde::Serialize, serde::Deserialize)
@@ -190,17 +182,17 @@ pub struct RadrootsOrderInventoryCommitment {
serde(rename_all = "snake_case", tag = "decision")
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsOrderDecisionOutcome {
+pub enum OrderDecisionOutcome {
#[cfg_attr(any(feature = "serde", test), serde(rename = "accepted"))]
Accepted {
- inventory_commitments: Vec<RadrootsOrderInventoryCommitment>,
+ inventory_commitments: Vec<OrderInventoryCommitment>,
},
#[cfg_attr(any(feature = "serde", test), serde(rename = "declined"))]
Declined { reason: String },
}
-impl RadrootsOrderDecisionOutcome {
- pub fn validate(&self) -> Result<(), RadrootsOrderPayloadError> {
+impl OrderDecisionOutcome {
+ pub fn validate(&self) -> Result<(), OrderPayloadError> {
match self {
Self::Accepted {
inventory_commitments,
@@ -212,24 +204,24 @@ impl RadrootsOrderDecisionOutcome {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
-#[cfg_attr(all(test, feature = "std"), dto(ts(name = "RadrootsOrderDecision")))]
+#[cfg_attr(all(test, feature = "std"), dto(ts(name = "OrderDecision")))]
#[cfg_attr(
any(feature = "serde", test),
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsOrderDecision {
- pub order_id: RadrootsOrderId,
- pub listing_addr: RadrootsClassifiedListingAddress,
+pub struct OrderDecision {
+ pub order_id: OrderId,
+ pub listing_addr: ClassifiedListingAddress,
#[cfg_attr(all(test, feature = "std"), dto(as = "string"))]
pub buyer_pubkey: PublicKey,
#[cfg_attr(all(test, feature = "std"), dto(as = "string"))]
pub seller_pubkey: PublicKey,
- pub decision: RadrootsOrderDecisionOutcome,
+ pub decision: OrderDecisionOutcome,
}
-impl RadrootsOrderDecision {
- pub fn validate(&self) -> Result<(), RadrootsOrderPayloadError> {
+impl OrderDecision {
+ pub fn validate(&self) -> Result<(), OrderPayloadError> {
validate_required_field(self.order_id.as_str(), "order_id")?;
validate_required_field(self.listing_addr.as_str(), "listing_addr")?;
self.decision.validate()
@@ -238,18 +230,15 @@ impl RadrootsOrderDecision {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
-#[cfg_attr(
- all(test, feature = "std"),
- dto(ts(name = "RadrootsOrderCancellation"))
-)]
+#[cfg_attr(all(test, feature = "std"), dto(ts(name = "OrderCancellation")))]
#[cfg_attr(
any(feature = "serde", test),
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsOrderCancellation {
- pub order_id: RadrootsOrderId,
- pub listing_addr: RadrootsClassifiedListingAddress,
+pub struct OrderCancellation {
+ pub order_id: OrderId,
+ pub listing_addr: ClassifiedListingAddress,
#[cfg_attr(all(test, feature = "std"), dto(as = "string"))]
pub buyer_pubkey: PublicKey,
#[cfg_attr(all(test, feature = "std"), dto(as = "string"))]
@@ -257,8 +246,8 @@ pub struct RadrootsOrderCancellation {
pub reason: String,
}
-impl RadrootsOrderCancellation {
- pub fn validate(&self) -> Result<(), RadrootsOrderPayloadError> {
+impl OrderCancellation {
+ pub fn validate(&self) -> Result<(), OrderPayloadError> {
validate_required_field(self.order_id.as_str(), "order_id")?;
validate_required_field(self.listing_addr.as_str(), "listing_addr")?;
validate_required_field(&self.reason, "reason")
@@ -267,27 +256,27 @@ impl RadrootsOrderCancellation {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
-#[cfg_attr(all(test, feature = "std"), dto(ts(name = "RadrootsCommercialDomain")))]
+#[cfg_attr(all(test, feature = "std"), dto(ts(name = "CommercialDomain")))]
#[cfg_attr(
any(feature = "serde", test),
derive(serde::Serialize, serde::Deserialize)
)]
#[cfg_attr(any(feature = "serde", test), serde(rename_all = "snake_case"))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsCommercialDomain {
+pub enum CommercialDomain {
#[cfg_attr(any(feature = "serde", test), serde(rename = "trade:listing"))]
Listing,
}
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
-#[cfg_attr(all(test, feature = "std"), dto(ts(name = "RadrootsOrderEventType")))]
+#[cfg_attr(all(test, feature = "std"), dto(ts(name = "OrderEventType")))]
#[cfg_attr(
any(feature = "serde", test),
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsOrderEventType {
+pub enum OrderEventType {
#[cfg_attr(any(feature = "serde", test), serde(rename = "TradeOrderRequested"))]
OrderRequested,
#[cfg_attr(any(feature = "serde", test), serde(rename = "TradeOrderDecision"))]
@@ -296,7 +285,7 @@ pub enum RadrootsOrderEventType {
OrderCancelled,
}
-impl RadrootsOrderEventType {
+impl OrderEventType {
#[inline]
pub const fn from_kind(kind: u32) -> Option<Self> {
match kind {
@@ -341,27 +330,27 @@ impl RadrootsOrderEventType {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsOrderEnvelope<T> {
+pub struct OrderEnvelope<T> {
pub version: u16,
- pub domain: RadrootsCommercialDomain,
+ pub domain: CommercialDomain,
#[cfg_attr(any(feature = "serde", test), serde(rename = "type"))]
- pub message_type: RadrootsOrderEventType,
+ pub message_type: OrderEventType,
pub order_id: String,
pub listing_addr: String,
pub payload: T,
}
-impl<T> RadrootsOrderEnvelope<T> {
+impl<T> OrderEnvelope<T> {
#[inline]
pub fn new(
- message_type: RadrootsOrderEventType,
+ message_type: OrderEventType,
listing_addr: impl Into<String>,
order_id: impl Into<String>,
payload: T,
) -> Self {
Self {
version: RADROOTS_ORDER_ENVELOPE_VERSION,
- domain: RadrootsCommercialDomain::Listing,
+ domain: CommercialDomain::Listing,
message_type,
order_id: order_id.into(),
listing_addr: listing_addr.into(),
@@ -369,31 +358,31 @@ impl<T> RadrootsOrderEnvelope<T> {
}
}
- pub fn validate(&self) -> Result<(), RadrootsOrderEnvelopeError> {
+ pub fn validate(&self) -> Result<(), OrderEnvelopeError> {
if self.version != RADROOTS_ORDER_ENVELOPE_VERSION {
- return Err(RadrootsOrderEnvelopeError::InvalidVersion {
+ return Err(OrderEnvelopeError::InvalidVersion {
expected: RADROOTS_ORDER_ENVELOPE_VERSION,
got: self.version,
});
}
if self.order_id.trim().is_empty() {
- return Err(RadrootsOrderEnvelopeError::MissingOrderId);
+ return Err(OrderEnvelopeError::MissingOrderId);
}
if self.listing_addr.trim().is_empty() {
- return Err(RadrootsOrderEnvelopeError::MissingListingAddr);
+ return Err(OrderEnvelopeError::MissingListingAddr);
}
Ok(())
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
-pub enum RadrootsOrderEnvelopeError {
+pub enum OrderEnvelopeError {
InvalidVersion { expected: u16, got: u16 },
MissingOrderId,
MissingListingAddr,
}
-impl core::fmt::Display for RadrootsOrderEnvelopeError {
+impl core::fmt::Display for OrderEnvelopeError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::InvalidVersion { expected, got } => {
@@ -409,10 +398,10 @@ impl core::fmt::Display for RadrootsOrderEnvelopeError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsOrderEnvelopeError {}
+impl std::error::Error for OrderEnvelopeError {}
#[derive(Debug, Clone, PartialEq, Eq)]
-pub enum RadrootsOrderPayloadError {
+pub enum OrderPayloadError {
EmptyField(&'static str),
MissingItems,
InvalidItemBinCount { index: usize },
@@ -433,7 +422,7 @@ pub enum RadrootsOrderPayloadError {
InvalidInventoryCommitmentCount { index: usize },
}
-impl core::fmt::Display for RadrootsOrderPayloadError {
+impl core::fmt::Display for OrderPayloadError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::EmptyField(field) => write!(f, "{field} cannot be empty"),
@@ -501,49 +490,46 @@ impl core::fmt::Display for RadrootsOrderPayloadError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsOrderPayloadError {}
+impl std::error::Error for OrderPayloadError {}
-fn validate_required_field(
- value: &str,
- field: &'static str,
-) -> Result<(), RadrootsOrderPayloadError> {
+fn validate_required_field(value: &str, field: &'static str) -> Result<(), OrderPayloadError> {
if value.trim().is_empty() {
- Err(RadrootsOrderPayloadError::EmptyField(field))
+ Err(OrderPayloadError::EmptyField(field))
} else {
Ok(())
}
}
-fn validate_order_items(items: &[RadrootsOrderItem]) -> Result<(), RadrootsOrderPayloadError> {
+fn validate_order_items(items: &[OrderItem]) -> Result<(), OrderPayloadError> {
if items.is_empty() {
- return Err(RadrootsOrderPayloadError::MissingItems);
+ return Err(OrderPayloadError::MissingItems);
}
for (index, item) in items.iter().enumerate() {
validate_required_field(item.bin_id.as_str(), "bin_id")?;
if item.bin_count == 0 {
- return Err(RadrootsOrderPayloadError::InvalidItemBinCount { index });
+ return Err(OrderPayloadError::InvalidItemBinCount { index });
}
}
Ok(())
}
fn validate_economic_item(
- item: &RadrootsOrderEconomicItem,
+ item: &OrderEconomicItem,
expected_currency: Currency,
index: usize,
-) -> Result<Money, RadrootsOrderPayloadError> {
+) -> Result<Money, OrderPayloadError> {
validate_required_field(item.bin_id.as_str(), "economics.items.bin_id")?;
if item.bin_count == 0 {
- return Err(RadrootsOrderPayloadError::InvalidEconomicItemBinCount { index });
+ return Err(OrderPayloadError::InvalidEconomicItemBinCount { index });
}
if item.quantity_amount.is_zero() || item.quantity_amount.is_sign_negative() {
- return Err(RadrootsOrderPayloadError::InvalidEconomicItemQuantity { index });
+ return Err(OrderPayloadError::InvalidEconomicItemQuantity { index });
}
if item.unit_price_amount.is_sign_negative() {
- return Err(RadrootsOrderPayloadError::InvalidEconomicItemPrice { index });
+ return Err(OrderPayloadError::InvalidEconomicItemPrice { index });
}
if item.unit_price_currency != expected_currency {
- return Err(RadrootsOrderPayloadError::InvalidEconomicCurrency {
+ return Err(OrderPayloadError::InvalidEconomicCurrency {
field: "items.unit_price_currency",
});
}
@@ -554,35 +540,35 @@ fn validate_economic_item(
)?;
let quantity_total = checked_decimal_mul(item.quantity_amount, Decimal::from(item.bin_count))
- .ok_or(RadrootsOrderPayloadError::InvalidEconomicItemSubtotal { index })?;
+ .ok_or(OrderPayloadError::InvalidEconomicItemSubtotal { index })?;
let expected_subtotal = checked_decimal_mul(item.unit_price_amount, quantity_total)
- .ok_or(RadrootsOrderPayloadError::InvalidEconomicItemSubtotal { index })?;
+ .ok_or(OrderPayloadError::InvalidEconomicItemSubtotal { index })?;
if item.line_subtotal.amount() != expected_subtotal {
- return Err(RadrootsOrderPayloadError::InvalidEconomicItemSubtotal { index });
+ return Err(OrderPayloadError::InvalidEconomicItemSubtotal { index });
}
Ok(item.line_subtotal.clone())
}
fn validate_order_economics_binding(
- items: &[RadrootsOrderItem],
- economics: &RadrootsOrderEconomics,
-) -> Result<(), RadrootsOrderPayloadError> {
+ items: &[OrderItem],
+ economics: &OrderEconomics,
+) -> Result<(), OrderPayloadError> {
let order_items = normalized_order_item_counts(items).ok_or(
- RadrootsOrderPayloadError::InvalidOrderEconomicsBinding {
+ OrderPayloadError::InvalidOrderEconomicsBinding {
field: "items.bin_count",
},
)?;
if order_items.len() != economics.items.len() {
- return Err(RadrootsOrderPayloadError::InvalidOrderEconomicsBinding { field: "items" });
+ return Err(OrderPayloadError::InvalidOrderEconomicsBinding { field: "items" });
}
for (item, economic_item) in order_items.iter().zip(economics.items.iter()) {
if item.bin_id != economic_item.bin_id.as_str() {
- return Err(RadrootsOrderPayloadError::InvalidOrderEconomicsBinding {
+ return Err(OrderPayloadError::InvalidOrderEconomicsBinding {
field: "items.bin_id",
});
}
if item.bin_count != u64::from(economic_item.bin_count) {
- return Err(RadrootsOrderPayloadError::InvalidOrderEconomicsBinding {
+ return Err(OrderPayloadError::InvalidOrderEconomicsBinding {
field: "items.bin_count",
});
}
@@ -596,9 +582,7 @@ struct NormalizedOrderItemCount {
bin_count: u64,
}
-fn normalized_order_item_counts(
- items: &[RadrootsOrderItem],
-) -> Option<Vec<NormalizedOrderItemCount>> {
+fn normalized_order_item_counts(items: &[OrderItem]) -> Option<Vec<NormalizedOrderItemCount>> {
let mut counts: Vec<NormalizedOrderItemCount> = Vec::new();
for item in items {
let bin_id = item.bin_id.as_str();
@@ -619,28 +603,26 @@ fn normalized_order_item_counts(
}
fn validate_economic_line(
- line: &RadrootsOrderEconomicLine,
+ line: &OrderEconomicLine,
expected_currency: Currency,
field: &'static str,
index: usize,
-) -> Result<(), RadrootsOrderPayloadError> {
+) -> Result<(), OrderPayloadError> {
validate_required_field(&line.id, "economics.line.id")?;
validate_required_field(&line.reason, "economics.line.reason")?;
if line.amount.currency() != expected_currency {
- return Err(RadrootsOrderPayloadError::InvalidEconomicCurrency { field });
+ return Err(OrderPayloadError::InvalidEconomicCurrency { field });
}
if line.amount.amount().is_zero() || line.amount.amount().is_sign_negative() {
- return Err(RadrootsOrderPayloadError::InvalidEconomicLineAmount { field, index });
+ return Err(OrderPayloadError::InvalidEconomicLineAmount { field, index });
}
Ok(())
}
-fn validate_economic_item_order(
- items: &[RadrootsOrderEconomicItem],
-) -> Result<(), RadrootsOrderPayloadError> {
+fn validate_economic_item_order(items: &[OrderEconomicItem]) -> Result<(), OrderPayloadError> {
for pair in items.windows(2) {
if pair[0].bin_id >= pair[1].bin_id {
- return Err(RadrootsOrderPayloadError::InvalidEconomicOrdering {
+ return Err(OrderPayloadError::InvalidEconomicOrdering {
field: "items.bin_id",
});
}
@@ -649,12 +631,12 @@ fn validate_economic_item_order(
}
fn validate_economic_line_order(
- lines: &[RadrootsOrderEconomicLine],
+ lines: &[OrderEconomicLine],
field: &'static str,
-) -> Result<(), RadrootsOrderPayloadError> {
+) -> Result<(), OrderPayloadError> {
for pair in lines.windows(2) {
if pair[0].id >= pair[1].id {
- return Err(RadrootsOrderPayloadError::InvalidEconomicOrdering { field });
+ return Err(OrderPayloadError::InvalidEconomicOrdering { field });
}
}
Ok(())
@@ -664,12 +646,12 @@ fn validate_total_money(
money: &Money,
expected_currency: Currency,
field: &'static str,
-) -> Result<(), RadrootsOrderPayloadError> {
+) -> Result<(), OrderPayloadError> {
if money.currency() != expected_currency {
- return Err(RadrootsOrderPayloadError::InvalidEconomicCurrency { field });
+ return Err(OrderPayloadError::InvalidEconomicCurrency { field });
}
if money.amount().is_sign_negative() {
- return Err(RadrootsOrderPayloadError::InvalidEconomicTotal { field });
+ return Err(OrderPayloadError::InvalidEconomicTotal { field });
}
Ok(())
}
@@ -678,12 +660,12 @@ fn validate_total_matches(
actual: &Money,
expected: &Money,
field: &'static str,
-) -> Result<(), RadrootsOrderPayloadError> {
+) -> Result<(), OrderPayloadError> {
if actual.currency() != expected.currency() {
- return Err(RadrootsOrderPayloadError::InvalidEconomicCurrency { field });
+ return Err(OrderPayloadError::InvalidEconomicCurrency { field });
}
if actual.amount() != expected.amount() {
- return Err(RadrootsOrderPayloadError::InvalidEconomicTotal { field });
+ return Err(OrderPayloadError::InvalidEconomicTotal { field });
}
Ok(())
}
@@ -704,43 +686,43 @@ fn checked_money_add(
left: &Money,
right: &Money,
field: &'static str,
-) -> Result<Money, RadrootsOrderPayloadError> {
+) -> Result<Money, OrderPayloadError> {
if left.currency() != right.currency() {
- return Err(RadrootsOrderPayloadError::InvalidEconomicCurrency { field });
+ return Err(OrderPayloadError::InvalidEconomicCurrency { field });
}
let amount = checked_decimal_add(left.amount(), right.amount())
- .ok_or(RadrootsOrderPayloadError::InvalidEconomicTotal { field })?;
+ .ok_or(OrderPayloadError::InvalidEconomicTotal { field })?;
Money::try_new(amount, left.currency())
- .map_err(|_| RadrootsOrderPayloadError::InvalidEconomicTotal { field })
+ .map_err(|_| OrderPayloadError::InvalidEconomicTotal { field })
}
fn checked_money_sub_non_negative(
left: &Money,
right: &Money,
field: &'static str,
-) -> Result<Money, RadrootsOrderPayloadError> {
+) -> Result<Money, OrderPayloadError> {
if left.currency() != right.currency() {
- return Err(RadrootsOrderPayloadError::InvalidEconomicCurrency { field });
+ return Err(OrderPayloadError::InvalidEconomicCurrency { field });
}
let amount = checked_decimal_sub(left.amount(), right.amount())
- .ok_or(RadrootsOrderPayloadError::InvalidEconomicTotal { field })?;
+ .ok_or(OrderPayloadError::InvalidEconomicTotal { field })?;
if amount.is_sign_negative() {
- return Err(RadrootsOrderPayloadError::InvalidEconomicTotal { field });
+ return Err(OrderPayloadError::InvalidEconomicTotal { field });
}
Money::try_new(amount, left.currency())
- .map_err(|_| RadrootsOrderPayloadError::InvalidEconomicTotal { field })
+ .map_err(|_| OrderPayloadError::InvalidEconomicTotal { field })
}
fn validate_inventory_commitments(
- commitments: &[RadrootsOrderInventoryCommitment],
-) -> Result<(), RadrootsOrderPayloadError> {
+ commitments: &[OrderInventoryCommitment],
+) -> Result<(), OrderPayloadError> {
if commitments.is_empty() {
- return Err(RadrootsOrderPayloadError::MissingInventoryCommitments);
+ return Err(OrderPayloadError::MissingInventoryCommitments);
}
for (index, commitment) in commitments.iter().enumerate() {
validate_required_field(commitment.bin_id.as_str(), "bin_id")?;
if commitment.bin_count == 0 {
- return Err(RadrootsOrderPayloadError::InvalidInventoryCommitmentCount { index });
+ return Err(OrderPayloadError::InvalidInventoryCommitmentCount { index });
}
}
Ok(())
@@ -763,31 +745,31 @@ mod tests {
pubkey('a')
}
- fn sample_listing_addr() -> RadrootsClassifiedListingAddress {
+ fn sample_listing_addr() -> ClassifiedListingAddress {
format!("30402:{}:AAAAAAAAAAAAAAAAAAAAAg", seller_pubkey())
.parse()
.unwrap()
}
- fn order_id(raw: &str) -> RadrootsOrderId {
+ fn order_id(raw: &str) -> OrderId {
raw.parse().unwrap()
}
- fn quote_id(raw: &str) -> RadrootsOrderQuoteId {
+ fn quote_id(raw: &str) -> OrderQuoteId {
raw.parse().unwrap()
}
- fn bin_id(raw: &str) -> RadrootsInventoryBinId {
+ fn bin_id(raw: &str) -> InventoryBinId {
raw.parse().unwrap()
}
- fn sample_order_request() -> RadrootsOrderRequest {
- RadrootsOrderRequest {
+ fn sample_order_request() -> OrderRequest {
+ OrderRequest {
order_id: order_id("order-1"),
listing_addr: sample_listing_addr(),
buyer_pubkey: buyer_pubkey(),
seller_pubkey: seller_pubkey(),
- items: vec![RadrootsOrderItem {
+ items: vec![OrderItem {
bin_id: bin_id("bin-1"),
bin_count: 2,
}],
@@ -807,14 +789,14 @@ mod tests {
Money::try_new(decimal(raw), currency).unwrap()
}
- fn sample_order_economics() -> RadrootsOrderEconomics {
- RadrootsOrderEconomics {
+ fn sample_order_economics() -> OrderEconomics {
+ OrderEconomics {
quote_id: quote_id("quote-1"),
quote_version: 1,
- pricing_basis: RadrootsOrderPricingBasis::ListingEvent,
+ pricing_basis: OrderPricingBasis::ListingEvent,
currency: Currency::USD,
items: vec![
- RadrootsOrderEconomicItem {
+ OrderEconomicItem {
bin_id: bin_id("bin-a"),
bin_count: 2,
quantity_amount: decimal("1.5"),
@@ -823,7 +805,7 @@ mod tests {
unit_price_currency: Currency::USD,
line_subtotal: usd("12"),
},
- RadrootsOrderEconomicItem {
+ OrderEconomicItem {
bin_id: bin_id("bin-b"),
bin_count: 1,
quantity_amount: decimal("2"),
@@ -833,28 +815,28 @@ mod tests {
line_subtotal: usd("6"),
},
],
- discounts: vec![RadrootsOrderEconomicLine {
+ discounts: vec![OrderEconomicLine {
id: "discount-a".into(),
- kind: RadrootsOrderEconomicLineKind::ListingDiscount,
- actor: RadrootsOrderEconomicActor::Seller,
- effect: RadrootsOrderEconomicEffect::Decrease,
+ kind: OrderEconomicLineKind::ListingDiscount,
+ actor: OrderEconomicActor::Seller,
+ effect: OrderEconomicEffect::Decrease,
amount: usd("3"),
reason: "farmstand pickup".into(),
}],
adjustments: vec![
- RadrootsOrderEconomicLine {
+ OrderEconomicLine {
id: "adjustment-a".into(),
- kind: RadrootsOrderEconomicLineKind::BasketAdjustment,
- actor: RadrootsOrderEconomicActor::Buyer,
- effect: RadrootsOrderEconomicEffect::Increase,
+ kind: OrderEconomicLineKind::BasketAdjustment,
+ actor: OrderEconomicActor::Buyer,
+ effect: OrderEconomicEffect::Increase,
amount: usd("2"),
reason: "special handling".into(),
},
- RadrootsOrderEconomicLine {
+ OrderEconomicLine {
id: "adjustment-b".into(),
- kind: RadrootsOrderEconomicLineKind::BasketAdjustment,
- actor: RadrootsOrderEconomicActor::Buyer,
- effect: RadrootsOrderEconomicEffect::Decrease,
+ kind: OrderEconomicLineKind::BasketAdjustment,
+ actor: OrderEconomicActor::Buyer,
+ effect: OrderEconomicEffect::Decrease,
amount: usd("1"),
reason: "local pickup credit".into(),
},
@@ -866,13 +848,13 @@ mod tests {
}
}
- fn sample_bound_order_economics() -> RadrootsOrderEconomics {
- RadrootsOrderEconomics {
+ fn sample_bound_order_economics() -> OrderEconomics {
+ OrderEconomics {
quote_id: quote_id("quote-bound-1"),
quote_version: 1,
- pricing_basis: RadrootsOrderPricingBasis::ListingEvent,
+ pricing_basis: OrderPricingBasis::ListingEvent,
currency: Currency::USD,
- items: vec![RadrootsOrderEconomicItem {
+ items: vec![OrderEconomicItem {
bin_id: bin_id("bin-1"),
bin_count: 2,
quantity_amount: decimal("1"),
@@ -890,27 +872,27 @@ mod tests {
}
}
- fn sample_inventory_commitment() -> RadrootsOrderInventoryCommitment {
- RadrootsOrderInventoryCommitment {
+ fn sample_inventory_commitment() -> OrderInventoryCommitment {
+ OrderInventoryCommitment {
bin_id: bin_id("bin-1"),
bin_count: 2,
}
}
- fn sample_order_decision() -> RadrootsOrderDecision {
- RadrootsOrderDecision {
+ fn sample_order_decision() -> OrderDecision {
+ OrderDecision {
order_id: order_id("order-1"),
listing_addr: sample_listing_addr(),
buyer_pubkey: buyer_pubkey(),
seller_pubkey: seller_pubkey(),
- decision: RadrootsOrderDecisionOutcome::Accepted {
+ decision: OrderDecisionOutcome::Accepted {
inventory_commitments: vec![sample_inventory_commitment()],
},
}
}
- fn sample_order_cancellation() -> RadrootsOrderCancellation {
- RadrootsOrderCancellation {
+ fn sample_order_cancellation() -> OrderCancellation {
+ OrderCancellation {
order_id: order_id("order-1"),
listing_addr: sample_listing_addr(),
buyer_pubkey: buyer_pubkey(),
@@ -922,57 +904,41 @@ mod tests {
#[test]
fn order_message_type_uses_canonical_names_and_kinds() {
assert_eq!(
- RadrootsOrderEventType::from_kind(KIND_ORDER_REQUEST),
- Some(RadrootsOrderEventType::OrderRequested)
- );
- assert_eq!(
- RadrootsOrderEventType::from_kind(KIND_ORDER_DECISION),
- Some(RadrootsOrderEventType::OrderDecision)
+ OrderEventType::from_kind(KIND_ORDER_REQUEST),
+ Some(OrderEventType::OrderRequested)
);
- assert_eq!(RadrootsOrderEventType::from_kind(3424), None);
- assert_eq!(RadrootsOrderEventType::from_kind(3425), None);
assert_eq!(
- RadrootsOrderEventType::from_kind(KIND_ORDER_CANCELLATION),
- Some(RadrootsOrderEventType::OrderCancelled)
+ OrderEventType::from_kind(KIND_ORDER_DECISION),
+ Some(OrderEventType::OrderDecision)
);
- assert_eq!(RadrootsOrderEventType::from_kind(3433), None);
- assert_eq!(RadrootsOrderEventType::from_kind(3434), None);
- assert_eq!(RadrootsOrderEventType::from_kind(3435), None);
- assert_eq!(RadrootsOrderEventType::from_kind(3436), None);
- assert_eq!(RadrootsOrderEventType::from_kind(3431), None);
+ assert_eq!(OrderEventType::from_kind(3424), None);
+ assert_eq!(OrderEventType::from_kind(3425), None);
assert_eq!(
- RadrootsOrderEventType::OrderRequested.kind(),
- KIND_ORDER_REQUEST
+ OrderEventType::from_kind(KIND_ORDER_CANCELLATION),
+ Some(OrderEventType::OrderCancelled)
);
+ assert_eq!(OrderEventType::from_kind(3433), None);
+ assert_eq!(OrderEventType::from_kind(3434), None);
+ assert_eq!(OrderEventType::from_kind(3435), None);
+ assert_eq!(OrderEventType::from_kind(3436), None);
+ assert_eq!(OrderEventType::from_kind(3431), None);
+ assert_eq!(OrderEventType::OrderRequested.kind(), KIND_ORDER_REQUEST);
+ assert_eq!(OrderEventType::OrderDecision.kind(), KIND_ORDER_DECISION);
assert_eq!(
- RadrootsOrderEventType::OrderDecision.kind(),
- KIND_ORDER_DECISION
- );
- assert_eq!(
- RadrootsOrderEventType::OrderCancelled.kind(),
+ OrderEventType::OrderCancelled.kind(),
KIND_ORDER_CANCELLATION
);
- assert_eq!(
- RadrootsOrderEventType::OrderRequested.name(),
- "TradeOrderRequested"
- );
- assert_eq!(
- RadrootsOrderEventType::OrderDecision.name(),
- "TradeOrderDecision"
- );
- assert_eq!(
- RadrootsOrderEventType::OrderCancelled.name(),
- "TradeOrderCancelled"
- );
- assert!(RadrootsOrderEventType::OrderRequested.requires_listing_snapshot());
- assert!(RadrootsOrderEventType::OrderDecision.requires_order_chain());
- assert!(RadrootsOrderEventType::OrderCancelled.requires_order_chain());
- assert!(!RadrootsOrderEventType::OrderRequested.requires_order_chain());
-
- let request_name = serde_json::to_value(RadrootsOrderEventType::OrderRequested).unwrap();
- let decision_name = serde_json::to_value(RadrootsOrderEventType::OrderDecision).unwrap();
- let cancellation_name =
- serde_json::to_value(RadrootsOrderEventType::OrderCancelled).unwrap();
+ assert_eq!(OrderEventType::OrderRequested.name(), "TradeOrderRequested");
+ assert_eq!(OrderEventType::OrderDecision.name(), "TradeOrderDecision");
+ assert_eq!(OrderEventType::OrderCancelled.name(), "TradeOrderCancelled");
+ assert!(OrderEventType::OrderRequested.requires_listing_snapshot());
+ assert!(OrderEventType::OrderDecision.requires_order_chain());
+ assert!(OrderEventType::OrderCancelled.requires_order_chain());
+ assert!(!OrderEventType::OrderRequested.requires_order_chain());
+
+ let request_name = serde_json::to_value(OrderEventType::OrderRequested).unwrap();
+ let decision_name = serde_json::to_value(OrderEventType::OrderDecision).unwrap();
+ let cancellation_name = serde_json::to_value(OrderEventType::OrderCancelled).unwrap();
assert_eq!(request_name, serde_json::json!("TradeOrderRequested"));
assert_eq!(decision_name, serde_json::json!("TradeOrderDecision"));
assert_eq!(cancellation_name, serde_json::json!("TradeOrderCancelled"));
@@ -986,21 +952,21 @@ mod tests {
missing_items.items.clear();
assert_eq!(
missing_items.validate().unwrap_err(),
- RadrootsOrderPayloadError::MissingItems
+ OrderPayloadError::MissingItems
);
let mut invalid_count = sample_order_request();
invalid_count.items[0].bin_count = 0;
assert_eq!(
invalid_count.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidItemBinCount { index: 0 }
+ OrderPayloadError::InvalidItemBinCount { index: 0 }
);
let mut mismatched_economic_item = sample_order_request();
mismatched_economic_item.economics.items[0].bin_id = bin_id("bin-other");
assert_eq!(
mismatched_economic_item.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidOrderEconomicsBinding {
+ OrderPayloadError::InvalidOrderEconomicsBinding {
field: "items.bin_id"
}
);
@@ -1012,7 +978,7 @@ mod tests {
mismatched_economic_count.economics.total = usd("15");
assert_eq!(
mismatched_economic_count.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidOrderEconomicsBinding {
+ OrderPayloadError::InvalidOrderEconomicsBinding {
field: "items.bin_count"
}
);
@@ -1022,35 +988,29 @@ mod tests {
fn order_payload_json_rejects_invalid_protocol_identifiers() {
let mut request = serde_json::to_value(sample_order_request()).unwrap();
request["buyer_pubkey"] = serde_json::json!("not-a-pubkey");
- assert!(serde_json::from_value::<RadrootsOrderRequest>(request).is_err());
+ assert!(serde_json::from_value::<OrderRequest>(request).is_err());
}
#[test]
fn listing_parse_error_json_preserves_external_tagged_shape() {
assert_eq!(
- serde_json::to_value(RadrootsOperationalListingParseError::InvalidKind(
- KIND_PROFILE
- ))
- .unwrap(),
+ serde_json::to_value(OperationalListingParseError::InvalidKind(KIND_PROFILE)).unwrap(),
serde_json::json!({ "InvalidKind": KIND_PROFILE })
);
assert_eq!(
- serde_json::to_value(RadrootsOperationalListingParseError::MissingTag(
- "price".into()
- ))
- .unwrap(),
+ serde_json::to_value(OperationalListingParseError::MissingTag("price".into())).unwrap(),
serde_json::json!({ "MissingTag": "price" })
);
assert_eq!(
- serde_json::to_value(RadrootsOperationalListingParseError::InvalidUnit).unwrap(),
+ serde_json::to_value(OperationalListingParseError::InvalidUnit).unwrap(),
serde_json::json!("InvalidUnit")
);
assert_eq!(
- serde_json::from_value::<RadrootsOperationalListingParseError>(serde_json::json!({
+ serde_json::from_value::<OperationalListingParseError>(serde_json::json!({
"InvalidJson": "bins"
}))
.unwrap(),
- RadrootsOperationalListingParseError::InvalidJson("bins".into())
+ OperationalListingParseError::InvalidJson("bins".into())
);
}
@@ -1082,11 +1042,11 @@ mod tests {
let mut economics = sample_order_economics();
economics.items.reverse();
economics.adjustments.reverse();
- economics.discounts.push(RadrootsOrderEconomicLine {
+ economics.discounts.push(OrderEconomicLine {
id: "discount-b".into(),
- kind: RadrootsOrderEconomicLineKind::ListingDiscount,
- actor: RadrootsOrderEconomicActor::Seller,
- effect: RadrootsOrderEconomicEffect::Decrease,
+ kind: OrderEconomicLineKind::ListingDiscount,
+ actor: OrderEconomicActor::Seller,
+ effect: OrderEconomicEffect::Decrease,
amount: usd("1"),
reason: "market credit".into(),
});
@@ -1095,7 +1055,7 @@ mod tests {
economics.total = usd("17");
assert_eq!(
economics.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidEconomicOrdering {
+ OrderPayloadError::InvalidEconomicOrdering {
field: "items.bin_id"
}
);
@@ -1122,7 +1082,7 @@ mod tests {
economics.items[0].unit_price_currency = Currency::EUR;
assert_eq!(
economics.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidEconomicCurrency {
+ OrderPayloadError::InvalidEconomicCurrency {
field: "items.unit_price_currency"
}
);
@@ -1131,7 +1091,7 @@ mod tests {
economics.adjustments[0].amount = money("2", Currency::EUR);
assert_eq!(
economics.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidEconomicCurrency {
+ OrderPayloadError::InvalidEconomicCurrency {
field: "adjustments"
}
);
@@ -1143,21 +1103,21 @@ mod tests {
economics.items[0].bin_count = 0;
assert_eq!(
economics.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidEconomicItemBinCount { index: 0 }
+ OrderPayloadError::InvalidEconomicItemBinCount { index: 0 }
);
let mut economics = sample_order_economics();
economics.items[0].line_subtotal = usd("11.99");
assert_eq!(
economics.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidEconomicItemSubtotal { index: 0 }
+ OrderPayloadError::InvalidEconomicItemSubtotal { index: 0 }
);
let mut economics = sample_order_economics();
economics.items[0].line_subtotal = money("12", Currency::EUR);
assert_eq!(
economics.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidEconomicCurrency {
+ OrderPayloadError::InvalidEconomicCurrency {
field: "items.line_subtotal"
}
);
@@ -1169,42 +1129,42 @@ mod tests {
economics.items.clear();
assert_eq!(
economics.derived_totals().unwrap_err(),
- RadrootsOrderPayloadError::MissingEconomicItems
+ OrderPayloadError::MissingEconomicItems
);
let mut economics = sample_order_economics();
economics.quote_version = 0;
assert_eq!(
economics.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidQuoteVersion
+ OrderPayloadError::InvalidQuoteVersion
);
let mut economics = sample_order_economics();
economics.items[0].quantity_amount = decimal("0");
assert_eq!(
economics.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidEconomicItemQuantity { index: 0 }
+ OrderPayloadError::InvalidEconomicItemQuantity { index: 0 }
);
let mut economics = sample_order_economics();
economics.items[0].quantity_amount = decimal("-1");
assert_eq!(
economics.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidEconomicItemQuantity { index: 0 }
+ OrderPayloadError::InvalidEconomicItemQuantity { index: 0 }
);
let mut economics = sample_order_economics();
economics.items[0].unit_price_amount = decimal("-1");
assert_eq!(
economics.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidEconomicItemPrice { index: 0 }
+ OrderPayloadError::InvalidEconomicItemPrice { index: 0 }
);
let mut economics = sample_order_economics();
- economics.discounts[0].kind = RadrootsOrderEconomicLineKind::BasketAdjustment;
+ economics.discounts[0].kind = OrderEconomicLineKind::BasketAdjustment;
assert_eq!(
economics.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidEconomicLineKind {
+ OrderPayloadError::InvalidEconomicLineKind {
field: "discounts",
index: 0
}
@@ -1214,14 +1174,14 @@ mod tests {
economics.subtotal = money("18", Currency::EUR);
assert_eq!(
economics.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidEconomicCurrency { field: "subtotal" }
+ OrderPayloadError::InvalidEconomicCurrency { field: "subtotal" }
);
let mut economics = sample_order_economics();
economics.discount_total = usd("4");
assert_eq!(
economics.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidEconomicTotal {
+ OrderPayloadError::InvalidEconomicTotal {
field: "discount_total"
}
);
@@ -1230,7 +1190,7 @@ mod tests {
economics.adjustment_total = usd("4");
assert_eq!(
economics.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidEconomicTotal {
+ OrderPayloadError::InvalidEconomicTotal {
field: "adjustment_total"
}
);
@@ -1238,26 +1198,26 @@ mod tests {
let economics = sample_bound_order_economics();
assert_eq!(
validate_order_economics_binding(&[], &economics).unwrap_err(),
- RadrootsOrderPayloadError::InvalidOrderEconomicsBinding { field: "items" }
+ OrderPayloadError::InvalidOrderEconomicsBinding { field: "items" }
);
- let invalid_order_items = [RadrootsOrderItem {
+ let invalid_order_items = [OrderItem {
bin_id: bin_id("bin-1"),
bin_count: 0,
}];
assert_eq!(
validate_order_economics_binding(&invalid_order_items, &economics).unwrap_err(),
- RadrootsOrderPayloadError::InvalidOrderEconomicsBinding {
+ OrderPayloadError::InvalidOrderEconomicsBinding {
field: "items.bin_count"
}
);
let duplicate_counts = normalized_order_item_counts(&[
- RadrootsOrderItem {
+ OrderItem {
bin_id: bin_id("bin-1"),
bin_count: 1,
},
- RadrootsOrderItem {
+ OrderItem {
bin_id: bin_id("bin-1"),
bin_count: 2,
},
@@ -1266,18 +1226,18 @@ mod tests {
assert_eq!(duplicate_counts[0].bin_count, 3);
assert!(
- normalized_order_item_counts(&[RadrootsOrderItem {
+ normalized_order_item_counts(&[OrderItem {
bin_id: bin_id("bin-1"),
bin_count: 0,
}])
.is_none()
);
let sorted_counts = normalized_order_item_counts(&[
- RadrootsOrderItem {
+ OrderItem {
bin_id: bin_id("bin-b"),
bin_count: 1,
},
- RadrootsOrderItem {
+ OrderItem {
bin_id: bin_id("bin-a"),
bin_count: 1,
},
@@ -1289,20 +1249,20 @@ mod tests {
#[test]
fn order_economics_validation_rejects_bad_line_semantics() {
let mut economics = sample_order_economics();
- economics.discounts[0].effect = RadrootsOrderEconomicEffect::Increase;
+ economics.discounts[0].effect = OrderEconomicEffect::Increase;
assert_eq!(
economics.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidEconomicLineEffect {
+ OrderPayloadError::InvalidEconomicLineEffect {
field: "discounts",
index: 0
}
);
let mut economics = sample_order_economics();
- economics.adjustments[0].kind = RadrootsOrderEconomicLineKind::ListingDiscount;
+ economics.adjustments[0].kind = OrderEconomicLineKind::ListingDiscount;
assert_eq!(
economics.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidEconomicLineKind {
+ OrderPayloadError::InvalidEconomicLineKind {
field: "adjustments",
index: 0
}
@@ -1312,7 +1272,7 @@ mod tests {
economics.adjustments[0].amount = usd("0");
assert_eq!(
economics.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidEconomicLineAmount {
+ OrderPayloadError::InvalidEconomicLineAmount {
field: "adjustments",
index: 0
}
@@ -1323,16 +1283,16 @@ mod tests {
fn order_economics_helpers_cover_currency_error_paths() {
assert_eq!(
validate_total_matches(&usd("1"), &money("1", Currency::EUR), "total").unwrap_err(),
- RadrootsOrderPayloadError::InvalidEconomicCurrency { field: "total" }
+ OrderPayloadError::InvalidEconomicCurrency { field: "total" }
);
assert_eq!(
checked_money_add(&usd("1"), &money("1", Currency::EUR), "subtotal").unwrap_err(),
- RadrootsOrderPayloadError::InvalidEconomicCurrency { field: "subtotal" }
+ OrderPayloadError::InvalidEconomicCurrency { field: "subtotal" }
);
assert_eq!(
checked_money_sub_non_negative(&usd("1"), &money("1", Currency::EUR), "total")
.unwrap_err(),
- RadrootsOrderPayloadError::InvalidEconomicCurrency { field: "total" }
+ OrderPayloadError::InvalidEconomicCurrency { field: "total" }
);
}
@@ -1342,7 +1302,7 @@ mod tests {
economics.adjustments[1].id = "adjustment-a".into();
assert_eq!(
economics.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidEconomicOrdering {
+ OrderPayloadError::InvalidEconomicOrdering {
field: "adjustments"
}
);
@@ -1356,7 +1316,7 @@ mod tests {
economics.total = usd("0");
assert_eq!(
economics.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidEconomicTotal { field: "total" }
+ OrderPayloadError::InvalidEconomicTotal { field: "total" }
);
}
@@ -1364,28 +1324,28 @@ mod tests {
fn order_decision_validation_enforces_commitment_invariants() {
assert_eq!(sample_order_decision().validate(), Ok(()));
- let declined = RadrootsOrderDecision {
- decision: RadrootsOrderDecisionOutcome::Declined {
+ let declined = OrderDecision {
+ decision: OrderDecisionOutcome::Declined {
reason: "out_of_stock".into(),
},
..sample_order_decision()
};
assert_eq!(declined.validate(), Ok(()));
- let accepted_without_commitments = RadrootsOrderDecision {
- decision: RadrootsOrderDecisionOutcome::Accepted {
+ let accepted_without_commitments = OrderDecision {
+ decision: OrderDecisionOutcome::Accepted {
inventory_commitments: Vec::new(),
},
..sample_order_decision()
};
assert_eq!(
accepted_without_commitments.validate().unwrap_err(),
- RadrootsOrderPayloadError::MissingInventoryCommitments
+ OrderPayloadError::MissingInventoryCommitments
);
- let accepted_with_zero_count = RadrootsOrderDecision {
- decision: RadrootsOrderDecisionOutcome::Accepted {
- inventory_commitments: vec![RadrootsOrderInventoryCommitment {
+ let accepted_with_zero_count = OrderDecision {
+ decision: OrderDecisionOutcome::Accepted {
+ inventory_commitments: vec![OrderInventoryCommitment {
bin_id: bin_id("bin-1"),
bin_count: 0,
}],
@@ -1394,16 +1354,16 @@ mod tests {
};
assert_eq!(
accepted_with_zero_count.validate().unwrap_err(),
- RadrootsOrderPayloadError::InvalidInventoryCommitmentCount { index: 0 }
+ OrderPayloadError::InvalidInventoryCommitmentCount { index: 0 }
);
- let declined_without_reason = RadrootsOrderDecision {
- decision: RadrootsOrderDecisionOutcome::Declined { reason: " ".into() },
+ let declined_without_reason = OrderDecision {
+ decision: OrderDecisionOutcome::Declined { reason: " ".into() },
..sample_order_decision()
};
assert_eq!(
declined_without_reason.validate().unwrap_err(),
- RadrootsOrderPayloadError::EmptyField("reason")
+ OrderPayloadError::EmptyField("reason")
);
}
@@ -1411,20 +1371,20 @@ mod tests {
fn order_cancellation_validation_requires_buyer_bindings_and_reason() {
assert_eq!(sample_order_cancellation().validate(), Ok(()));
- let missing_reason = RadrootsOrderCancellation {
+ let missing_reason = OrderCancellation {
reason: " ".into(),
..sample_order_cancellation()
};
assert_eq!(
missing_reason.validate().unwrap_err(),
- RadrootsOrderPayloadError::EmptyField("reason")
+ OrderPayloadError::EmptyField("reason")
);
}
#[test]
fn order_envelope_serializes_canonical_type_name() {
- let envelope = RadrootsOrderEnvelope::new(
- RadrootsOrderEventType::OrderRequested,
+ let envelope = OrderEnvelope::new(
+ OrderEventType::OrderRequested,
sample_listing_addr(),
"order-1",
sample_order_request(),
@@ -1443,10 +1403,10 @@ mod tests {
#[test]
fn order_envelope_validation_and_display_cover_error_paths() {
- let invalid_version = RadrootsOrderEnvelope {
+ let invalid_version = OrderEnvelope {
version: RADROOTS_ORDER_ENVELOPE_VERSION + 1,
- domain: RadrootsCommercialDomain::Listing,
- message_type: RadrootsOrderEventType::OrderRequested,
+ domain: CommercialDomain::Listing,
+ message_type: OrderEventType::OrderRequested,
order_id: "order-1".into(),
listing_addr: sample_listing_addr().into_string(),
payload: sample_order_request(),
@@ -1454,7 +1414,7 @@ mod tests {
let invalid_version_err = invalid_version.validate().unwrap_err();
assert_eq!(
invalid_version_err,
- RadrootsOrderEnvelopeError::InvalidVersion {
+ OrderEnvelopeError::InvalidVersion {
expected: RADROOTS_ORDER_ENVELOPE_VERSION,
got: RADROOTS_ORDER_ENVELOPE_VERSION + 1,
}
@@ -1464,68 +1424,62 @@ mod tests {
"invalid order envelope version: expected 1, got 2"
);
- let missing_order = RadrootsOrderEnvelope::new(
- RadrootsOrderEventType::OrderRequested,
+ let missing_order = OrderEnvelope::new(
+ OrderEventType::OrderRequested,
sample_listing_addr(),
" ",
sample_order_request(),
);
let missing_order_err = missing_order.validate().unwrap_err();
- assert_eq!(
- missing_order_err,
- RadrootsOrderEnvelopeError::MissingOrderId
- );
+ assert_eq!(missing_order_err, OrderEnvelopeError::MissingOrderId);
assert_eq!(
missing_order_err.to_string(),
"missing order_id for order message"
);
- let missing_listing = RadrootsOrderEnvelope::new(
- RadrootsOrderEventType::OrderRequested,
+ let missing_listing = OrderEnvelope::new(
+ OrderEventType::OrderRequested,
" ",
"order-1",
sample_order_request(),
);
let missing_listing_err = missing_listing.validate().unwrap_err();
- assert_eq!(
- missing_listing_err,
- RadrootsOrderEnvelopeError::MissingListingAddr
- );
+ assert_eq!(missing_listing_err, OrderEnvelopeError::MissingListingAddr);
assert_eq!(missing_listing_err.to_string(), "missing listing_addr");
}
#[test]
fn listing_parse_error_display_variants() {
assert_eq!(
- RadrootsOperationalListingParseError::InvalidKind(KIND_PROFILE).to_string(),
+ OperationalListingParseError::InvalidKind(KIND_PROFILE).to_string(),
"invalid operational listing kind: 0"
);
assert_eq!(
- RadrootsOperationalListingParseError::MissingTag("price".into()).to_string(),
+ OperationalListingParseError::MissingTag("price".into()).to_string(),
"missing required tag: price"
);
assert_eq!(
- RadrootsOperationalListingParseError::InvalidTag("farm".into()).to_string(),
+ OperationalListingParseError::InvalidTag("farm".into()).to_string(),
"invalid tag: farm"
);
assert_eq!(
- RadrootsOperationalListingParseError::InvalidNumber("inventory".into()).to_string(),
+ OperationalListingParseError::InvalidNumber("inventory".into()).to_string(),
"invalid number: inventory"
);
assert_eq!(
- RadrootsOperationalListingParseError::InvalidUnit.to_string(),
+ OperationalListingParseError::InvalidUnit.to_string(),
"invalid unit"
);
assert_eq!(
- RadrootsOperationalListingParseError::InvalidCurrency.to_string(),
+ OperationalListingParseError::InvalidCurrency.to_string(),
"invalid currency"
);
assert_eq!(
- RadrootsOperationalListingParseError::InvalidJson("bins".into()).to_string(),
+ OperationalListingParseError::InvalidJson("bins".into()).to_string(),
"invalid json: bins"
);
assert_eq!(
- RadrootsOperationalListingParseError::InvalidDiscount("offer".into()).to_string(),
+ OperationalListingParseError::InvalidDiscount("offer".into()).to_string(),
"invalid discount data for offer"
);
}
@@ -1533,101 +1487,100 @@ mod tests {
#[test]
fn listing_validation_error_display_variants() {
assert_eq!(
- (RadrootsOperationalListingValidationError::InvalidKind { kind: KIND_PROFILE })
- .to_string(),
+ (OperationalListingValidationError::InvalidKind { kind: KIND_PROFILE }).to_string(),
"invalid listing kind: 0"
);
assert_eq!(
- RadrootsOperationalListingValidationError::InvalidProfile.to_string(),
+ OperationalListingValidationError::InvalidProfile.to_string(),
"classified listing is not an Operational Listing profile"
);
assert_eq!(
- RadrootsOperationalListingValidationError::MissingListingId.to_string(),
+ OperationalListingValidationError::MissingListingId.to_string(),
"missing listing id"
);
assert_eq!(
- RadrootsOperationalListingValidationError::ListingEventNotFound {
+ OperationalListingValidationError::ListingEventNotFound {
listing_addr: "listing-1".into(),
}
.to_string(),
"listing event not found: listing-1"
);
assert_eq!(
- RadrootsOperationalListingValidationError::ListingEventFetchFailed {
+ OperationalListingValidationError::ListingEventFetchFailed {
listing_addr: "listing-2".into(),
}
.to_string(),
"listing event fetch failed: listing-2"
);
assert_eq!(
- RadrootsOperationalListingValidationError::ParseError {
- error: RadrootsOperationalListingParseError::InvalidJson("payload".into()),
+ OperationalListingValidationError::ParseError {
+ error: OperationalListingParseError::InvalidJson("payload".into()),
}
.to_string(),
"invalid listing data: invalid json: payload"
);
assert_eq!(
- RadrootsOperationalListingValidationError::InvalidSeller.to_string(),
+ OperationalListingValidationError::InvalidSeller.to_string(),
"listing author does not match farm pubkey"
);
assert_eq!(
- RadrootsOperationalListingValidationError::MissingFarmProfile.to_string(),
+ OperationalListingValidationError::MissingFarmProfile.to_string(),
"missing farm profile"
);
assert_eq!(
- RadrootsOperationalListingValidationError::MissingFarmRecord.to_string(),
+ OperationalListingValidationError::MissingFarmRecord.to_string(),
"missing farm record"
);
assert_eq!(
- RadrootsOperationalListingValidationError::MissingTitle.to_string(),
+ OperationalListingValidationError::MissingTitle.to_string(),
"missing listing title"
);
assert_eq!(
- RadrootsOperationalListingValidationError::MissingDescription.to_string(),
+ OperationalListingValidationError::MissingDescription.to_string(),
"missing listing description"
);
assert_eq!(
- RadrootsOperationalListingValidationError::MissingProductType.to_string(),
+ OperationalListingValidationError::MissingProductType.to_string(),
"missing listing product type"
);
assert_eq!(
- RadrootsOperationalListingValidationError::MissingBins.to_string(),
+ OperationalListingValidationError::MissingBins.to_string(),
"missing listing bins"
);
assert_eq!(
- RadrootsOperationalListingValidationError::MissingPrimaryBin.to_string(),
+ OperationalListingValidationError::MissingPrimaryBin.to_string(),
"missing primary listing bin"
);
assert_eq!(
- RadrootsOperationalListingValidationError::InvalidBin.to_string(),
+ OperationalListingValidationError::InvalidBin.to_string(),
"invalid listing bin"
);
assert_eq!(
- RadrootsOperationalListingValidationError::MissingPrice.to_string(),
+ OperationalListingValidationError::MissingPrice.to_string(),
"missing listing price"
);
assert_eq!(
- RadrootsOperationalListingValidationError::InvalidPrice.to_string(),
+ OperationalListingValidationError::InvalidPrice.to_string(),
"invalid listing price"
);
assert_eq!(
- RadrootsOperationalListingValidationError::MissingInventory.to_string(),
+ OperationalListingValidationError::MissingInventory.to_string(),
"missing listing inventory"
);
assert_eq!(
- RadrootsOperationalListingValidationError::InvalidInventory.to_string(),
+ OperationalListingValidationError::InvalidInventory.to_string(),
"invalid listing inventory"
);
assert_eq!(
- RadrootsOperationalListingValidationError::MissingAvailability.to_string(),
+ OperationalListingValidationError::MissingAvailability.to_string(),
"missing listing availability"
);
assert_eq!(
- RadrootsOperationalListingValidationError::MissingLocation.to_string(),
+ OperationalListingValidationError::MissingLocation.to_string(),
"missing listing location"
);
assert_eq!(
- RadrootsOperationalListingValidationError::MissingDeliveryMethod.to_string(),
+ OperationalListingValidationError::MissingDeliveryMethod.to_string(),
"missing listing delivery method"
);
}
@@ -1636,84 +1589,84 @@ mod tests {
fn order_payload_error_display_variants_cover_all_messages() {
let cases = [
(
- RadrootsOrderPayloadError::EmptyField("field"),
+ OrderPayloadError::EmptyField("field"),
"field cannot be empty",
),
(
- RadrootsOrderPayloadError::MissingItems,
+ OrderPayloadError::MissingItems,
"items must contain at least one item",
),
(
- RadrootsOrderPayloadError::InvalidItemBinCount { index: 2 },
+ OrderPayloadError::InvalidItemBinCount { index: 2 },
"items[2].bin_count must be greater than zero",
),
(
- RadrootsOrderPayloadError::MissingEconomicItems,
+ OrderPayloadError::MissingEconomicItems,
"economics.items must contain at least one item",
),
(
- RadrootsOrderPayloadError::InvalidEconomicItemBinCount { index: 3 },
+ OrderPayloadError::InvalidEconomicItemBinCount { index: 3 },
"economics.items[3].bin_count must be greater than zero",
),
(
- RadrootsOrderPayloadError::InvalidEconomicItemQuantity { index: 4 },
+ OrderPayloadError::InvalidEconomicItemQuantity { index: 4 },
"economics.items[4].quantity_amount must be greater than zero",
),
(
- RadrootsOrderPayloadError::InvalidEconomicItemPrice { index: 5 },
+ OrderPayloadError::InvalidEconomicItemPrice { index: 5 },
"economics.items[5].unit_price_amount must not be negative",
),
(
- RadrootsOrderPayloadError::InvalidEconomicItemSubtotal { index: 6 },
+ OrderPayloadError::InvalidEconomicItemSubtotal { index: 6 },
"economics.items[6].line_subtotal is invalid",
),
(
- RadrootsOrderPayloadError::InvalidEconomicLineAmount {
+ OrderPayloadError::InvalidEconomicLineAmount {
field: "adjustments",
index: 7,
},
"economics.adjustments[7].amount must be greater than zero",
),
(
- RadrootsOrderPayloadError::InvalidEconomicLineKind {
+ OrderPayloadError::InvalidEconomicLineKind {
field: "discounts",
index: 8,
},
"economics.discounts[8].kind is invalid",
),
(
- RadrootsOrderPayloadError::InvalidEconomicLineEffect {
+ OrderPayloadError::InvalidEconomicLineEffect {
field: "discounts",
index: 9,
},
"economics.discounts[9].effect is invalid",
),
(
- RadrootsOrderPayloadError::InvalidEconomicCurrency { field: "total" },
+ OrderPayloadError::InvalidEconomicCurrency { field: "total" },
"economics.total currency is invalid",
),
(
- RadrootsOrderPayloadError::InvalidEconomicOrdering { field: "items" },
+ OrderPayloadError::InvalidEconomicOrdering { field: "items" },
"economics.items is not in canonical order",
),
(
- RadrootsOrderPayloadError::InvalidEconomicTotal { field: "subtotal" },
+ OrderPayloadError::InvalidEconomicTotal { field: "subtotal" },
"economics.subtotal total is invalid",
),
(
- RadrootsOrderPayloadError::InvalidOrderEconomicsBinding { field: "items" },
+ OrderPayloadError::InvalidOrderEconomicsBinding { field: "items" },
"order items does not match economics",
),
(
- RadrootsOrderPayloadError::InvalidQuoteVersion,
+ OrderPayloadError::InvalidQuoteVersion,
"economics.quote_version must be greater than zero",
),
(
- RadrootsOrderPayloadError::MissingInventoryCommitments,
+ OrderPayloadError::MissingInventoryCommitments,
"accepted decisions must contain at least one inventory commitment",
),
(
- RadrootsOrderPayloadError::InvalidInventoryCommitmentCount { index: 1 },
+ OrderPayloadError::InvalidInventoryCommitmentCount { index: 1 },
"inventory_commitments[1].bin_count must be greater than zero",
),
];
diff --git a/crates/event/src/order_economics.rs b/crates/event/src/order_economics.rs
@@ -5,51 +5,45 @@ use alloc::{string::String, vec::Vec};
use radroots_core::{Currency, Decimal, Money, Unit};
-use crate::id::{RadrootsInventoryBinId, RadrootsOrderQuoteId};
+use crate::id::{InventoryBinId, OrderQuoteId};
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
-#[cfg_attr(all(test, feature = "std"), dto(ts(name = "RadrootsOrderItem")))]
+#[cfg_attr(all(test, feature = "std"), dto(ts(name = "OrderItem")))]
#[cfg_attr(
any(feature = "serde", test),
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsOrderItem {
- pub bin_id: RadrootsInventoryBinId,
+pub struct OrderItem {
+ pub bin_id: InventoryBinId,
pub bin_count: u32,
}
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
-#[cfg_attr(
- all(test, feature = "std"),
- dto(ts(name = "RadrootsOrderPricingBasis"))
-)]
+#[cfg_attr(all(test, feature = "std"), dto(ts(name = "OrderPricingBasis")))]
#[cfg_attr(
any(feature = "serde", test),
derive(serde::Serialize, serde::Deserialize)
)]
#[cfg_attr(any(feature = "serde", test), serde(rename_all = "snake_case"))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsOrderPricingBasis {
+pub enum OrderPricingBasis {
#[cfg_attr(any(feature = "serde", test), serde(rename = "listing_event"))]
ListingEvent,
}
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
-#[cfg_attr(
- all(test, feature = "std"),
- dto(ts(name = "RadrootsOrderEconomicLineKind"))
-)]
+#[cfg_attr(all(test, feature = "std"), dto(ts(name = "OrderEconomicLineKind")))]
#[cfg_attr(
any(feature = "serde", test),
derive(serde::Serialize, serde::Deserialize)
)]
#[cfg_attr(any(feature = "serde", test), serde(rename_all = "snake_case"))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsOrderEconomicLineKind {
+pub enum OrderEconomicLineKind {
#[cfg_attr(any(feature = "serde", test), serde(rename = "listing_discount"))]
ListingDiscount,
#[cfg_attr(any(feature = "serde", test), serde(rename = "basket_adjustment"))]
@@ -60,17 +54,14 @@ pub enum RadrootsOrderEconomicLineKind {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
-#[cfg_attr(
- all(test, feature = "std"),
- dto(ts(name = "RadrootsOrderEconomicActor"))
-)]
+#[cfg_attr(all(test, feature = "std"), dto(ts(name = "OrderEconomicActor")))]
#[cfg_attr(
any(feature = "serde", test),
derive(serde::Serialize, serde::Deserialize)
)]
#[cfg_attr(any(feature = "serde", test), serde(rename_all = "snake_case"))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsOrderEconomicActor {
+pub enum OrderEconomicActor {
#[cfg_attr(any(feature = "serde", test), serde(rename = "buyer"))]
Buyer,
#[cfg_attr(any(feature = "serde", test), serde(rename = "seller"))]
@@ -79,17 +70,14 @@ pub enum RadrootsOrderEconomicActor {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
-#[cfg_attr(
- all(test, feature = "std"),
- dto(ts(name = "RadrootsOrderEconomicEffect"))
-)]
+#[cfg_attr(all(test, feature = "std"), dto(ts(name = "OrderEconomicEffect")))]
#[cfg_attr(
any(feature = "serde", test),
derive(serde::Serialize, serde::Deserialize)
)]
#[cfg_attr(any(feature = "serde", test), serde(rename_all = "snake_case"))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsOrderEconomicEffect {
+pub enum OrderEconomicEffect {
#[cfg_attr(any(feature = "serde", test), serde(rename = "increase"))]
Increase,
#[cfg_attr(any(feature = "serde", test), serde(rename = "decrease"))]
@@ -103,8 +91,8 @@ pub enum RadrootsOrderEconomicEffect {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsOrderEconomicItem {
- pub bin_id: RadrootsInventoryBinId,
+pub struct OrderEconomicItem {
+ pub bin_id: InventoryBinId,
pub bin_count: u32,
#[cfg_attr(all(test, feature = "std"), dto(ts(type = "Decimal")))]
pub quantity_amount: Decimal,
@@ -120,20 +108,17 @@ pub struct RadrootsOrderEconomicItem {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
-#[cfg_attr(
- all(test, feature = "std"),
- dto(ts(name = "RadrootsOrderEconomicLine"))
-)]
+#[cfg_attr(all(test, feature = "std"), dto(ts(name = "OrderEconomicLine")))]
#[cfg_attr(
any(feature = "serde", test),
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsOrderEconomicLine {
+pub struct OrderEconomicLine {
pub id: String,
- pub kind: RadrootsOrderEconomicLineKind,
- pub actor: RadrootsOrderEconomicActor,
- pub effect: RadrootsOrderEconomicEffect,
+ pub kind: OrderEconomicLineKind,
+ pub actor: OrderEconomicActor,
+ pub effect: OrderEconomicEffect,
#[cfg_attr(all(test, feature = "std"), dto(ts(type = "Money")))]
pub amount: Money,
pub reason: String,
@@ -141,16 +126,13 @@ pub struct RadrootsOrderEconomicLine {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
-#[cfg_attr(
- all(test, feature = "std"),
- dto(ts(name = "RadrootsOrderEconomicTotals"))
-)]
+#[cfg_attr(all(test, feature = "std"), dto(ts(name = "OrderEconomicTotals")))]
#[cfg_attr(
any(feature = "serde", test),
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsOrderEconomicTotals {
+pub struct OrderEconomicTotals {
#[cfg_attr(all(test, feature = "std"), dto(ts(type = "Money")))]
pub subtotal: Money,
#[cfg_attr(all(test, feature = "std"), dto(ts(type = "Money")))]
@@ -168,15 +150,15 @@ pub struct RadrootsOrderEconomicTotals {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsOrderEconomics {
- pub quote_id: RadrootsOrderQuoteId,
+pub struct OrderEconomics {
+ pub quote_id: OrderQuoteId,
pub quote_version: u32,
- pub pricing_basis: RadrootsOrderPricingBasis,
+ pub pricing_basis: OrderPricingBasis,
#[cfg_attr(all(test, feature = "std"), dto(ts(type = "Currency")))]
pub currency: Currency,
- pub items: Vec<RadrootsOrderEconomicItem>,
- pub discounts: Vec<RadrootsOrderEconomicLine>,
- pub adjustments: Vec<RadrootsOrderEconomicLine>,
+ pub items: Vec<OrderEconomicItem>,
+ pub discounts: Vec<OrderEconomicLine>,
+ pub adjustments: Vec<OrderEconomicLine>,
#[cfg_attr(all(test, feature = "std"), dto(ts(type = "Money")))]
pub subtotal: Money,
#[cfg_attr(all(test, feature = "std"), dto(ts(type = "Money")))]
diff --git a/crates/event/src/plot.rs b/crates/event/src/plot.rs
@@ -1,4 +1,4 @@
-use crate::{farm::RadrootsFarmRef, farm::change_set::RadrootsGcsLocation};
+use crate::{farm::FarmRef, farm::change_set::GcsLocation};
#[cfg(not(feature = "std"))]
use alloc::{string::String, vec::Vec};
@@ -10,7 +10,7 @@ use alloc::{string::String, vec::Vec};
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsPlotRef {
+pub struct PlotRef {
pub pubkey: String,
pub d_tag: String,
}
@@ -22,12 +22,12 @@ pub struct RadrootsPlotRef {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsPlot {
+pub struct Plot {
pub d_tag: String,
- pub farm: RadrootsFarmRef,
+ pub farm: FarmRef,
pub name: String,
pub about: Option<String>,
- pub location: Option<RadrootsPlotLocation>,
+ pub location: Option<PlotLocation>,
pub tags: Option<Vec<String>>,
}
@@ -38,10 +38,10 @@ pub struct RadrootsPlot {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsPlotLocation {
+pub struct PlotLocation {
pub primary: Option<String>,
pub city: Option<String>,
pub region: Option<String>,
pub country: Option<String>,
- pub gcs: RadrootsGcsLocation,
+ pub gcs: GcsLocation,
}
diff --git a/crates/event/src/post.rs b/crates/event/src/post.rs
@@ -7,11 +7,7 @@ use core::fmt;
use radroots_blossom::url::ApprovedBlobUrl;
use url_nostd::Url;
-use crate::media::RadrootsAuthoredImage;
-use crate::social::{
- RadrootsSocialFarmAnchor, RadrootsSocialLocation, RadrootsSocialMediaMetadata,
- RadrootsSocialTarget,
-};
+use crate::media::AuthoredImage;
use crate::tag::name::TAG_IMETA;
pub const RADROOTS_POST_CONTENT_MAX_BYTES: usize = crate::wire::v1::DEFAULT_CONTENT_MAX_BYTES;
@@ -38,55 +34,9 @@ const RADROOTS_POST_SIGNED_EVENT_FIXED_MAX_BYTES: usize = "{\"id\":\"".len()
+ 128
+ "\"}".len();
-#[cfg_attr(
- any(feature = "serde", test),
- derive(serde::Serialize, serde::Deserialize)
-)]
-#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
-#[cfg_attr(all(test, feature = "std"), dto(export))]
-#[derive(Clone, Debug)]
-/// Compatibility projection for the legacy social post decoder.
-///
-/// This mutable model is not an authored event boundary. New publication code
-/// must use `RadrootsAuthoredUpdate`, `RadrootsAuthoredPhotoUpdate`, or
-/// `RadrootsAuthoredAsk` so raw `imeta` cannot bypass the strict profile.
-pub struct RadrootsPost {
- pub content: String,
- #[cfg_attr(
- feature = "serde",
- serde(default, skip_serializing_if = "Option::is_none")
- )]
- pub farm: Option<RadrootsSocialFarmAnchor>,
- #[cfg_attr(
- feature = "serde",
- serde(default, skip_serializing_if = "Option::is_none")
- )]
- pub address_refs: Option<Vec<RadrootsSocialTarget>>,
- #[cfg_attr(
- feature = "serde",
- serde(default, skip_serializing_if = "Option::is_none")
- )]
- pub location: Option<RadrootsSocialLocation>,
- #[cfg_attr(
- feature = "serde",
- serde(default, skip_serializing_if = "Option::is_none")
- )]
- pub topics: Option<Vec<String>>,
- #[cfg_attr(
- feature = "serde",
- serde(default, skip_serializing_if = "Option::is_none")
- )]
- pub quote_refs: Option<Vec<RadrootsSocialTarget>>,
- #[cfg_attr(
- feature = "serde",
- serde(default, skip_serializing_if = "Option::is_none")
- )]
- pub media: Option<Vec<RadrootsSocialMediaMetadata>>,
-}
-
#[non_exhaustive]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsAuthoredPostError {
+pub enum AuthoredPostError {
ContentMissing,
ContentTooLarge { max: usize, actual: usize },
ImageMissing,
@@ -104,7 +54,7 @@ pub enum RadrootsAuthoredPostError {
EventWireTooLarge { max: usize, actual: usize },
}
-impl RadrootsAuthoredPostError {
+impl AuthoredPostError {
pub const fn code(&self) -> &'static str {
match self {
Self::ContentMissing => "post_content_missing",
@@ -126,7 +76,7 @@ impl RadrootsAuthoredPostError {
}
}
-impl fmt::Display for RadrootsAuthoredPostError {
+impl fmt::Display for AuthoredPostError {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::ContentMissing => {
@@ -192,19 +142,19 @@ impl fmt::Display for RadrootsAuthoredPostError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsAuthoredPostError {}
+impl std::error::Error for AuthoredPostError {}
/// Nonzero pixel dimensions for one strict authored NIP-92 image.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub struct RadrootsPostImageDimensions {
+pub struct PostImageDimensions {
width: u32,
height: u32,
}
-impl RadrootsPostImageDimensions {
- pub const fn new(width: u32, height: u32) -> Result<Self, RadrootsAuthoredPostError> {
+impl PostImageDimensions {
+ pub const fn new(width: u32, height: u32) -> Result<Self, AuthoredPostError> {
if width == 0 || height == 0 {
- return Err(RadrootsAuthoredPostError::ImageDimensionsInvalid);
+ return Err(AuthoredPostError::ImageDimensionsInvalid);
}
Ok(Self { width, height })
}
@@ -225,33 +175,33 @@ impl RadrootsPostImageDimensions {
/// network availability. Publication runtimes must separately require a
/// successful BUD-02 upload before signing.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsAuthoredPostImage {
- image: RadrootsAuthoredImage,
- dimensions: RadrootsPostImageDimensions,
+pub struct AuthoredPostImage {
+ image: AuthoredImage,
+ dimensions: PostImageDimensions,
alt: String,
fallbacks: Vec<ApprovedBlobUrl>,
imeta_tag: Vec<String>,
}
-impl RadrootsAuthoredPostImage {
+impl AuthoredPostImage {
pub fn new(
- image: RadrootsAuthoredImage,
- dimensions: RadrootsPostImageDimensions,
+ image: AuthoredImage,
+ dimensions: PostImageDimensions,
alt: impl Into<String>,
- ) -> Result<Self, RadrootsAuthoredPostError> {
+ ) -> Result<Self, AuthoredPostError> {
let descriptor = image.descriptor();
if descriptor.size() == 0 {
- return Err(RadrootsAuthoredPostError::ImageSizeInvalid);
+ return Err(AuthoredPostError::ImageSizeInvalid);
}
if !post_image_media_type_is_valid(descriptor.media_type().as_str()) {
- return Err(RadrootsAuthoredPostError::ImageMediaTypeInvalid);
+ return Err(AuthoredPostError::ImageMediaTypeInvalid);
}
let alt = alt.into();
if alt.trim().is_empty() {
- return Err(RadrootsAuthoredPostError::ImageAltInvalid);
+ return Err(AuthoredPostError::ImageAltInvalid);
}
if alt.len() > RADROOTS_POST_ALT_MAX_BYTES {
- return Err(RadrootsAuthoredPostError::ImageAltTooLarge {
+ return Err(AuthoredPostError::ImageAltTooLarge {
max: RADROOTS_POST_ALT_MAX_BYTES,
actual: alt.len(),
});
@@ -270,9 +220,9 @@ impl RadrootsAuthoredPostImage {
pub fn try_with_fallback(
mut self,
fallback: ApprovedBlobUrl,
- ) -> Result<Self, RadrootsAuthoredPostError> {
+ ) -> Result<Self, AuthoredPostError> {
if fallback.as_blob_url().hash_path().hash() != self.image.descriptor().sha256() {
- return Err(RadrootsAuthoredPostError::ImageFallbackHashMismatch);
+ return Err(AuthoredPostError::ImageFallbackHashMismatch);
}
let fallback_element = format!("fallback {fallback}");
validate_tag_element(&fallback_element)?;
@@ -284,11 +234,11 @@ impl RadrootsAuthoredPostImage {
Ok(self)
}
- pub fn image(&self) -> &RadrootsAuthoredImage {
+ pub fn image(&self) -> &AuthoredImage {
&self.image
}
- pub const fn dimensions(&self) -> RadrootsPostImageDimensions {
+ pub const fn dimensions(&self) -> PostImageDimensions {
self.dimensions
}
@@ -313,16 +263,16 @@ impl RadrootsAuthoredPostImage {
/// Strict authored root kind-1 Update without Ask or media tags.
///
/// ```compile_fail
-/// let _: radroots_event::post::RadrootsAuthoredUpdate =
+/// let _: radroots_event::post::AuthoredUpdate =
/// serde_json::from_str(r#"{"content":"harvest"}"#).unwrap();
/// ```
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsAuthoredUpdate {
+pub struct AuthoredUpdate {
content: String,
}
-impl RadrootsAuthoredUpdate {
- pub fn new(content: impl Into<String>) -> Result<Self, RadrootsAuthoredPostError> {
+impl AuthoredUpdate {
+ pub fn new(content: impl Into<String>) -> Result<Self, AuthoredPostError> {
let content = content.into();
validate_authored_root_content(&content)?;
validate_post_event_wire_size(&content, false, &[])?;
@@ -336,16 +286,16 @@ impl RadrootsAuthoredUpdate {
/// Strict authored root kind-1 PhotoUpdate with deterministic NIP-92 tags.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsAuthoredPhotoUpdate {
+pub struct AuthoredPhotoUpdate {
content: String,
- images: Vec<RadrootsAuthoredPostImage>,
+ images: Vec<AuthoredPostImage>,
}
-impl RadrootsAuthoredPhotoUpdate {
+impl AuthoredPhotoUpdate {
pub fn new(
content: impl Into<String>,
- images: Vec<RadrootsAuthoredPostImage>,
- ) -> Result<Self, RadrootsAuthoredPostError> {
+ images: Vec<AuthoredPostImage>,
+ ) -> Result<Self, AuthoredPostError> {
let content = content.into();
validate_content_size(&content)?;
validate_authored_images(&content, &images, 0)?;
@@ -357,27 +307,27 @@ impl RadrootsAuthoredPhotoUpdate {
&self.content
}
- pub fn images(&self) -> &[RadrootsAuthoredPostImage] {
+ pub fn images(&self) -> &[AuthoredPostImage] {
&self.images
}
}
/// Strict authored root kind-1 Ask with its exact product marker.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsAuthoredAsk {
+pub struct AuthoredAsk {
content: String,
- images: Vec<RadrootsAuthoredPostImage>,
+ images: Vec<AuthoredPostImage>,
}
-impl RadrootsAuthoredAsk {
+impl AuthoredAsk {
pub fn new(
content: impl Into<String>,
- images: Vec<RadrootsAuthoredPostImage>,
- ) -> Result<Self, RadrootsAuthoredPostError> {
+ images: Vec<AuthoredPostImage>,
+ ) -> Result<Self, AuthoredPostError> {
let content = content.into();
validate_authored_root_content(&content)?;
if images.len() > RADROOTS_POST_IMETA_MAX_COUNT {
- return Err(RadrootsAuthoredPostError::ImageCountExceeded {
+ return Err(AuthoredPostError::ImageCountExceeded {
max: RADROOTS_POST_IMETA_MAX_COUNT,
actual: images.len(),
});
@@ -393,22 +343,22 @@ impl RadrootsAuthoredAsk {
&self.content
}
- pub fn images(&self) -> &[RadrootsAuthoredPostImage] {
+ pub fn images(&self) -> &[AuthoredPostImage] {
&self.images
}
}
-fn validate_authored_root_content(content: &str) -> Result<(), RadrootsAuthoredPostError> {
+fn validate_authored_root_content(content: &str) -> Result<(), AuthoredPostError> {
validate_content_size(content)?;
if content.trim().is_empty() {
- return Err(RadrootsAuthoredPostError::ContentMissing);
+ return Err(AuthoredPostError::ContentMissing);
}
Ok(())
}
-fn validate_content_size(content: &str) -> Result<(), RadrootsAuthoredPostError> {
+fn validate_content_size(content: &str) -> Result<(), AuthoredPostError> {
if content.len() > RADROOTS_POST_CONTENT_MAX_BYTES {
- return Err(RadrootsAuthoredPostError::ContentTooLarge {
+ return Err(AuthoredPostError::ContentTooLarge {
max: RADROOTS_POST_CONTENT_MAX_BYTES,
actual: content.len(),
});
@@ -418,27 +368,27 @@ fn validate_content_size(content: &str) -> Result<(), RadrootsAuthoredPostError>
fn validate_authored_images(
content: &str,
- images: &[RadrootsAuthoredPostImage],
+ images: &[AuthoredPostImage],
initial_tag_bytes: usize,
-) -> Result<(), RadrootsAuthoredPostError> {
+) -> Result<(), AuthoredPostError> {
if images.is_empty() {
- return Err(RadrootsAuthoredPostError::ImageMissing);
+ return Err(AuthoredPostError::ImageMissing);
}
if images.len() > RADROOTS_POST_IMETA_MAX_COUNT {
- return Err(RadrootsAuthoredPostError::ImageCountExceeded {
+ return Err(AuthoredPostError::ImageCountExceeded {
max: RADROOTS_POST_IMETA_MAX_COUNT,
actual: images.len(),
});
}
for (index, image) in images.iter().enumerate() {
if !content.contains(image.url()) {
- return Err(RadrootsAuthoredPostError::ImageUrlMissingFromContent);
+ return Err(AuthoredPostError::ImageUrlMissingFromContent);
}
if images[..index]
.iter()
.any(|candidate| candidate.url() == image.url())
{
- return Err(RadrootsAuthoredPostError::DuplicateImageUrl);
+ return Err(AuthoredPostError::DuplicateImageUrl);
}
}
let total_tag_bytes = images.iter().fold(initial_tag_bytes, |total, image| {
@@ -449,11 +399,11 @@ fn validate_authored_images(
}
fn derive_imeta_tag(
- image: &RadrootsAuthoredImage,
- dimensions: RadrootsPostImageDimensions,
+ image: &AuthoredImage,
+ dimensions: PostImageDimensions,
alt: &str,
fallbacks: &[ApprovedBlobUrl],
-) -> Result<Vec<String>, RadrootsAuthoredPostError> {
+) -> Result<Vec<String>, AuthoredPostError> {
let descriptor = image.descriptor();
let mut tag = Vec::with_capacity(7 + fallbacks.len());
tag.push(TAG_IMETA.into());
@@ -479,9 +429,9 @@ fn derive_imeta_tag(
Ok(tag)
}
-fn validate_tag_element(element: &str) -> Result<(), RadrootsAuthoredPostError> {
+fn validate_tag_element(element: &str) -> Result<(), AuthoredPostError> {
if element.len() > RADROOTS_POST_TAG_ELEMENT_MAX_BYTES {
- return Err(RadrootsAuthoredPostError::TagElementTooLarge {
+ return Err(AuthoredPostError::TagElementTooLarge {
max: RADROOTS_POST_TAG_ELEMENT_MAX_BYTES,
actual: element.len(),
});
@@ -489,9 +439,9 @@ fn validate_tag_element(element: &str) -> Result<(), RadrootsAuthoredPostError>
Ok(())
}
-fn validate_tag_bytes(actual: usize) -> Result<(), RadrootsAuthoredPostError> {
+fn validate_tag_bytes(actual: usize) -> Result<(), AuthoredPostError> {
if actual > RADROOTS_POST_TAG_TOTAL_MAX_BYTES {
- return Err(RadrootsAuthoredPostError::TagBytesExceeded {
+ return Err(AuthoredPostError::TagBytesExceeded {
max: RADROOTS_POST_TAG_TOTAL_MAX_BYTES,
actual,
});
@@ -507,8 +457,8 @@ fn imeta_tag_bytes(tag: &[String]) -> usize {
fn validate_post_event_wire_size(
content: &str,
ask_marker: bool,
- images: &[RadrootsAuthoredPostImage],
-) -> Result<(), RadrootsAuthoredPostError> {
+ images: &[AuthoredPostImage],
+) -> Result<(), AuthoredPostError> {
let mut tags_json_bytes = 2usize;
let mut tag_count = 0usize;
if ask_marker {
@@ -529,7 +479,7 @@ fn validate_post_event_wire_size(
.saturating_add(tags_json_bytes)
.saturating_add(canonical_json_string_bytes(content));
if actual > RADROOTS_POST_EVENT_WIRE_MAX_BYTES {
- return Err(RadrootsAuthoredPostError::EventWireTooLarge {
+ return Err(AuthoredPostError::EventWireTooLarge {
max: RADROOTS_POST_EVENT_WIRE_MAX_BYTES,
actual,
});
@@ -621,36 +571,6 @@ mod tests {
use super::*;
#[test]
- fn content_only_post_deserializes_without_social_metadata() {
- let post: RadrootsPost =
- serde_json::from_str(r#"{"content":"farm update"}"#).expect("post");
-
- assert_eq!(post.content, "farm update");
- assert!(post.farm.is_none());
- assert!(post.address_refs.is_none());
- assert!(post.location.is_none());
- assert!(post.topics.is_none());
- assert!(post.quote_refs.is_none());
- assert!(post.media.is_none());
- }
-
- #[test]
- fn content_only_post_serializes_without_null_social_metadata() {
- let post = RadrootsPost {
- content: "farm update".to_string(),
- farm: None,
- address_refs: None,
- location: None,
- topics: None,
- quote_refs: None,
- media: None,
- };
-
- let json = serde_json::to_string(&post).expect("json");
- assert_eq!(json, r#"{"content":"farm update"}"#);
- }
-
- #[test]
fn post_image_media_type_uses_exact_product_grammar() {
for valid in [
"image/png",
diff --git a/crates/event/src/profile.rs b/crates/event/src/profile.rs
@@ -4,7 +4,7 @@
use alloc::string::String;
use core::{fmt, str::FromStr};
-use crate::media::RadrootsAuthoredImage;
+use crate::media::AuthoredImage;
pub const RADROOTS_PROFILE_TYPE_TAG_KEY: &str = "t";
pub const RADROOTS_PROFILE_TYPE_TAG_INDIVIDUAL: &str = "radroots:type:individual";
@@ -23,7 +23,7 @@ pub const RADROOTS_PROFILE_METADATA_MAX_CONTENT_BYTES: usize =
)]
#[cfg_attr(any(feature = "serde", test), serde(rename_all = "snake_case"))]
#[derive(Clone, Debug, PartialEq, Eq, Copy)]
-pub enum RadrootsProfileType {
+pub enum ProfileType {
#[cfg_attr(any(feature = "serde", test), serde(rename = "individual"))]
Individual,
#[cfg_attr(any(feature = "serde", test), serde(rename = "farm"))]
@@ -36,58 +36,37 @@ pub enum RadrootsProfileType {
Radrootsd,
}
-pub fn radroots_profile_type_tag_value(profile_type: RadrootsProfileType) -> &'static str {
+pub fn radroots_profile_type_tag_value(profile_type: ProfileType) -> &'static str {
match profile_type {
- RadrootsProfileType::Individual => RADROOTS_PROFILE_TYPE_TAG_INDIVIDUAL,
- RadrootsProfileType::Farm => RADROOTS_PROFILE_TYPE_TAG_FARM,
- RadrootsProfileType::Coop => RADROOTS_PROFILE_TYPE_TAG_COOP,
- RadrootsProfileType::Any => RADROOTS_PROFILE_TYPE_TAG_ANY,
- RadrootsProfileType::Radrootsd => RADROOTS_PROFILE_TYPE_TAG_RADROOTSD,
+ ProfileType::Individual => RADROOTS_PROFILE_TYPE_TAG_INDIVIDUAL,
+ ProfileType::Farm => RADROOTS_PROFILE_TYPE_TAG_FARM,
+ ProfileType::Coop => RADROOTS_PROFILE_TYPE_TAG_COOP,
+ ProfileType::Any => RADROOTS_PROFILE_TYPE_TAG_ANY,
+ ProfileType::Radrootsd => RADROOTS_PROFILE_TYPE_TAG_RADROOTSD,
}
}
-pub fn radroots_profile_type_from_tag_value(value: &str) -> Option<RadrootsProfileType> {
+pub fn radroots_profile_type_from_tag_value(value: &str) -> Option<ProfileType> {
match value {
- RADROOTS_PROFILE_TYPE_TAG_INDIVIDUAL => Some(RadrootsProfileType::Individual),
- RADROOTS_PROFILE_TYPE_TAG_FARM => Some(RadrootsProfileType::Farm),
- RADROOTS_PROFILE_TYPE_TAG_COOP => Some(RadrootsProfileType::Coop),
- RADROOTS_PROFILE_TYPE_TAG_ANY => Some(RadrootsProfileType::Any),
- RADROOTS_PROFILE_TYPE_TAG_RADROOTSD => Some(RadrootsProfileType::Radrootsd),
+ RADROOTS_PROFILE_TYPE_TAG_INDIVIDUAL => Some(ProfileType::Individual),
+ RADROOTS_PROFILE_TYPE_TAG_FARM => Some(ProfileType::Farm),
+ RADROOTS_PROFILE_TYPE_TAG_COOP => Some(ProfileType::Coop),
+ RADROOTS_PROFILE_TYPE_TAG_ANY => Some(ProfileType::Any),
+ RADROOTS_PROFILE_TYPE_TAG_RADROOTSD => Some(ProfileType::Radrootsd),
_ => None,
}
}
-#[cfg_attr(any(feature = "serde", test), derive(serde::Deserialize))]
-/// Read-only compatibility projection used by legacy inbound codecs.
-///
-/// This type deliberately has no serializer or DTO export. Its media fields are
-/// unverified strings and its `bot` field is not a JSON Boolean, so it must not
-/// cross an authored or publication boundary. New reads use the tolerant
-/// inbound metadata model; new authoring must use `RadrootsAuthoredProfile`.
-#[derive(Clone, Debug)]
-pub struct RadrootsProfile {
- pub name: String,
- pub display_name: Option<String>,
- pub nip05: Option<String>,
- pub about: Option<String>,
- pub website: Option<String>,
- pub picture: Option<String>,
- pub banner: Option<String>,
- pub lud06: Option<String>,
- pub lud16: Option<String>,
- pub bot: Option<String>,
-}
-
#[non_exhaustive]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsNip05IdentifierError {
+pub enum Nip05IdentifierError {
MissingSeparator,
MultipleSeparators,
InvalidLocalPart,
InvalidDomain,
}
-impl RadrootsNip05IdentifierError {
+impl Nip05IdentifierError {
pub const fn code(&self) -> &'static str {
match self {
Self::MissingSeparator => "missing_separator",
@@ -98,7 +77,7 @@ impl RadrootsNip05IdentifierError {
}
}
-impl fmt::Display for RadrootsNip05IdentifierError {
+impl fmt::Display for Nip05IdentifierError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::MissingSeparator => f.write_str("NIP-05 identifier must contain one @ separator"),
@@ -112,22 +91,22 @@ impl fmt::Display for RadrootsNip05IdentifierError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsNip05IdentifierError {}
+impl std::error::Error for Nip05IdentifierError {}
/// A syntax-checked NIP-05 internet identifier.
///
/// The DNS domain is canonicalized to lowercase. This type performs no network
/// resolution and makes no identity-verification claim.
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct RadrootsNip05Identifier(String);
+pub struct Nip05Identifier(String);
-impl RadrootsNip05Identifier {
- pub fn parse(value: &str) -> Result<Self, RadrootsNip05IdentifierError> {
+impl Nip05Identifier {
+ pub fn parse(value: &str) -> Result<Self, Nip05IdentifierError> {
let Some((local_part, domain)) = value.split_once('@') else {
- return Err(RadrootsNip05IdentifierError::MissingSeparator);
+ return Err(Nip05IdentifierError::MissingSeparator);
};
if domain.contains('@') {
- return Err(RadrootsNip05IdentifierError::MultipleSeparators);
+ return Err(Nip05IdentifierError::MultipleSeparators);
}
if local_part.is_empty()
|| !local_part.bytes().all(|byte| {
@@ -136,11 +115,11 @@ impl RadrootsNip05Identifier {
|| matches!(byte, b'-' | b'_' | b'.')
})
{
- return Err(RadrootsNip05IdentifierError::InvalidLocalPart);
+ return Err(Nip05IdentifierError::InvalidLocalPart);
}
let domain = domain.to_ascii_lowercase();
if !valid_nip05_domain(&domain) {
- return Err(RadrootsNip05IdentifierError::InvalidDomain);
+ return Err(Nip05IdentifierError::InvalidDomain);
}
let mut canonical = String::with_capacity(value.len());
canonical.push_str(local_part);
@@ -168,14 +147,14 @@ impl RadrootsNip05Identifier {
}
}
-impl fmt::Display for RadrootsNip05Identifier {
+impl fmt::Display for Nip05Identifier {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.as_str())
}
}
-impl FromStr for RadrootsNip05Identifier {
- type Err = RadrootsNip05IdentifierError;
+impl FromStr for Nip05Identifier {
+ type Err = Nip05IdentifierError;
fn from_str(value: &str) -> Result<Self, Self::Err> {
Self::parse(value)
@@ -204,11 +183,11 @@ fn valid_nip05_domain(domain: &str) -> bool {
#[non_exhaustive]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsAuthoredProfileError {
+pub enum AuthoredProfileError {
InvalidName,
}
-impl RadrootsAuthoredProfileError {
+impl AuthoredProfileError {
pub const fn code(&self) -> &'static str {
match self {
Self::InvalidName => "invalid_name",
@@ -216,7 +195,7 @@ impl RadrootsAuthoredProfileError {
}
}
-impl fmt::Display for RadrootsAuthoredProfileError {
+impl fmt::Display for AuthoredProfileError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::InvalidName => {
@@ -227,7 +206,7 @@ impl fmt::Display for RadrootsAuthoredProfileError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsAuthoredProfileError {}
+impl std::error::Error for AuthoredProfileError {}
/// Metadata accepted by the strict authored kind-0 Profile operation.
///
@@ -239,25 +218,25 @@ impl std::error::Error for RadrootsAuthoredProfileError {}
/// Omitting an existing field removes it from the authored replacement.
///
/// ```compile_fail
-/// let _: radroots_event::profile::RadrootsAuthoredProfile =
+/// let _: radroots_event::profile::AuthoredProfile =
/// serde_json::from_str(r#"{"name":"alice"}"#).unwrap();
/// ```
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsAuthoredProfile {
+pub struct AuthoredProfile {
name: String,
display_name: Option<String>,
about: Option<String>,
- picture: Option<RadrootsAuthoredImage>,
- banner: Option<RadrootsAuthoredImage>,
- nip05: Option<RadrootsNip05Identifier>,
+ picture: Option<AuthoredImage>,
+ banner: Option<AuthoredImage>,
+ nip05: Option<Nip05Identifier>,
bot: Option<bool>,
}
-impl RadrootsAuthoredProfile {
- pub fn new(name: impl Into<String>) -> Result<Self, RadrootsAuthoredProfileError> {
+impl AuthoredProfile {
+ pub fn new(name: impl Into<String>) -> Result<Self, AuthoredProfileError> {
let name = name.into();
if name.trim().is_empty() || name.chars().any(char::is_control) {
- return Err(RadrootsAuthoredProfileError::InvalidName);
+ return Err(AuthoredProfileError::InvalidName);
}
Ok(Self {
name,
@@ -283,19 +262,19 @@ impl RadrootsAuthoredProfile {
}
#[must_use]
- pub fn with_picture(mut self, value: RadrootsAuthoredImage) -> Self {
+ pub fn with_picture(mut self, value: AuthoredImage) -> Self {
self.picture = Some(value);
self
}
#[must_use]
- pub fn with_banner(mut self, value: RadrootsAuthoredImage) -> Self {
+ pub fn with_banner(mut self, value: AuthoredImage) -> Self {
self.banner = Some(value);
self
}
#[must_use]
- pub fn with_nip05(mut self, value: RadrootsNip05Identifier) -> Self {
+ pub fn with_nip05(mut self, value: Nip05Identifier) -> Self {
self.nip05 = Some(value);
self
}
@@ -318,15 +297,15 @@ impl RadrootsAuthoredProfile {
self.about.as_deref()
}
- pub fn picture(&self) -> Option<&RadrootsAuthoredImage> {
+ pub fn picture(&self) -> Option<&AuthoredImage> {
self.picture.as_ref()
}
- pub fn banner(&self) -> Option<&RadrootsAuthoredImage> {
+ pub fn banner(&self) -> Option<&AuthoredImage> {
self.banner.as_ref()
}
- pub fn nip05(&self) -> Option<&RadrootsNip05Identifier> {
+ pub fn nip05(&self) -> Option<&Nip05Identifier> {
self.nip05.as_ref()
}
@@ -343,23 +322,23 @@ mod tests {
#[test]
fn maps_profile_type_to_tag_value() {
assert_eq!(
- radroots_profile_type_tag_value(RadrootsProfileType::Individual),
+ radroots_profile_type_tag_value(ProfileType::Individual),
RADROOTS_PROFILE_TYPE_TAG_INDIVIDUAL
);
assert_eq!(
- radroots_profile_type_tag_value(RadrootsProfileType::Farm),
+ radroots_profile_type_tag_value(ProfileType::Farm),
RADROOTS_PROFILE_TYPE_TAG_FARM
);
assert_eq!(
- radroots_profile_type_tag_value(RadrootsProfileType::Coop),
+ radroots_profile_type_tag_value(ProfileType::Coop),
RADROOTS_PROFILE_TYPE_TAG_COOP
);
assert_eq!(
- radroots_profile_type_tag_value(RadrootsProfileType::Any),
+ radroots_profile_type_tag_value(ProfileType::Any),
RADROOTS_PROFILE_TYPE_TAG_ANY
);
assert_eq!(
- radroots_profile_type_tag_value(RadrootsProfileType::Radrootsd),
+ radroots_profile_type_tag_value(ProfileType::Radrootsd),
RADROOTS_PROFILE_TYPE_TAG_RADROOTSD
);
}
@@ -368,23 +347,23 @@ mod tests {
fn maps_tag_value_to_profile_type() {
assert_eq!(
radroots_profile_type_from_tag_value(RADROOTS_PROFILE_TYPE_TAG_INDIVIDUAL),
- Some(RadrootsProfileType::Individual)
+ Some(ProfileType::Individual)
);
assert_eq!(
radroots_profile_type_from_tag_value(RADROOTS_PROFILE_TYPE_TAG_FARM),
- Some(RadrootsProfileType::Farm)
+ Some(ProfileType::Farm)
);
assert_eq!(
radroots_profile_type_from_tag_value(RADROOTS_PROFILE_TYPE_TAG_COOP),
- Some(RadrootsProfileType::Coop)
+ Some(ProfileType::Coop)
);
assert_eq!(
radroots_profile_type_from_tag_value(RADROOTS_PROFILE_TYPE_TAG_ANY),
- Some(RadrootsProfileType::Any)
+ Some(ProfileType::Any)
);
assert_eq!(
radroots_profile_type_from_tag_value(RADROOTS_PROFILE_TYPE_TAG_RADROOTSD),
- Some(RadrootsProfileType::Radrootsd)
+ Some(ProfileType::Radrootsd)
);
assert_eq!(radroots_profile_type_from_tag_value("unknown"), None);
}
@@ -402,16 +381,13 @@ mod tests {
("alice@xn--bcher-kva.example", "alice@xn--bcher-kva.example"),
("alice@Example.COM", "alice@example.com"),
] {
- let identifier = RadrootsNip05Identifier::parse(value).unwrap();
+ let identifier = Nip05Identifier::parse(value).unwrap();
assert_eq!(identifier.as_str(), canonical);
assert_eq!(identifier.to_string(), canonical);
- assert_eq!(
- canonical.parse::<RadrootsNip05Identifier>().unwrap(),
- identifier
- );
+ assert_eq!(canonical.parse::<Nip05Identifier>().unwrap(), identifier);
}
- let identifier = RadrootsNip05Identifier::parse("alice@example.com").unwrap();
+ let identifier = Nip05Identifier::parse("alice@example.com").unwrap();
assert_eq!(identifier.local_part(), "alice");
assert_eq!(identifier.domain(), "example.com");
}
@@ -419,48 +395,27 @@ mod tests {
#[test]
fn nip05_identifier_rejects_noncanonical_or_ambiguous_syntax() {
let cases = [
- ("alice", RadrootsNip05IdentifierError::MissingSeparator),
+ ("alice", Nip05IdentifierError::MissingSeparator),
(
"alice@example.com@other.example",
- RadrootsNip05IdentifierError::MultipleSeparators,
- ),
- (
- "@example.com",
- RadrootsNip05IdentifierError::InvalidLocalPart,
- ),
- (
- "Alice@example.com",
- RadrootsNip05IdentifierError::InvalidLocalPart,
+ Nip05IdentifierError::MultipleSeparators,
),
+ ("@example.com", Nip05IdentifierError::InvalidLocalPart),
+ ("Alice@example.com", Nip05IdentifierError::InvalidLocalPart),
(
"alice+farm@example.com",
- RadrootsNip05IdentifierError::InvalidLocalPart,
- ),
- ("alice@", RadrootsNip05IdentifierError::InvalidDomain),
- (
- "alice@-example.com",
- RadrootsNip05IdentifierError::InvalidDomain,
- ),
- (
- "alice@example-.com",
- RadrootsNip05IdentifierError::InvalidDomain,
- ),
- (
- "alice@example..com",
- RadrootsNip05IdentifierError::InvalidDomain,
- ),
- (
- "alice@example.com.",
- RadrootsNip05IdentifierError::InvalidDomain,
- ),
- (
- "alice@example_com",
- RadrootsNip05IdentifierError::InvalidDomain,
+ Nip05IdentifierError::InvalidLocalPart,
),
+ ("alice@", Nip05IdentifierError::InvalidDomain),
+ ("alice@-example.com", Nip05IdentifierError::InvalidDomain),
+ ("alice@example-.com", Nip05IdentifierError::InvalidDomain),
+ ("alice@example..com", Nip05IdentifierError::InvalidDomain),
+ ("alice@example.com.", Nip05IdentifierError::InvalidDomain),
+ ("alice@example_com", Nip05IdentifierError::InvalidDomain),
];
for (value, expected) in cases {
- let error = RadrootsNip05Identifier::parse(value).unwrap_err();
+ let error = Nip05Identifier::parse(value).unwrap_err();
assert_eq!(error, expected, "{value}");
assert!(!error.code().is_empty());
assert!(!error.to_string().is_empty());
@@ -468,35 +423,34 @@ mod tests {
let long_label = "a".repeat(64);
assert_eq!(
- RadrootsNip05Identifier::parse(&format!("alice@{long_label}.example")),
- Err(RadrootsNip05IdentifierError::InvalidDomain)
+ Nip05Identifier::parse(&format!("alice@{long_label}.example")),
+ Err(Nip05IdentifierError::InvalidDomain)
);
let long_domain = (0..43).map(|_| "aaaaa").collect::<Vec<_>>().join(".");
assert!(long_domain.len() > 253);
assert_eq!(
- RadrootsNip05Identifier::parse(&format!("alice@{long_domain}")),
- Err(RadrootsNip05IdentifierError::InvalidDomain)
+ Nip05Identifier::parse(&format!("alice@{long_domain}")),
+ Err(Nip05IdentifierError::InvalidDomain)
);
}
#[test]
fn authored_profile_requires_name_and_image_only_verified_media() {
- let media =
- RadrootsAuthoredImage::try_from(verified_descriptor("image/webp", "webp")).unwrap();
- let profile = RadrootsAuthoredProfile::new("alice")
+ let media = AuthoredImage::try_from(verified_descriptor("image/webp", "webp")).unwrap();
+ let profile = AuthoredProfile::new("alice")
.unwrap()
.with_display_name("Alice")
.with_about("Victoria grower")
.with_picture(media.clone())
.with_banner(media)
- .with_nip05(RadrootsNip05Identifier::parse("alice@example.com").unwrap())
+ .with_nip05(Nip05Identifier::parse("alice@example.com").unwrap())
.with_bot(false);
assert_eq!(profile.name(), "alice");
assert_eq!(profile.display_name(), Some("Alice"));
assert_eq!(profile.about(), Some("Victoria grower"));
assert_eq!(
- profile.nip05().map(RadrootsNip05Identifier::as_str),
+ profile.nip05().map(Nip05Identifier::as_str),
Some("alice@example.com")
);
assert_eq!(profile.bot(), Some(false));
@@ -517,18 +471,14 @@ mod tests {
.map(|value| value.descriptor().url().as_str())
);
- let error =
- RadrootsAuthoredImage::try_from(verified_descriptor("text/plain", "txt")).unwrap_err();
- assert_eq!(
- error,
- crate::media::RadrootsAuthoredImageError::MediaTypeNotImage
- );
+ let error = AuthoredImage::try_from(verified_descriptor("text/plain", "txt")).unwrap_err();
+ assert_eq!(error, crate::media::AuthoredImageError::MediaTypeNotImage);
assert_eq!(error.code(), "media_type_not_image");
assert!(!error.to_string().is_empty());
for invalid_name in ["", " ", "alice\n"] {
- let error = RadrootsAuthoredProfile::new(invalid_name).unwrap_err();
- assert_eq!(error, RadrootsAuthoredProfileError::InvalidName);
+ let error = AuthoredProfile::new(invalid_name).unwrap_err();
+ assert_eq!(error, AuthoredProfileError::InvalidName);
assert_eq!(error.code(), "invalid_name");
assert!(!error.to_string().is_empty());
}
diff --git a/crates/event/src/reaction.rs b/crates/event/src/reaction.rs
@@ -1,4 +1,4 @@
-use crate::social::RadrootsSocialTarget;
+use crate::social::SocialTarget;
#[cfg(not(feature = "std"))]
use alloc::string::String;
@@ -10,7 +10,7 @@ use alloc::string::String;
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug)]
-pub struct RadrootsReaction {
- pub target: RadrootsSocialTarget,
+pub struct Reaction {
+ pub target: SocialTarget,
pub content: String,
}
diff --git a/crates/event/src/relay_auth.rs b/crates/event/src/relay_auth.rs
@@ -12,7 +12,7 @@ pub const KIND_RELAY_AUTH: u32 = KIND_RELAY_AUTH_EVENT;
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsRelayAuth {
+pub struct RelayAuth {
pub relay: String,
pub challenge: String,
}
@@ -28,7 +28,7 @@ mod tests {
#[test]
fn relay_auth_serializes_nip42_tags() {
- let value = serde_json::to_value(RadrootsRelayAuth {
+ let value = serde_json::to_value(RelayAuth {
relay: "wss://relay.example.invalid/farm/ABCDEFGHIJKLMNOPQRSTUV".to_string(),
challenge: "relay-provided-challenge".to_string(),
})
diff --git a/crates/event/src/relay_document.rs b/crates/event/src/relay_document.rs
@@ -8,7 +8,7 @@ use alloc::{string::String, vec::Vec};
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsRelayDocument {
+pub struct RelayDocument {
#[cfg_attr(
any(feature = "serde", test),
serde(skip_serializing_if = "Option::is_none")
diff --git a/crates/event/src/relay_hint.rs b/crates/event/src/relay_hint.rs
@@ -2,20 +2,20 @@
use alloc::string::{String, ToString};
use core::{fmt, net::Ipv6Addr, str::FromStr};
-use crate::id::RadrootsIdParseError;
+use crate::id::ParseError;
/// One canonical, byte-stable Nostr relay hint.
///
/// This intentionally accepts a conservative subset of WebSocket URLs. It
/// does not inherit browser URL normalization, legacy IPv4 syntax, Unicode
/// host processing, user information, or fragments. It is separate from the
-/// generic [`crate::id::RadrootsRelayUrl`] type because protocol-tag
+/// generic [`crate::id::RelayUrl`] type because protocol-tag
/// validation must be portable across implementations.
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct RadrootsNostrRelayHint(String);
+pub struct NostrRelayHint(String);
-impl RadrootsNostrRelayHint {
- pub fn parse(value: impl AsRef<str>) -> Result<Self, RadrootsIdParseError> {
+impl NostrRelayHint {
+ pub fn parse(value: impl AsRef<str>) -> Result<Self, ParseError> {
validate_nostr_relay_hint(value.as_ref()).map(Self)
}
@@ -30,65 +30,65 @@ impl RadrootsNostrRelayHint {
}
}
-impl AsRef<str> for RadrootsNostrRelayHint {
+impl AsRef<str> for NostrRelayHint {
#[inline]
fn as_ref(&self) -> &str {
self.as_str()
}
}
-impl From<RadrootsNostrRelayHint> for String {
+impl From<NostrRelayHint> for String {
#[inline]
- fn from(value: RadrootsNostrRelayHint) -> Self {
+ fn from(value: NostrRelayHint) -> Self {
value.into_string()
}
}
-impl fmt::Display for RadrootsNostrRelayHint {
+impl fmt::Display for NostrRelayHint {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
formatter.write_str(self.as_str())
}
}
-impl FromStr for RadrootsNostrRelayHint {
- type Err = RadrootsIdParseError;
+impl FromStr for NostrRelayHint {
+ type Err = ParseError;
fn from_str(value: &str) -> Result<Self, Self::Err> {
Self::parse(value)
}
}
-impl TryFrom<&str> for RadrootsNostrRelayHint {
- type Error = RadrootsIdParseError;
+impl TryFrom<&str> for NostrRelayHint {
+ type Error = ParseError;
fn try_from(value: &str) -> Result<Self, Self::Error> {
Self::parse(value)
}
}
-impl TryFrom<String> for RadrootsNostrRelayHint {
- type Error = RadrootsIdParseError;
+impl TryFrom<String> for NostrRelayHint {
+ type Error = ParseError;
fn try_from(value: String) -> Result<Self, Self::Error> {
Self::parse(value)
}
}
-fn validate_nostr_relay_hint(value: &str) -> Result<String, RadrootsIdParseError> {
+fn validate_nostr_relay_hint(value: &str) -> Result<String, ParseError> {
if value.is_empty() {
- return Err(RadrootsIdParseError::Empty);
+ return Err(ParseError::Empty);
}
if !value.bytes().all(|byte| matches!(byte, 0x21..=0x7e)) {
- return Err(RadrootsIdParseError::InvalidCharacter);
+ return Err(ParseError::InvalidCharacter);
}
if value.bytes().any(|byte| matches!(byte, b'#' | b'\\')) {
- return Err(RadrootsIdParseError::InvalidFormat);
+ return Err(ParseError::InvalidFormat);
}
let remainder = value
.strip_prefix("wss://")
.or_else(|| value.strip_prefix("ws://"))
- .ok_or(RadrootsIdParseError::InvalidFormat)?;
+ .ok_or(ParseError::InvalidFormat)?;
let authority_end = remainder
.bytes()
.position(|byte| matches!(byte, b'/' | b'?'))
@@ -98,12 +98,12 @@ fn validate_nostr_relay_hint(value: &str) -> Result<String, RadrootsIdParseError
|| authority.bytes().any(|byte| byte == b'@')
|| matches!(remainder.as_bytes().first(), Some(b'/' | b'?'))
{
- return Err(RadrootsIdParseError::InvalidFormat);
+ return Err(ParseError::InvalidFormat);
}
if !relay_authority_is_valid(authority)
|| !relay_path_and_query_are_valid(&remainder[authority_end..])
{
- return Err(RadrootsIdParseError::InvalidFormat);
+ return Err(ParseError::InvalidFormat);
}
Ok(value.to_string())
}
@@ -334,7 +334,7 @@ fn upper_hex_digit(byte: u8) -> bool {
#[cfg(test)]
mod tests {
use super::*;
- use crate::id::RadrootsRelayUrl;
+ use crate::id::RelayUrl;
#[test]
fn canonical_relay_hints_accept_portable_hosts_paths_and_queries() {
@@ -348,14 +348,11 @@ mod tests {
"wss://relay.example:443?",
"wss://relay.example/a/b:@!$&'()*+,;=~_-?next=/feed??page=1",
] {
- let relay = RadrootsNostrRelayHint::parse(value)
+ let relay = NostrRelayHint::parse(value)
.unwrap_or_else(|error| panic!("{value} must be canonical: {error}"));
assert_eq!(relay.as_str(), value);
assert_eq!(relay.to_string(), value);
- assert_eq!(
- value.parse::<RadrootsNostrRelayHint>().expect("FromStr"),
- relay
- );
+ assert_eq!(value.parse::<NostrRelayHint>().expect("FromStr"), relay);
}
let maximum_host = format!(
@@ -366,15 +363,12 @@ mod tests {
"d".repeat(61)
);
assert_eq!(maximum_host.len(), 253);
- RadrootsNostrRelayHint::parse(format!("wss://{maximum_host}")).expect("253-byte DNS host");
+ NostrRelayHint::parse(format!("wss://{maximum_host}")).expect("253-byte DNS host");
}
#[test]
fn canonical_relay_hints_reject_normalizing_or_ambiguous_forms() {
- assert_eq!(
- RadrootsNostrRelayHint::parse("").unwrap_err(),
- RadrootsIdParseError::Empty
- );
+ assert_eq!(NostrRelayHint::parse("").unwrap_err(), ParseError::Empty);
for value in [
"WSS://relay.example",
"https://relay.example",
@@ -422,8 +416,8 @@ mod tests {
"wss://relay.example/%GG",
] {
assert_eq!(
- RadrootsNostrRelayHint::parse(value).unwrap_err(),
- RadrootsIdParseError::InvalidFormat,
+ NostrRelayHint::parse(value).unwrap_err(),
+ ParseError::InvalidFormat,
"{value}"
);
}
@@ -434,16 +428,16 @@ mod tests {
"wss://relay.example/é",
] {
assert_eq!(
- RadrootsNostrRelayHint::parse(value).unwrap_err(),
- RadrootsIdParseError::InvalidCharacter,
+ NostrRelayHint::parse(value).unwrap_err(),
+ ParseError::InvalidCharacter,
"{value}"
);
}
let label_too_long = "a".repeat(64);
assert_eq!(
- RadrootsNostrRelayHint::parse(format!("wss://{label_too_long}.example")).unwrap_err(),
- RadrootsIdParseError::InvalidFormat
+ NostrRelayHint::parse(format!("wss://{label_too_long}.example")).unwrap_err(),
+ ParseError::InvalidFormat
);
let host_too_long = format!(
"{}.{}.{}.{}",
@@ -454,14 +448,14 @@ mod tests {
);
assert_eq!(host_too_long.len(), 254);
assert_eq!(
- RadrootsNostrRelayHint::parse(format!("wss://{host_too_long}")).unwrap_err(),
- RadrootsIdParseError::InvalidFormat
+ NostrRelayHint::parse(format!("wss://{host_too_long}")).unwrap_err(),
+ ParseError::InvalidFormat
);
}
#[test]
fn generic_relay_url_remains_a_distinct_surface() {
- assert!(RadrootsRelayUrl::parse("wss://Relay.Example").is_ok());
- assert!(RadrootsNostrRelayHint::parse("wss://Relay.Example").is_err());
+ assert!(RelayUrl::parse("wss://Relay.Example").is_ok());
+ assert!(NostrRelayHint::parse("wss://Relay.Example").is_err());
}
}
diff --git a/crates/event/src/reply.rs b/crates/event/src/reply.rs
@@ -3,12 +3,12 @@ use alloc::string::String;
use core::fmt;
use crate::{
- id::{RadrootsEventId, RadrootsIdParseError, parse_public_key},
+ id::{EventId, ParseError, parse_public_key},
post::{
RADROOTS_POST_CONTENT_MAX_BYTES, RADROOTS_POST_EVENT_WIRE_MAX_BYTES,
RADROOTS_POST_TAG_ELEMENT_MAX_BYTES, RADROOTS_POST_TAG_TOTAL_MAX_BYTES,
},
- tag::relay_hint::RadrootsNostrRelayHint,
+ tag::relay_hint::NostrRelayHint,
};
use radroots_identity::PublicKey;
@@ -26,19 +26,19 @@ const RADROOTS_NIP10_REPLY_SIGNED_EVENT_FIXED_MAX_BYTES: usize = "{\"id\":\"".le
#[non_exhaustive]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsNip10ReplyError {
+pub enum Nip10ReplyError {
ContentMissing,
ContentTooLarge { max: usize, actual: usize },
- EventIdInvalid(RadrootsIdParseError),
- AuthorInvalid(RadrootsIdParseError),
- RelayInvalid(RadrootsIdParseError),
+ EventIdInvalid(ParseError),
+ AuthorInvalid(ParseError),
+ RelayInvalid(ParseError),
NestedParentMatchesRoot,
TagElementTooLarge { max: usize, actual: usize },
TagBytesExceeded { max: usize, actual: usize },
EventWireTooLarge { max: usize, actual: usize },
}
-impl RadrootsNip10ReplyError {
+impl Nip10ReplyError {
pub const fn code(&self) -> &'static str {
match self {
Self::ContentMissing => "reply_content_missing",
@@ -54,7 +54,7 @@ impl RadrootsNip10ReplyError {
}
}
-impl fmt::Display for RadrootsNip10ReplyError {
+impl fmt::Display for Nip10ReplyError {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::ContentMissing => {
@@ -99,7 +99,7 @@ impl fmt::Display for RadrootsNip10ReplyError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsNip10ReplyError {
+impl std::error::Error for Nip10ReplyError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
Self::EventIdInvalid(error)
@@ -115,18 +115,18 @@ impl std::error::Error for RadrootsNip10ReplyError {
/// The caller asserts that the target is a kind-1 event. This value does not
/// retrieve the target or prove its existence, kind, signature, or author.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsNip10ReplyReference {
- event_id: RadrootsEventId,
+pub struct Nip10ReplyReference {
+ event_id: EventId,
author: PublicKey,
- relay: Option<RadrootsNostrRelayHint>,
+ relay: Option<NostrRelayHint>,
}
-impl RadrootsNip10ReplyReference {
+impl Nip10ReplyReference {
pub fn new(
- event_id: RadrootsEventId,
+ event_id: EventId,
author: PublicKey,
- relay: Option<RadrootsNostrRelayHint>,
- ) -> Result<Self, RadrootsNip10ReplyError> {
+ relay: Option<NostrRelayHint>,
+ ) -> Result<Self, Nip10ReplyError> {
if let Some(relay) = &relay {
validate_tag_element(relay.as_str())?;
}
@@ -141,21 +141,19 @@ impl RadrootsNip10ReplyReference {
event_id: impl AsRef<str>,
author: impl AsRef<str>,
relay: Option<&str>,
- ) -> Result<Self, RadrootsNip10ReplyError> {
- let event_id =
- RadrootsEventId::parse(event_id).map_err(RadrootsNip10ReplyError::EventIdInvalid)?;
- let author = parse_public_key(author).map_err(RadrootsNip10ReplyError::AuthorInvalid)?;
+ ) -> Result<Self, Nip10ReplyError> {
+ let event_id = EventId::parse(event_id).map_err(Nip10ReplyError::EventIdInvalid)?;
+ let author = parse_public_key(author).map_err(Nip10ReplyError::AuthorInvalid)?;
let relay = match relay {
None | Some("") => None,
- Some(relay) => Some(
- RadrootsNostrRelayHint::parse(relay)
- .map_err(RadrootsNip10ReplyError::RelayInvalid)?,
- ),
+ Some(relay) => {
+ Some(NostrRelayHint::parse(relay).map_err(Nip10ReplyError::RelayInvalid)?)
+ }
};
Self::new(event_id, author, relay)
}
- pub const fn event_id(&self) -> &RadrootsEventId {
+ pub const fn event_id(&self) -> &EventId {
&self.event_id
}
@@ -163,14 +161,12 @@ impl RadrootsNip10ReplyReference {
&self.author
}
- pub const fn relay(&self) -> Option<&RadrootsNostrRelayHint> {
+ pub const fn relay(&self) -> Option<&NostrRelayHint> {
self.relay.as_ref()
}
pub fn relay_or_empty(&self) -> &str {
- self.relay
- .as_ref()
- .map_or("", RadrootsNostrRelayHint::as_str)
+ self.relay.as_ref().map_or("", NostrRelayHint::as_str)
}
}
@@ -181,40 +177,40 @@ impl RadrootsNip10ReplyReference {
/// and has no Serde construction path.
///
/// ```compile_fail
-/// let _: radroots_event::post::reply::RadrootsAuthoredNip10Reply =
+/// let _: radroots_event::post::reply::AuthoredNip10Reply =
/// serde_json::from_str(r#"{"content":"reply"}"#).unwrap();
/// ```
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsAuthoredNip10Reply {
+pub struct AuthoredNip10Reply {
content: String,
- root: RadrootsNip10ReplyReference,
- parent: Option<RadrootsNip10ReplyReference>,
+ root: Nip10ReplyReference,
+ parent: Option<Nip10ReplyReference>,
}
-impl RadrootsAuthoredNip10Reply {
+impl AuthoredNip10Reply {
pub fn direct(
content: impl Into<String>,
- root: RadrootsNip10ReplyReference,
- ) -> Result<Self, RadrootsNip10ReplyError> {
+ root: Nip10ReplyReference,
+ ) -> Result<Self, Nip10ReplyError> {
Self::new(content.into(), root, None)
}
pub fn nested(
content: impl Into<String>,
- root: RadrootsNip10ReplyReference,
- parent: RadrootsNip10ReplyReference,
- ) -> Result<Self, RadrootsNip10ReplyError> {
+ root: Nip10ReplyReference,
+ parent: Nip10ReplyReference,
+ ) -> Result<Self, Nip10ReplyError> {
if root.event_id == parent.event_id {
- return Err(RadrootsNip10ReplyError::NestedParentMatchesRoot);
+ return Err(Nip10ReplyError::NestedParentMatchesRoot);
}
Self::new(content.into(), root, Some(parent))
}
fn new(
content: String,
- root: RadrootsNip10ReplyReference,
- parent: Option<RadrootsNip10ReplyReference>,
- ) -> Result<Self, RadrootsNip10ReplyError> {
+ root: Nip10ReplyReference,
+ parent: Option<Nip10ReplyReference>,
+ ) -> Result<Self, Nip10ReplyError> {
validate_content(&content)?;
validate_authored_reply_wire_size(&content, &root, parent.as_ref())?;
Ok(Self {
@@ -228,11 +224,11 @@ impl RadrootsAuthoredNip10Reply {
&self.content
}
- pub const fn root(&self) -> &RadrootsNip10ReplyReference {
+ pub const fn root(&self) -> &Nip10ReplyReference {
&self.root
}
- pub const fn parent(&self) -> Option<&RadrootsNip10ReplyReference> {
+ pub const fn parent(&self) -> Option<&Nip10ReplyReference> {
self.parent.as_ref()
}
@@ -241,12 +237,12 @@ impl RadrootsAuthoredNip10Reply {
}
}
-fn validate_content(content: &str) -> Result<(), RadrootsNip10ReplyError> {
+fn validate_content(content: &str) -> Result<(), Nip10ReplyError> {
if content.trim().is_empty() {
- return Err(RadrootsNip10ReplyError::ContentMissing);
+ return Err(Nip10ReplyError::ContentMissing);
}
if content.len() > RADROOTS_POST_CONTENT_MAX_BYTES {
- return Err(RadrootsNip10ReplyError::ContentTooLarge {
+ return Err(Nip10ReplyError::ContentTooLarge {
max: RADROOTS_POST_CONTENT_MAX_BYTES,
actual: content.len(),
});
@@ -254,9 +250,9 @@ fn validate_content(content: &str) -> Result<(), RadrootsNip10ReplyError> {
Ok(())
}
-fn validate_tag_element(element: &str) -> Result<(), RadrootsNip10ReplyError> {
+fn validate_tag_element(element: &str) -> Result<(), Nip10ReplyError> {
if element.len() > RADROOTS_POST_TAG_ELEMENT_MAX_BYTES {
- return Err(RadrootsNip10ReplyError::TagElementTooLarge {
+ return Err(Nip10ReplyError::TagElementTooLarge {
max: RADROOTS_POST_TAG_ELEMENT_MAX_BYTES,
actual: element.len(),
});
@@ -266,9 +262,9 @@ fn validate_tag_element(element: &str) -> Result<(), RadrootsNip10ReplyError> {
fn validate_authored_reply_wire_size(
content: &str,
- root: &RadrootsNip10ReplyReference,
- parent: Option<&RadrootsNip10ReplyReference>,
-) -> Result<(), RadrootsNip10ReplyError> {
+ root: &Nip10ReplyReference,
+ parent: Option<&Nip10ReplyReference>,
+) -> Result<(), Nip10ReplyError> {
let mut tag_bytes = 0usize;
let mut tags_json_bytes = 2usize;
let mut tag_count = 0usize;
@@ -310,7 +306,7 @@ fn validate_authored_reply_wire_size(
}
if tag_bytes > RADROOTS_POST_TAG_TOTAL_MAX_BYTES {
- return Err(RadrootsNip10ReplyError::TagBytesExceeded {
+ return Err(Nip10ReplyError::TagBytesExceeded {
max: RADROOTS_POST_TAG_TOTAL_MAX_BYTES,
actual: tag_bytes,
});
@@ -319,7 +315,7 @@ fn validate_authored_reply_wire_size(
.saturating_add(tags_json_bytes)
.saturating_add(canonical_json_string_bytes(content));
if actual > RADROOTS_POST_EVENT_WIRE_MAX_BYTES {
- return Err(RadrootsNip10ReplyError::EventWireTooLarge {
+ return Err(Nip10ReplyError::EventWireTooLarge {
max: RADROOTS_POST_EVENT_WIRE_MAX_BYTES,
actual,
});
@@ -361,8 +357,8 @@ fn canonical_json_string_bytes(value: &str) -> usize {
mod tests {
use super::*;
- fn reference(event: char, author: char) -> RadrootsNip10ReplyReference {
- RadrootsNip10ReplyReference::parse(
+ fn reference(event: char, author: char) -> Nip10ReplyReference {
+ Nip10ReplyReference::parse(
event.to_string().repeat(64),
crate::test_valid_hex_64(author),
Some("wss://relay.example"),
@@ -372,14 +368,12 @@ mod tests {
#[test]
fn builds_direct_and_nested_replies_with_distinct_coordinates() {
- let direct =
- RadrootsAuthoredNip10Reply::direct("Direct", reference('a', 'b')).expect("direct");
+ let direct = AuthoredNip10Reply::direct("Direct", reference('a', 'b')).expect("direct");
assert!(direct.is_direct());
assert!(direct.parent().is_none());
- let nested =
- RadrootsAuthoredNip10Reply::nested("Nested", reference('a', 'b'), reference('c', 'd'))
- .expect("nested");
+ let nested = AuthoredNip10Reply::nested("Nested", reference('a', 'b'), reference('c', 'd'))
+ .expect("nested");
assert!(!nested.is_direct());
assert_eq!(
nested.parent().expect("parent").event_id().to_hex(),
@@ -390,21 +384,21 @@ mod tests {
#[test]
fn rejects_blank_content_and_ambiguous_nested_parent() {
assert_eq!(
- RadrootsAuthoredNip10Reply::direct("\t", reference('a', 'b')).unwrap_err(),
- RadrootsNip10ReplyError::ContentMissing
+ AuthoredNip10Reply::direct("\t", reference('a', 'b')).unwrap_err(),
+ Nip10ReplyError::ContentMissing
);
let root = reference('a', 'b');
let parent = reference('a', 'c');
assert_eq!(
- RadrootsAuthoredNip10Reply::nested("Nested", root, parent).unwrap_err(),
- RadrootsNip10ReplyError::NestedParentMatchesRoot
+ AuthoredNip10Reply::nested("Nested", root, parent).unwrap_err(),
+ Nip10ReplyError::NestedParentMatchesRoot
);
}
#[test]
fn parses_and_canonicalizes_reference_identifiers() {
- let reference = RadrootsNip10ReplyReference::parse(
+ let reference = Nip10ReplyReference::parse(
"A".repeat(64),
crate::test_valid_hex_64('B'),
Some("wss://relay.example"),
@@ -417,23 +411,22 @@ mod tests {
"wss://relay.example"
);
- let error =
- RadrootsNip10ReplyReference::parse("not-an-id", crate::test_valid_hex_64('b'), None)
- .unwrap_err();
+ let error = Nip10ReplyReference::parse("not-an-id", crate::test_valid_hex_64('b'), None)
+ .unwrap_err();
assert_eq!(error.code(), "reply_event_id_invalid");
}
#[test]
fn enforces_content_and_relay_element_boundaries() {
let exact_content = "x".repeat(RADROOTS_POST_CONTENT_MAX_BYTES);
- RadrootsAuthoredNip10Reply::direct(exact_content, reference('a', 'b'))
+ AuthoredNip10Reply::direct(exact_content, reference('a', 'b'))
.expect("exact decoded content limit");
assert!(matches!(
- RadrootsAuthoredNip10Reply::direct(
+ AuthoredNip10Reply::direct(
"x".repeat(RADROOTS_POST_CONTENT_MAX_BYTES + 1),
reference('a', 'b'),
),
- Err(RadrootsNip10ReplyError::ContentTooLarge {
+ Err(Nip10ReplyError::ContentTooLarge {
max: RADROOTS_POST_CONTENT_MAX_BYTES,
actual,
}) if actual == RADROOTS_POST_CONTENT_MAX_BYTES + 1
@@ -444,7 +437,7 @@ mod tests {
"{prefix}{}",
"a".repeat(RADROOTS_POST_TAG_ELEMENT_MAX_BYTES - prefix.len())
);
- RadrootsNip10ReplyReference::parse(
+ Nip10ReplyReference::parse(
"a".repeat(64),
crate::test_valid_hex_64('b'),
Some(&exact_relay),
@@ -452,12 +445,12 @@ mod tests {
.expect("exact tag-element limit");
let overflow_relay = format!("{exact_relay}a");
assert!(matches!(
- RadrootsNip10ReplyReference::parse(
+ Nip10ReplyReference::parse(
"a".repeat(64),
crate::test_valid_hex_64('b'),
Some(&overflow_relay),
),
- Err(RadrootsNip10ReplyError::TagElementTooLarge {
+ Err(Nip10ReplyError::TagElementTooLarge {
max: RADROOTS_POST_TAG_ELEMENT_MAX_BYTES,
actual,
}) if actual == RADROOTS_POST_TAG_ELEMENT_MAX_BYTES + 1
@@ -470,8 +463,7 @@ mod tests {
let mut upper = RADROOTS_POST_CONTENT_MAX_BYTES;
while lower < upper {
let candidate = lower + (upper - lower).div_ceil(2);
- if RadrootsAuthoredNip10Reply::direct("\u{0001}".repeat(candidate), reference('a', 'b'))
- .is_ok()
+ if AuthoredNip10Reply::direct("\u{0001}".repeat(candidate), reference('a', 'b')).is_ok()
{
lower = candidate;
} else {
@@ -479,11 +471,11 @@ mod tests {
}
}
- RadrootsAuthoredNip10Reply::direct("\u{0001}".repeat(lower), reference('a', 'b'))
+ AuthoredNip10Reply::direct("\u{0001}".repeat(lower), reference('a', 'b'))
.expect("largest escaped content fitting the wire budget");
assert!(matches!(
- RadrootsAuthoredNip10Reply::direct("\u{0001}".repeat(lower + 1), reference('a', 'b'),),
- Err(RadrootsNip10ReplyError::EventWireTooLarge {
+ AuthoredNip10Reply::direct("\u{0001}".repeat(lower + 1), reference('a', 'b'),),
+ Err(Nip10ReplyError::EventWireTooLarge {
max: RADROOTS_POST_EVENT_WIRE_MAX_BYTES,
..
})
diff --git a/crates/event/src/report.rs b/crates/event/src/report.rs
@@ -1,26 +1,26 @@
#[cfg(not(feature = "std"))]
use alloc::string::String;
-use crate::social::{RadrootsReportFileTarget, RadrootsReportType, RadrootsSocialTarget};
+use crate::social::{ReportFileTarget, ReportType, SocialTarget};
#[cfg_attr(
any(feature = "serde", test),
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsReport {
+pub struct Report {
pub reported_pubkey: String,
- pub report_type: RadrootsReportType,
+ pub report_type: ReportType,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
- pub event: Option<RadrootsSocialTarget>,
+ pub event: Option<SocialTarget>,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
- pub file: Option<RadrootsReportFileTarget>,
+ pub file: Option<ReportFileTarget>,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
@@ -34,10 +34,10 @@ mod tests {
#[test]
fn report_model_requires_reported_pubkey_field() {
- let report = RadrootsReport {
+ let report = Report {
reported_pubkey: "a".repeat(64),
- report_type: RadrootsReportType::Spam,
- event: Some(RadrootsSocialTarget::Event {
+ report_type: ReportType::Spam,
+ event: Some(SocialTarget::Event {
id: "b".repeat(64),
author: Some("a".repeat(64)),
event_kind: Some(1),
@@ -48,20 +48,17 @@ mod tests {
};
assert_eq!(report.reported_pubkey.len(), 64);
- assert_eq!(report.report_type, RadrootsReportType::Spam);
- assert!(matches!(
- report.event,
- Some(RadrootsSocialTarget::Event { .. })
- ));
+ assert_eq!(report.report_type, ReportType::Spam);
+ assert!(matches!(report.event, Some(SocialTarget::Event { .. })));
}
#[test]
fn report_model_supports_file_targets_with_required_pubkey() {
- let report = RadrootsReport {
+ let report = Report {
reported_pubkey: "a".repeat(64),
- report_type: RadrootsReportType::Malware,
+ report_type: ReportType::Malware,
event: None,
- file: Some(RadrootsReportFileTarget {
+ file: Some(ReportFileTarget {
sha256: Some("b".repeat(64)),
url: Some("https://example.test/file".to_string()),
magnet: None,
diff --git a/crates/event/src/repost.rs b/crates/event/src/repost.rs
@@ -1,15 +1,15 @@
#[cfg(not(feature = "std"))]
use alloc::string::String;
-use crate::social::RadrootsSocialTarget;
+use crate::social::SocialTarget;
#[cfg_attr(
any(feature = "serde", test),
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsRepost {
- pub target: RadrootsSocialTarget,
+pub struct Repost {
+ pub target: SocialTarget,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
@@ -22,8 +22,8 @@ pub struct RadrootsRepost {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsGenericRepost {
- pub target: RadrootsSocialTarget,
+pub struct GenericRepost {
+ pub target: SocialTarget,
pub target_kind: u32,
#[cfg_attr(
feature = "serde",
@@ -38,34 +38,31 @@ mod tests {
#[test]
fn repost_models_represent_note_and_generic_targets() {
- let note_target = RadrootsSocialTarget::Event {
+ let note_target = SocialTarget::Event {
id: "a".repeat(64),
author: Some(crate::test_valid_hex_64('b')),
event_kind: Some(1),
relays: None,
};
- let article_target = RadrootsSocialTarget::Address {
+ let article_target = SocialTarget::Address {
address: "30023:pubkey:article".to_string(),
author: Some(crate::test_valid_hex_64('b')),
event_kind: Some(30023),
relays: Some(vec!["wss://relay.example".to_string()]),
};
- let repost = RadrootsRepost {
+ let repost = Repost {
target: note_target,
content: None,
};
- let generic = RadrootsGenericRepost {
+ let generic = GenericRepost {
target: article_target,
target_kind: 30023,
content: Some("long-form share".to_string()),
};
- assert!(matches!(repost.target, RadrootsSocialTarget::Event { .. }));
+ assert!(matches!(repost.target, SocialTarget::Event { .. }));
assert_eq!(generic.target_kind, 30023);
- assert!(matches!(
- generic.target,
- RadrootsSocialTarget::Address { .. }
- ));
+ assert!(matches!(generic.target, SocialTarget::Address { .. }));
}
}
diff --git a/crates/event/src/resource_area.rs b/crates/event/src/resource_area.rs
@@ -1,6 +1,6 @@
#![forbid(unsafe_code)]
-use crate::farm::change_set::RadrootsGcsLocation;
+use crate::farm::change_set::GcsLocation;
#[cfg(not(feature = "std"))]
use alloc::{string::String, vec::Vec};
@@ -12,11 +12,11 @@ use alloc::{string::String, vec::Vec};
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsResourceArea {
+pub struct ResourceArea {
pub d_tag: String,
pub name: String,
pub about: Option<String>,
- pub location: RadrootsResourceAreaLocation,
+ pub location: ResourceAreaLocation,
pub tags: Option<Vec<String>>,
}
@@ -27,7 +27,7 @@ pub struct RadrootsResourceArea {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsResourceAreaRef {
+pub struct ResourceAreaRef {
pub pubkey: String,
pub d_tag: String,
}
@@ -39,10 +39,10 @@ pub struct RadrootsResourceAreaRef {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsResourceAreaLocation {
+pub struct ResourceAreaLocation {
pub primary: Option<String>,
pub city: Option<String>,
pub region: Option<String>,
pub country: Option<String>,
- pub gcs: RadrootsGcsLocation,
+ pub gcs: GcsLocation,
}
diff --git a/crates/event/src/resource_cap.rs b/crates/event/src/resource_cap.rs
@@ -2,7 +2,7 @@
use radroots_core::{Decimal, Quantity, Unit};
-use crate::farm::resource_area::RadrootsResourceAreaRef;
+use crate::farm::resource_area::ResourceAreaRef;
#[cfg(not(feature = "std"))]
use alloc::{string::String, vec::Vec};
@@ -14,7 +14,7 @@ use alloc::{string::String, vec::Vec};
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsResourceHarvestProduct {
+pub struct ResourceHarvestProduct {
pub key: String,
pub category: Option<String>,
}
@@ -26,10 +26,10 @@ pub struct RadrootsResourceHarvestProduct {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug)]
-pub struct RadrootsResourceHarvestCap {
+pub struct ResourceHarvestCap {
pub d_tag: String,
- pub resource_area: RadrootsResourceAreaRef,
- pub product: RadrootsResourceHarvestProduct,
+ pub resource_area: ResourceAreaRef,
+ pub product: ResourceHarvestProduct,
#[cfg_attr(all(test, feature = "std"), dto(int = "json_string"))]
pub start: u64,
#[cfg_attr(all(test, feature = "std"), dto(int = "json_string"))]
diff --git a/crates/event/src/seal.rs b/crates/event/src/seal.rs
@@ -10,6 +10,6 @@ use alloc::string::String;
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
-pub struct RadrootsSeal {
+pub struct Seal {
pub content: String,
}
diff --git a/crates/event/src/social.rs b/crates/event/src/social.rs
@@ -1,6 +1,6 @@
//! Social graph, messaging, access, and job event models.
-use crate::farm::RadrootsFarmRef;
+use crate::farm::FarmRef;
#[cfg(not(feature = "std"))]
use alloc::{string::String, vec::Vec};
@@ -15,7 +15,7 @@ use alloc::{string::String, vec::Vec};
serde(rename_all = "snake_case", tag = "kind")
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsSocialTarget {
+pub enum SocialTarget {
Event {
id: String,
author: Option<String>,
@@ -41,8 +41,8 @@ pub enum RadrootsSocialTarget {
)]
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[derive(Clone, Debug, Default)]
-pub struct RadrootsSocialFarmAnchor {
- pub farm: RadrootsFarmRef,
+pub struct SocialFarmAnchor {
+ pub farm: FarmRef,
pub relays: Option<Vec<String>>,
}
@@ -52,7 +52,7 @@ pub struct RadrootsSocialFarmAnchor {
)]
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
-pub struct RadrootsSocialLocation {
+pub struct SocialLocation {
pub name: Option<String>,
pub geohash: Option<String>,
}
@@ -63,7 +63,7 @@ pub struct RadrootsSocialLocation {
)]
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
-pub struct RadrootsSocialMediaDimensions {
+pub struct SocialMediaDimensions {
pub width: u32,
pub height: u32,
}
@@ -74,9 +74,9 @@ pub struct RadrootsSocialMediaDimensions {
)]
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
-pub struct RadrootsSocialMediaThumbnail {
+pub struct SocialMediaThumbnail {
pub url: String,
- pub dimensions: Option<RadrootsSocialMediaDimensions>,
+ pub dimensions: Option<SocialMediaDimensions>,
}
#[cfg_attr(
@@ -85,16 +85,16 @@ pub struct RadrootsSocialMediaThumbnail {
)]
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
-pub struct RadrootsSocialMediaMetadata {
+pub struct SocialMediaMetadata {
pub url: Option<String>,
pub mime_type: Option<String>,
pub sha256: Option<String>,
pub original_sha256: Option<String>,
#[cfg_attr(all(test, feature = "std"), dto(int = "json_string"))]
pub size: Option<u64>,
- pub dimensions: Option<RadrootsSocialMediaDimensions>,
+ pub dimensions: Option<SocialMediaDimensions>,
pub blurhash: Option<String>,
- pub thumbnails: Option<Vec<RadrootsSocialMediaThumbnail>>,
+ pub thumbnails: Option<Vec<SocialMediaThumbnail>>,
pub image: Option<String>,
pub summary: Option<String>,
pub alt: Option<String>,
@@ -111,7 +111,7 @@ pub struct RadrootsSocialMediaMetadata {
)]
#[cfg_attr(any(feature = "serde", test), serde(rename_all = "snake_case"))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsReportType {
+pub enum ReportType {
Nudity,
Malware,
Profanity,
@@ -126,7 +126,7 @@ pub enum RadrootsReportType {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
-pub struct RadrootsReportFileTarget {
+pub struct ReportFileTarget {
pub sha256: Option<String>,
pub url: Option<String>,
pub magnet: Option<String>,
@@ -137,10 +137,10 @@ pub struct RadrootsReportFileTarget {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsReportTarget {
+pub struct ReportTarget {
pub reported_pubkey: String,
- pub event: Option<RadrootsSocialTarget>,
- pub file: Option<RadrootsReportFileTarget>,
+ pub event: Option<SocialTarget>,
+ pub file: Option<ReportFileTarget>,
}
#[cfg(test)]
@@ -149,37 +149,37 @@ mod tests {
#[test]
fn supports_nip22_target_shapes() {
- let event = RadrootsSocialTarget::Event {
+ let event = SocialTarget::Event {
id: "a".repeat(64),
author: Some(crate::test_valid_hex_64('b')),
event_kind: Some(30023),
relays: Some(vec!["wss://relay.example".to_string()]),
};
- let address = RadrootsSocialTarget::Address {
+ let address = SocialTarget::Address {
address: "30023:pubkey:d-tag".to_string(),
author: None,
event_kind: Some(30023),
relays: None,
};
- let external = RadrootsSocialTarget::External {
+ let external = SocialTarget::External {
id: "https://example.test/object".to_string(),
external_kind: "web".to_string(),
hint: None,
};
- assert!(matches!(event, RadrootsSocialTarget::Event { .. }));
- assert!(matches!(address, RadrootsSocialTarget::Address { .. }));
- assert!(matches!(external, RadrootsSocialTarget::External { .. }));
+ assert!(matches!(event, SocialTarget::Event { .. }));
+ assert!(matches!(address, SocialTarget::Address { .. }));
+ assert!(matches!(external, SocialTarget::External { .. }));
}
#[test]
fn defaults_media_and_farm_anchor_primitives() {
- let media = RadrootsSocialMediaMetadata::default();
+ let media = SocialMediaMetadata::default();
assert!(media.url.is_none());
assert!(media.content_hashes.is_none());
assert!(media.services.is_none());
- let anchor = RadrootsSocialFarmAnchor::default();
+ let anchor = SocialFarmAnchor::default();
assert!(anchor.farm.pubkey.is_empty());
assert!(anchor.farm.d_tag.is_empty());
assert!(anchor.relays.is_none());
@@ -187,7 +187,7 @@ mod tests {
#[test]
fn exposes_report_enums() {
- assert_eq!(RadrootsReportType::Spam, RadrootsReportType::Spam);
+ assert_eq!(ReportType::Spam, ReportType::Spam);
}
}
#[path = "app_data.rs"]
diff --git a/crates/event/src/tag.rs b/crates/event/src/tag.rs
@@ -17,7 +17,7 @@ pub mod relay_hint;
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsEventRef {
+pub struct EventRef {
pub id: String,
#[cfg_attr(all(test, feature = "std"), dto(as = "string"))]
pub author: radroots_identity::PublicKey,
@@ -33,7 +33,7 @@ pub struct RadrootsEventRef {
#[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))]
#[cfg_attr(all(test, feature = "std"), dto(export))]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsEventPtr {
+pub struct EventPtr {
pub id: String,
pub relays: Option<String>,
}
diff --git a/crates/event/src/trade.rs b/crates/event/src/trade.rs
@@ -22,14 +22,8 @@ use crate::envelope::kind::{
KIND_TRADE_CANCELLATION, KIND_TRADE_DECISION, KIND_TRADE_PROPOSAL,
KIND_TRADE_REVISION_DECISION, KIND_TRADE_REVISION_PROPOSAL,
};
-use crate::id::{
- RadrootsClassifiedListingAddress, RadrootsDTag, RadrootsEventId, RadrootsIdParseError,
- RadrootsInventoryBinId, RadrootsTradeCandidateId, RadrootsTradeId, RadrootsTradeMutationId,
-};
-pub use crate::id::{
- RadrootsTradeCandidateId as CandidateId, RadrootsTradeId as TradeId,
- RadrootsTradeMutationId as MutationId,
-};
+pub use crate::id::{CandidateId, MutationId, TradeId};
+use crate::id::{ClassifiedListingAddress, DTag, EventId, InventoryBinId, ParseError};
use radroots_identity::PublicKey;
#[cfg(feature = "serde")]
use serde::{
@@ -67,7 +61,7 @@ pub const RADROOTS_TRADE_MAX_PARENT_MUTATIONS: usize = 4;
pub const RADROOTS_TRADE_MAX_PRIVATE_ARTIFACT_BYTES: usize = 64 * 1024;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum RadrootsTradeMutationKindV1 {
+pub enum TradeMutationKindV1 {
Proposal,
Decision,
RevisionProposal,
@@ -75,7 +69,7 @@ pub enum RadrootsTradeMutationKindV1 {
Cancellation,
}
-impl RadrootsTradeMutationKindV1 {
+impl TradeMutationKindV1 {
pub const fn contract_id(self) -> &'static str {
match self {
Self::Proposal => RADROOTS_TRADE_PROPOSAL_CONTRACT_ID,
@@ -99,51 +93,51 @@ impl RadrootsTradeMutationKindV1 {
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
-pub struct RadrootsTradeMutationEnvelopeV1 {
- pub mutation_id: Option<RadrootsTradeMutationId>,
+pub struct TradeMutationEnvelopeV1 {
+ pub mutation_id: Option<MutationId>,
pub contract_id: String,
pub schema_version: u16,
- pub trade_id: RadrootsTradeId,
- pub root_mutation_id: Option<RadrootsTradeMutationId>,
+ pub trade_id: TradeId,
+ pub root_mutation_id: Option<MutationId>,
pub buyer_pubkey: PublicKey,
pub seller_pubkey: PublicKey,
- pub farm_id: RadrootsDTag,
- pub parent_mutation_ids: Vec<RadrootsTradeMutationId>,
+ pub farm_id: DTag,
+ pub parent_mutation_ids: Vec<MutationId>,
pub author_pubkey: PublicKey,
pub counterparty_pubkey: PublicKey,
pub authored_at_unix_s: u64,
- pub body: RadrootsTradeMutationBodyV1,
+ pub body: TradeMutationBodyV1,
}
-impl RadrootsTradeMutationEnvelopeV1 {
- pub fn mutation_kind(&self) -> RadrootsTradeMutationKindV1 {
+impl TradeMutationEnvelopeV1 {
+ pub fn mutation_kind(&self) -> TradeMutationKindV1 {
self.body.mutation_kind()
}
- pub fn validate(&self) -> Result<(), RadrootsTradeProtocolError> {
+ pub fn validate(&self) -> Result<(), TradeProtocolError> {
if self.schema_version != RADROOTS_TRADE_SCHEMA_VERSION {
- return Err(RadrootsTradeProtocolError::InvalidSchemaVersion {
+ return Err(TradeProtocolError::InvalidSchemaVersion {
expected: RADROOTS_TRADE_SCHEMA_VERSION,
actual: self.schema_version,
});
}
let expected = self.mutation_kind().contract_id();
if self.contract_id != expected {
- return Err(RadrootsTradeProtocolError::ContractMismatch {
+ return Err(TradeProtocolError::ContractMismatch {
expected,
actual: self.contract_id.clone(),
});
}
validate_parent_mutation_ids(self.mutation_id.as_ref(), &self.parent_mutation_ids)?;
match self.mutation_kind() {
- RadrootsTradeMutationKindV1::Proposal => {
+ TradeMutationKindV1::Proposal => {
if self.root_mutation_id.is_some() || !self.parent_mutation_ids.is_empty() {
- return Err(RadrootsTradeProtocolError::InvalidInitialParents);
+ return Err(TradeProtocolError::InvalidInitialParents);
}
}
_ => {
if self.root_mutation_id.is_none() || self.parent_mutation_ids.is_empty() {
- return Err(RadrootsTradeProtocolError::MissingParentMutation);
+ return Err(TradeProtocolError::MissingParentMutation);
}
}
}
@@ -157,42 +151,42 @@ impl RadrootsTradeMutationEnvelopeV1 {
feature = "serde",
serde(rename_all = "snake_case", tag = "mutation_type")
)]
-pub enum RadrootsTradeMutationBodyV1 {
+pub enum TradeMutationBodyV1 {
Proposal {
- candidate: RadrootsTradeCandidateTermsV1,
+ candidate: TradeCandidateTermsV1,
},
Decision {
- proposal_mutation_id: RadrootsTradeMutationId,
- candidate_id: RadrootsTradeCandidateId,
- decision: RadrootsTradeDecisionV1,
+ proposal_mutation_id: MutationId,
+ candidate_id: CandidateId,
+ decision: TradeDecisionV1,
},
RevisionProposal {
- candidate: RadrootsTradeCandidateTermsV1,
+ candidate: TradeCandidateTermsV1,
},
RevisionDecision {
- proposal_mutation_id: RadrootsTradeMutationId,
- candidate_id: RadrootsTradeCandidateId,
- decision: RadrootsTradeDecisionV1,
+ proposal_mutation_id: MutationId,
+ candidate_id: CandidateId,
+ decision: TradeDecisionV1,
},
Cancellation {
- target_candidate_id: Option<RadrootsTradeCandidateId>,
- target_claim_mutation_id: Option<RadrootsTradeMutationId>,
+ target_candidate_id: Option<CandidateId>,
+ target_claim_mutation_id: Option<MutationId>,
reason: String,
},
}
-impl RadrootsTradeMutationBodyV1 {
- pub const fn mutation_kind(&self) -> RadrootsTradeMutationKindV1 {
+impl TradeMutationBodyV1 {
+ pub const fn mutation_kind(&self) -> TradeMutationKindV1 {
match self {
- Self::Proposal { .. } => RadrootsTradeMutationKindV1::Proposal,
- Self::Decision { .. } => RadrootsTradeMutationKindV1::Decision,
- Self::RevisionProposal { .. } => RadrootsTradeMutationKindV1::RevisionProposal,
- Self::RevisionDecision { .. } => RadrootsTradeMutationKindV1::RevisionDecision,
- Self::Cancellation { .. } => RadrootsTradeMutationKindV1::Cancellation,
+ Self::Proposal { .. } => TradeMutationKindV1::Proposal,
+ Self::Decision { .. } => TradeMutationKindV1::Decision,
+ Self::RevisionProposal { .. } => TradeMutationKindV1::RevisionProposal,
+ Self::RevisionDecision { .. } => TradeMutationKindV1::RevisionDecision,
+ Self::Cancellation { .. } => TradeMutationKindV1::Cancellation,
}
}
- pub fn validate(&self) -> Result<(), RadrootsTradeProtocolError> {
+ pub fn validate(&self) -> Result<(), TradeProtocolError> {
match self {
Self::Proposal { candidate } | Self::RevisionProposal { candidate } => {
candidate.validate()
@@ -213,7 +207,7 @@ impl RadrootsTradeMutationBodyV1 {
reason,
} => {
if target_candidate_id.is_none() && target_claim_mutation_id.is_none() {
- return Err(RadrootsTradeProtocolError::MissingCancellationTarget);
+ return Err(TradeProtocolError::MissingCancellationTarget);
}
validate_non_empty(reason, "reason")
}
@@ -223,36 +217,36 @@ impl RadrootsTradeMutationBodyV1 {
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
-pub struct RadrootsTradeCandidateTermsV1 {
- pub candidate_id: Option<RadrootsTradeCandidateId>,
+pub struct TradeCandidateTermsV1 {
+ pub candidate_id: Option<CandidateId>,
pub schema_version: u16,
- pub base_candidate_id: Option<RadrootsTradeCandidateId>,
+ pub base_candidate_id: Option<CandidateId>,
pub supersession_intent: Option<String>,
pub buyer_pubkey: PublicKey,
pub seller_pubkey: PublicKey,
- pub farm_id: RadrootsDTag,
- pub lines: Vec<RadrootsTradeCandidateLineV1>,
- pub line_tombstones: Vec<RadrootsTradeLineTombstoneV1>,
- pub economics: RadrootsTradeEconomicsProfileV1,
- pub fulfillment: RadrootsFulfillmentProfileV1,
- pub cancellation: RadrootsTradeCancellationProfileV1,
- pub private_terms: Option<RadrootsTradePrivateTermsRefV1>,
+ pub farm_id: DTag,
+ pub lines: Vec<TradeCandidateLineV1>,
+ pub line_tombstones: Vec<TradeLineTombstoneV1>,
+ pub economics: TradeEconomicsProfileV1,
+ pub fulfillment: FulfillmentProfileV1,
+ pub cancellation: TradeCancellationProfileV1,
+ pub private_terms: Option<TradePrivateTermsRefV1>,
pub proposal_expires_at_unix_s: u64,
}
-impl RadrootsTradeCandidateTermsV1 {
- pub fn validate(&self) -> Result<(), RadrootsTradeProtocolError> {
+impl TradeCandidateTermsV1 {
+ pub fn validate(&self) -> Result<(), TradeProtocolError> {
if self.schema_version != RADROOTS_TRADE_SCHEMA_VERSION {
- return Err(RadrootsTradeProtocolError::InvalidSchemaVersion {
+ return Err(TradeProtocolError::InvalidSchemaVersion {
expected: RADROOTS_TRADE_SCHEMA_VERSION,
actual: self.schema_version,
});
}
if self.lines.is_empty() {
- return Err(RadrootsTradeProtocolError::MissingLines);
+ return Err(TradeProtocolError::MissingLines);
}
if self.lines.len() > RADROOTS_TRADE_MAX_ACTIVE_LINES {
- return Err(RadrootsTradeProtocolError::TooManyLines {
+ return Err(TradeProtocolError::TooManyLines {
max: RADROOTS_TRADE_MAX_ACTIVE_LINES,
actual: self.lines.len(),
});
@@ -281,14 +275,14 @@ impl RadrootsTradeCandidateTermsV1 {
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
-pub struct RadrootsTradeCandidateLineV1 {
- pub line_id: RadrootsDTag,
- pub listing_addr: RadrootsClassifiedListingAddress,
- pub listing_event_id: RadrootsEventId,
+pub struct TradeCandidateLineV1 {
+ pub line_id: DTag,
+ pub listing_addr: ClassifiedListingAddress,
+ pub listing_event_id: EventId,
pub listing_snapshot_sha256: String,
pub product_id: String,
pub option_id: Option<String>,
- pub bin_id: RadrootsInventoryBinId,
+ pub bin_id: InventoryBinId,
pub quantity_mantissa: String,
pub quantity_scale: u8,
pub unit_code: String,
@@ -296,11 +290,11 @@ pub struct RadrootsTradeCandidateLineV1 {
pub unit_price_mantissa: String,
pub currency_code: String,
pub line_subtotal_mantissa: String,
- pub replaces_line_id: Option<RadrootsDTag>,
+ pub replaces_line_id: Option<DTag>,
}
-impl RadrootsTradeCandidateLineV1 {
- pub fn validate(&self) -> Result<(), RadrootsTradeProtocolError> {
+impl TradeCandidateLineV1 {
+ pub fn validate(&self) -> Result<(), TradeProtocolError> {
validate_sha256_hex(&self.listing_snapshot_sha256, "listing_snapshot_sha256")?;
validate_non_empty(&self.product_id, "product_id")?;
if let Some(option_id) = &self.option_id {
@@ -317,20 +311,20 @@ impl RadrootsTradeCandidateLineV1 {
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
-pub struct RadrootsTradeLineTombstoneV1 {
- pub line_id: RadrootsDTag,
+pub struct TradeLineTombstoneV1 {
+ pub line_id: DTag,
pub reason: String,
}
-impl RadrootsTradeLineTombstoneV1 {
- pub fn validate(&self) -> Result<(), RadrootsTradeProtocolError> {
+impl TradeLineTombstoneV1 {
+ pub fn validate(&self) -> Result<(), TradeProtocolError> {
validate_non_empty(&self.reason, "line_tombstone.reason")
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
-pub struct RadrootsTradeEconomicsProfileV1 {
+pub struct TradeEconomicsProfileV1 {
pub profile_id: String,
pub currency_code: String,
pub currency_exponent: u8,
@@ -339,11 +333,11 @@ pub struct RadrootsTradeEconomicsProfileV1 {
pub discount_total_mantissa: String,
pub adjustment_total_mantissa: String,
pub total_mantissa: String,
- pub adjustments: Vec<RadrootsTradeEconomicAdjustmentV1>,
+ pub adjustments: Vec<TradeEconomicAdjustmentV1>,
}
-impl RadrootsTradeEconomicsProfileV1 {
- pub fn validate(&self) -> Result<(), RadrootsTradeProtocolError> {
+impl TradeEconomicsProfileV1 {
+ pub fn validate(&self) -> Result<(), TradeProtocolError> {
validate_non_empty(&self.profile_id, "economics.profile_id")?;
validate_non_empty(&self.currency_code, "economics.currency_code")?;
validate_non_empty(&self.rounding_profile, "economics.rounding_profile")?;
@@ -358,7 +352,7 @@ impl RadrootsTradeEconomicsProfileV1 {
)?;
validate_decimal_string(&self.total_mantissa, "economics.total_mantissa")?;
if self.adjustments.len() > RADROOTS_TRADE_MAX_ADJUSTMENTS {
- return Err(RadrootsTradeProtocolError::TooManyAdjustments {
+ return Err(TradeProtocolError::TooManyAdjustments {
max: RADROOTS_TRADE_MAX_ADJUSTMENTS,
actual: self.adjustments.len(),
});
@@ -377,16 +371,16 @@ impl RadrootsTradeEconomicsProfileV1 {
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
-pub struct RadrootsTradeEconomicAdjustmentV1 {
- pub adjustment_id: RadrootsDTag,
+pub struct TradeEconomicAdjustmentV1 {
+ pub adjustment_id: DTag,
pub actor: String,
pub effect: String,
pub amount_mantissa: String,
pub reason: String,
}
-impl RadrootsTradeEconomicAdjustmentV1 {
- pub fn validate(&self) -> Result<(), RadrootsTradeProtocolError> {
+impl TradeEconomicAdjustmentV1 {
+ pub fn validate(&self) -> Result<(), TradeProtocolError> {
validate_non_empty(&self.actor, "adjustment.actor")?;
validate_non_empty(&self.effect, "adjustment.effect")?;
validate_decimal_string(&self.amount_mantissa, "adjustment.amount_mantissa")?;
@@ -396,7 +390,7 @@ impl RadrootsTradeEconomicAdjustmentV1 {
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
-pub struct RadrootsFulfillmentProfileV1 {
+pub struct FulfillmentProfileV1 {
pub profile_id: String,
pub method: String,
pub starts_at_unix_s: u64,
@@ -408,17 +402,17 @@ pub struct RadrootsFulfillmentProfileV1 {
pub requires_private_terms: bool,
}
-impl RadrootsFulfillmentProfileV1 {
- pub fn validate(&self) -> Result<(), RadrootsTradeProtocolError> {
+impl FulfillmentProfileV1 {
+ pub fn validate(&self) -> Result<(), TradeProtocolError> {
validate_non_empty(&self.profile_id, "fulfillment.profile_id")?;
validate_non_empty(&self.method, "fulfillment.method")?;
validate_non_empty(&self.timezone, "fulfillment.timezone")?;
validate_non_empty(&self.location_class, "fulfillment.location_class")?;
if self.ends_at_unix_s <= self.starts_at_unix_s {
- return Err(RadrootsTradeProtocolError::InvalidTimeRange);
+ return Err(TradeProtocolError::InvalidTimeRange);
}
if self.fold > 1 {
- return Err(RadrootsTradeProtocolError::InvalidField("fulfillment.fold"));
+ return Err(TradeProtocolError::InvalidField("fulfillment.fold"));
}
Ok(())
}
@@ -426,29 +420,29 @@ impl RadrootsFulfillmentProfileV1 {
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
-pub struct RadrootsTradeCancellationProfileV1 {
+pub struct TradeCancellationProfileV1 {
pub profile_id: String,
pub buyer_pre_agreement: bool,
pub post_agreement_cutoff_unix_s: Option<u64>,
}
-impl RadrootsTradeCancellationProfileV1 {
- pub fn validate(&self) -> Result<(), RadrootsTradeProtocolError> {
+impl TradeCancellationProfileV1 {
+ pub fn validate(&self) -> Result<(), TradeProtocolError> {
validate_non_empty(&self.profile_id, "cancellation.profile_id")
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
-pub struct RadrootsTradePrivateTermsRefV1 {
+pub struct TradePrivateTermsRefV1 {
pub artifact_id: String,
pub schema_id: String,
pub ciphertext_commitment: String,
pub required_acknowledgement: bool,
}
-impl RadrootsTradePrivateTermsRefV1 {
- pub fn validate(&self) -> Result<(), RadrootsTradeProtocolError> {
+impl TradePrivateTermsRefV1 {
+ pub fn validate(&self) -> Result<(), TradeProtocolError> {
validate_non_empty(&self.artifact_id, "private_terms.artifact_id")?;
validate_non_empty(&self.schema_id, "private_terms.schema_id")?;
validate_sha256_hex(
@@ -460,20 +454,20 @@ impl RadrootsTradePrivateTermsRefV1 {
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
-pub struct RadrootsSellerReservationAssertionV1 {
- pub reservation_id: RadrootsDTag,
+pub struct SellerReservationAssertionV1 {
+ pub reservation_id: DTag,
pub inventory_authority_id: PublicKey,
pub inventory_epoch: u64,
- pub candidate_id: RadrootsTradeCandidateId,
- pub commitments: Vec<RadrootsSellerReservationLineV1>,
+ pub candidate_id: CandidateId,
+ pub commitments: Vec<SellerReservationLineV1>,
pub reservation_expires_at_unix_s: u64,
pub assertion_commitment: String,
}
-impl RadrootsSellerReservationAssertionV1 {
- pub fn validate(&self) -> Result<(), RadrootsTradeProtocolError> {
+impl SellerReservationAssertionV1 {
+ pub fn validate(&self) -> Result<(), TradeProtocolError> {
if self.commitments.is_empty() {
- return Err(RadrootsTradeProtocolError::MissingReservationCommitments);
+ return Err(TradeProtocolError::MissingReservationCommitments);
}
validate_sorted_unique_by(
&self.commitments,
@@ -492,16 +486,16 @@ impl RadrootsSellerReservationAssertionV1 {
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
-pub struct RadrootsSellerReservationLineV1 {
- pub line_id: RadrootsDTag,
- pub bin_id: RadrootsInventoryBinId,
+pub struct SellerReservationLineV1 {
+ pub line_id: DTag,
+ pub bin_id: InventoryBinId,
pub quantity_mantissa: String,
pub quantity_scale: u8,
pub unit_code: String,
}
-impl RadrootsSellerReservationLineV1 {
- pub fn validate(&self) -> Result<(), RadrootsTradeProtocolError> {
+impl SellerReservationLineV1 {
+ pub fn validate(&self) -> Result<(), TradeProtocolError> {
validate_decimal_string(
&self.quantity_mantissa,
"reservation.line.quantity_mantissa",
@@ -513,17 +507,17 @@ impl RadrootsSellerReservationLineV1 {
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "snake_case", tag = "decision"))]
-pub enum RadrootsTradeDecisionV1 {
+pub enum TradeDecisionV1 {
Accepted {
- reservation_assertion: Option<RadrootsSellerReservationAssertionV1>,
+ reservation_assertion: Option<SellerReservationAssertionV1>,
},
Declined {
reason: String,
},
}
-impl RadrootsTradeDecisionV1 {
- pub fn validate(&self) -> Result<(), RadrootsTradeProtocolError> {
+impl TradeDecisionV1 {
+ pub fn validate(&self) -> Result<(), TradeProtocolError> {
match self {
Self::Accepted {
reservation_assertion,
@@ -539,14 +533,14 @@ impl RadrootsTradeDecisionV1 {
}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsTradeCanonicalMutationV1 {
- pub mutation_id: RadrootsTradeMutationId,
- pub envelope: RadrootsTradeMutationEnvelopeV1,
+pub struct TradeCanonicalMutationV1 {
+ pub mutation_id: MutationId,
+ pub envelope: TradeMutationEnvelopeV1,
pub content: String,
}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsTradeProtocolError {
+pub enum TradeProtocolError {
InvalidSchemaVersion {
expected: u16,
actual: u16,
@@ -585,7 +579,7 @@ pub enum RadrootsTradeProtocolError {
InvalidField(&'static str),
InvalidIdentifier {
field: &'static str,
- error: RadrootsIdParseError,
+ error: ParseError,
},
InvalidTimeRange,
MissingReservationCommitments,
@@ -600,7 +594,7 @@ pub enum RadrootsTradeProtocolError {
},
}
-impl fmt::Display for RadrootsTradeProtocolError {
+impl fmt::Display for TradeProtocolError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::InvalidSchemaVersion { expected, actual } => {
@@ -656,12 +650,12 @@ impl fmt::Display for RadrootsTradeProtocolError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsTradeProtocolError {}
+impl std::error::Error for TradeProtocolError {}
#[cfg(feature = "serde")]
pub fn canonical_trade_candidate_id(
- candidate: &RadrootsTradeCandidateTermsV1,
-) -> Result<RadrootsTradeCandidateId, RadrootsTradeProtocolError> {
+ candidate: &TradeCandidateTermsV1,
+) -> Result<CandidateId, TradeProtocolError> {
let mut value = serialize_trade_value(candidate);
remove_object_field(&mut value, "candidate_id")?;
let canonical = canonical_jcs_value(&value)?;
@@ -670,8 +664,8 @@ pub fn canonical_trade_candidate_id(
#[cfg(feature = "serde")]
pub fn canonical_trade_mutation_id(
- envelope: &RadrootsTradeMutationEnvelopeV1,
-) -> Result<RadrootsTradeMutationId, RadrootsTradeProtocolError> {
+ envelope: &TradeMutationEnvelopeV1,
+) -> Result<MutationId, TradeProtocolError> {
let mut value = serialize_trade_value(envelope);
remove_object_field(&mut value, "mutation_id")?;
let canonical = canonical_jcs_value(&value)?;
@@ -680,8 +674,8 @@ pub fn canonical_trade_mutation_id(
#[cfg(feature = "serde")]
pub fn canonical_trade_mutation_content(
- mut envelope: RadrootsTradeMutationEnvelopeV1,
-) -> Result<RadrootsTradeCanonicalMutationV1, RadrootsTradeProtocolError> {
+ mut envelope: TradeMutationEnvelopeV1,
+) -> Result<TradeCanonicalMutationV1, TradeProtocolError> {
finalize_body_candidate_ids(&mut envelope.body)?;
envelope.validate()?;
let mutation_id = canonical_trade_mutation_id(&envelope)?;
@@ -689,12 +683,12 @@ pub fn canonical_trade_mutation_content(
let value = serialize_trade_value(&envelope);
let content = canonical_jcs_value(&value)?;
if content.len() > RADROOTS_TRADE_MAX_PUBLIC_CONTENT_BYTES {
- return Err(RadrootsTradeProtocolError::ContentTooLarge {
+ return Err(TradeProtocolError::ContentTooLarge {
max: RADROOTS_TRADE_MAX_PUBLIC_CONTENT_BYTES,
actual: content.len(),
});
}
- Ok(RadrootsTradeCanonicalMutationV1 {
+ Ok(TradeCanonicalMutationV1 {
mutation_id,
envelope,
content,
@@ -704,25 +698,25 @@ pub fn canonical_trade_mutation_content(
#[cfg(feature = "serde")]
pub fn trade_mutation_from_canonical_content(
content: &str,
-) -> Result<RadrootsTradeMutationEnvelopeV1, RadrootsTradeProtocolError> {
+) -> Result<TradeMutationEnvelopeV1, TradeProtocolError> {
if content.len() > RADROOTS_TRADE_MAX_PUBLIC_CONTENT_BYTES {
- return Err(RadrootsTradeProtocolError::ContentTooLarge {
+ return Err(TradeProtocolError::ContentTooLarge {
max: RADROOTS_TRADE_MAX_PUBLIC_CONTENT_BYTES,
actual: content.len(),
});
}
let value = parse_json_without_duplicate_keys(content)?;
if canonical_jcs_value(&value)? != content {
- return Err(RadrootsTradeProtocolError::NonCanonicalJson);
+ return Err(TradeProtocolError::NonCanonicalJson);
}
- let envelope: RadrootsTradeMutationEnvelopeV1 = serde_json::from_value(value)
- .map_err(|error| RadrootsTradeProtocolError::InvalidJson(error.to_string()))?;
+ let envelope: TradeMutationEnvelopeV1 = serde_json::from_value(value)
+ .map_err(|error| TradeProtocolError::InvalidJson(error.to_string()))?;
envelope.validate()?;
verify_candidate_ids(&envelope.body)?;
if let Some(declared) = &envelope.mutation_id {
let computed = canonical_trade_mutation_id(&envelope)?;
if declared != &computed {
- return Err(RadrootsTradeProtocolError::MutationIdMismatch {
+ return Err(TradeProtocolError::MutationIdMismatch {
declared: declared.to_string(),
computed: computed.to_string(),
});
@@ -732,20 +726,20 @@ pub fn trade_mutation_from_canonical_content(
}
#[cfg(feature = "serde")]
-pub fn canonical_jcs_from_str(content: &str) -> Result<String, RadrootsTradeProtocolError> {
+pub fn canonical_jcs_from_str(content: &str) -> Result<String, TradeProtocolError> {
let value = parse_json_without_duplicate_keys(content)?;
canonical_jcs_value(&value)
}
#[cfg(feature = "serde")]
-pub fn canonical_jcs_value(value: &Value) -> Result<String, RadrootsTradeProtocolError> {
+pub fn canonical_jcs_value(value: &Value) -> Result<String, TradeProtocolError> {
let mut output = String::new();
write_canonical_jcs(value, &mut output)?;
Ok(output)
}
#[cfg(feature = "serde")]
-fn parse_json_without_duplicate_keys(content: &str) -> Result<Value, RadrootsTradeProtocolError> {
+fn parse_json_without_duplicate_keys(content: &str) -> Result<Value, TradeProtocolError> {
let mut deserializer = serde_json::Deserializer::from_str(content);
let value = NoDuplicateJsonValue::deserialize(&mut deserializer).map_err(map_json_error)?;
deserializer.end().map_err(map_json_error)?;
@@ -753,20 +747,17 @@ fn parse_json_without_duplicate_keys(content: &str) -> Result<Value, RadrootsTra
}
#[cfg(feature = "serde")]
-fn map_json_error(error: serde_json::Error) -> RadrootsTradeProtocolError {
+fn map_json_error(error: serde_json::Error) -> TradeProtocolError {
let message = error.to_string();
if let Some(key) = message.strip_prefix("duplicate key: ") {
let key = key.split(" at line ").next().unwrap_or(key).to_string();
- return RadrootsTradeProtocolError::DuplicateKey(key);
+ return TradeProtocolError::DuplicateKey(key);
}
- RadrootsTradeProtocolError::InvalidJson(message)
+ TradeProtocolError::InvalidJson(message)
}
#[cfg(feature = "serde")]
-fn write_canonical_jcs(
- value: &Value,
- output: &mut String,
-) -> Result<(), RadrootsTradeProtocolError> {
+fn write_canonical_jcs(value: &Value, output: &mut String) -> Result<(), TradeProtocolError> {
match value {
Value::Null => output.push_str("null"),
Value::Bool(value) => output.push_str(if *value { "true" } else { "false" }),
@@ -804,11 +795,11 @@ fn write_canonical_jcs(
}
#[cfg(feature = "serde")]
-fn canonical_number(number: &Number) -> Result<String, RadrootsTradeProtocolError> {
+fn canonical_number(number: &Number) -> Result<String, TradeProtocolError> {
if number.is_i64() || number.is_u64() {
Ok(number.to_string())
} else {
- Err(RadrootsTradeProtocolError::UnsupportedNumber)
+ Err(TradeProtocolError::UnsupportedNumber)
}
}
@@ -834,25 +825,22 @@ fn canonical_json_string(value: &str) -> String {
#[cfg(feature = "serde")]
#[cfg_attr(coverage_nightly, coverage(off))]
-fn trade_candidate_id_from_canonical(canonical: &[u8]) -> RadrootsTradeCandidateId {
- RadrootsTradeCandidateId::parse(digest_prefixed(RADROOTS_TRADE_CANDIDATE_DOMAIN, canonical))
+fn trade_candidate_id_from_canonical(canonical: &[u8]) -> CandidateId {
+ CandidateId::parse(digest_prefixed(RADROOTS_TRADE_CANDIDATE_DOMAIN, canonical))
.expect("SHA-256 always produces a canonical 64-character identifier")
}
#[cfg(feature = "serde")]
#[cfg_attr(coverage_nightly, coverage(off))]
-fn trade_mutation_id_from_canonical(canonical: &[u8]) -> RadrootsTradeMutationId {
- RadrootsTradeMutationId::parse(digest_prefixed(RADROOTS_TRADE_MUTATION_DOMAIN, canonical))
+fn trade_mutation_id_from_canonical(canonical: &[u8]) -> MutationId {
+ MutationId::parse(digest_prefixed(RADROOTS_TRADE_MUTATION_DOMAIN, canonical))
.expect("SHA-256 always produces a canonical 64-character identifier")
}
#[cfg(feature = "serde")]
-fn remove_object_field(
- value: &mut Value,
- field: &'static str,
-) -> Result<(), RadrootsTradeProtocolError> {
+fn remove_object_field(value: &mut Value, field: &'static str) -> Result<(), TradeProtocolError> {
let Value::Object(map) = value else {
- return Err(RadrootsTradeProtocolError::InvalidJson(
+ return Err(TradeProtocolError::InvalidJson(
"root must be object".to_string(),
));
};
@@ -861,12 +849,10 @@ fn remove_object_field(
}
#[cfg(feature = "serde")]
-fn finalize_body_candidate_ids(
- body: &mut RadrootsTradeMutationBodyV1,
-) -> Result<(), RadrootsTradeProtocolError> {
+fn finalize_body_candidate_ids(body: &mut TradeMutationBodyV1) -> Result<(), TradeProtocolError> {
match body {
- RadrootsTradeMutationBodyV1::Proposal { candidate }
- | RadrootsTradeMutationBodyV1::RevisionProposal { candidate } => {
+ TradeMutationBodyV1::Proposal { candidate }
+ | TradeMutationBodyV1::RevisionProposal { candidate } => {
let candidate_id = canonical_trade_candidate_id(candidate)?;
candidate.candidate_id = Some(candidate_id);
}
@@ -876,16 +862,14 @@ fn finalize_body_candidate_ids(
}
#[cfg(feature = "serde")]
-fn verify_candidate_ids(
- body: &RadrootsTradeMutationBodyV1,
-) -> Result<(), RadrootsTradeProtocolError> {
+fn verify_candidate_ids(body: &TradeMutationBodyV1) -> Result<(), TradeProtocolError> {
match body {
- RadrootsTradeMutationBodyV1::Proposal { candidate }
- | RadrootsTradeMutationBodyV1::RevisionProposal { candidate } => {
+ TradeMutationBodyV1::Proposal { candidate }
+ | TradeMutationBodyV1::RevisionProposal { candidate } => {
if let Some(declared) = &candidate.candidate_id {
let computed = canonical_trade_candidate_id(candidate)?;
if declared != &computed {
- return Err(RadrootsTradeProtocolError::CandidateIdMismatch {
+ return Err(TradeProtocolError::CandidateIdMismatch {
declared: declared.to_string(),
computed: computed.to_string(),
});
@@ -898,27 +882,27 @@ fn verify_candidate_ids(
}
fn validate_parent_mutation_ids(
- mutation_id: Option<&RadrootsTradeMutationId>,
- parents: &[RadrootsTradeMutationId],
-) -> Result<(), RadrootsTradeProtocolError> {
+ mutation_id: Option<&MutationId>,
+ parents: &[MutationId],
+) -> Result<(), TradeProtocolError> {
if parents.len() > RADROOTS_TRADE_MAX_PARENT_MUTATIONS {
- return Err(RadrootsTradeProtocolError::TooManyParents {
+ return Err(TradeProtocolError::TooManyParents {
max: RADROOTS_TRADE_MAX_PARENT_MUTATIONS,
actual: parents.len(),
});
}
- let mut previous: Option<&RadrootsTradeMutationId> = None;
+ let mut previous: Option<&MutationId> = None;
for parent in parents {
if Some(parent) == mutation_id {
- return Err(RadrootsTradeProtocolError::SelfParent);
+ return Err(TradeProtocolError::SelfParent);
}
if let Some(previous) = previous {
match previous.cmp(parent) {
core::cmp::Ordering::Greater => {
- return Err(RadrootsTradeProtocolError::UnsortedParents);
+ return Err(TradeProtocolError::UnsortedParents);
}
core::cmp::Ordering::Equal => {
- return Err(RadrootsTradeProtocolError::DuplicateParent);
+ return Err(TradeProtocolError::DuplicateParent);
}
core::cmp::Ordering::Less => {}
}
@@ -932,7 +916,7 @@ fn validate_sorted_unique_by<T, F>(
items: &[T],
mut key: F,
field: &'static str,
-) -> Result<(), RadrootsTradeProtocolError>
+) -> Result<(), TradeProtocolError>
where
F: FnMut(&T) -> &str,
{
@@ -943,25 +927,22 @@ where
if let Some(previous) = previous
&& previous >= item_key
{
- return Err(RadrootsTradeProtocolError::InvalidField(field));
+ return Err(TradeProtocolError::InvalidField(field));
}
previous = Some(item_key);
}
Ok(())
}
-fn validate_non_empty(value: &str, field: &'static str) -> Result<(), RadrootsTradeProtocolError> {
+fn validate_non_empty(value: &str, field: &'static str) -> Result<(), TradeProtocolError> {
if value.trim().is_empty() {
- Err(RadrootsTradeProtocolError::EmptyField(field))
+ Err(TradeProtocolError::EmptyField(field))
} else {
Ok(())
}
}
-fn validate_decimal_string(
- value: &str,
- field: &'static str,
-) -> Result<(), RadrootsTradeProtocolError> {
+fn validate_decimal_string(value: &str, field: &'static str) -> Result<(), TradeProtocolError> {
validate_non_empty(value, field)?;
let mut chars = value.chars();
if matches!(chars.clone().next(), Some('-')) {
@@ -971,20 +952,20 @@ fn validate_decimal_string(
for character in chars {
match character {
'0'..='9' => saw_digit = true,
- _ => return Err(RadrootsTradeProtocolError::InvalidField(field)),
+ _ => return Err(TradeProtocolError::InvalidField(field)),
}
}
if saw_digit {
Ok(())
} else {
- Err(RadrootsTradeProtocolError::InvalidField(field))
+ Err(TradeProtocolError::InvalidField(field))
}
}
-fn validate_sha256_hex(value: &str, field: &'static str) -> Result<(), RadrootsTradeProtocolError> {
- RadrootsTradeMutationId::parse(value)
+fn validate_sha256_hex(value: &str, field: &'static str) -> Result<(), TradeProtocolError> {
+ MutationId::parse(value)
.map(|_| ())
- .map_err(|error| RadrootsTradeProtocolError::InvalidIdentifier { field, error })
+ .map_err(|error| TradeProtocolError::InvalidIdentifier { field, error })
}
#[cfg(feature = "serde")]
@@ -1101,34 +1082,34 @@ mod tests {
parse_public_key(crate::test_valid_hex_64(character)).unwrap()
}
- fn event_id(character: char) -> RadrootsEventId {
- RadrootsEventId::parse(hex_64(character)).unwrap()
+ fn event_id(character: char) -> EventId {
+ EventId::parse(hex_64(character)).unwrap()
}
- fn trade_id() -> RadrootsTradeId {
- RadrootsTradeId::parse(hex_32('1')).unwrap()
+ fn trade_id() -> TradeId {
+ TradeId::parse(hex_32('1')).unwrap()
}
- fn mutation_id(character: char) -> RadrootsTradeMutationId {
- RadrootsTradeMutationId::parse(hex_64(character)).unwrap()
+ fn mutation_id(character: char) -> MutationId {
+ MutationId::parse(hex_64(character)).unwrap()
}
- fn candidate_id(character: char) -> RadrootsTradeCandidateId {
- RadrootsTradeCandidateId::parse(hex_64(character)).unwrap()
+ fn candidate_id(character: char) -> CandidateId {
+ CandidateId::parse(hex_64(character)).unwrap()
}
- fn candidate() -> RadrootsTradeCandidateTermsV1 {
- RadrootsTradeCandidateTermsV1 {
+ fn candidate() -> TradeCandidateTermsV1 {
+ TradeCandidateTermsV1 {
candidate_id: None,
schema_version: RADROOTS_TRADE_SCHEMA_VERSION,
base_candidate_id: None,
supersession_intent: None,
buyer_pubkey: pubkey('a'),
seller_pubkey: pubkey('b'),
- farm_id: RadrootsDTag::parse("farm-1").unwrap(),
- lines: vec![RadrootsTradeCandidateLineV1 {
- line_id: RadrootsDTag::parse("line-1").unwrap(),
- listing_addr: RadrootsClassifiedListingAddress::parse(format!(
+ farm_id: DTag::parse("farm-1").unwrap(),
+ lines: vec![TradeCandidateLineV1 {
+ line_id: DTag::parse("line-1").unwrap(),
+ listing_addr: ClassifiedListingAddress::parse(format!(
"30402:{}:listing-1",
crate::test_valid_hex_64('b')
))
@@ -1137,7 +1118,7 @@ mod tests {
listing_snapshot_sha256: hex_64('d'),
product_id: "carrots".to_string(),
option_id: None,
- bin_id: RadrootsInventoryBinId::parse("bin-1").unwrap(),
+ bin_id: InventoryBinId::parse("bin-1").unwrap(),
quantity_mantissa: "2".to_string(),
quantity_scale: 0,
unit_code: "count".to_string(),
@@ -1148,7 +1129,7 @@ mod tests {
replaces_line_id: None,
}],
line_tombstones: Vec::new(),
- economics: RadrootsTradeEconomicsProfileV1 {
+ economics: TradeEconomicsProfileV1 {
profile_id: "mvp-fixed".to_string(),
currency_code: "USD".to_string(),
currency_exponent: 2,
@@ -1159,7 +1140,7 @@ mod tests {
total_mantissa: "1000".to_string(),
adjustments: Vec::new(),
},
- fulfillment: RadrootsFulfillmentProfileV1 {
+ fulfillment: FulfillmentProfileV1 {
profile_id: "market-pickup".to_string(),
method: "pickup".to_string(),
starts_at_unix_s: 1_800_000_000,
@@ -1170,7 +1151,7 @@ mod tests {
location_class: "farmstand".to_string(),
requires_private_terms: false,
},
- cancellation: RadrootsTradeCancellationProfileV1 {
+ cancellation: TradeCancellationProfileV1 {
profile_id: "buyer-pre-agreement".to_string(),
buyer_pre_agreement: true,
post_agreement_cutoff_unix_s: None,
@@ -1180,8 +1161,8 @@ mod tests {
}
}
- fn proposal() -> RadrootsTradeMutationEnvelopeV1 {
- RadrootsTradeMutationEnvelopeV1 {
+ fn proposal() -> TradeMutationEnvelopeV1 {
+ TradeMutationEnvelopeV1 {
mutation_id: None,
contract_id: RADROOTS_TRADE_PROPOSAL_CONTRACT_ID.to_string(),
schema_version: RADROOTS_TRADE_SCHEMA_VERSION,
@@ -1189,20 +1170,20 @@ mod tests {
root_mutation_id: None,
buyer_pubkey: pubkey('a'),
seller_pubkey: pubkey('b'),
- farm_id: RadrootsDTag::parse("farm-1").unwrap(),
+ farm_id: DTag::parse("farm-1").unwrap(),
parent_mutation_ids: Vec::new(),
author_pubkey: pubkey('a'),
counterparty_pubkey: pubkey('b'),
authored_at_unix_s: 1_799_000_000,
- body: RadrootsTradeMutationBodyV1::Proposal {
+ body: TradeMutationBodyV1::Proposal {
candidate: candidate(),
},
}
}
- fn adjustment(id: &str) -> RadrootsTradeEconomicAdjustmentV1 {
- RadrootsTradeEconomicAdjustmentV1 {
- adjustment_id: RadrootsDTag::parse(id).unwrap(),
+ fn adjustment(id: &str) -> TradeEconomicAdjustmentV1 {
+ TradeEconomicAdjustmentV1 {
+ adjustment_id: DTag::parse(id).unwrap(),
actor: "seller".to_owned(),
effect: "charge".to_owned(),
amount_mantissa: "10".to_owned(),
@@ -1210,15 +1191,15 @@ mod tests {
}
}
- fn reservation_assertion() -> RadrootsSellerReservationAssertionV1 {
- RadrootsSellerReservationAssertionV1 {
- reservation_id: RadrootsDTag::parse("reservation-1").unwrap(),
+ fn reservation_assertion() -> SellerReservationAssertionV1 {
+ SellerReservationAssertionV1 {
+ reservation_id: DTag::parse("reservation-1").unwrap(),
inventory_authority_id: pubkey('c'),
inventory_epoch: 1,
candidate_id: candidate_id('d'),
- commitments: vec![RadrootsSellerReservationLineV1 {
- line_id: RadrootsDTag::parse("line-1").unwrap(),
- bin_id: RadrootsInventoryBinId::parse("bin-1").unwrap(),
+ commitments: vec![SellerReservationLineV1 {
+ line_id: DTag::parse("line-1").unwrap(),
+ bin_id: InventoryBinId::parse("bin-1").unwrap(),
quantity_mantissa: "2".to_owned(),
quantity_scale: 0,
unit_code: "count".to_owned(),
@@ -1228,7 +1209,7 @@ mod tests {
}
}
- fn child_envelope(body: RadrootsTradeMutationBodyV1) -> RadrootsTradeMutationEnvelopeV1 {
+ fn child_envelope(body: TradeMutationBodyV1) -> TradeMutationEnvelopeV1 {
let mut envelope = proposal();
envelope.contract_id = body.mutation_kind().contract_id().to_owned();
envelope.root_mutation_id = Some(mutation_id('a'));
@@ -1245,7 +1226,7 @@ mod tests {
);
assert!(matches!(
canonical_jcs_from_str(r#"{"a":1,"a":2}"#),
- Err(RadrootsTradeProtocolError::DuplicateKey(_))
+ Err(TradeProtocolError::DuplicateKey(_))
));
}
@@ -1265,17 +1246,17 @@ mod tests {
fn canonical_trade_mutation_rejects_parent_ordering() {
let mut envelope = proposal();
envelope.contract_id = RADROOTS_TRADE_REVISION_PROPOSAL_CONTRACT_ID.to_string();
- envelope.root_mutation_id = Some(RadrootsTradeMutationId::parse(hex_64('a')).unwrap());
+ envelope.root_mutation_id = Some(MutationId::parse(hex_64('a')).unwrap());
envelope.parent_mutation_ids = vec![
- RadrootsTradeMutationId::parse(hex_64('b')).unwrap(),
- RadrootsTradeMutationId::parse(hex_64('a')).unwrap(),
+ MutationId::parse(hex_64('b')).unwrap(),
+ MutationId::parse(hex_64('a')).unwrap(),
];
- envelope.body = RadrootsTradeMutationBodyV1::RevisionProposal {
+ envelope.body = TradeMutationBodyV1::RevisionProposal {
candidate: candidate(),
};
assert!(matches!(
canonical_trade_mutation_content(envelope),
- Err(RadrootsTradeProtocolError::UnsortedParents)
+ Err(TradeProtocolError::UnsortedParents)
));
}
@@ -1283,11 +1264,11 @@ mod tests {
#[cfg_attr(coverage_nightly, coverage(off))]
fn trade_validation_contract_covers_every_mutation_and_parent_rule() {
let kinds = [
- RadrootsTradeMutationKindV1::Proposal,
- RadrootsTradeMutationKindV1::Decision,
- RadrootsTradeMutationKindV1::RevisionProposal,
- RadrootsTradeMutationKindV1::RevisionDecision,
- RadrootsTradeMutationKindV1::Cancellation,
+ TradeMutationKindV1::Proposal,
+ TradeMutationKindV1::Decision,
+ TradeMutationKindV1::RevisionProposal,
+ TradeMutationKindV1::RevisionDecision,
+ TradeMutationKindV1::Cancellation,
];
for kind in kinds {
assert!(!kind.contract_id().is_empty());
@@ -1298,31 +1279,31 @@ mod tests {
envelope.schema_version += 1;
assert!(matches!(
envelope.validate(),
- Err(RadrootsTradeProtocolError::InvalidSchemaVersion { .. })
+ Err(TradeProtocolError::InvalidSchemaVersion { .. })
));
let mut envelope = proposal();
envelope.contract_id = "wrong".to_owned();
assert!(matches!(
envelope.validate(),
- Err(RadrootsTradeProtocolError::ContractMismatch { .. })
+ Err(TradeProtocolError::ContractMismatch { .. })
));
let mut envelope = proposal();
envelope.root_mutation_id = Some(mutation_id('a'));
assert_eq!(
envelope.validate(),
- Err(RadrootsTradeProtocolError::InvalidInitialParents)
+ Err(TradeProtocolError::InvalidInitialParents)
);
let mut envelope = proposal();
envelope.parent_mutation_ids = vec![mutation_id('a')];
assert_eq!(
envelope.validate(),
- Err(RadrootsTradeProtocolError::InvalidInitialParents)
+ Err(TradeProtocolError::InvalidInitialParents)
);
- let mut envelope = child_envelope(RadrootsTradeMutationBodyV1::Decision {
+ let mut envelope = child_envelope(TradeMutationBodyV1::Decision {
proposal_mutation_id: mutation_id('a'),
candidate_id: candidate_id('a'),
- decision: RadrootsTradeDecisionV1::Accepted {
+ decision: TradeDecisionV1::Accepted {
reservation_assertion: None,
},
});
@@ -1330,41 +1311,41 @@ mod tests {
envelope.root_mutation_id = None;
assert_eq!(
envelope.validate(),
- Err(RadrootsTradeProtocolError::MissingParentMutation)
+ Err(TradeProtocolError::MissingParentMutation)
);
- let mut envelope = child_envelope(RadrootsTradeMutationBodyV1::Decision {
+ let mut envelope = child_envelope(TradeMutationBodyV1::Decision {
proposal_mutation_id: mutation_id('a'),
candidate_id: candidate_id('a'),
- decision: RadrootsTradeDecisionV1::Accepted {
+ decision: TradeDecisionV1::Accepted {
reservation_assertion: None,
},
});
envelope.parent_mutation_ids.clear();
assert_eq!(
envelope.validate(),
- Err(RadrootsTradeProtocolError::MissingParentMutation)
+ Err(TradeProtocolError::MissingParentMutation)
);
- let revision_decision = child_envelope(RadrootsTradeMutationBodyV1::RevisionDecision {
+ let revision_decision = child_envelope(TradeMutationBodyV1::RevisionDecision {
proposal_mutation_id: mutation_id('a'),
candidate_id: candidate_id('a'),
- decision: RadrootsTradeDecisionV1::Declined {
+ decision: TradeDecisionV1::Declined {
reason: "inventory unavailable".to_owned(),
},
});
assert!(revision_decision.validate().is_ok());
- let revision = child_envelope(RadrootsTradeMutationBodyV1::RevisionProposal {
+ let revision = child_envelope(TradeMutationBodyV1::RevisionProposal {
candidate: candidate(),
});
assert!(revision.validate().is_ok());
for body in [
- RadrootsTradeMutationBodyV1::Cancellation {
+ TradeMutationBodyV1::Cancellation {
target_candidate_id: Some(candidate_id('a')),
target_claim_mutation_id: None,
reason: "cancelled".to_owned(),
},
- RadrootsTradeMutationBodyV1::Cancellation {
+ TradeMutationBodyV1::Cancellation {
target_candidate_id: None,
target_claim_mutation_id: Some(mutation_id('a')),
reason: "cancelled".to_owned(),
@@ -1373,16 +1354,16 @@ mod tests {
assert!(child_envelope(body).validate().is_ok());
}
assert_eq!(
- RadrootsTradeMutationBodyV1::Cancellation {
+ TradeMutationBodyV1::Cancellation {
target_candidate_id: None,
target_claim_mutation_id: None,
reason: "cancelled".to_owned(),
}
.validate(),
- Err(RadrootsTradeProtocolError::MissingCancellationTarget)
+ Err(TradeProtocolError::MissingCancellationTarget)
);
assert!(
- RadrootsTradeMutationBodyV1::Cancellation {
+ TradeMutationBodyV1::Cancellation {
target_candidate_id: Some(candidate_id('a')),
target_claim_mutation_id: None,
reason: " ".to_owned(),
@@ -1402,18 +1383,18 @@ mod tests {
mutation_id('e'),
],
),
- Err(RadrootsTradeProtocolError::TooManyParents {
+ Err(TradeProtocolError::TooManyParents {
max: RADROOTS_TRADE_MAX_PARENT_MUTATIONS,
actual: 5,
})
);
assert_eq!(
validate_parent_mutation_ids(None, &[mutation_id('a'), mutation_id('a')]),
- Err(RadrootsTradeProtocolError::DuplicateParent)
+ Err(TradeProtocolError::DuplicateParent)
);
assert_eq!(
validate_parent_mutation_ids(Some(&mutation_id('a')), &[mutation_id('a')]),
- Err(RadrootsTradeProtocolError::SelfParent)
+ Err(TradeProtocolError::SelfParent)
);
assert!(validate_parent_mutation_ids(None, &[mutation_id('a'), mutation_id('b')]).is_ok());
assert!(validate_sorted_unique_by(&["a", "b"], |value| *value, "values").is_ok());
@@ -1430,25 +1411,22 @@ mod tests {
assert!(invalid.validate().is_err());
let mut invalid = base.clone();
invalid.lines.clear();
- assert_eq!(
- invalid.validate(),
- Err(RadrootsTradeProtocolError::MissingLines)
- );
+ assert_eq!(invalid.validate(), Err(TradeProtocolError::MissingLines));
let mut invalid = base.clone();
invalid.lines = vec![base.lines[0].clone(); RADROOTS_TRADE_MAX_ACTIVE_LINES + 1];
assert!(matches!(
invalid.validate(),
- Err(RadrootsTradeProtocolError::TooManyLines { .. })
+ Err(TradeProtocolError::TooManyLines { .. })
));
let mut invalid = base.clone();
invalid.lines.push(base.lines[0].clone());
assert!(matches!(
invalid.validate(),
- Err(RadrootsTradeProtocolError::InvalidField("lines"))
+ Err(TradeProtocolError::InvalidField("lines"))
));
- let tombstone = RadrootsTradeLineTombstoneV1 {
- line_id: RadrootsDTag::parse("line-2").unwrap(),
+ let tombstone = TradeLineTombstoneV1 {
+ line_id: DTag::parse("line-2").unwrap(),
reason: "removed".to_owned(),
};
let mut with_tombstone = base.clone();
@@ -1465,17 +1443,15 @@ mod tests {
line.option_id = Some("option-1".to_owned());
assert!(line.validate().is_ok());
for mutate in [
- |line: &mut RadrootsTradeCandidateLineV1| {
- line.listing_snapshot_sha256 = "bad".to_owned()
- },
- |line: &mut RadrootsTradeCandidateLineV1| line.product_id = " ".to_owned(),
- |line: &mut RadrootsTradeCandidateLineV1| line.option_id = Some(" ".to_owned()),
- |line: &mut RadrootsTradeCandidateLineV1| line.quantity_mantissa = "1.5".to_owned(),
- |line: &mut RadrootsTradeCandidateLineV1| line.unit_code = " ".to_owned(),
- |line: &mut RadrootsTradeCandidateLineV1| line.unit_profile = " ".to_owned(),
- |line: &mut RadrootsTradeCandidateLineV1| line.unit_price_mantissa = "-".to_owned(),
- |line: &mut RadrootsTradeCandidateLineV1| line.currency_code = " ".to_owned(),
- |line: &mut RadrootsTradeCandidateLineV1| line.line_subtotal_mantissa = "x".to_owned(),
+ |line: &mut TradeCandidateLineV1| line.listing_snapshot_sha256 = "bad".to_owned(),
+ |line: &mut TradeCandidateLineV1| line.product_id = " ".to_owned(),
+ |line: &mut TradeCandidateLineV1| line.option_id = Some(" ".to_owned()),
+ |line: &mut TradeCandidateLineV1| line.quantity_mantissa = "1.5".to_owned(),
+ |line: &mut TradeCandidateLineV1| line.unit_code = " ".to_owned(),
+ |line: &mut TradeCandidateLineV1| line.unit_profile = " ".to_owned(),
+ |line: &mut TradeCandidateLineV1| line.unit_price_mantissa = "-".to_owned(),
+ |line: &mut TradeCandidateLineV1| line.currency_code = " ".to_owned(),
+ |line: &mut TradeCandidateLineV1| line.line_subtotal_mantissa = "x".to_owned(),
] {
let mut line = base.lines[0].clone();
mutate(&mut line);
@@ -1487,17 +1463,13 @@ mod tests {
let economics = base.economics.clone();
for mutate in [
- |value: &mut RadrootsTradeEconomicsProfileV1| value.profile_id = " ".to_owned(),
- |value: &mut RadrootsTradeEconomicsProfileV1| value.currency_code = " ".to_owned(),
- |value: &mut RadrootsTradeEconomicsProfileV1| value.rounding_profile = " ".to_owned(),
- |value: &mut RadrootsTradeEconomicsProfileV1| value.subtotal_mantissa = "x".to_owned(),
- |value: &mut RadrootsTradeEconomicsProfileV1| {
- value.discount_total_mantissa = "x".to_owned()
- },
- |value: &mut RadrootsTradeEconomicsProfileV1| {
- value.adjustment_total_mantissa = "x".to_owned()
- },
- |value: &mut RadrootsTradeEconomicsProfileV1| value.total_mantissa = "x".to_owned(),
+ |value: &mut TradeEconomicsProfileV1| value.profile_id = " ".to_owned(),
+ |value: &mut TradeEconomicsProfileV1| value.currency_code = " ".to_owned(),
+ |value: &mut TradeEconomicsProfileV1| value.rounding_profile = " ".to_owned(),
+ |value: &mut TradeEconomicsProfileV1| value.subtotal_mantissa = "x".to_owned(),
+ |value: &mut TradeEconomicsProfileV1| value.discount_total_mantissa = "x".to_owned(),
+ |value: &mut TradeEconomicsProfileV1| value.adjustment_total_mantissa = "x".to_owned(),
+ |value: &mut TradeEconomicsProfileV1| value.total_mantissa = "x".to_owned(),
] {
let mut value = economics.clone();
mutate(&mut value);
@@ -1507,7 +1479,7 @@ mod tests {
value.adjustments = vec![adjustment("adjustment-1"); RADROOTS_TRADE_MAX_ADJUSTMENTS + 1];
assert!(matches!(
value.validate(),
- Err(RadrootsTradeProtocolError::TooManyAdjustments { .. })
+ Err(TradeProtocolError::TooManyAdjustments { .. })
));
let mut value = economics.clone();
value.adjustments = vec![adjustment("adjustment-1"), adjustment("adjustment-1")];
@@ -1516,10 +1488,10 @@ mod tests {
value.adjustments = vec![adjustment("adjustment-1")];
assert!(value.validate().is_ok());
for mutate in [
- |value: &mut RadrootsTradeEconomicAdjustmentV1| value.actor = " ".to_owned(),
- |value: &mut RadrootsTradeEconomicAdjustmentV1| value.effect = " ".to_owned(),
- |value: &mut RadrootsTradeEconomicAdjustmentV1| value.amount_mantissa = "x".to_owned(),
- |value: &mut RadrootsTradeEconomicAdjustmentV1| value.reason = " ".to_owned(),
+ |value: &mut TradeEconomicAdjustmentV1| value.actor = " ".to_owned(),
+ |value: &mut TradeEconomicAdjustmentV1| value.effect = " ".to_owned(),
+ |value: &mut TradeEconomicAdjustmentV1| value.amount_mantissa = "x".to_owned(),
+ |value: &mut TradeEconomicAdjustmentV1| value.reason = " ".to_owned(),
] {
let mut value = adjustment("adjustment-1");
mutate(&mut value);
@@ -1528,14 +1500,12 @@ mod tests {
let fulfillment = base.fulfillment.clone();
for mutate in [
- |value: &mut RadrootsFulfillmentProfileV1| value.profile_id = " ".to_owned(),
- |value: &mut RadrootsFulfillmentProfileV1| value.method = " ".to_owned(),
- |value: &mut RadrootsFulfillmentProfileV1| value.timezone = " ".to_owned(),
- |value: &mut RadrootsFulfillmentProfileV1| value.location_class = " ".to_owned(),
- |value: &mut RadrootsFulfillmentProfileV1| {
- value.ends_at_unix_s = value.starts_at_unix_s
- },
- |value: &mut RadrootsFulfillmentProfileV1| value.fold = 2,
+ |value: &mut FulfillmentProfileV1| value.profile_id = " ".to_owned(),
+ |value: &mut FulfillmentProfileV1| value.method = " ".to_owned(),
+ |value: &mut FulfillmentProfileV1| value.timezone = " ".to_owned(),
+ |value: &mut FulfillmentProfileV1| value.location_class = " ".to_owned(),
+ |value: &mut FulfillmentProfileV1| value.ends_at_unix_s = value.starts_at_unix_s,
+ |value: &mut FulfillmentProfileV1| value.fold = 2,
] {
let mut value = fulfillment.clone();
mutate(&mut value);
@@ -1545,7 +1515,7 @@ mod tests {
cancellation.profile_id = " ".to_owned();
assert!(cancellation.validate().is_err());
- let private_terms = RadrootsTradePrivateTermsRefV1 {
+ let private_terms = TradePrivateTermsRefV1 {
artifact_id: "artifact-1".to_owned(),
schema_id: "schema-1".to_owned(),
ciphertext_commitment: hex_64('a'),
@@ -1555,11 +1525,9 @@ mod tests {
with_private.private_terms = Some(private_terms.clone());
assert!(with_private.validate().is_ok());
for mutate in [
- |value: &mut RadrootsTradePrivateTermsRefV1| value.artifact_id = " ".to_owned(),
- |value: &mut RadrootsTradePrivateTermsRefV1| value.schema_id = " ".to_owned(),
- |value: &mut RadrootsTradePrivateTermsRefV1| {
- value.ciphertext_commitment = "bad".to_owned()
- },
+ |value: &mut TradePrivateTermsRefV1| value.artifact_id = " ".to_owned(),
+ |value: &mut TradePrivateTermsRefV1| value.schema_id = " ".to_owned(),
+ |value: &mut TradePrivateTermsRefV1| value.ciphertext_commitment = "bad".to_owned(),
] {
let mut value = private_terms.clone();
mutate(&mut value);
@@ -1573,7 +1541,7 @@ mod tests {
value["lines"][0]["listing_addr"] =
serde_json::json!(format!("30023:{}:listing-1", crate::test_valid_hex_64('b')));
- assert!(serde_json::from_value::<RadrootsTradeCandidateTermsV1>(value).is_err());
+ assert!(serde_json::from_value::<TradeCandidateTermsV1>(value).is_err());
}
#[test]
@@ -1582,28 +1550,28 @@ mod tests {
let assertion = reservation_assertion();
assert!(assertion.validate().is_ok());
assert!(
- RadrootsTradeDecisionV1::Accepted {
+ TradeDecisionV1::Accepted {
reservation_assertion: None,
}
.validate()
.is_ok()
);
assert!(
- RadrootsTradeDecisionV1::Accepted {
+ TradeDecisionV1::Accepted {
reservation_assertion: Some(assertion.clone()),
}
.validate()
.is_ok()
);
assert!(
- RadrootsTradeDecisionV1::Declined {
+ TradeDecisionV1::Declined {
reason: "declined".to_owned(),
}
.validate()
.is_ok()
);
assert!(
- RadrootsTradeDecisionV1::Declined {
+ TradeDecisionV1::Declined {
reason: " ".to_owned(),
}
.validate()
@@ -1614,7 +1582,7 @@ mod tests {
invalid.commitments.clear();
assert_eq!(
invalid.validate(),
- Err(RadrootsTradeProtocolError::MissingReservationCommitments)
+ Err(TradeProtocolError::MissingReservationCommitments)
);
let mut invalid = assertion.clone();
invalid.commitments.push(invalid.commitments[0].clone());
@@ -1638,12 +1606,12 @@ mod tests {
let canonical = canonical_trade_mutation_content(proposal()).expect("canonical proposal");
assert_eq!(
canonical_trade_candidate_id(match &canonical.envelope.body {
- RadrootsTradeMutationBodyV1::Proposal { candidate } => candidate,
+ TradeMutationBodyV1::Proposal { candidate } => candidate,
_ => unreachable!("proposal"),
})
.expect("candidate id"),
match &canonical.envelope.body {
- RadrootsTradeMutationBodyV1::Proposal { candidate } => {
+ TradeMutationBodyV1::Proposal { candidate } => {
candidate.candidate_id.expect("candidate id")
}
_ => unreachable!("proposal"),
@@ -1658,27 +1626,27 @@ mod tests {
trade_mutation_from_canonical_content(
&"x".repeat(RADROOTS_TRADE_MAX_PUBLIC_CONTENT_BYTES + 1)
),
- Err(RadrootsTradeProtocolError::ContentTooLarge { .. })
+ Err(TradeProtocolError::ContentTooLarge { .. })
));
assert_eq!(
trade_mutation_from_canonical_content(" {} "),
- Err(RadrootsTradeProtocolError::NonCanonicalJson)
+ Err(TradeProtocolError::NonCanonicalJson)
);
assert!(matches!(
trade_mutation_from_canonical_content("{}"),
- Err(RadrootsTradeProtocolError::InvalidJson(_))
+ Err(TradeProtocolError::InvalidJson(_))
));
assert!(matches!(
canonical_jcs_from_str("{"),
- Err(RadrootsTradeProtocolError::InvalidJson(_))
+ Err(TradeProtocolError::InvalidJson(_))
));
assert!(matches!(
canonical_jcs_from_str("1.5"),
- Err(RadrootsTradeProtocolError::InvalidJson(_))
+ Err(TradeProtocolError::InvalidJson(_))
));
assert_eq!(
canonical_jcs_value(&serde_json::json!(1.5)),
- Err(RadrootsTradeProtocolError::UnsupportedNumber)
+ Err(TradeProtocolError::UnsupportedNumber)
);
assert_eq!(
canonical_jcs_value(&Value::Number(Number::from(u64::MAX))).expect("large integer"),
@@ -1691,7 +1659,7 @@ mod tests {
let wrong_candidate = canonical_jcs_value(&value).expect("wrong candidate json");
assert!(matches!(
trade_mutation_from_canonical_content(&wrong_candidate),
- Err(RadrootsTradeProtocolError::CandidateIdMismatch { .. })
+ Err(TradeProtocolError::CandidateIdMismatch { .. })
));
let mut value: Value = serde_json::from_str(&canonical.content).expect("canonical json");
@@ -1699,7 +1667,7 @@ mod tests {
let wrong_mutation = canonical_jcs_value(&value).expect("wrong mutation json");
assert!(matches!(
trade_mutation_from_canonical_content(&wrong_mutation),
- Err(RadrootsTradeProtocolError::MutationIdMismatch { .. })
+ Err(TradeProtocolError::MutationIdMismatch { .. })
));
let mut value: Value = serde_json::from_str(&canonical.content).expect("canonical json");
@@ -1708,29 +1676,29 @@ mod tests {
let undeclared_ids = canonical_jcs_value(&value).expect("undeclared ids json");
assert!(trade_mutation_from_canonical_content(&undeclared_ids).is_ok());
- let decision = child_envelope(RadrootsTradeMutationBodyV1::Decision {
+ let decision = child_envelope(TradeMutationBodyV1::Decision {
proposal_mutation_id: mutation_id('a'),
candidate_id: candidate_id('a'),
- decision: RadrootsTradeDecisionV1::Accepted {
+ decision: TradeDecisionV1::Accepted {
reservation_assertion: None,
},
});
let decision = canonical_trade_mutation_content(decision).expect("canonical decision");
assert!(trade_mutation_from_canonical_content(&decision.content).is_ok());
- let revision = child_envelope(RadrootsTradeMutationBodyV1::RevisionProposal {
+ let revision = child_envelope(TradeMutationBodyV1::RevisionProposal {
candidate: candidate(),
});
let revision = canonical_trade_mutation_content(revision).expect("canonical revision");
assert!(trade_mutation_from_canonical_content(&revision.content).is_ok());
let mut oversized = proposal();
- if let RadrootsTradeMutationBodyV1::Proposal { candidate } = &mut oversized.body {
+ if let TradeMutationBodyV1::Proposal { candidate } = &mut oversized.body {
candidate.lines[0].product_id = "x".repeat(RADROOTS_TRADE_MAX_PUBLIC_CONTENT_BYTES + 1);
}
assert!(matches!(
canonical_trade_mutation_content(oversized),
- Err(RadrootsTradeProtocolError::ContentTooLarge { .. })
+ Err(TradeProtocolError::ContentTooLarge { .. })
));
let string_value: Result<NoDuplicateJsonValue, serde_json::Error> =
@@ -1754,44 +1722,44 @@ mod tests {
);
assert!(expected.to_string().contains("JSON value"));
- let parse_error = RadrootsTradeMutationId::parse("bad").expect_err("invalid id");
+ let parse_error = MutationId::parse("bad").expect_err("invalid id");
let errors = [
- RadrootsTradeProtocolError::InvalidSchemaVersion {
+ TradeProtocolError::InvalidSchemaVersion {
expected: 1,
actual: 2,
},
- RadrootsTradeProtocolError::ContractMismatch {
+ TradeProtocolError::ContractMismatch {
expected: "expected",
actual: "actual".to_owned(),
},
- RadrootsTradeProtocolError::InvalidInitialParents,
- RadrootsTradeProtocolError::MissingParentMutation,
- RadrootsTradeProtocolError::TooManyParents { max: 1, actual: 2 },
- RadrootsTradeProtocolError::UnsortedParents,
- RadrootsTradeProtocolError::DuplicateParent,
- RadrootsTradeProtocolError::SelfParent,
- RadrootsTradeProtocolError::MissingLines,
- RadrootsTradeProtocolError::TooManyLines { max: 1, actual: 2 },
- RadrootsTradeProtocolError::TooManyAdjustments { max: 1, actual: 2 },
- RadrootsTradeProtocolError::DuplicateKey("key".to_owned()),
- RadrootsTradeProtocolError::InvalidJson("json".to_owned()),
- RadrootsTradeProtocolError::NonCanonicalJson,
- RadrootsTradeProtocolError::UnsupportedNumber,
- RadrootsTradeProtocolError::ContentTooLarge { max: 1, actual: 2 },
- RadrootsTradeProtocolError::EmptyField("field"),
- RadrootsTradeProtocolError::InvalidField("field"),
- RadrootsTradeProtocolError::InvalidIdentifier {
+ TradeProtocolError::InvalidInitialParents,
+ TradeProtocolError::MissingParentMutation,
+ TradeProtocolError::TooManyParents { max: 1, actual: 2 },
+ TradeProtocolError::UnsortedParents,
+ TradeProtocolError::DuplicateParent,
+ TradeProtocolError::SelfParent,
+ TradeProtocolError::MissingLines,
+ TradeProtocolError::TooManyLines { max: 1, actual: 2 },
+ TradeProtocolError::TooManyAdjustments { max: 1, actual: 2 },
+ TradeProtocolError::DuplicateKey("key".to_owned()),
+ TradeProtocolError::InvalidJson("json".to_owned()),
+ TradeProtocolError::NonCanonicalJson,
+ TradeProtocolError::UnsupportedNumber,
+ TradeProtocolError::ContentTooLarge { max: 1, actual: 2 },
+ TradeProtocolError::EmptyField("field"),
+ TradeProtocolError::InvalidField("field"),
+ TradeProtocolError::InvalidIdentifier {
field: "field",
error: parse_error,
},
- RadrootsTradeProtocolError::InvalidTimeRange,
- RadrootsTradeProtocolError::MissingReservationCommitments,
- RadrootsTradeProtocolError::MissingCancellationTarget,
- RadrootsTradeProtocolError::CandidateIdMismatch {
+ TradeProtocolError::InvalidTimeRange,
+ TradeProtocolError::MissingReservationCommitments,
+ TradeProtocolError::MissingCancellationTarget,
+ TradeProtocolError::CandidateIdMismatch {
declared: "a".to_owned(),
computed: "b".to_owned(),
},
- RadrootsTradeProtocolError::MutationIdMismatch {
+ TradeProtocolError::MutationIdMismatch {
declared: "a".to_owned(),
computed: "b".to_owned(),
},
diff --git a/crates/event/src/trade_validation.rs b/crates/event/src/trade_validation.rs
@@ -3,7 +3,7 @@
#[cfg(not(feature = "std"))]
use alloc::string::String;
-use crate::listing::operational::RadrootsOperationalListingParseError;
+use crate::listing::operational::OperationalListingParseError;
#[cfg_attr(
any(feature = "serde", test),
@@ -16,21 +16,13 @@ use crate::listing::operational::RadrootsOperationalListingParseError;
serde(rename_all = "snake_case", tag = "kind", content = "amount")
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsOperationalListingValidationError {
- InvalidKind {
- kind: u32,
- },
+pub enum OperationalListingValidationError {
+ InvalidKind { kind: u32 },
InvalidProfile,
MissingListingId,
- ListingEventNotFound {
- listing_addr: String,
- },
- ListingEventFetchFailed {
- listing_addr: String,
- },
- ParseError {
- error: RadrootsOperationalListingParseError,
- },
+ ListingEventNotFound { listing_addr: String },
+ ListingEventFetchFailed { listing_addr: String },
+ ParseError { error: OperationalListingParseError },
InvalidSeller,
MissingFarmProfile,
MissingFarmRecord,
@@ -52,7 +44,7 @@ pub enum RadrootsOperationalListingValidationError {
MissingDeliveryMethod,
}
-impl core::fmt::Display for RadrootsOperationalListingValidationError {
+impl core::fmt::Display for OperationalListingValidationError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::InvalidKind { kind } => write!(f, "invalid listing kind: {kind}"),
@@ -94,7 +86,7 @@ impl core::fmt::Display for RadrootsOperationalListingValidationError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsOperationalListingValidationError {}
+impl std::error::Error for OperationalListingValidationError {}
#[cfg(test)]
mod tests {
@@ -103,23 +95,23 @@ mod tests {
#[test]
fn listing_validation_error_display_covers_location_variants() {
assert_eq!(
- RadrootsOperationalListingValidationError::InvalidProfile.to_string(),
+ OperationalListingValidationError::InvalidProfile.to_string(),
"classified listing is not an Operational Listing profile"
);
assert_eq!(
- RadrootsOperationalListingValidationError::MissingLocation.to_string(),
+ OperationalListingValidationError::MissingLocation.to_string(),
"missing listing location"
);
assert_eq!(
- RadrootsOperationalListingValidationError::MissingLocationLocality.to_string(),
+ OperationalListingValidationError::MissingLocationLocality.to_string(),
"missing listing location locality"
);
assert_eq!(
- RadrootsOperationalListingValidationError::MissingLocationGeohash.to_string(),
+ OperationalListingValidationError::MissingLocationGeohash.to_string(),
"missing listing location geohash"
);
assert_eq!(
- RadrootsOperationalListingValidationError::InvalidLocationGeohash.to_string(),
+ OperationalListingValidationError::InvalidLocationGeohash.to_string(),
"invalid listing location geohash"
);
}
diff --git a/crates/event/src/verification.rs b/crates/event/src/verification.rs
@@ -9,30 +9,30 @@ use core::fmt;
use crate::{
contract::registry_v7::{
- RadrootsContractValidationError, RadrootsEventContract, validate_event_contract_registry_v7,
+ ContractValidationError, EventContract, validate_event_contract_registry_v7,
},
- envelope::RadrootsEventEnvelope,
- id::RadrootsEventId,
+ envelope::EventEnvelope,
+ id::EventId,
wire::compute_canonical_nip01_event_id,
};
/// A structurally valid event whose canonical identifier is not yet trusted.
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RawEvent(RadrootsEventEnvelope);
+pub struct RawEvent(EventEnvelope);
impl RawEvent {
#[must_use]
- pub const fn new(event: RadrootsEventEnvelope) -> Self {
+ pub const fn new(event: EventEnvelope) -> Self {
Self(event)
}
#[must_use]
- pub const fn event(&self) -> &RadrootsEventEnvelope {
+ pub const fn event(&self) -> &EventEnvelope {
&self.0
}
#[must_use]
- pub fn into_event(self) -> RadrootsEventEnvelope {
+ pub fn into_event(self) -> EventEnvelope {
self.0
}
@@ -66,16 +66,16 @@ impl RawEvent {
/// }
/// ```
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct IdVerifiedEvent(RadrootsEventEnvelope);
+pub struct IdVerifiedEvent(EventEnvelope);
impl IdVerifiedEvent {
#[must_use]
- pub const fn event(&self) -> &RadrootsEventEnvelope {
+ pub const fn event(&self) -> &EventEnvelope {
&self.0
}
#[must_use]
- pub fn into_event(self) -> RadrootsEventEnvelope {
+ pub fn into_event(self) -> EventEnvelope {
self.0
}
@@ -102,7 +102,7 @@ impl IdVerifiedEvent {
pub trait SignatureVerifier: Send + Sync {
/// Returns success only when the envelope's signature is valid for its
/// already verified canonical event identifier.
- fn verify_signature(&self, event: &RadrootsEventEnvelope) -> Result<(), Error>;
+ fn verify_signature(&self, event: &EventEnvelope) -> Result<(), Error>;
}
/// An event whose canonical identifier and BIP-340 signature are verified.
@@ -115,16 +115,16 @@ pub trait SignatureVerifier: Send + Sync {
/// }
/// ```
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct SignatureVerifiedEvent(RadrootsEventEnvelope);
+pub struct SignatureVerifiedEvent(EventEnvelope);
impl SignatureVerifiedEvent {
#[must_use]
- pub const fn event(&self) -> &RadrootsEventEnvelope {
+ pub const fn event(&self) -> &EventEnvelope {
&self.0
}
#[must_use]
- pub fn into_event(self) -> RadrootsEventEnvelope {
+ pub fn into_event(self) -> EventEnvelope {
self.0
}
@@ -151,7 +151,7 @@ impl SignatureVerifiedEvent {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ContractValidatedEvent {
event: SignatureVerifiedEvent,
- contract: &'static RadrootsEventContract,
+ contract: &'static EventContract,
}
impl ContractValidatedEvent {
@@ -161,12 +161,12 @@ impl ContractValidatedEvent {
}
#[must_use]
- pub const fn event(&self) -> &RadrootsEventEnvelope {
+ pub const fn event(&self) -> &EventEnvelope {
self.event.event()
}
#[must_use]
- pub const fn contract(&self) -> &'static RadrootsEventContract {
+ pub const fn contract(&self) -> &'static EventContract {
self.contract
}
@@ -181,7 +181,7 @@ impl ContractValidatedEvent {
}
#[must_use]
- pub fn into_event(self) -> RadrootsEventEnvelope {
+ pub fn into_event(self) -> EventEnvelope {
self.event.into_event()
}
}
@@ -191,12 +191,9 @@ impl ContractValidatedEvent {
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Error {
MalformedEnvelope,
- IdMismatch {
- expected: RadrootsEventId,
- actual: RadrootsEventId,
- },
+ IdMismatch { expected: EventId, actual: EventId },
SignatureInvalid,
- ContractValidation(RadrootsContractValidationError),
+ ContractValidation(ContractValidationError),
}
impl Error {
@@ -239,12 +236,12 @@ impl std::error::Error for Error {}
#[cfg(test)]
mod tests {
use super::*;
- use crate::envelope::RadrootsEventEnvelopeParts;
+ use crate::envelope::EventEnvelopeParts;
struct Accept;
impl SignatureVerifier for Accept {
- fn verify_signature(&self, _event: &RadrootsEventEnvelope) -> Result<(), Error> {
+ fn verify_signature(&self, _event: &EventEnvelope) -> Result<(), Error> {
Ok(())
}
}
@@ -252,13 +249,13 @@ mod tests {
struct Reject;
impl SignatureVerifier for Reject {
- fn verify_signature(&self, _event: &RadrootsEventEnvelope) -> Result<(), Error> {
+ fn verify_signature(&self, _event: &EventEnvelope) -> Result<(), Error> {
Err(Error::SignatureInvalid)
}
}
- fn valid_profile_event() -> RadrootsEventEnvelope {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ fn valid_profile_event() -> EventEnvelope {
+ EventEnvelope::new(EventEnvelopeParts {
id: "762bee187e9e645b81ec26ade05a69b5e8398caf527be8de0d9a45311ed0c7a0"
.to_owned(),
author: "585591529da0bab31b3b1b1f986611cf5f435dca84f978c89ee8a40cca7103df"
diff --git a/crates/event/src/wire/v1.rs b/crates/event/src/wire/v1.rs
@@ -12,10 +12,8 @@ use alloc::{
#[cfg(any(feature = "std", test))]
use std::{collections::BTreeMap, string::String, vec::Vec};
-use crate::envelope::{
- RadrootsEventEnvelope, RadrootsEventEnvelopeError, RadrootsEventEnvelopeParts,
-};
-use crate::id::{RadrootsEventId, RadrootsEventSignature, RadrootsIdParseError, parse_public_key};
+use crate::envelope::{EventEnvelope, EventEnvelopeError, EventEnvelopeParts};
+use crate::id::{EventId, EventSignature, ParseError, parse_public_key};
use core::fmt;
use serde_json::{Map, Value};
use sha2::{Digest, Sha256};
@@ -30,7 +28,7 @@ pub const DEFAULT_EXTRA_MAX_FIELDS: usize = 64;
pub const DEFAULT_EXTRA_TOTAL_JSON_MAX_BYTES: usize = 64 * 1024;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub struct RadrootsEventWireLimits {
+pub struct EventWireLimits {
pub max_raw_json_bytes: usize,
pub max_content_bytes: usize,
pub max_tag_count: usize,
@@ -41,7 +39,7 @@ pub struct RadrootsEventWireLimits {
pub max_total_extra_json_bytes: usize,
}
-impl Default for RadrootsEventWireLimits {
+impl Default for EventWireLimits {
fn default() -> Self {
Self {
max_raw_json_bytes: DEFAULT_RAW_JSON_MAX_BYTES,
@@ -57,12 +55,12 @@ impl Default for RadrootsEventWireLimits {
}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsCanonicalEventIdError {
- InvalidPubkey(RadrootsIdParseError),
- InvalidComputedEventId(RadrootsIdParseError),
+pub enum CanonicalEventIdError {
+ InvalidPubkey(ParseError),
+ InvalidComputedEventId(ParseError),
}
-impl fmt::Display for RadrootsCanonicalEventIdError {
+impl fmt::Display for CanonicalEventIdError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::InvalidPubkey(error) => {
@@ -76,17 +74,17 @@ impl fmt::Display for RadrootsCanonicalEventIdError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsCanonicalEventIdError {}
+impl std::error::Error for CanonicalEventIdError {}
#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum RadrootsEventWireError {
+pub enum EventWireError {
Json(String),
RootNotObject,
MissingField(&'static str),
InvalidField(&'static str),
InvalidIdentifier {
field: &'static str,
- error: RadrootsIdParseError,
+ error: ParseError,
},
NonCanonicalIdentifier {
field: &'static str,
@@ -134,15 +132,15 @@ pub enum RadrootsEventWireError {
max: usize,
actual: usize,
},
- CanonicalEventId(RadrootsCanonicalEventIdError),
- Envelope(RadrootsEventEnvelopeError),
+ CanonicalEventId(CanonicalEventIdError),
+ Envelope(EventEnvelopeError),
EventIdMismatch {
declared: String,
computed: String,
},
}
-impl fmt::Display for RadrootsEventWireError {
+impl fmt::Display for EventWireError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Json(error) => write!(f, "event wire json is invalid: {error}"),
@@ -204,16 +202,16 @@ impl fmt::Display for RadrootsEventWireError {
}
#[cfg(feature = "std")]
-impl std::error::Error for RadrootsEventWireError {}
+impl std::error::Error for EventWireError {}
-impl From<RadrootsCanonicalEventIdError> for RadrootsEventWireError {
- fn from(value: RadrootsCanonicalEventIdError) -> Self {
+impl From<CanonicalEventIdError> for EventWireError {
+ fn from(value: CanonicalEventIdError) -> Self {
Self::CanonicalEventId(value)
}
}
-impl From<RadrootsEventEnvelopeError> for RadrootsEventWireError {
- fn from(value: RadrootsEventEnvelopeError) -> Self {
+impl From<EventEnvelopeError> for EventWireError {
+ fn from(value: EventEnvelopeError) -> Self {
Self::Envelope(value)
}
}
@@ -223,7 +221,7 @@ impl From<RadrootsEventEnvelopeError> for RadrootsEventWireError {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsNip01EventWireParts {
+pub struct Nip01EventWireParts {
pub kind: u32,
pub content: String,
pub tags: Vec<Vec<String>>,
@@ -234,7 +232,7 @@ pub struct RadrootsNip01EventWireParts {
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct RadrootsNip01EventWire {
+pub struct Nip01EventWire {
pub id: String,
pub pubkey: String,
pub created_at: u64,
@@ -246,28 +244,28 @@ pub struct RadrootsNip01EventWire {
pub extra: BTreeMap<String, Value>,
}
-impl RadrootsNip01EventWire {
- pub fn parse_json(raw_json: &str) -> Result<Self, RadrootsEventWireError> {
- Self::parse_json_with_limits(raw_json, RadrootsEventWireLimits::default())
+impl Nip01EventWire {
+ pub fn parse_json(raw_json: &str) -> Result<Self, EventWireError> {
+ Self::parse_json_with_limits(raw_json, EventWireLimits::default())
}
pub fn parse_json_with_limits(
raw_json: &str,
- limits: RadrootsEventWireLimits,
- ) -> Result<Self, RadrootsEventWireError> {
+ limits: EventWireLimits,
+ ) -> Result<Self, EventWireError> {
let raw_len = raw_json.len();
if raw_len > limits.max_raw_json_bytes {
- return Err(RadrootsEventWireError::RawJsonTooLarge {
+ return Err(EventWireError::RawJsonTooLarge {
max: limits.max_raw_json_bytes,
actual: raw_len,
});
}
let value = serde_json::from_str::<Value>(raw_json)
- .map_err(|error| RadrootsEventWireError::Json(error.to_string()))?;
+ .map_err(|error| EventWireError::Json(error.to_string()))?;
Self::from_json_value(value, limits)
}
- pub fn canonical_id_preimage(&self) -> Result<String, RadrootsCanonicalEventIdError> {
+ pub fn canonical_id_preimage(&self) -> Result<String, CanonicalEventIdError> {
canonical_nip01_event_id_preimage(
self.pubkey.as_str(),
self.created_at,
@@ -277,7 +275,7 @@ impl RadrootsNip01EventWire {
)
}
- pub fn computed_event_id(&self) -> Result<RadrootsEventId, RadrootsCanonicalEventIdError> {
+ pub fn computed_event_id(&self) -> Result<EventId, CanonicalEventIdError> {
compute_canonical_nip01_event_id(
self.pubkey.as_str(),
self.created_at,
@@ -287,10 +285,10 @@ impl RadrootsNip01EventWire {
)
}
- pub fn verify_id(&self) -> Result<(), RadrootsEventWireError> {
+ pub fn verify_id(&self) -> Result<(), EventWireError> {
let computed = self.computed_event_id()?.into_string();
if computed.as_str() != self.id.as_str() {
- return Err(RadrootsEventWireError::EventIdMismatch {
+ return Err(EventWireError::EventIdMismatch {
declared: self.id.clone(),
computed,
});
@@ -298,16 +296,14 @@ impl RadrootsNip01EventWire {
Ok(())
}
- pub fn into_envelope(self) -> Result<RadrootsEventEnvelope, RadrootsEventWireError> {
+ pub fn into_envelope(self) -> Result<EventEnvelope, EventWireError> {
self.verify_id()?;
self.into_envelope_unchecked_id()
- .map_err(RadrootsEventWireError::Envelope)
+ .map_err(EventWireError::Envelope)
}
- pub(crate) fn into_envelope_unchecked_id(
- self,
- ) -> Result<RadrootsEventEnvelope, RadrootsEventEnvelopeError> {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ pub(crate) fn into_envelope_unchecked_id(self) -> Result<EventEnvelope, EventEnvelopeError> {
+ EventEnvelope::new(EventEnvelopeParts {
id: self.id,
author: self.pubkey,
created_at: self.created_at,
@@ -318,13 +314,10 @@ impl RadrootsNip01EventWire {
})
}
- fn from_json_value(
- value: Value,
- limits: RadrootsEventWireLimits,
- ) -> Result<Self, RadrootsEventWireError> {
+ fn from_json_value(value: Value, limits: EventWireLimits) -> Result<Self, EventWireError> {
let mut object = match value {
Value::Object(object) => object,
- _ => return Err(RadrootsEventWireError::RootNotObject),
+ _ => return Err(EventWireError::RootNotObject),
};
let id = take_canonical_event_id(&mut object)?;
let pubkey = take_canonical_pubkey(&mut object)?;
@@ -334,7 +327,7 @@ impl RadrootsNip01EventWire {
let content = take_string(&mut object, "content")?;
let content_len = content.len();
if content_len > limits.max_content_bytes {
- return Err(RadrootsEventWireError::ContentTooLarge {
+ return Err(EventWireError::ContentTooLarge {
max: limits.max_content_bytes,
actual: content_len,
});
@@ -362,7 +355,7 @@ pub fn canonical_nip01_event_id_preimage(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<String, RadrootsCanonicalEventIdError> {
+) -> Result<String, CanonicalEventIdError> {
canonical_nip01_event_id_preimage_v1(pubkey, created_at, kind, tags, content)
}
@@ -373,8 +366,8 @@ pub fn canonical_nip01_event_id_preimage_v1(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<String, RadrootsCanonicalEventIdError> {
- let pubkey = parse_public_key(pubkey).map_err(RadrootsCanonicalEventIdError::InvalidPubkey)?;
+) -> Result<String, CanonicalEventIdError> {
+ let pubkey = parse_public_key(pubkey).map_err(CanonicalEventIdError::InvalidPubkey)?;
let pubkey = pubkey.to_hex();
let mut preimage = String::new();
preimage.push_str("[0,");
@@ -409,7 +402,7 @@ pub fn compute_canonical_nip01_event_id(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsEventId, RadrootsCanonicalEventIdError> {
+) -> Result<EventId, CanonicalEventIdError> {
compute_canonical_nip01_event_id_v1(pubkey, created_at, kind, tags, content)
}
@@ -420,56 +413,48 @@ pub fn compute_canonical_nip01_event_id_v1(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsEventId, RadrootsCanonicalEventIdError> {
+) -> Result<EventId, CanonicalEventIdError> {
let preimage = canonical_nip01_event_id_preimage_v1(pubkey, created_at, kind, tags, content)?;
let digest = Sha256::digest(preimage.as_bytes());
let event_id = hex::encode(digest);
- RadrootsEventId::parse(event_id).map_err(RadrootsCanonicalEventIdError::InvalidComputedEventId)
+ EventId::parse(event_id).map_err(CanonicalEventIdError::InvalidComputedEventId)
}
fn take_string(
object: &mut Map<String, Value>,
field: &'static str,
-) -> Result<String, RadrootsEventWireError> {
+) -> Result<String, EventWireError> {
match object.remove(field) {
Some(Value::String(value)) => Ok(value),
- Some(_) => Err(RadrootsEventWireError::InvalidField(field)),
- None => Err(RadrootsEventWireError::MissingField(field)),
+ Some(_) => Err(EventWireError::InvalidField(field)),
+ None => Err(EventWireError::MissingField(field)),
}
}
-fn take_canonical_event_id(
- object: &mut Map<String, Value>,
-) -> Result<String, RadrootsEventWireError> {
+fn take_canonical_event_id(object: &mut Map<String, Value>) -> Result<String, EventWireError> {
let raw = take_string(object, "id")?;
- let parsed = RadrootsEventId::parse(raw.as_str())
- .map_err(|error| RadrootsEventWireError::InvalidIdentifier { field: "id", error })?;
+ let parsed = EventId::parse(raw.as_str())
+ .map_err(|error| EventWireError::InvalidIdentifier { field: "id", error })?;
canonical_identifier_string("id", raw, parsed.into_string())
}
-fn take_canonical_pubkey(
- object: &mut Map<String, Value>,
-) -> Result<String, RadrootsEventWireError> {
+fn take_canonical_pubkey(object: &mut Map<String, Value>) -> Result<String, EventWireError> {
let raw = take_string(object, "pubkey")?;
- let parsed = parse_public_key(raw.as_str()).map_err(|error| {
- RadrootsEventWireError::InvalidIdentifier {
+ let parsed =
+ parse_public_key(raw.as_str()).map_err(|error| EventWireError::InvalidIdentifier {
field: "pubkey",
error,
- }
- })?;
+ })?;
canonical_identifier_string("pubkey", raw, parsed.to_hex())
}
-fn take_canonical_signature(
- object: &mut Map<String, Value>,
-) -> Result<String, RadrootsEventWireError> {
+fn take_canonical_signature(object: &mut Map<String, Value>) -> Result<String, EventWireError> {
let raw = take_string(object, "sig")?;
- let parsed = RadrootsEventSignature::parse(raw.as_str()).map_err(|error| {
- RadrootsEventWireError::InvalidIdentifier {
+ let parsed =
+ EventSignature::parse(raw.as_str()).map_err(|error| EventWireError::InvalidIdentifier {
field: "sig",
error,
- }
- })?;
+ })?;
canonical_identifier_string("sig", raw, parsed.into_string())
}
@@ -477,58 +462,50 @@ fn canonical_identifier_string(
field: &'static str,
raw: String,
canonical: String,
-) -> Result<String, RadrootsEventWireError> {
+) -> Result<String, EventWireError> {
if canonical.as_str() != raw.as_str() {
- return Err(RadrootsEventWireError::NonCanonicalIdentifier { field });
+ return Err(EventWireError::NonCanonicalIdentifier { field });
}
Ok(canonical)
}
-fn take_u64(
- object: &mut Map<String, Value>,
- field: &'static str,
-) -> Result<u64, RadrootsEventWireError> {
+fn take_u64(object: &mut Map<String, Value>, field: &'static str) -> Result<u64, EventWireError> {
match object.remove(field) {
- Some(Value::Number(value)) => value
- .as_u64()
- .ok_or(RadrootsEventWireError::InvalidField(field)),
- Some(_) => Err(RadrootsEventWireError::InvalidField(field)),
- None => Err(RadrootsEventWireError::MissingField(field)),
+ Some(Value::Number(value)) => value.as_u64().ok_or(EventWireError::InvalidField(field)),
+ Some(_) => Err(EventWireError::InvalidField(field)),
+ None => Err(EventWireError::MissingField(field)),
}
}
-fn take_u32(
- object: &mut Map<String, Value>,
- field: &'static str,
-) -> Result<u32, RadrootsEventWireError> {
+fn take_u32(object: &mut Map<String, Value>, field: &'static str) -> Result<u32, EventWireError> {
let value = take_u64(object, field)?;
- u32::try_from(value).map_err(|_| RadrootsEventWireError::InvalidField(field))
+ u32::try_from(value).map_err(|_| EventWireError::InvalidField(field))
}
fn take_tags(
object: &mut Map<String, Value>,
- limits: RadrootsEventWireLimits,
-) -> Result<Vec<Vec<String>>, RadrootsEventWireError> {
+ limits: EventWireLimits,
+) -> Result<Vec<Vec<String>>, EventWireError> {
let raw_tags = match object.remove("tags") {
Some(Value::Array(raw_tags)) => raw_tags,
- Some(_) => return Err(RadrootsEventWireError::InvalidField("tags")),
- None => return Err(RadrootsEventWireError::MissingField("tags")),
+ Some(_) => return Err(EventWireError::InvalidField("tags")),
+ None => return Err(EventWireError::MissingField("tags")),
};
let tag_count = raw_tags.len();
if tag_count > limits.max_tag_count {
- return Err(RadrootsEventWireError::TooManyTags {
+ return Err(EventWireError::TooManyTags {
max: limits.max_tag_count,
actual: tag_count,
});
}
let total_tag_elements = raw_tags.iter().try_fold(0usize, |total, raw_tag| {
let Value::Array(values) = raw_tag else {
- return Err(RadrootsEventWireError::InvalidField("tags"));
+ return Err(EventWireError::InvalidField("tags"));
};
Ok(total.saturating_add(values.len()))
})?;
if total_tag_elements > limits.max_total_tag_elements {
- return Err(RadrootsEventWireError::TooManyTagElements {
+ return Err(EventWireError::TooManyTagElements {
max: limits.max_total_tag_elements,
actual: total_tag_elements,
});
@@ -538,20 +515,20 @@ fn take_tags(
for (tag_index, raw_tag) in raw_tags.into_iter().enumerate() {
let raw_values = match raw_tag {
Value::Array(values) => values,
- _ => return Err(RadrootsEventWireError::InvalidField("tags")),
+ _ => return Err(EventWireError::InvalidField("tags")),
};
if raw_values.is_empty() {
- return Err(RadrootsEventWireError::EmptyTag { index: tag_index });
+ return Err(EventWireError::EmptyTag { index: tag_index });
}
let mut tag = Vec::with_capacity(raw_values.len());
for (element_index, raw_value) in raw_values.into_iter().enumerate() {
let value = match raw_value {
Value::String(value) => value,
- _ => return Err(RadrootsEventWireError::InvalidField("tags")),
+ _ => return Err(EventWireError::InvalidField("tags")),
};
let value_len = value.len();
if value_len > limits.max_tag_element_bytes {
- return Err(RadrootsEventWireError::TagElementTooLarge {
+ return Err(EventWireError::TagElementTooLarge {
tag_index,
element_index,
max: limits.max_tag_element_bytes,
@@ -563,7 +540,7 @@ fn take_tags(
}
total_tag_bytes = total_tag_bytes.saturating_add(value_len);
if total_tag_bytes > limits.max_total_tag_bytes {
- return Err(RadrootsEventWireError::TagsTooLarge {
+ return Err(EventWireError::TagsTooLarge {
max: limits.max_total_tag_bytes,
actual: total_tag_bytes,
});
@@ -575,23 +552,23 @@ fn take_tags(
Ok(tags)
}
-fn validate_tag_key(index: usize, value: &str) -> Result<(), RadrootsEventWireError> {
+fn validate_tag_key(index: usize, value: &str) -> Result<(), EventWireError> {
if value.is_empty() {
- return Err(RadrootsEventWireError::EmptyTagKey { index });
+ return Err(EventWireError::EmptyTagKey { index });
}
if value.chars().any(char::is_control) {
- return Err(RadrootsEventWireError::ControlCharacterTagKey { index });
+ return Err(EventWireError::ControlCharacterTagKey { index });
}
Ok(())
}
fn validate_extra(
object: Map<String, Value>,
- limits: RadrootsEventWireLimits,
-) -> Result<BTreeMap<String, Value>, RadrootsEventWireError> {
+ limits: EventWireLimits,
+) -> Result<BTreeMap<String, Value>, EventWireError> {
let extra_count = object.len();
if extra_count > limits.max_extra_fields {
- return Err(RadrootsEventWireError::TooManyExtraFields {
+ return Err(EventWireError::TooManyExtraFields {
max: limits.max_extra_fields,
actual: extra_count,
});
@@ -606,7 +583,7 @@ fn validate_extra(
.saturating_add(1)
.saturating_add(value_json_len);
if total_json_bytes > limits.max_total_extra_json_bytes {
- return Err(RadrootsEventWireError::ExtraJsonTooLarge {
+ return Err(EventWireError::ExtraJsonTooLarge {
max: limits.max_total_extra_json_bytes,
actual: total_json_bytes,
});
diff --git a/crates/event/src/wire/v1/tests.rs b/crates/event/src/wire/v1/tests.rs
@@ -45,12 +45,12 @@ fn tag_with_total_elements(element_count: usize) -> Vec<Vec<String>> {
vec![tag]
}
-fn valid_envelope_parts(content: &str, tags: Vec<Vec<String>>) -> RadrootsEventEnvelopeParts {
+fn valid_envelope_parts(content: &str, tags: Vec<Vec<String>>) -> EventEnvelopeParts {
let pubkey = hex_64('a');
let id = compute_canonical_nip01_event_id(pubkey.as_str(), 1_700_000_000, 1, &tags, content)
.expect("event id")
.into_string();
- RadrootsEventEnvelopeParts {
+ EventEnvelopeParts {
id,
author: pubkey,
created_at: 1_700_000_000,
@@ -85,7 +85,7 @@ fn parses_wire_json_preserves_extra_and_verifies_id() {
.as_object_mut()
.expect("object")
.insert("client".to_owned(), json!({"name":"radroots-test"}));
- let wire = RadrootsNip01EventWire::parse_json(raw_json(&value).as_str()).expect("wire");
+ let wire = Nip01EventWire::parse_json(raw_json(&value).as_str()).expect("wire");
assert_eq!(wire.pubkey, hex_64('a'));
assert_eq!(wire.created_at, 1_700_000_000);
@@ -105,9 +105,8 @@ fn parses_wire_json_preserves_extra_and_verifies_id() {
#[test]
fn into_envelope_verifies_id_before_domain_conversion() {
- let wire =
- RadrootsNip01EventWire::parse_json(valid_event_json("hello", default_tags()).as_str())
- .expect("wire");
+ let wire = Nip01EventWire::parse_json(valid_event_json("hello", default_tags()).as_str())
+ .expect("wire");
let envelope = wire.clone().into_envelope().expect("envelope");
assert_eq!(envelope.id_hex(), wire.id);
@@ -117,14 +116,14 @@ fn into_envelope_verifies_id_before_domain_conversion() {
tampered_id.id = hex_64('f');
assert!(matches!(
tampered_id.into_envelope(),
- Err(RadrootsEventWireError::EventIdMismatch { .. })
+ Err(EventWireError::EventIdMismatch { .. })
));
let mut tampered_content = wire;
tampered_content.content = "tampered".to_owned();
assert!(matches!(
tampered_content.into_envelope(),
- Err(RadrootsEventWireError::EventIdMismatch { .. })
+ Err(EventWireError::EventIdMismatch { .. })
));
}
@@ -135,7 +134,7 @@ fn into_envelope_ignores_extra_for_id_and_propagates_domain_limits() {
.as_object_mut()
.expect("object")
.insert("client".to_owned(), json!("radroots-test"));
- let wire = RadrootsNip01EventWire::parse_json(raw_json(&value).as_str()).expect("wire");
+ let wire = Nip01EventWire::parse_json(raw_json(&value).as_str()).expect("wire");
let envelope = wire.into_envelope().expect("envelope");
assert_eq!(envelope.content(), "hello");
@@ -151,7 +150,7 @@ fn into_envelope_ignores_extra_for_id_and_propagates_domain_limits() {
)
.expect("event id")
.into_string();
- let wire = RadrootsNip01EventWire {
+ let wire = Nip01EventWire {
id,
pubkey,
created_at: 1_700_000_000,
@@ -164,8 +163,8 @@ fn into_envelope_ignores_extra_for_id_and_propagates_domain_limits() {
assert!(matches!(
wire.into_envelope(),
- Err(RadrootsEventWireError::Envelope(
- RadrootsEventEnvelopeError::ContentTooLarge { .. }
+ Err(EventWireError::Envelope(
+ EventEnvelopeError::ContentTooLarge { .. }
))
));
}
@@ -178,7 +177,7 @@ fn serde_flatten_preserves_extra_fields() {
.as_object_mut()
.expect("object")
.insert("client".to_owned(), json!("radroots-test"));
- let wire = RadrootsNip01EventWire::parse_json(raw_json(&value).as_str()).expect("wire");
+ let wire = Nip01EventWire::parse_json(raw_json(&value).as_str()).expect("wire");
let encoded = serde_json::to_value(&wire).expect("encoded");
assert_eq!(encoded.get("client"), Some(&json!("radroots-test")));
@@ -190,8 +189,8 @@ fn parse_json_rejects_required_field_errors_and_id_mismatch() {
let mut value = valid_event_value("hello", default_tags());
value.as_object_mut().expect("object").remove("id");
assert!(matches!(
- RadrootsNip01EventWire::parse_json(raw_json(&value).as_str()),
- Err(RadrootsEventWireError::MissingField("id"))
+ Nip01EventWire::parse_json(raw_json(&value).as_str()),
+ Err(EventWireError::MissingField("id"))
));
let mut value = valid_event_value("hello", default_tags());
@@ -200,8 +199,8 @@ fn parse_json_rejects_required_field_errors_and_id_mismatch() {
.expect("object")
.insert("pubkey".to_owned(), json!("not-hex"));
assert!(matches!(
- RadrootsNip01EventWire::parse_json(raw_json(&value).as_str()),
- Err(RadrootsEventWireError::InvalidIdentifier {
+ Nip01EventWire::parse_json(raw_json(&value).as_str()),
+ Err(EventWireError::InvalidIdentifier {
field: "pubkey",
..
})
@@ -213,8 +212,8 @@ fn parse_json_rejects_required_field_errors_and_id_mismatch() {
.expect("object")
.insert("sig".to_owned(), json!(hex_64('b')));
assert!(matches!(
- RadrootsNip01EventWire::parse_json(raw_json(&value).as_str()),
- Err(RadrootsEventWireError::InvalidIdentifier { field: "sig", .. })
+ Nip01EventWire::parse_json(raw_json(&value).as_str()),
+ Err(EventWireError::InvalidIdentifier { field: "sig", .. })
));
let mut value = valid_event_value("hello", default_tags());
@@ -223,8 +222,8 @@ fn parse_json_rejects_required_field_errors_and_id_mismatch() {
.expect("object")
.insert("id".to_owned(), json!(hex_64('f')));
assert!(matches!(
- RadrootsNip01EventWire::parse_json(raw_json(&value).as_str()),
- Err(RadrootsEventWireError::EventIdMismatch { .. })
+ Nip01EventWire::parse_json(raw_json(&value).as_str()),
+ Err(EventWireError::EventIdMismatch { .. })
));
let mut value = valid_event_value("hello", default_tags());
@@ -233,8 +232,8 @@ fn parse_json_rejects_required_field_errors_and_id_mismatch() {
.expect("object")
.insert("id".to_owned(), json!(hex_64('A')));
assert!(matches!(
- RadrootsNip01EventWire::parse_json(raw_json(&value).as_str()),
- Err(RadrootsEventWireError::NonCanonicalIdentifier { field: "id" })
+ Nip01EventWire::parse_json(raw_json(&value).as_str()),
+ Err(EventWireError::NonCanonicalIdentifier { field: "id" })
));
}
@@ -246,8 +245,8 @@ fn parse_json_rejects_tag_shape_errors() {
.expect("object")
.insert("tags".to_owned(), json!([[]]));
assert!(matches!(
- RadrootsNip01EventWire::parse_json(raw_json(&value).as_str()),
- Err(RadrootsEventWireError::EmptyTag { index: 0 })
+ Nip01EventWire::parse_json(raw_json(&value).as_str()),
+ Err(EventWireError::EmptyTag { index: 0 })
));
let mut value = valid_event_value("hello", default_tags());
@@ -256,8 +255,8 @@ fn parse_json_rejects_tag_shape_errors() {
.expect("object")
.insert("tags".to_owned(), json!([["", "soil"]]));
assert!(matches!(
- RadrootsNip01EventWire::parse_json(raw_json(&value).as_str()),
- Err(RadrootsEventWireError::EmptyTagKey { index: 0 })
+ Nip01EventWire::parse_json(raw_json(&value).as_str()),
+ Err(EventWireError::EmptyTagKey { index: 0 })
));
let mut value = valid_event_value("hello", default_tags());
@@ -266,8 +265,8 @@ fn parse_json_rejects_tag_shape_errors() {
.expect("object")
.insert("tags".to_owned(), json!([["t\n", "soil"]]));
assert!(matches!(
- RadrootsNip01EventWire::parse_json(raw_json(&value).as_str()),
- Err(RadrootsEventWireError::ControlCharacterTagKey { index: 0 })
+ Nip01EventWire::parse_json(raw_json(&value).as_str()),
+ Err(EventWireError::ControlCharacterTagKey { index: 0 })
));
}
@@ -275,74 +274,74 @@ fn parse_json_rejects_tag_shape_errors() {
fn parse_json_rejects_resource_budget_violations() {
let raw = valid_event_json("hello", default_tags());
assert!(matches!(
- RadrootsNip01EventWire::parse_json_with_limits(
+ Nip01EventWire::parse_json_with_limits(
raw.as_str(),
- RadrootsEventWireLimits {
+ EventWireLimits {
max_raw_json_bytes: 1,
- ..RadrootsEventWireLimits::default()
+ ..EventWireLimits::default()
}
),
- Err(RadrootsEventWireError::RawJsonTooLarge { .. })
+ Err(EventWireError::RawJsonTooLarge { .. })
));
let raw = valid_event_json("hello", default_tags());
assert!(matches!(
- RadrootsNip01EventWire::parse_json_with_limits(
+ Nip01EventWire::parse_json_with_limits(
raw.as_str(),
- RadrootsEventWireLimits {
+ EventWireLimits {
max_content_bytes: 1,
- ..RadrootsEventWireLimits::default()
+ ..EventWireLimits::default()
}
),
- Err(RadrootsEventWireError::ContentTooLarge { .. })
+ Err(EventWireError::ContentTooLarge { .. })
));
let raw = valid_event_json("hello", default_tags());
assert!(matches!(
- RadrootsNip01EventWire::parse_json_with_limits(
+ Nip01EventWire::parse_json_with_limits(
raw.as_str(),
- RadrootsEventWireLimits {
+ EventWireLimits {
max_tag_count: 0,
- ..RadrootsEventWireLimits::default()
+ ..EventWireLimits::default()
}
),
- Err(RadrootsEventWireError::TooManyTags { .. })
+ Err(EventWireError::TooManyTags { .. })
));
let raw = valid_event_json("hello", default_tags());
assert_eq!(
- RadrootsNip01EventWire::parse_json_with_limits(
+ Nip01EventWire::parse_json_with_limits(
raw.as_str(),
- RadrootsEventWireLimits {
+ EventWireLimits {
max_total_tag_elements: 1,
- ..RadrootsEventWireLimits::default()
+ ..EventWireLimits::default()
}
),
- Err(RadrootsEventWireError::TooManyTagElements { max: 1, actual: 2 })
+ Err(EventWireError::TooManyTagElements { max: 1, actual: 2 })
);
let raw = valid_event_json("hello", vec![vec!["t".to_owned(), "soil".to_owned()]]);
assert!(matches!(
- RadrootsNip01EventWire::parse_json_with_limits(
+ Nip01EventWire::parse_json_with_limits(
raw.as_str(),
- RadrootsEventWireLimits {
+ EventWireLimits {
max_tag_element_bytes: 1,
- ..RadrootsEventWireLimits::default()
+ ..EventWireLimits::default()
}
),
- Err(RadrootsEventWireError::TagElementTooLarge { .. })
+ Err(EventWireError::TagElementTooLarge { .. })
));
let raw = valid_event_json("hello", default_tags());
assert!(matches!(
- RadrootsNip01EventWire::parse_json_with_limits(
+ Nip01EventWire::parse_json_with_limits(
raw.as_str(),
- RadrootsEventWireLimits {
+ EventWireLimits {
max_total_tag_bytes: 1,
- ..RadrootsEventWireLimits::default()
+ ..EventWireLimits::default()
}
),
- Err(RadrootsEventWireError::TagsTooLarge { .. })
+ Err(EventWireError::TagsTooLarge { .. })
));
let mut value = valid_event_value("hello", default_tags());
@@ -352,36 +351,36 @@ fn parse_json_rejects_resource_budget_violations() {
.insert("client".to_owned(), json!("radroots-test"));
let raw = raw_json(&value);
assert!(matches!(
- RadrootsNip01EventWire::parse_json_with_limits(
+ Nip01EventWire::parse_json_with_limits(
raw.as_str(),
- RadrootsEventWireLimits {
+ EventWireLimits {
max_extra_fields: 0,
- ..RadrootsEventWireLimits::default()
+ ..EventWireLimits::default()
}
),
- Err(RadrootsEventWireError::TooManyExtraFields { .. })
+ Err(EventWireError::TooManyExtraFields { .. })
));
assert!(matches!(
- RadrootsNip01EventWire::parse_json_with_limits(
+ Nip01EventWire::parse_json_with_limits(
raw.as_str(),
- RadrootsEventWireLimits {
+ EventWireLimits {
max_total_extra_json_bytes: 1,
- ..RadrootsEventWireLimits::default()
+ ..EventWireLimits::default()
}
),
- Err(RadrootsEventWireError::ExtraJsonTooLarge { .. })
+ Err(EventWireError::ExtraJsonTooLarge { .. })
));
}
#[test]
fn wire_accepts_exact_total_tag_element_boundary() {
let raw = valid_event_json("hello", default_tags());
- let wire = RadrootsNip01EventWire::parse_json_with_limits(
+ let wire = Nip01EventWire::parse_json_with_limits(
raw.as_str(),
- RadrootsEventWireLimits {
+ EventWireLimits {
max_total_tag_elements: 2,
- ..RadrootsEventWireLimits::default()
+ ..EventWireLimits::default()
},
)
.expect("wire at exact tag element boundary");
@@ -392,23 +391,23 @@ fn wire_accepts_exact_total_tag_element_boundary() {
#[test]
fn wire_and_envelope_share_default_total_tag_element_boundary() {
let exact_tags = tag_with_total_elements(DEFAULT_TAG_TOTAL_ELEMENT_MAX_COUNT);
- RadrootsNip01EventWire::parse_json(valid_event_json("", exact_tags.clone()).as_str())
+ Nip01EventWire::parse_json(valid_event_json("", exact_tags.clone()).as_str())
.expect("wire at default tag element boundary");
- RadrootsEventEnvelope::new(valid_envelope_parts("", exact_tags))
+ EventEnvelope::new(valid_envelope_parts("", exact_tags))
.expect("envelope at default tag element boundary");
let overflow_elements = DEFAULT_TAG_TOTAL_ELEMENT_MAX_COUNT + 1;
let overflow_tags = tag_with_total_elements(overflow_elements);
assert_eq!(
- RadrootsNip01EventWire::parse_json(valid_event_json("", overflow_tags.clone()).as_str()),
- Err(RadrootsEventWireError::TooManyTagElements {
+ Nip01EventWire::parse_json(valid_event_json("", overflow_tags.clone()).as_str()),
+ Err(EventWireError::TooManyTagElements {
max: DEFAULT_TAG_TOTAL_ELEMENT_MAX_COUNT,
actual: overflow_elements,
})
);
assert_eq!(
- RadrootsEventEnvelope::new(valid_envelope_parts("", overflow_tags)),
- Err(RadrootsEventEnvelopeError::TooManyTagElements {
+ EventEnvelope::new(valid_envelope_parts("", overflow_tags)),
+ Err(EventEnvelopeError::TooManyTagElements {
max: DEFAULT_TAG_TOTAL_ELEMENT_MAX_COUNT,
actual: overflow_elements,
})
@@ -418,38 +417,36 @@ fn wire_and_envelope_share_default_total_tag_element_boundary() {
#[test]
#[cfg_attr(coverage_nightly, coverage(off))]
fn wire_parser_and_error_contracts_cover_all_typed_failures() {
- let parse_error = RadrootsEventId::parse("bad").expect_err("invalid id");
+ let parse_error = EventId::parse("bad").expect_err("invalid id");
for error in [
- RadrootsEventWireError::Json("bad json".to_owned()),
- RadrootsEventWireError::RootNotObject,
- RadrootsEventWireError::MissingField("id"),
- RadrootsEventWireError::InvalidField("kind"),
- RadrootsEventWireError::InvalidIdentifier {
+ EventWireError::Json("bad json".to_owned()),
+ EventWireError::RootNotObject,
+ EventWireError::MissingField("id"),
+ EventWireError::InvalidField("kind"),
+ EventWireError::InvalidIdentifier {
field: "id",
error: parse_error.clone(),
},
- RadrootsEventWireError::NonCanonicalIdentifier { field: "id" },
- RadrootsEventWireError::RawJsonTooLarge { max: 1, actual: 2 },
- RadrootsEventWireError::ContentTooLarge { max: 1, actual: 2 },
- RadrootsEventWireError::TooManyTags { max: 1, actual: 2 },
- RadrootsEventWireError::TooManyTagElements { max: 1, actual: 2 },
- RadrootsEventWireError::EmptyTag { index: 1 },
- RadrootsEventWireError::EmptyTagKey { index: 1 },
- RadrootsEventWireError::ControlCharacterTagKey { index: 1 },
- RadrootsEventWireError::TagElementTooLarge {
+ EventWireError::NonCanonicalIdentifier { field: "id" },
+ EventWireError::RawJsonTooLarge { max: 1, actual: 2 },
+ EventWireError::ContentTooLarge { max: 1, actual: 2 },
+ EventWireError::TooManyTags { max: 1, actual: 2 },
+ EventWireError::TooManyTagElements { max: 1, actual: 2 },
+ EventWireError::EmptyTag { index: 1 },
+ EventWireError::EmptyTagKey { index: 1 },
+ EventWireError::ControlCharacterTagKey { index: 1 },
+ EventWireError::TagElementTooLarge {
tag_index: 1,
element_index: 2,
max: 3,
actual: 4,
},
- RadrootsEventWireError::TagsTooLarge { max: 1, actual: 2 },
- RadrootsEventWireError::TooManyExtraFields { max: 1, actual: 2 },
- RadrootsEventWireError::ExtraJsonTooLarge { max: 1, actual: 2 },
- RadrootsEventWireError::from(RadrootsCanonicalEventIdError::InvalidPubkey(
- parse_error.clone(),
- )),
- RadrootsEventWireError::from(RadrootsEventEnvelopeError::NonCanonicalId),
- RadrootsEventWireError::EventIdMismatch {
+ EventWireError::TagsTooLarge { max: 1, actual: 2 },
+ EventWireError::TooManyExtraFields { max: 1, actual: 2 },
+ EventWireError::ExtraJsonTooLarge { max: 1, actual: 2 },
+ EventWireError::from(CanonicalEventIdError::InvalidPubkey(parse_error.clone())),
+ EventWireError::from(EventEnvelopeError::NonCanonicalId),
+ EventWireError::EventIdMismatch {
declared: "a".to_owned(),
computed: "b".to_owned(),
},
@@ -458,7 +455,7 @@ fn wire_parser_and_error_contracts_cover_all_typed_failures() {
}
for raw in ["{", "[]", "null"] {
- assert!(RadrootsNip01EventWire::parse_json(raw).is_err());
+ assert!(Nip01EventWire::parse_json(raw).is_err());
}
for (field, replacement) in [
@@ -483,13 +480,13 @@ fn wire_parser_and_error_contracts_cover_all_typed_failures() {
.as_object_mut()
.expect("object")
.insert(field.to_owned(), replacement);
- assert!(RadrootsNip01EventWire::parse_json(raw_json(&value).as_str()).is_err());
+ assert!(Nip01EventWire::parse_json(raw_json(&value).as_str()).is_err());
}
for field in ["pubkey", "created_at", "kind", "tags", "content", "sig"] {
let mut value = valid_event_value("hello", default_tags());
value.as_object_mut().expect("object").remove(field);
- assert!(RadrootsNip01EventWire::parse_json(raw_json(&value).as_str()).is_err());
+ assert!(Nip01EventWire::parse_json(raw_json(&value).as_str()).is_err());
}
}
@@ -513,7 +510,7 @@ fn checked_in_conformance_vectors_match_wire_behavior() {
.and_then(Value::as_str)
.expect("raw json");
let expected = entry.get("expected").expect("expected");
- let wire = RadrootsNip01EventWire::parse_json(raw).expect("wire");
+ let wire = Nip01EventWire::parse_json(raw).expect("wire");
assert_eq!(
wire.canonical_id_preimage().expect("preimage"),
expected
@@ -535,7 +532,7 @@ fn checked_in_conformance_vectors_match_wire_behavior() {
.and_then(|input| input.get("raw_json"))
.and_then(Value::as_str)
.expect("raw json");
- assert!(RadrootsNip01EventWire::parse_json(raw).is_err());
+ assert!(Nip01EventWire::parse_json(raw).is_err());
}
other => panic!("unknown event wire vector kind {other}"),
}
diff --git a/crates/event/tests/package_boundary.rs b/crates/event/tests/package_boundary.rs
@@ -22,6 +22,10 @@ const RELAY_HINT: &str = include_str!("../src/relay_hint.rs");
const TRADE: &str = include_str!("../src/trade.rs");
const ADMISSION: &str = include_str!("../src/admission.rs");
const VERIFICATION: &str = include_str!("../src/verification.rs");
+const PUBLIC_API: &str = include_str!("../../../docs/api/radroots_event.txt");
+const CODEC_MANIFEST: &str = include_str!("../../event_codec/Cargo.toml");
+const CODEC_POST_DECODE: &str = include_str!("../../event_codec/src/post/decode.rs");
+const CODEC_PROFILE: &str = include_str!("../../event_codec/src/profile/mod.rs");
#[test]
fn manifest_has_final_identity_and_required_radroots_dependencies() {
@@ -167,6 +171,51 @@ fn crate_root_exposes_the_curated_native_event_vocabulary() {
}
#[test]
+fn public_native_items_do_not_retain_the_legacy_radroots_prefix() {
+ let prefixed_items = PUBLIC_API
+ .lines()
+ .filter(|line| {
+ line.split("::").any(|segment| {
+ segment
+ .strip_prefix("Radroots")
+ .and_then(|suffix| suffix.chars().next())
+ .is_some_and(|character| character.is_ascii_uppercase())
+ })
+ })
+ .collect::<Vec<_>>();
+
+ assert!(
+ prefixed_items.is_empty(),
+ "legacy-prefixed native items remain public: {prefixed_items:#?}"
+ );
+ for retired in [
+ "radroots_event::post::Post",
+ "radroots_event::profile::Profile",
+ ] {
+ let declaration = format!("pub struct {retired}");
+ let member_prefix = format!("pub {retired}::");
+ assert!(
+ !PUBLIC_API
+ .lines()
+ .any(|line| line == declaration || line.starts_with(&member_prefix)),
+ "retired compatibility type remains public: {retired}"
+ );
+ }
+}
+
+#[test]
+fn lossy_legacy_projections_are_quarantined_until_codec_retirement() {
+ assert!(CODEC_MANIFEST.contains("publish = false"));
+ for (source, compatibility_type) in [
+ (CODEC_POST_DECODE, "pub struct LegacyPost"),
+ (CODEC_PROFILE, "pub struct LegacyProfile"),
+ ] {
+ assert!(source.contains(compatibility_type));
+ assert!(source.contains("superseded codec APIs in Step 087"));
+ }
+}
+
+#[test]
fn verification_typestates_are_native_private_and_policy_gated() {
let admission = include_str!("../src/admission.rs");
let verification = include_str!("../src/verification.rs");
@@ -186,8 +235,8 @@ fn verification_typestates_are_native_private_and_policy_gated() {
}
assert!(ROOT.contains("mod verification;"));
assert!(!ROOT.contains("pub mod verification;"));
- assert!(verification.contains("pub struct IdVerifiedEvent(RadrootsEventEnvelope);"));
- assert!(verification.contains("pub struct SignatureVerifiedEvent(RadrootsEventEnvelope);"));
+ assert!(verification.contains("pub struct IdVerifiedEvent(EventEnvelope);"));
+ assert!(verification.contains("pub struct SignatureVerifiedEvent(EventEnvelope);"));
assert!(admission.contains("policy.admit(&self)?;"));
assert!(admission.contains("policy.make_visible(&self)?;"));
assert!(verification.contains("pub trait SignatureVerifier: Send + Sync"));
@@ -243,7 +292,7 @@ fn event_references_use_the_identity_owned_public_key() {
let author =
PublicKey::from_hex("585591529da0bab31b3b1b1f986611cf5f435dca84f978c89ee8a40cca7103df")
.expect("valid public key");
- let reference = radroots_event::tag::RadrootsEventRef {
+ let reference = radroots_event::tag::EventRef {
id: "a".repeat(64),
author,
kind: 1,
@@ -272,12 +321,12 @@ fn trade_protocol_identifiers_have_one_definition_and_deliberate_facades() {
assert_eq!(core::mem::size_of::<CandidateId>(), 32);
assert_eq!(core::mem::size_of::<MutationId>(), 32);
assert!(TradeId::parse("order-1").is_err());
- assert!(radroots_event::id::RadrootsOrderId::parse("order-1").is_ok());
+ assert!(radroots_event::id::OrderId::parse("order-1").is_ok());
for definition in [
- "validated_hex_id!(RadrootsTradeId, 16);",
- "validated_hex_id!(RadrootsTradeCandidateId, 32);",
- "validated_hex_id!(RadrootsTradeMutationId, 32);",
+ "validated_hex_id!(TradeId, 16);",
+ "validated_hex_id!(CandidateId, 32);",
+ "validated_hex_id!(MutationId, 32);",
] {
assert_eq!(IDENTIFIERS.matches(definition).count(), 1, "{definition}");
}
@@ -285,9 +334,6 @@ fn trade_protocol_identifiers_have_one_definition_and_deliberate_facades() {
"pub struct TradeId",
"pub struct CandidateId",
"pub struct MutationId",
- "pub struct RadrootsTradeId",
- "pub struct RadrootsTradeCandidateId",
- "pub struct RadrootsTradeMutationId",
] {
assert!(
!TRADE.contains(duplicate),
diff --git a/crates/event/tests/parser_robustness.rs b/crates/event/tests/parser_robustness.rs
@@ -1,9 +1,9 @@
use std::panic::{AssertUnwindSafe, catch_unwind};
-use radroots_event::envelope::{RadrootsEventTag, RadrootsEventTags};
+use radroots_event::envelope::{EventTag, EventTags};
use radroots_event::id::{DTag, EventId, EventSignature, Nip01Coordinate};
-use radroots_event::tag::relay_hint::RadrootsNostrRelayHint;
-use radroots_event::wire::v1::RadrootsNip01EventWire;
+use radroots_event::tag::relay_hint::NostrRelayHint;
+use radroots_event::wire::v1::Nip01EventWire;
const VALID_WIRE_VECTOR: &str =
include_str!("../../../contracts/conformance/vectors/event/nip01_wire.v1.json");
@@ -27,19 +27,19 @@ fn wire_and_tag_parsers_are_total_over_deterministic_mutation_corpus() {
fn assert_parser_totality(bytes: &[u8], case: u64) {
let result = catch_unwind(AssertUnwindSafe(|| {
if let Ok(text) = core::str::from_utf8(bytes) {
- let _ = RadrootsNip01EventWire::parse_json(text);
+ let _ = Nip01EventWire::parse_json(text);
let _ = DTag::parse(text);
let _ = EventId::parse(text);
let _ = EventSignature::parse(text);
let _ = Nip01Coordinate::parse(text);
- let _ = RadrootsNostrRelayHint::parse(text);
+ let _ = NostrRelayHint::parse(text);
}
let tags = tags_from_bytes(bytes);
for (index, tag) in tags.iter().cloned().enumerate() {
- let _ = RadrootsEventTag::new(index, tag);
+ let _ = EventTag::new(index, tag);
}
- let _ = RadrootsEventTags::new(tags);
+ let _ = EventTags::new(tags);
}));
assert!(result.is_ok(), "parser mutation case {case} panicked");
diff --git a/crates/event/tests/source_boundary.rs b/crates/event/tests/source_boundary.rs
@@ -17,11 +17,11 @@ const FORBIDDEN_EVENT_NAMES: &[ForbiddenEventName] = &[
},
ForbiddenEventName {
pattern: "WireEventParts",
- reason: "event construction must use RadrootsNip01EventWireParts",
+ reason: "event construction must use Nip01EventWireParts",
},
ForbiddenEventName {
pattern: "RadrootsFrozenEventDraft",
- reason: "event construction must use RadrootsEventDraft",
+ reason: "event construction must use EventDraft",
},
ForbiddenEventName {
pattern: "RadrootsNostrEvent",
@@ -29,15 +29,15 @@ const FORBIDDEN_EVENT_NAMES: &[ForbiddenEventName] = &[
},
ForbiddenEventName {
pattern: "RadrootsNostrEventRef",
- reason: "product-level event references must use RadrootsEventRef",
+ reason: "product-level event references must use EventRef",
},
ForbiddenEventName {
pattern: "RadrootsNostrEventPtr",
- reason: "product-level event pointers must use RadrootsEventPtr",
+ reason: "product-level event pointers must use EventPtr",
},
ForbiddenEventName {
pattern: "RadrootsSignedNostrEvent",
- reason: "signed-event surfaces must use RadrootsSignedEvent",
+ reason: "signed-event surfaces must use SignedEvent",
},
ForbiddenEventName {
pattern: "RadrootsSignedNostrEventParts",
@@ -45,6 +45,13 @@ const FORBIDDEN_EVENT_NAMES: &[ForbiddenEventName] = &[
},
];
+const RETIRED_EVENT_MODULE_PATHS: &[&str] = &[
+ "radroots_event::event_head",
+ "radroots_event::events",
+ "radroots_event::ids",
+ "radroots_event::kinds",
+];
+
#[test]
fn generic_event_source_does_not_reintroduce_old_core_nostr_event_names() {
let repo_root = Path::new(env!("CARGO_MANIFEST_DIR"))
@@ -76,6 +83,60 @@ fn generic_event_source_does_not_reintroduce_old_core_nostr_event_names() {
);
}
+#[test]
+fn first_party_sources_do_not_reintroduce_retired_event_module_paths() {
+ let repo_root = Path::new(env!("CARGO_MANIFEST_DIR"))
+ .parent()
+ .and_then(Path::parent)
+ .expect("lib repo root");
+ let mut findings = Vec::new();
+
+ for path in source_boundary_guard_files(repo_root) {
+ let relative_path = relative_path(repo_root, path.as_path());
+ let source = fs::read_to_string(path.as_path()).expect("read source file");
+ for retired_path in RETIRED_EVENT_MODULE_PATHS {
+ if source.contains(retired_path) {
+ findings.push(format!(
+ "{relative_path} contains retired event module path `{retired_path}`"
+ ));
+ }
+ }
+ }
+
+ assert!(
+ findings.is_empty(),
+ "retired radroots_event module paths remain:\n{}",
+ findings.join("\n")
+ );
+}
+
+#[test]
+fn public_api_has_no_redundant_radroots_type_prefixes() {
+ let repo_root = Path::new(env!("CARGO_MANIFEST_DIR"))
+ .parent()
+ .and_then(Path::parent)
+ .expect("lib repo root");
+ let baseline = fs::read_to_string(repo_root.join("docs/api/radroots_event.txt"))
+ .expect("read radroots_event public API baseline");
+ let mut prefixed = baseline
+ .split(|character: char| !is_identifier_character(character))
+ .filter(|identifier| {
+ identifier
+ .strip_prefix("Radroots")
+ .and_then(|suffix| suffix.chars().next())
+ .is_some_and(|character| character.is_ascii_uppercase())
+ })
+ .collect::<Vec<_>>();
+ prefixed.sort_unstable();
+ prefixed.dedup();
+
+ assert!(
+ prefixed.is_empty(),
+ "radroots_event public API contains redundant prefixed identifiers: {}",
+ prefixed.join(", ")
+ );
+}
+
fn source_boundary_guard_files(repo_root: &Path) -> Vec<PathBuf> {
let mut paths = Vec::new();
for relative_root in ["crates", "contracts"] {
@@ -95,7 +156,7 @@ fn collect_source_boundary_guard_files(root: &Path, paths: &mut Vec<PathBuf>) {
if path.is_dir() {
if matches!(
path.file_name().and_then(|file_name| file_name.to_str()),
- Some("target")
+ Some("generated" | "target")
) {
continue;
}
@@ -107,6 +168,13 @@ fn collect_source_boundary_guard_files(root: &Path, paths: &mut Vec<PathBuf>) {
continue;
}
+ if path.ends_with("event_store/src/nip09/reconciliation_v1/result_vector_executor.rs") {
+ // This predecessor is an authenticated immutable artifact. Active NIP-09
+ // execution uses the maintained successor surface; the frozen source must
+ // retain its historical bytes so its provenance check remains meaningful.
+ continue;
+ }
+
if matches!(
path.extension().and_then(|extension| extension.to_str()),
Some("rs") | Some("toml") | Some("md")
diff --git a/crates/event_codec/README.md b/crates/event_codec/README.md
@@ -62,7 +62,7 @@ marker takes precedence. Structural inbound URLs remain unverified and no
network retrieval occurs.
The Reply codec deterministically emits strict marked direct and nested NIP-10
-wire parts from `RadrootsAuthoredNip10Reply`. Its inbound boundary projects
+wire parts from `AuthoredNip10Reply`. Its inbound boundary projects
only signature-and-id verified kind-1 envelopes, accepts marked and deprecated
positional thread anchors, retains valid supplemental citations, and reports
malformed advisory relay, author, participant, and citation metadata through
@@ -70,7 +70,7 @@ ordered diagnostics. Root and parent ambiguity or malformed hard anchors
remain projection failures.
Authored and inbound NIP-10 Reply and NIP-22 Comment relay metadata uses the
-shared `RadrootsNostrRelayHint` profile: exact lowercase `ws://` or `wss://`,
+shared `NostrRelayHint` profile: exact lowercase `ws://` or `wss://`,
visible ASCII, canonical lowercase DNS or four-octet IPv4 or bracketed
pure-hex RFC 5952 IPv6, canonical optional port `1..65535`, and RFC 3986
path-abempty/query syntax with uppercase `%HH` escapes. IDNA or
@@ -259,7 +259,7 @@ Strict date admission rejects every uppercase-`D` extension. Strict time
admission requires canonical decimal timestamps and the exact ascending
uppercase-`D` sequence for the exclusive interval, bounded to 366 covered
days. Authored codecs derive that sequence and emit unsigned
-`RadrootsNip01EventWireParts`; signing and transport stay at the owning runtime
+`Nip01EventWireParts`; signing and transport stay at the owning runtime
boundary.
Kind `31924` is handled only by the calendar-specific codec. Generic NIP-51
diff --git a/crates/event_codec/src/admission.rs b/crates/event_codec/src/admission.rs
@@ -4,10 +4,8 @@ use alloc::boxed::Box;
use core::fmt;
use radroots_event::{
- contract::{
- RadrootsContractMatchError, RadrootsContractValidationError, RadrootsEventContract,
- },
- envelope::RadrootsEventEnvelope,
+ contract::{ContractMatchError, ContractValidationError, EventContract},
+ envelope::EventEnvelope,
envelope::kind::{
KIND_CLASSIFIED_LISTING, KIND_COMMENT, KIND_DELETION_REQUEST, KIND_POST, KIND_PROFILE,
},
@@ -72,11 +70,11 @@ impl RadrootsAdmittedEvent {
}
}
- pub fn event(&self) -> &RadrootsEventEnvelope {
+ pub fn event(&self) -> &EventEnvelope {
self.verified_event().event()
}
- pub fn contract(&self) -> &'static RadrootsEventContract {
+ pub fn contract(&self) -> &'static EventContract {
match self {
Self::Profile(event) => event.contract(),
Self::RootPost(event) => event.contract(),
@@ -108,8 +106,8 @@ impl RadrootsAdmittedEvent {
#[non_exhaustive]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum RadrootsEventAdmissionError {
- ContractMatch(RadrootsContractMatchError),
- ContractValidation(RadrootsContractValidationError),
+ ContractMatch(ContractMatchError),
+ ContractValidation(ContractValidationError),
Profile(RadrootsProfileAdmissionError),
Post(RadrootsPostAdmissionError),
Reply(RadrootsNip10ReplyAdmissionError),
@@ -121,13 +119,9 @@ pub enum RadrootsEventAdmissionError {
impl RadrootsEventAdmissionError {
pub const fn code(&self) -> &'static str {
match self {
- Self::ContractMatch(RadrootsContractMatchError::UnsupportedKind(_)) => {
- "unsupported_kind"
- }
- Self::ContractMatch(RadrootsContractMatchError::UnsupportedShape(_)) => {
- "unsupported_shape"
- }
- Self::ContractMatch(RadrootsContractMatchError::AmbiguousShape(_)) => "ambiguous_shape",
+ Self::ContractMatch(ContractMatchError::UnsupportedKind(_)) => "unsupported_kind",
+ Self::ContractMatch(ContractMatchError::UnsupportedShape(_)) => "unsupported_shape",
+ Self::ContractMatch(ContractMatchError::AmbiguousShape(_)) => "ambiguous_shape",
Self::ContractValidation(error) => error.code(),
Self::Profile(error) => error.code(),
Self::Post(error) => error.code(),
@@ -142,16 +136,16 @@ impl RadrootsEventAdmissionError {
impl fmt::Display for RadrootsEventAdmissionError {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
- Self::ContractMatch(RadrootsContractMatchError::UnsupportedKind(kind)) => {
+ Self::ContractMatch(ContractMatchError::UnsupportedKind(kind)) => {
write!(formatter, "event kind {kind} has no registered contract")
}
- Self::ContractMatch(RadrootsContractMatchError::UnsupportedShape(kind)) => {
+ Self::ContractMatch(ContractMatchError::UnsupportedShape(kind)) => {
write!(
formatter,
"event kind {kind} has no supported contract shape"
)
}
- Self::ContractMatch(RadrootsContractMatchError::AmbiguousShape(kind)) => {
+ Self::ContractMatch(ContractMatchError::AmbiguousShape(kind)) => {
write!(
formatter,
"event kind {kind} matches multiple contract shapes"
@@ -251,9 +245,9 @@ fn admit_registry_contract(
.map_err(map_contract_validation)
}
-fn map_contract_validation(error: RadrootsContractValidationError) -> RadrootsEventAdmissionError {
+fn map_contract_validation(error: ContractValidationError) -> RadrootsEventAdmissionError {
match error {
- RadrootsContractValidationError::ContractMatch { error } => {
+ ContractValidationError::ContractMatch { error } => {
RadrootsEventAdmissionError::ContractMatch(error)
}
error => RadrootsEventAdmissionError::ContractValidation(error),
@@ -263,18 +257,13 @@ fn map_contract_validation(error: RadrootsContractValidationError) -> RadrootsEv
#[cfg(test)]
mod tests {
use super::*;
- use radroots_event::contract::{RadrootsEventDiscriminator, all_event_contracts};
+ use radroots_event::contract::{EventDiscriminator, all_event_contracts};
#[test]
fn covers_the_exact_admission_only_registry_inventory() {
let mut actual = all_event_contracts()
.iter()
- .filter(|contract| {
- matches!(
- contract.discriminator,
- RadrootsEventDiscriminator::AdmissionOnly
- )
- })
+ .filter(|contract| matches!(contract.discriminator, EventDiscriminator::AdmissionOnly))
.map(|contract| contract.id);
for expected in [
@@ -295,15 +284,15 @@ mod tests {
fn contract_match_error_codes_are_stable_and_distinct() {
for (error, code) in [
(
- RadrootsContractMatchError::UnsupportedKind(65_535),
+ ContractMatchError::UnsupportedKind(65_535),
"unsupported_kind",
),
(
- RadrootsContractMatchError::UnsupportedShape(KIND_CLASSIFIED_LISTING),
+ ContractMatchError::UnsupportedShape(KIND_CLASSIFIED_LISTING),
"unsupported_shape",
),
(
- RadrootsContractMatchError::AmbiguousShape(KIND_CLASSIFIED_LISTING),
+ ContractMatchError::AmbiguousShape(KIND_CLASSIFIED_LISTING),
"ambiguous_shape",
),
] {
@@ -323,7 +312,7 @@ mod tests {
use nostr::secp256k1::Message;
use nostr::{Keys, SECP256K1};
use radroots_event::{
- envelope::RadrootsEventEnvelopeParts, envelope::kind::KIND_FOLLOW,
+ envelope::EventEnvelopeParts, envelope::kind::KIND_FOLLOW,
wire::compute_canonical_nip01_event_id,
};
@@ -390,9 +379,7 @@ mod tests {
.expect_err("unregistered kind must remain unsupported");
assert!(matches!(
unsupported,
- RadrootsEventAdmissionError::ContractMatch(
- RadrootsContractMatchError::UnsupportedKind(_)
- )
+ RadrootsEventAdmissionError::ContractMatch(ContractMatchError::UnsupportedKind(_))
));
let unsupported_listing =
@@ -400,9 +387,9 @@ mod tests {
.expect_err("generic NIP-99 shape must remain unsupported");
assert!(matches!(
unsupported_listing,
- RadrootsEventAdmissionError::ContractMatch(
- RadrootsContractMatchError::UnsupportedShape(KIND_CLASSIFIED_LISTING)
- )
+ RadrootsEventAdmissionError::ContractMatch(ContractMatchError::UnsupportedShape(
+ KIND_CLASSIFIED_LISTING
+ ))
));
let tolerant_profile = admitted(
@@ -484,7 +471,7 @@ mod tests {
kind: u32,
tags: Vec<Vec<String>>,
content: &str,
- ) -> RadrootsEventEnvelope {
+ ) -> EventEnvelope {
let keys = Keys::parse(FIXTURE_ALICE_SECRET_KEY_HEX)
.expect("fixed fixture secret key must parse");
let author = keys.public_key().to_string();
@@ -494,7 +481,7 @@ mod tests {
let message = Message::from_digest(nostr_id.to_bytes());
let signature = SECP256K1.sign_schnorr_no_aux_rand(&message, keys.key_pair(SECP256K1));
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ EventEnvelope::new(EventEnvelopeParts {
id: id.into_string(),
author,
created_at,
diff --git a/crates/event_codec/src/admission/registry_v7.rs b/crates/event_codec/src/admission/registry_v7.rs
@@ -1,7 +1,7 @@
use radroots_event::{
contract::registry_v7::{
- RadrootsContractMatchError, RadrootsContractValidationError, RadrootsEventContract,
- event_contract_registry_v7, validate_event_contract_registry_v7,
+ ContractMatchError, ContractValidationError, EventContract, event_contract_registry_v7,
+ validate_event_contract_registry_v7,
},
envelope::kind::{
KIND_CLASSIFIED_LISTING, KIND_COMMENT, KIND_DELETION_REQUEST, KIND_POST, KIND_PROFILE,
@@ -31,18 +31,10 @@ const INTERNAL_CONTRACT_MISSING: &str = "registry_v7_contract_missing";
/// Later registries may grow those APIs without changing persisted v7 facts.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RadrootsRegistryV7AdmissionDecision {
- Admitted {
- contract: &'static RadrootsEventContract,
- },
- Unsupported {
- code: &'static str,
- },
- Invalid {
- code: &'static str,
- },
- Defect {
- code: &'static str,
- },
+ Admitted { contract: &'static EventContract },
+ Unsupported { code: &'static str },
+ Invalid { code: &'static str },
+ Defect { code: &'static str },
}
/// Admits through the immutable event-contract registry-v7 behavior graph.
@@ -95,14 +87,14 @@ fn admit_registry_contract_v7(
) -> RadrootsRegistryV7AdmissionDecision {
match validate_event_contract_registry_v7(event.event()) {
Ok(contract) => RadrootsRegistryV7AdmissionDecision::Admitted { contract },
- Err(RadrootsContractValidationError::ContractMatch {
- error: RadrootsContractMatchError::UnsupportedKind(_),
+ Err(ContractValidationError::ContractMatch {
+ error: ContractMatchError::UnsupportedKind(_),
}) => unsupported("unsupported_kind"),
- Err(RadrootsContractValidationError::ContractMatch {
- error: RadrootsContractMatchError::UnsupportedShape(_),
+ Err(ContractValidationError::ContractMatch {
+ error: ContractMatchError::UnsupportedShape(_),
}) => unsupported("unsupported_shape"),
- Err(RadrootsContractValidationError::ContractMatch {
- error: RadrootsContractMatchError::AmbiguousShape(_),
+ Err(ContractValidationError::ContractMatch {
+ error: ContractMatchError::AmbiguousShape(_),
}) => invalid("ambiguous_shape"),
Err(error) => invalid(error.code()),
}
diff --git a/crates/event_codec/src/app_data/decode.rs b/crates/event_codec/src/app_data/decode.rs
@@ -5,7 +5,7 @@ use alloc::{
};
use radroots_event::{
- social::app_data::{KIND_APP_DATA, RadrootsAppData},
+ social::app_data::{AppData, KIND_APP_DATA},
tag::name::TAG_D,
};
@@ -31,7 +31,7 @@ pub fn app_data_from_tags(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsAppData, EventParseError> {
+) -> Result<AppData, EventParseError> {
if kind != KIND_APP_DATA {
return Err(EventParseError::InvalidKind {
expected: "30078",
@@ -39,7 +39,7 @@ pub fn app_data_from_tags(
});
}
let d_tag = parse_d_tag(tags)?;
- Ok(RadrootsAppData {
+ Ok(AppData {
d_tag,
content: content.to_string(),
})
@@ -52,7 +52,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsAppData>, EventParseError> {
+) -> Result<RadrootsParsedData<AppData>, EventParseError> {
let app_data = app_data_from_tags(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -71,7 +71,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsAppData>, EventParseError> {
+) -> Result<RadrootsParsedEvent<AppData>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
diff --git a/crates/event_codec/src/app_data/encode.rs b/crates/event_codec/src/app_data/encode.rs
@@ -5,36 +5,32 @@ use alloc::{
vec::Vec,
};
-use radroots_event::social::app_data::{KIND_APP_DATA, RadrootsAppData};
+use radroots_event::social::app_data::{AppData, KIND_APP_DATA};
use radroots_event::tag::name::TAG_D;
use crate::error::EventEncodeError;
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
-pub fn app_data_build_tags(
- app_data: &RadrootsAppData,
-) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn app_data_build_tags(app_data: &AppData) -> Result<Vec<Vec<String>>, EventEncodeError> {
if app_data.d_tag.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("d_tag"));
}
Ok(vec![vec![TAG_D.to_string(), app_data.d_tag.clone()]])
}
-pub fn to_wire_parts(
- app_data: &RadrootsAppData,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+pub fn to_wire_parts(app_data: &AppData) -> Result<Nip01EventWireParts, EventEncodeError> {
to_wire_parts_with_kind(app_data, KIND_APP_DATA)
}
pub fn to_wire_parts_with_kind(
- app_data: &RadrootsAppData,
+ app_data: &AppData,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != KIND_APP_DATA {
return Err(EventEncodeError::InvalidKind(kind));
}
let tags = app_data_build_tags(app_data)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content: app_data.content.clone(),
tags,
diff --git a/crates/event_codec/src/article/decode.rs b/crates/event_codec/src/article/decode.rs
@@ -6,9 +6,9 @@ use alloc::{
use radroots_event::{
envelope::kind::{KIND_ARTICLE, KIND_FARM},
- farm::RadrootsFarmRef,
- post::article::RadrootsArticle,
- social::RadrootsSocialFarmAnchor,
+ farm::FarmRef,
+ post::article::Article,
+ social::SocialFarmAnchor,
tag::name::{TAG_A, TAG_D, TAG_IMAGE, TAG_PUBLISHED_AT, TAG_SUMMARY, TAG_T, TAG_TITLE},
};
@@ -26,7 +26,7 @@ pub fn article_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsArticle, EventParseError> {
+) -> Result<Article, EventParseError> {
if kind != KIND_ARTICLE {
return Err(EventParseError::InvalidKind {
expected: EXPECTED_KIND,
@@ -45,7 +45,7 @@ pub fn article_from_event(
})
.transpose()?;
let farm = parse_farm_anchor(tags)?;
- Ok(RadrootsArticle {
+ Ok(Article {
d_tag,
title,
content: content.to_string(),
@@ -65,7 +65,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsArticle>, EventParseError> {
+) -> Result<RadrootsParsedData<Article>, EventParseError> {
let article = article_from_event(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -84,7 +84,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsArticle>, EventParseError> {
+) -> Result<RadrootsParsedEvent<Article>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
@@ -96,15 +96,13 @@ pub fn parsed_from_event(
RadrootsParsedEvent::from_event_parts(id, author, published_at, kind, content, tags, sig, data)
}
-fn parse_farm_anchor(
- tags: &[Vec<String>],
-) -> Result<Option<RadrootsSocialFarmAnchor>, EventParseError> {
+fn parse_farm_anchor(tags: &[Vec<String>]) -> Result<Option<SocialFarmAnchor>, EventParseError> {
let Some(value) = first_tag_value(tags, TAG_A) else {
return Ok(None);
};
let address = parse_address_tag_with_kind(&value, KIND_FARM, TAG_A)?;
- Ok(Some(RadrootsSocialFarmAnchor {
- farm: RadrootsFarmRef {
+ Ok(Some(SocialFarmAnchor {
+ farm: FarmRef {
pubkey: address.pubkey,
d_tag: address.d_tag,
},
diff --git a/crates/event_codec/src/article/encode.rs b/crates/event_codec/src/article/encode.rs
@@ -6,7 +6,7 @@ use alloc::{
use radroots_event::{
envelope::kind::KIND_ARTICLE,
- post::article::RadrootsArticle,
+ post::article::Article,
tag::name::{TAG_D, TAG_IMAGE, TAG_PUBLISHED_AT, TAG_SUMMARY, TAG_T, TAG_TITLE},
};
@@ -14,11 +14,11 @@ use crate::d_tag::validate_d_tag;
use crate::error::EventEncodeError;
use crate::field_helpers::{push_optional_tag, push_tag, validate_non_empty_field};
use crate::social_helpers::push_location_tags;
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
const DEFAULT_KIND: u32 = KIND_ARTICLE;
-pub fn article_build_tags(article: &RadrootsArticle) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn article_build_tags(article: &Article) -> Result<Vec<Vec<String>>, EventEncodeError> {
validate_article(article)?;
let mut tags = Vec::new();
push_tag(&mut tags, TAG_D, article.d_tag.as_str());
@@ -42,27 +42,25 @@ pub fn article_build_tags(article: &RadrootsArticle) -> Result<Vec<Vec<String>>,
Ok(tags)
}
-pub fn to_wire_parts(
- article: &RadrootsArticle,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+pub fn to_wire_parts(article: &Article) -> Result<Nip01EventWireParts, EventEncodeError> {
to_wire_parts_with_kind(article, DEFAULT_KIND)
}
pub fn to_wire_parts_with_kind(
- article: &RadrootsArticle,
+ article: &Article,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != DEFAULT_KIND {
return Err(EventEncodeError::InvalidKind(kind));
}
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content: article.content.clone(),
tags: article_build_tags(article)?,
})
}
-fn validate_article(article: &RadrootsArticle) -> Result<(), EventEncodeError> {
+fn validate_article(article: &Article) -> Result<(), EventEncodeError> {
validate_d_tag(&article.d_tag, "d_tag")?;
validate_non_empty_field(&article.title, "title")?;
validate_non_empty_field(&article.content, "content")?;
diff --git a/crates/event_codec/src/calendar/decode.rs b/crates/event_codec/src/calendar/decode.rs
@@ -6,18 +6,15 @@ use alloc::{
use radroots_event::{
calendar::{
- RADROOTS_CALENDAR_SECONDS_PER_DAY, RadrootsAdmittedCalendar,
- RadrootsAdmittedCalendarDateEvent, RadrootsAdmittedCalendarEventRsvp,
- RadrootsAdmittedCalendarTimeEvent, RadrootsCalendarDate,
- RadrootsCalendarEventAuthorReference, RadrootsCalendarEventFreeBusy,
- RadrootsCalendarEventReference, RadrootsCalendarEventRevisionReference,
- RadrootsCalendarEventRsvpStatus, RadrootsCalendarParticipant, RadrootsCalendarRequest,
- RadrootsCalendarUri, RadrootsIanaTimeZoneId, RadrootsObservedUtcDay,
- RadrootsParsedNip52Calendar, RadrootsParsedNip52CalendarCommon,
- RadrootsParsedNip52CalendarCommonParts, RadrootsParsedNip52CalendarDateEvent,
- RadrootsParsedNip52CalendarEventRsvp, RadrootsParsedNip52CalendarEventRsvpParts,
- RadrootsParsedNip52CalendarParts, RadrootsParsedNip52CalendarTimeEvent,
- calendar_geohash_is_valid, calendar_relay_url_is_valid, calendar_tag_text_is_valid,
+ AdmittedCalendar, AdmittedCalendarDateEvent, AdmittedCalendarEventRsvp,
+ AdmittedCalendarTimeEvent, CalendarDate, CalendarEventAuthorReference,
+ CalendarEventFreeBusy, CalendarEventReference, CalendarEventRevisionReference,
+ CalendarEventRsvpStatus, CalendarParticipant, CalendarRequest, CalendarUri, IanaTimeZoneId,
+ ObservedUtcDay, ParsedNip52Calendar, ParsedNip52CalendarCommon,
+ ParsedNip52CalendarCommonParts, ParsedNip52CalendarDateEvent, ParsedNip52CalendarEventRsvp,
+ ParsedNip52CalendarEventRsvpParts, ParsedNip52CalendarParts, ParsedNip52CalendarTimeEvent,
+ RADROOTS_CALENDAR_SECONDS_PER_DAY, calendar_geohash_is_valid, calendar_relay_url_is_valid,
+ calendar_tag_text_is_valid,
},
envelope::kind::{
KIND_CALENDAR, KIND_CALENDAR_DATE_EVENT, KIND_CALENDAR_EVENT_RSVP, KIND_CALENDAR_TIME_EVENT,
@@ -46,7 +43,7 @@ pub fn parse_nip52_calendar_date_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsParsedNip52CalendarDateEvent, EventParseError> {
+) -> Result<ParsedNip52CalendarDateEvent, EventParseError> {
validate_bounded_calendar_parts(tags, content)?;
if kind != KIND_CALENDAR_DATE_EVENT {
return Err(EventParseError::InvalidKind {
@@ -64,7 +61,7 @@ pub fn parse_nip52_calendar_date_event(
.filter(|tag| tag.first().map(String::as_str) == Some(TAG_D_DAY))
.cloned()
.collect();
- RadrootsParsedNip52CalendarDateEvent::try_new(common, start, end, extension_day_tags)
+ ParsedNip52CalendarDateEvent::try_new(common, start, end, extension_day_tags)
.map_err(|_| EventParseError::InvalidTag(TAG_END))
}
@@ -72,7 +69,7 @@ pub fn parse_nip52_calendar_time_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsParsedNip52CalendarTimeEvent, EventParseError> {
+) -> Result<ParsedNip52CalendarTimeEvent, EventParseError> {
validate_bounded_calendar_parts(tags, content)?;
if kind != KIND_CALENDAR_TIME_EVENT {
return Err(EventParseError::InvalidKind {
@@ -91,7 +88,7 @@ pub fn parse_nip52_calendar_time_event(
let observed_day_indices = repeated_exact_tag_values(tags, TAG_D_DAY)?
.into_iter()
.map(|value| {
- RadrootsObservedUtcDay::parse(value).map_err(|_| EventParseError::InvalidTag(TAG_D_DAY))
+ ObservedUtcDay::parse(value).map_err(|_| EventParseError::InvalidTag(TAG_D_DAY))
})
.collect::<Result<Vec<_>, _>>()?;
if end.is_some_and(|end| end <= start) {
@@ -112,7 +109,7 @@ pub fn parse_nip52_calendar_time_event(
}
let start_tzid = optional_iana_tzid(tags, TAG_START_TZID)?;
let end_tzid = optional_iana_tzid(tags, TAG_END_TZID)?;
- RadrootsParsedNip52CalendarTimeEvent::try_new(
+ ParsedNip52CalendarTimeEvent::try_new(
common,
start_wire,
start,
@@ -126,28 +123,22 @@ pub fn parse_nip52_calendar_time_event(
}
pub fn admit_radroots_calendar_date_event(
- parsed: RadrootsParsedNip52CalendarDateEvent,
-) -> Result<
- RadrootsAdmittedCalendarDateEvent,
- radroots_event::calendar::RadrootsCalendarAdmissionError,
-> {
- RadrootsAdmittedCalendarDateEvent::try_from_parsed(parsed)
+ parsed: ParsedNip52CalendarDateEvent,
+) -> Result<AdmittedCalendarDateEvent, radroots_event::calendar::CalendarAdmissionError> {
+ AdmittedCalendarDateEvent::try_from_parsed(parsed)
}
pub fn admit_radroots_calendar_time_event(
- parsed: RadrootsParsedNip52CalendarTimeEvent,
-) -> Result<
- RadrootsAdmittedCalendarTimeEvent,
- radroots_event::calendar::RadrootsCalendarAdmissionError,
-> {
- RadrootsAdmittedCalendarTimeEvent::try_from_parsed(parsed)
+ parsed: ParsedNip52CalendarTimeEvent,
+) -> Result<AdmittedCalendarTimeEvent, radroots_event::calendar::CalendarAdmissionError> {
+ AdmittedCalendarTimeEvent::try_from_parsed(parsed)
}
pub fn parse_nip52_calendar(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsParsedNip52Calendar, EventParseError> {
+) -> Result<ParsedNip52Calendar, EventParseError> {
validate_bounded_calendar_parts(tags, content)?;
if kind != KIND_CALENDAR {
return Err(EventParseError::InvalidKind {
@@ -162,7 +153,7 @@ pub fn parse_nip52_calendar(
let event_references = calendar_event_references_from_tags(tags)?;
let list_description = optional_calendar_text_tag(tags, TAG_DESCRIPTION)?;
let image = optional_calendar_uri_tag(tags, TAG_IMAGE)?;
- RadrootsParsedNip52Calendar::try_new(RadrootsParsedNip52CalendarParts {
+ ParsedNip52Calendar::try_new(ParsedNip52CalendarParts {
d_tag,
title,
content: content.to_string(),
@@ -174,16 +165,16 @@ pub fn parse_nip52_calendar(
}
pub fn admit_radroots_calendar(
- parsed: RadrootsParsedNip52Calendar,
-) -> Result<RadrootsAdmittedCalendar, radroots_event::calendar::RadrootsCalendarAdmissionError> {
- RadrootsAdmittedCalendar::try_from_parsed(parsed)
+ parsed: ParsedNip52Calendar,
+) -> Result<AdmittedCalendar, radroots_event::calendar::CalendarAdmissionError> {
+ AdmittedCalendar::try_from_parsed(parsed)
}
pub fn parse_nip52_calendar_event_rsvp(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsParsedNip52CalendarEventRsvp, EventParseError> {
+) -> Result<ParsedNip52CalendarEventRsvp, EventParseError> {
validate_bounded_calendar_parts(tags, content)?;
if kind != KIND_CALENDAR_EVENT_RSVP {
return Err(EventParseError::InvalidKind {
@@ -196,7 +187,7 @@ pub fn parse_nip52_calendar_event_rsvp(
let event_reference = calendar_event_reference_from_required_tag(tags)?;
let revision_reference = optional_reference_tag(tags, TAG_E)?
.map(|tag| {
- RadrootsCalendarEventRevisionReference::parse(&tag[1], tag.get(2).map(String::as_str))
+ CalendarEventRevisionReference::parse(&tag[1], tag.get(2).map(String::as_str))
.map_err(|_| EventParseError::InvalidTag(TAG_E))
})
.transpose()?;
@@ -206,11 +197,11 @@ pub fn parse_nip52_calendar_event_rsvp(
.transpose()?;
let author_hint = optional_reference_tag(tags, TAG_P)?
.map(|tag| {
- RadrootsCalendarEventAuthorReference::parse(&tag[1], tag.get(2).map(String::as_str))
+ CalendarEventAuthorReference::parse(&tag[1], tag.get(2).map(String::as_str))
.map_err(|_| EventParseError::InvalidTag(TAG_P))
})
.transpose()?;
- RadrootsParsedNip52CalendarEventRsvp::try_new(RadrootsParsedNip52CalendarEventRsvpParts {
+ ParsedNip52CalendarEventRsvp::try_new(ParsedNip52CalendarEventRsvpParts {
d_tag,
event_reference,
revision_reference,
@@ -223,12 +214,9 @@ pub fn parse_nip52_calendar_event_rsvp(
}
pub fn admit_radroots_calendar_event_rsvp(
- parsed: RadrootsParsedNip52CalendarEventRsvp,
-) -> Result<
- RadrootsAdmittedCalendarEventRsvp,
- radroots_event::calendar::RadrootsCalendarAdmissionError,
-> {
- RadrootsAdmittedCalendarEventRsvp::try_from_parsed(parsed)
+ parsed: ParsedNip52CalendarEventRsvp,
+) -> Result<AdmittedCalendarEventRsvp, radroots_event::calendar::CalendarAdmissionError> {
+ AdmittedCalendarEventRsvp::try_from_parsed(parsed)
}
pub fn nip52_date_data_from_event(
@@ -238,7 +226,7 @@ pub fn nip52_date_data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsParsedNip52CalendarDateEvent>, EventParseError> {
+) -> Result<RadrootsParsedData<ParsedNip52CalendarDateEvent>, EventParseError> {
let event = parse_nip52_calendar_date_event(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -256,7 +244,7 @@ pub fn nip52_time_data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsParsedNip52CalendarTimeEvent>, EventParseError> {
+) -> Result<RadrootsParsedData<ParsedNip52CalendarTimeEvent>, EventParseError> {
let event = parse_nip52_calendar_time_event(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -274,7 +262,7 @@ pub fn nip52_calendar_data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsParsedNip52Calendar>, EventParseError> {
+) -> Result<RadrootsParsedData<ParsedNip52Calendar>, EventParseError> {
let calendar = parse_nip52_calendar(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -292,7 +280,7 @@ pub fn nip52_calendar_event_rsvp_data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsParsedNip52CalendarEventRsvp>, EventParseError> {
+) -> Result<RadrootsParsedData<ParsedNip52CalendarEventRsvp>, EventParseError> {
let rsvp = parse_nip52_calendar_event_rsvp(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -311,7 +299,7 @@ pub fn nip52_date_parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsParsedNip52CalendarDateEvent>, EventParseError> {
+) -> Result<RadrootsParsedEvent<ParsedNip52CalendarDateEvent>, EventParseError> {
let data = nip52_date_data_from_event(
id.clone(),
author.clone(),
@@ -331,7 +319,7 @@ pub fn nip52_time_parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsParsedNip52CalendarTimeEvent>, EventParseError> {
+) -> Result<RadrootsParsedEvent<ParsedNip52CalendarTimeEvent>, EventParseError> {
let data = nip52_time_data_from_event(
id.clone(),
author.clone(),
@@ -351,7 +339,7 @@ pub fn nip52_calendar_parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsParsedNip52Calendar>, EventParseError> {
+) -> Result<RadrootsParsedEvent<ParsedNip52Calendar>, EventParseError> {
let data = nip52_calendar_data_from_event(
id.clone(),
author.clone(),
@@ -371,7 +359,7 @@ pub fn nip52_calendar_event_rsvp_parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsParsedNip52CalendarEventRsvp>, EventParseError> {
+) -> Result<RadrootsParsedEvent<ParsedNip52CalendarEventRsvp>, EventParseError> {
let data = nip52_calendar_event_rsvp_data_from_event(
id.clone(),
author.clone(),
@@ -386,7 +374,7 @@ pub fn nip52_calendar_event_rsvp_parsed_from_event(
fn parse_nip52_calendar_common(
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsParsedNip52CalendarCommon, EventParseError> {
+) -> Result<ParsedNip52CalendarCommon, EventParseError> {
let d_tag = required_exact_tag_value(tags, TAG_D)?;
validate_calendar_text_tag(&d_tag, TAG_D)?;
let title = required_exact_tag_value(tags, TAG_TITLE)?;
@@ -405,13 +393,11 @@ fn parse_nip52_calendar_common(
let categories = repeated_calendar_text_values(tags, TAG_T)?;
let references = repeated_exact_tag_values(tags, TAG_R)?
.into_iter()
- .map(|value| {
- RadrootsCalendarUri::parse(value).map_err(|_| EventParseError::InvalidTag(TAG_R))
- })
+ .map(|value| CalendarUri::parse(value).map_err(|_| EventParseError::InvalidTag(TAG_R)))
.collect::<Result<Vec<_>, _>>()?;
let calendar_requests = calendar_requests_from_tags(tags)?;
let legacy_name = optional_calendar_text_tag(tags, "name")?;
- RadrootsParsedNip52CalendarCommon::try_new(RadrootsParsedNip52CalendarCommonParts {
+ ParsedNip52CalendarCommon::try_new(ParsedNip52CalendarCommonParts {
d_tag,
title,
description: optional_content(content),
@@ -505,11 +491,8 @@ fn optional_exact_tag_value(
Ok(Some(value))
}
-fn parse_calendar_date(
- value: &str,
- key: &'static str,
-) -> Result<RadrootsCalendarDate, EventParseError> {
- RadrootsCalendarDate::parse(value).map_err(|_| EventParseError::InvalidTag(key))
+fn parse_calendar_date(value: &str, key: &'static str) -> Result<CalendarDate, EventParseError> {
+ CalendarDate::parse(value).map_err(|_| EventParseError::InvalidTag(key))
}
fn parse_standard_u64(value: &str, key: &'static str) -> Result<u64, EventParseError> {
@@ -524,11 +507,9 @@ fn parse_standard_u64(value: &str, key: &'static str) -> Result<u64, EventParseE
fn optional_iana_tzid(
tags: &[Vec<String>],
key: &'static str,
-) -> Result<Option<RadrootsIanaTimeZoneId>, EventParseError> {
+) -> Result<Option<IanaTimeZoneId>, EventParseError> {
optional_exact_tag_value(tags, key)?
- .map(|value| {
- RadrootsIanaTimeZoneId::parse(value).map_err(|_| EventParseError::InvalidTag(key))
- })
+ .map(|value| IanaTimeZoneId::parse(value).map_err(|_| EventParseError::InvalidTag(key)))
.transpose()
}
@@ -565,17 +546,15 @@ fn repeated_calendar_text_values(
fn optional_calendar_uri_tag(
tags: &[Vec<String>],
key: &'static str,
-) -> Result<Option<RadrootsCalendarUri>, EventParseError> {
+) -> Result<Option<CalendarUri>, EventParseError> {
optional_exact_tag_value(tags, key)?
- .map(|value| {
- RadrootsCalendarUri::parse(value).map_err(|_| EventParseError::InvalidTag(key))
- })
+ .map(|value| CalendarUri::parse(value).map_err(|_| EventParseError::InvalidTag(key)))
.transpose()
}
fn calendar_participants_from_tags(
tags: &[Vec<String>],
-) -> Result<Vec<RadrootsCalendarParticipant>, EventParseError> {
+) -> Result<Vec<CalendarParticipant>, EventParseError> {
let mut participants = Vec::new();
for tag in tags
.iter()
@@ -599,7 +578,7 @@ fn calendar_participants_from_tags(
if let Some(role) = role.as_deref() {
validate_calendar_text_tag(role, TAG_P)?;
}
- participants.push(RadrootsCalendarParticipant {
+ participants.push(CalendarParticipant {
pubkey: tag[1].clone(),
relay,
role,
@@ -610,7 +589,7 @@ fn calendar_participants_from_tags(
fn calendar_requests_from_tags(
tags: &[Vec<String>],
-) -> Result<Vec<RadrootsCalendarRequest>, EventParseError> {
+) -> Result<Vec<CalendarRequest>, EventParseError> {
tags.iter()
.filter(|tag| tag.first().map(String::as_str) == Some(TAG_A))
.map(|tag| {
@@ -620,7 +599,7 @@ fn calendar_requests_from_tags(
{
return Err(EventParseError::InvalidTag(TAG_A));
}
- RadrootsCalendarRequest::new(&tag[1], tag.get(2).map(String::as_str))
+ CalendarRequest::new(&tag[1], tag.get(2).map(String::as_str))
.map_err(|_| EventParseError::InvalidTag(TAG_A))
})
.collect()
@@ -636,7 +615,7 @@ fn optional_content(content: &str) -> Option<String> {
fn calendar_event_references_from_tags(
tags: &[Vec<String>],
-) -> Result<Vec<RadrootsCalendarEventReference>, EventParseError> {
+) -> Result<Vec<CalendarEventReference>, EventParseError> {
tags.iter()
.filter(|tag| tag.first().map(String::as_str) == Some(TAG_A))
.map(|tag| parse_calendar_event_reference_tag(tag))
@@ -645,16 +624,16 @@ fn calendar_event_references_from_tags(
fn calendar_event_reference_from_required_tag(
tags: &[Vec<String>],
-) -> Result<RadrootsCalendarEventReference, EventParseError> {
+) -> Result<CalendarEventReference, EventParseError> {
let tag = optional_reference_tag(tags, TAG_A)?.ok_or(EventParseError::MissingTag(TAG_A))?;
parse_calendar_event_reference_tag(tag)
}
fn parse_calendar_event_reference_tag(
tag: &[String],
-) -> Result<RadrootsCalendarEventReference, EventParseError> {
+) -> Result<CalendarEventReference, EventParseError> {
validate_reference_tag_shape(tag, TAG_A)?;
- RadrootsCalendarEventReference::parse(&tag[1], tag.get(2).map(String::as_str))
+ CalendarEventReference::parse(&tag[1], tag.get(2).map(String::as_str))
.map_err(|_| EventParseError::InvalidTag(TAG_A))
}
@@ -685,19 +664,19 @@ fn validate_reference_tag_shape(tag: &[String], key: &'static str) -> Result<(),
Ok(())
}
-fn parse_rsvp_status(value: &str) -> Result<RadrootsCalendarEventRsvpStatus, EventParseError> {
+fn parse_rsvp_status(value: &str) -> Result<CalendarEventRsvpStatus, EventParseError> {
match value {
- "accepted" => Ok(RadrootsCalendarEventRsvpStatus::Accepted),
- "declined" => Ok(RadrootsCalendarEventRsvpStatus::Declined),
- "tentative" => Ok(RadrootsCalendarEventRsvpStatus::Tentative),
+ "accepted" => Ok(CalendarEventRsvpStatus::Accepted),
+ "declined" => Ok(CalendarEventRsvpStatus::Declined),
+ "tentative" => Ok(CalendarEventRsvpStatus::Tentative),
_ => Err(EventParseError::InvalidTag(TAG_STATUS)),
}
}
-fn parse_free_busy(value: &str) -> Result<RadrootsCalendarEventFreeBusy, EventParseError> {
+fn parse_free_busy(value: &str) -> Result<CalendarEventFreeBusy, EventParseError> {
match value {
- "free" => Ok(RadrootsCalendarEventFreeBusy::Free),
- "busy" => Ok(RadrootsCalendarEventFreeBusy::Busy),
+ "free" => Ok(CalendarEventFreeBusy::Free),
+ "busy" => Ok(CalendarEventFreeBusy::Busy),
_ => Err(EventParseError::InvalidTag(TAG_FREE_BUSY)),
}
}
diff --git a/crates/event_codec/src/calendar/encode.rs b/crates/event_codec/src/calendar/encode.rs
@@ -7,12 +7,10 @@ use alloc::{
use radroots_event::{
calendar::{
- RadrootsAuthoredCalendar, RadrootsAuthoredCalendarDateEvent,
- RadrootsAuthoredCalendarEventRsvp, RadrootsAuthoredCalendarTimeEvent,
- RadrootsCalendarEventAuthorReference, RadrootsCalendarEventFreeBusy,
- RadrootsCalendarEventReference, RadrootsCalendarEventRevisionReference,
- RadrootsCalendarEventRsvpStatus, RadrootsCalendarParticipant, RadrootsCalendarRequest,
- RadrootsCalendarUri, covered_utc_days,
+ AuthoredCalendar, AuthoredCalendarDateEvent, AuthoredCalendarEventRsvp,
+ AuthoredCalendarTimeEvent, CalendarEventAuthorReference, CalendarEventFreeBusy,
+ CalendarEventReference, CalendarEventRevisionReference, CalendarEventRsvpStatus,
+ CalendarParticipant, CalendarRequest, CalendarUri, covered_utc_days,
},
envelope::kind::{
KIND_CALENDAR, KIND_CALENDAR_DATE_EVENT, KIND_CALENDAR_EVENT_RSVP, KIND_CALENDAR_TIME_EVENT,
@@ -27,10 +25,10 @@ use radroots_event::{
use crate::error::EventEncodeError;
use crate::field_helpers::{push_optional_tag, push_tag};
use crate::social_helpers::push_participants;
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
pub fn calendar_date_event_build_tags(
- event: &RadrootsAuthoredCalendarDateEvent,
+ event: &AuthoredCalendarDateEvent,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
validate_authored_date_event(event)?;
let mut tags = Vec::new();
@@ -53,7 +51,7 @@ pub fn calendar_date_event_build_tags(
}
pub fn calendar_time_event_build_tags(
- event: &RadrootsAuthoredCalendarTimeEvent,
+ event: &AuthoredCalendarTimeEvent,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
validate_authored_time_event(event)?;
let mut tags = Vec::new();
@@ -93,7 +91,7 @@ pub fn calendar_time_event_build_tags(
}
pub fn calendar_collection_build_tags(
- calendar: &RadrootsAuthoredCalendar,
+ calendar: &AuthoredCalendar,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
let mut tags = Vec::new();
push_tag(&mut tags, TAG_D, calendar.uid().as_str());
@@ -113,7 +111,7 @@ pub fn calendar_collection_build_tags(
}
pub fn rsvp_build_tags(
- rsvp: &RadrootsAuthoredCalendarEventRsvp,
+ rsvp: &AuthoredCalendarEventRsvp,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
let mut tags = Vec::new();
push_tag(&mut tags, TAG_D, rsvp.uid().as_str());
@@ -132,37 +130,37 @@ pub fn rsvp_build_tags(
}
pub fn date_to_wire_parts(
- event: &RadrootsAuthoredCalendarDateEvent,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ event: &AuthoredCalendarDateEvent,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
date_to_wire_parts_with_kind(event, KIND_CALENDAR_DATE_EVENT)
}
pub fn time_to_wire_parts(
- event: &RadrootsAuthoredCalendarTimeEvent,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ event: &AuthoredCalendarTimeEvent,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
time_to_wire_parts_with_kind(event, KIND_CALENDAR_TIME_EVENT)
}
pub fn calendar_to_wire_parts(
- calendar: &RadrootsAuthoredCalendar,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ calendar: &AuthoredCalendar,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
calendar_to_wire_parts_with_kind(calendar, KIND_CALENDAR)
}
pub fn rsvp_to_wire_parts(
- rsvp: &RadrootsAuthoredCalendarEventRsvp,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ rsvp: &AuthoredCalendarEventRsvp,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
rsvp_to_wire_parts_with_kind(rsvp, KIND_CALENDAR_EVENT_RSVP)
}
pub fn date_to_wire_parts_with_kind(
- event: &RadrootsAuthoredCalendarDateEvent,
+ event: &AuthoredCalendarDateEvent,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != KIND_CALENDAR_DATE_EVENT {
return Err(EventEncodeError::InvalidKind(kind));
}
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content: event.description().unwrap_or_default().to_string(),
tags: calendar_date_event_build_tags(event)?,
@@ -170,13 +168,13 @@ pub fn date_to_wire_parts_with_kind(
}
pub fn time_to_wire_parts_with_kind(
- event: &RadrootsAuthoredCalendarTimeEvent,
+ event: &AuthoredCalendarTimeEvent,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != KIND_CALENDAR_TIME_EVENT {
return Err(EventEncodeError::InvalidKind(kind));
}
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content: event.description().unwrap_or_default().to_string(),
tags: calendar_time_event_build_tags(event)?,
@@ -184,13 +182,13 @@ pub fn time_to_wire_parts_with_kind(
}
pub fn calendar_to_wire_parts_with_kind(
- calendar: &RadrootsAuthoredCalendar,
+ calendar: &AuthoredCalendar,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != KIND_CALENDAR {
return Err(EventEncodeError::InvalidKind(kind));
}
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content: calendar.content().to_string(),
tags: calendar_collection_build_tags(calendar)?,
@@ -198,13 +196,13 @@ pub fn calendar_to_wire_parts_with_kind(
}
pub fn rsvp_to_wire_parts_with_kind(
- rsvp: &RadrootsAuthoredCalendarEventRsvp,
+ rsvp: &AuthoredCalendarEventRsvp,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != KIND_CALENDAR_EVENT_RSVP {
return Err(EventEncodeError::InvalidKind(kind));
}
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content: rsvp.note().unwrap_or_default().to_string(),
tags: rsvp_build_tags(rsvp)?,
@@ -212,14 +210,12 @@ pub fn rsvp_to_wire_parts_with_kind(
}
fn validate_authored_date_event(
- _event: &RadrootsAuthoredCalendarDateEvent,
+ _event: &AuthoredCalendarDateEvent,
) -> Result<(), EventEncodeError> {
Ok(())
}
-fn validate_authored_time_event(
- event: &RadrootsAuthoredCalendarTimeEvent,
-) -> Result<(), EventEncodeError> {
+fn validate_authored_time_event(event: &AuthoredCalendarTimeEvent) -> Result<(), EventEncodeError> {
covered_utc_days(event.start(), event.end())
.map_err(|_| EventEncodeError::InvalidField("end"))?;
Ok(())
@@ -232,10 +228,10 @@ fn push_authored_calendar_common_tags(
geohash: Option<&str>,
summary: Option<&str>,
image: Option<&str>,
- participants: Option<&Vec<RadrootsCalendarParticipant>>,
+ participants: Option<&Vec<CalendarParticipant>>,
categories: &[String],
- references: &[RadrootsCalendarUri],
- calendar_requests: &[RadrootsCalendarRequest],
+ references: &[CalendarUri],
+ calendar_requests: &[CalendarRequest],
) {
for location in locations {
push_tag(tags, TAG_LOCATION, location);
@@ -259,10 +255,7 @@ fn push_authored_calendar_common_tags(
}
}
-fn push_calendar_event_reference(
- tags: &mut Vec<Vec<String>>,
- reference: &RadrootsCalendarEventReference,
-) {
+fn push_calendar_event_reference(tags: &mut Vec<Vec<String>>, reference: &CalendarEventReference) {
let mut tag = vec![
TAG_A.to_string(),
reference.coordinate().as_str().to_string(),
@@ -275,7 +268,7 @@ fn push_calendar_event_reference(
fn push_calendar_revision_reference(
tags: &mut Vec<Vec<String>>,
- reference: &RadrootsCalendarEventRevisionReference,
+ reference: &CalendarEventRevisionReference,
) {
let mut tag = vec![TAG_E.to_string(), reference.event_id().to_hex()];
if let Some(relay) = reference.relay() {
@@ -286,7 +279,7 @@ fn push_calendar_revision_reference(
fn push_calendar_author_reference(
tags: &mut Vec<Vec<String>>,
- reference: &RadrootsCalendarEventAuthorReference,
+ reference: &CalendarEventAuthorReference,
) {
let mut tag = vec![TAG_P.to_string(), reference.pubkey().to_hex()];
if let Some(relay) = reference.relay() {
@@ -295,17 +288,17 @@ fn push_calendar_author_reference(
tags.push(tag);
}
-fn rsvp_status_as_str(status: &RadrootsCalendarEventRsvpStatus) -> &'static str {
+fn rsvp_status_as_str(status: &CalendarEventRsvpStatus) -> &'static str {
match status {
- RadrootsCalendarEventRsvpStatus::Accepted => "accepted",
- RadrootsCalendarEventRsvpStatus::Declined => "declined",
- RadrootsCalendarEventRsvpStatus::Tentative => "tentative",
+ CalendarEventRsvpStatus::Accepted => "accepted",
+ CalendarEventRsvpStatus::Declined => "declined",
+ CalendarEventRsvpStatus::Tentative => "tentative",
}
}
-fn free_busy_as_str(free_busy: &RadrootsCalendarEventFreeBusy) -> &'static str {
+fn free_busy_as_str(free_busy: &CalendarEventFreeBusy) -> &'static str {
match free_busy {
- RadrootsCalendarEventFreeBusy::Free => "free",
- RadrootsCalendarEventFreeBusy::Busy => "busy",
+ CalendarEventFreeBusy::Free => "free",
+ CalendarEventFreeBusy::Busy => "busy",
}
}
diff --git a/crates/event_codec/src/comment/admission.rs b/crates/event_codec/src/comment/admission.rs
@@ -1,6 +1,6 @@
use core::fmt;
-use radroots_event::{contract::RadrootsEventContract, envelope::RadrootsEventEnvelope};
+use radroots_event::{contract::EventContract, envelope::EventEnvelope};
use crate::{
comment::inbound::{
@@ -24,7 +24,7 @@ impl RadrootsAdmittedNip22CommentEvent {
&self.verified_event
}
- pub fn event(&self) -> &RadrootsEventEnvelope {
+ pub fn event(&self) -> &EventEnvelope {
self.verified_event.event()
}
@@ -32,7 +32,7 @@ impl RadrootsAdmittedNip22CommentEvent {
&self.projection
}
- pub fn contract(&self) -> &'static RadrootsEventContract {
+ pub fn contract(&self) -> &'static EventContract {
radroots_event::contract::event_contract(self.projection.contract_id())
.expect("NIP-22 Comment contract is registry-owned")
}
@@ -105,7 +105,7 @@ pub fn admit_verified_nip22_comment_event(
}
pub fn verify_and_admit_nip22_comment_event(
- event: RadrootsEventEnvelope,
+ event: EventEnvelope,
) -> Result<RadrootsAdmittedNip22CommentEvent, RadrootsNip22CommentAdmissionError> {
admit_verified_nip22_comment_event(verify_nip01_event(event)?)
}
diff --git a/crates/event_codec/src/comment/authored.rs b/crates/event_codec/src/comment/authored.rs
@@ -8,28 +8,25 @@ use alloc::{
use radroots_event::{
envelope::kind::KIND_COMMENT,
post::comment::{
- RadrootsAuthoredNip22Comment, RadrootsNip22AddressRootReference,
- RadrootsNip22CommentParentReference, RadrootsNip22CommentPosition,
- RadrootsNip22CommentRoot, RadrootsNip22EventRootReference,
+ AuthoredNip22Comment, Nip22AddressRootReference, Nip22CommentParentReference,
+ Nip22CommentPosition, Nip22CommentRoot, Nip22EventRootReference,
},
- tag::relay_hint::RadrootsNostrRelayHint,
- wire::RadrootsNip01EventWireParts,
+ tag::relay_hint::NostrRelayHint,
+ wire::Nip01EventWireParts,
};
use radroots_identity::PublicKey;
/// Builds deterministic unsigned kind-1111 wire parts for a strict NIP-22
/// comment.
-pub fn authored_nip22_comment_to_wire_parts(
- comment: &RadrootsAuthoredNip22Comment,
-) -> RadrootsNip01EventWireParts {
+pub fn authored_nip22_comment_to_wire_parts(comment: &AuthoredNip22Comment) -> Nip01EventWireParts {
let root = comment.root();
let position = comment.position();
let mut tags = Vec::with_capacity(6);
match root {
- RadrootsNip22CommentRoot::Event(reference) => {
+ Nip22CommentRoot::Event(reference) => {
tags.push(event_reference_tag("E", reference));
}
- RadrootsNip22CommentRoot::Address(reference) => {
+ Nip22CommentRoot::Address(reference) => {
tags.push(address_reference_tag("A", reference));
}
}
@@ -37,17 +34,14 @@ pub fn authored_nip22_comment_to_wire_parts(
tags.push(participant_tag("P", root.author(), root.relay()));
match (root, position) {
- (
- RadrootsNip22CommentRoot::Event(reference),
- RadrootsNip22CommentPosition::TopLevelEvent,
- ) => {
+ (Nip22CommentRoot::Event(reference), Nip22CommentPosition::TopLevelEvent) => {
tags.push(event_reference_tag("e", reference));
tags.push(vec!["k".to_string(), root.kind().as_u32().to_string()]);
tags.push(participant_tag("p", reference.author(), reference.relay()));
}
(
- RadrootsNip22CommentRoot::Address(reference),
- RadrootsNip22CommentPosition::TopLevelAddress { current_revision },
+ Nip22CommentRoot::Address(reference),
+ Nip22CommentPosition::TopLevelAddress { current_revision },
) => {
tags.push(address_reference_tag("a", reference));
tags.push(optional_relay_tag(
@@ -58,7 +52,7 @@ pub fn authored_nip22_comment_to_wire_parts(
tags.push(vec!["k".to_string(), root.kind().as_u32().to_string()]);
tags.push(participant_tag("p", reference.author(), reference.relay()));
}
- (_, RadrootsNip22CommentPosition::Nested { parent }) => {
+ (_, Nip22CommentPosition::Nested { parent }) => {
tags.push(parent_reference_tag(parent));
tags.push(vec!["k".to_string(), KIND_COMMENT.to_string()]);
tags.push(participant_tag("p", parent.author(), parent.relay()));
@@ -66,14 +60,14 @@ pub fn authored_nip22_comment_to_wire_parts(
_ => unreachable!("authored Comment constructors preserve root and position compatibility"),
}
- RadrootsNip01EventWireParts {
+ Nip01EventWireParts {
kind: KIND_COMMENT,
content: comment.content().to_string(),
tags,
}
}
-fn event_reference_tag(name: &str, reference: &RadrootsNip22EventRootReference) -> Vec<String> {
+fn event_reference_tag(name: &str, reference: &Nip22EventRootReference) -> Vec<String> {
vec![
name.to_string(),
reference.event_id().to_hex(),
@@ -82,11 +76,11 @@ fn event_reference_tag(name: &str, reference: &RadrootsNip22EventRootReference)
]
}
-fn address_reference_tag(name: &str, reference: &RadrootsNip22AddressRootReference) -> Vec<String> {
+fn address_reference_tag(name: &str, reference: &Nip22AddressRootReference) -> Vec<String> {
optional_relay_tag(name, reference.coordinate().as_str(), reference.relay())
}
-fn parent_reference_tag(reference: &RadrootsNip22CommentParentReference) -> Vec<String> {
+fn parent_reference_tag(reference: &Nip22CommentParentReference) -> Vec<String> {
vec![
"e".to_string(),
reference.event_id().to_hex(),
@@ -95,19 +89,11 @@ fn parent_reference_tag(reference: &RadrootsNip22CommentParentReference) -> Vec<
]
}
-fn participant_tag(
- name: &str,
- author: &PublicKey,
- relay: Option<&RadrootsNostrRelayHint>,
-) -> Vec<String> {
+fn participant_tag(name: &str, author: &PublicKey, relay: Option<&NostrRelayHint>) -> Vec<String> {
optional_relay_tag(name, &author.to_hex(), relay)
}
-fn optional_relay_tag(
- name: &str,
- value: &str,
- relay: Option<&RadrootsNostrRelayHint>,
-) -> Vec<String> {
+fn optional_relay_tag(name: &str, value: &str, relay: Option<&NostrRelayHint>) -> Vec<String> {
let mut tag = vec![name.to_string(), value.to_string()];
if let Some(relay) = relay {
tag.push(relay.as_str().to_string());
@@ -123,9 +109,9 @@ mod tests {
KIND_CALENDAR_DATE_EVENT, KIND_CALENDAR_TIME_EVENT, KIND_CLASSIFIED_LISTING,
},
post::comment::{
- RADROOTS_NIP22_COMMENT_CONTENT_MAX_BYTES, RADROOTS_NIP22_COMMENT_EVENT_WIRE_MAX_BYTES,
- RadrootsNip22AddressRootReference, RadrootsNip22CommentError,
- RadrootsNip22CommentParentReference, RadrootsNip22EventRootReference,
+ Nip22AddressRootReference, Nip22CommentError, Nip22CommentParentReference,
+ Nip22EventRootReference, RADROOTS_NIP22_COMMENT_CONTENT_MAX_BYTES,
+ RADROOTS_NIP22_COMMENT_EVENT_WIRE_MAX_BYTES,
},
};
@@ -133,18 +119,18 @@ mod tests {
crate::test_fixtures::fixture_public_key_hex(character)
}
- fn event_root(relay: Option<&str>) -> RadrootsNip22EventRootReference {
- RadrootsNip22EventRootReference::parse(h('a'), h('b'), KIND_CLASSIFIED_LISTING, relay)
+ fn event_root(relay: Option<&str>) -> Nip22EventRootReference {
+ Nip22EventRootReference::parse(h('a'), h('b'), KIND_CLASSIFIED_LISTING, relay)
.expect("event root")
}
- fn address_root(relay: Option<&str>) -> RadrootsNip22AddressRootReference {
- RadrootsNip22AddressRootReference::parse(format!("31922:{}:market-day", h('b')), relay)
+ fn address_root(relay: Option<&str>) -> Nip22AddressRootReference {
+ Nip22AddressRootReference::parse(format!("31922:{}:market-day", h('b')), relay)
.expect("address root")
}
- fn parent(relay: Option<&str>) -> RadrootsNip22CommentParentReference {
- RadrootsNip22CommentParentReference::parse(h('c'), h('d'), relay).expect("parent")
+ fn parent(relay: Option<&str>) -> Nip22CommentParentReference {
+ Nip22CommentParentReference::parse(h('c'), h('d'), relay).expect("parent")
}
#[derive(Clone, Copy)]
@@ -158,29 +144,27 @@ mod tests {
fn authored_shape(
shape: AuthoredShape,
content: String,
- ) -> Result<RadrootsAuthoredNip22Comment, RadrootsNip22CommentError> {
+ ) -> Result<AuthoredNip22Comment, Nip22CommentError> {
match shape {
AuthoredShape::TopEvent => {
- RadrootsAuthoredNip22Comment::top_level_event(content, event_root(None))
+ AuthoredNip22Comment::top_level_event(content, event_root(None))
+ }
+ AuthoredShape::TopAddress => {
+ AuthoredNip22Comment::parse_top_level_address(content, address_root(None), h('e'))
}
- AuthoredShape::TopAddress => RadrootsAuthoredNip22Comment::parse_top_level_address(
- content,
- address_root(None),
- h('e'),
- ),
AuthoredShape::NestedEvent => {
- RadrootsAuthoredNip22Comment::nested(content, event_root(None), parent(None))
+ AuthoredNip22Comment::nested(content, event_root(None), parent(None))
}
AuthoredShape::NestedAddress => {
- RadrootsAuthoredNip22Comment::nested(content, address_root(None), parent(None))
+ AuthoredNip22Comment::nested(content, address_root(None), parent(None))
}
}
}
#[test]
fn emits_exact_top_level_event_tags_with_empty_relay_slot() {
- let comment = RadrootsAuthoredNip22Comment::top_level_event("Comment", event_root(None))
- .expect("comment");
+ let comment =
+ AuthoredNip22Comment::top_level_event("Comment", event_root(None)).expect("comment");
assert_eq!(
authored_nip22_comment_to_wire_parts(&comment).tags,
vec![
@@ -196,7 +180,7 @@ mod tests {
#[test]
fn emits_exact_top_level_address_tags_with_revision_without_author() {
- let comment = RadrootsAuthoredNip22Comment::parse_top_level_address(
+ let comment = AuthoredNip22Comment::parse_top_level_address(
"Comment",
address_root(Some("wss://relay.example")),
h('e'),
@@ -217,8 +201,8 @@ mod tests {
#[test]
fn emits_exact_nested_event_and_address_shapes() {
for root in [
- RadrootsNip22CommentRoot::from(
- RadrootsNip22EventRootReference::parse(
+ Nip22CommentRoot::from(
+ Nip22EventRootReference::parse(
h('a'),
h('b'),
KIND_CALENDAR_TIME_EVENT,
@@ -226,20 +210,17 @@ mod tests {
)
.expect("event root"),
),
- RadrootsNip22CommentRoot::from(
- RadrootsNip22AddressRootReference::parse(
+ Nip22CommentRoot::from(
+ Nip22AddressRootReference::parse(
format!("31922:{}:market", h('b')),
Some("wss://root.example"),
)
.expect("address root"),
),
] {
- let comment = RadrootsAuthoredNip22Comment::nested(
- "Reply",
- root,
- parent(Some("wss://parent.example")),
- )
- .expect("comment");
+ let comment =
+ AuthoredNip22Comment::nested("Reply", root, parent(Some("wss://parent.example")))
+ .expect("comment");
let tags = authored_nip22_comment_to_wire_parts(&comment).tags;
assert_eq!(tags.len(), 6);
assert_eq!(tags[4], vec!["k".to_string(), KIND_COMMENT.to_string()]);
@@ -301,7 +282,7 @@ mod tests {
.to_string();
assert!(matches!(
error,
- RadrootsNip22CommentError::EventWireTooLarge { max, actual }
+ Nip22CommentError::EventWireTooLarge { max, actual }
if max == RADROOTS_NIP22_COMMENT_EVENT_WIRE_MAX_BYTES
&& actual == overflow_json.len()
));
diff --git a/crates/event_codec/src/comment/inbound/registry_v7.rs b/crates/event_codec/src/comment/inbound/registry_v7.rs
@@ -6,17 +6,14 @@ use core::fmt;
use radroots_event::{
envelope::kind::KIND_COMMENT,
- id::{
- RadrootsAddressableCoordinate, RadrootsAddressableCoordinateParts, RadrootsEventId,
- RadrootsIdParseError,
- },
+ id::{AddressableCoordinate, AddressableCoordinateParts, EventId, ParseError},
post::comment::{
- RADROOTS_NIP22_COMMENT_CONTENT_MAX_BYTES, RADROOTS_NIP22_COMMENT_EVENT_WIRE_MAX_BYTES,
- RADROOTS_NIP22_COMMENT_TAG_ELEMENT_MAX_BYTES, RADROOTS_NIP22_COMMENT_TAG_MAX_COUNT,
- RADROOTS_NIP22_COMMENT_TAG_TOTAL_ELEMENT_MAX_COUNT,
- RADROOTS_NIP22_COMMENT_TAG_TOTAL_MAX_BYTES, RadrootsNip22CommentRootKind,
+ Nip22CommentRootKind, RADROOTS_NIP22_COMMENT_CONTENT_MAX_BYTES,
+ RADROOTS_NIP22_COMMENT_EVENT_WIRE_MAX_BYTES, RADROOTS_NIP22_COMMENT_TAG_ELEMENT_MAX_BYTES,
+ RADROOTS_NIP22_COMMENT_TAG_MAX_COUNT, RADROOTS_NIP22_COMMENT_TAG_TOTAL_ELEMENT_MAX_COUNT,
+ RADROOTS_NIP22_COMMENT_TAG_TOTAL_MAX_BYTES,
},
- tag::relay_hint::RadrootsNostrRelayHint,
+ tag::relay_hint::NostrRelayHint,
};
use radroots_identity::PublicKey;
@@ -129,7 +126,7 @@ impl RadrootsNip22CommentDiagnostic {
pub struct RadrootsInboundNip22Participant {
tag_index: usize,
pubkey: PublicKey,
- relay: Option<RadrootsNostrRelayHint>,
+ relay: Option<NostrRelayHint>,
raw_tag: Vec<String>,
}
@@ -142,7 +139,7 @@ impl RadrootsInboundNip22Participant {
&self.pubkey
}
- pub const fn relay(&self) -> Option<&RadrootsNostrRelayHint> {
+ pub const fn relay(&self) -> Option<&NostrRelayHint> {
self.relay.as_ref()
}
@@ -154,11 +151,11 @@ impl RadrootsInboundNip22Participant {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsInboundNip22EventRoot {
tag_index: usize,
- event_id: RadrootsEventId,
+ event_id: EventId,
kind_tag_index: usize,
kind_raw_tag: Vec<String>,
- kind: RadrootsNip22CommentRootKind,
- relay: Option<RadrootsNostrRelayHint>,
+ kind: Nip22CommentRootKind,
+ relay: Option<NostrRelayHint>,
author_hint: Option<PublicKey>,
author: RadrootsInboundNip22Participant,
raw_tag: Vec<String>,
@@ -169,7 +166,7 @@ impl RadrootsInboundNip22EventRoot {
self.tag_index
}
- pub const fn event_id(&self) -> &RadrootsEventId {
+ pub const fn event_id(&self) -> &EventId {
&self.event_id
}
@@ -181,11 +178,11 @@ impl RadrootsInboundNip22EventRoot {
&self.kind_raw_tag
}
- pub const fn kind(&self) -> RadrootsNip22CommentRootKind {
+ pub const fn kind(&self) -> Nip22CommentRootKind {
self.kind
}
- pub const fn relay(&self) -> Option<&RadrootsNostrRelayHint> {
+ pub const fn relay(&self) -> Option<&NostrRelayHint> {
self.relay.as_ref()
}
@@ -205,11 +202,11 @@ impl RadrootsInboundNip22EventRoot {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsInboundNip22AddressRoot {
tag_index: usize,
- coordinate: RadrootsAddressableCoordinate,
+ coordinate: AddressableCoordinate,
kind_tag_index: usize,
kind_raw_tag: Vec<String>,
- kind: RadrootsNip22CommentRootKind,
- relay: Option<RadrootsNostrRelayHint>,
+ kind: Nip22CommentRootKind,
+ relay: Option<NostrRelayHint>,
author: RadrootsInboundNip22Participant,
raw_tag: Vec<String>,
}
@@ -219,7 +216,7 @@ impl RadrootsInboundNip22AddressRoot {
self.tag_index
}
- pub const fn coordinate(&self) -> &RadrootsAddressableCoordinate {
+ pub const fn coordinate(&self) -> &AddressableCoordinate {
&self.coordinate
}
@@ -231,11 +228,11 @@ impl RadrootsInboundNip22AddressRoot {
&self.kind_raw_tag
}
- pub const fn kind(&self) -> RadrootsNip22CommentRootKind {
+ pub const fn kind(&self) -> Nip22CommentRootKind {
self.kind
}
- pub const fn relay(&self) -> Option<&RadrootsNostrRelayHint> {
+ pub const fn relay(&self) -> Option<&NostrRelayHint> {
self.relay.as_ref()
}
@@ -262,7 +259,7 @@ impl RadrootsInboundNip22CommentRoot {
}
}
- pub const fn kind(&self) -> RadrootsNip22CommentRootKind {
+ pub const fn kind(&self) -> Nip22CommentRootKind {
match self {
Self::Event(root) => root.kind(),
Self::Address(root) => root.kind(),
@@ -273,11 +270,11 @@ impl RadrootsInboundNip22CommentRoot {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsInboundNip22CommentParent {
tag_index: usize,
- event_id: RadrootsEventId,
+ event_id: EventId,
kind_tag_index: usize,
kind_raw_tag: Vec<String>,
kind: u32,
- relay: Option<RadrootsNostrRelayHint>,
+ relay: Option<NostrRelayHint>,
author_hint: Option<PublicKey>,
author: RadrootsInboundNip22Participant,
raw_tag: Vec<String>,
@@ -288,7 +285,7 @@ impl RadrootsInboundNip22CommentParent {
self.tag_index
}
- pub const fn event_id(&self) -> &RadrootsEventId {
+ pub const fn event_id(&self) -> &EventId {
&self.event_id
}
@@ -304,7 +301,7 @@ impl RadrootsInboundNip22CommentParent {
self.kind
}
- pub const fn relay(&self) -> Option<&RadrootsNostrRelayHint> {
+ pub const fn relay(&self) -> Option<&NostrRelayHint> {
self.relay.as_ref()
}
@@ -324,8 +321,8 @@ impl RadrootsInboundNip22CommentParent {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsInboundNip22CurrentRevision {
tag_index: usize,
- event_id: RadrootsEventId,
- relay: Option<RadrootsNostrRelayHint>,
+ event_id: EventId,
+ relay: Option<NostrRelayHint>,
raw_tag: Vec<String>,
}
@@ -334,11 +331,11 @@ impl RadrootsInboundNip22CurrentRevision {
self.tag_index
}
- pub const fn event_id(&self) -> &RadrootsEventId {
+ pub const fn event_id(&self) -> &EventId {
&self.event_id
}
- pub const fn relay(&self) -> Option<&RadrootsNostrRelayHint> {
+ pub const fn relay(&self) -> Option<&NostrRelayHint> {
self.relay.as_ref()
}
@@ -350,11 +347,11 @@ impl RadrootsInboundNip22CurrentRevision {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsInboundNip22TopLevelEventReference {
tag_index: usize,
- event_id: RadrootsEventId,
+ event_id: EventId,
kind_tag_index: usize,
kind_raw_tag: Vec<String>,
kind: u32,
- relay: Option<RadrootsNostrRelayHint>,
+ relay: Option<NostrRelayHint>,
author_hint: Option<PublicKey>,
author: RadrootsInboundNip22Participant,
raw_tag: Vec<String>,
@@ -363,11 +360,11 @@ pub struct RadrootsInboundNip22TopLevelEventReference {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsInboundNip22TopLevelAddressReference {
tag_index: usize,
- coordinate: RadrootsAddressableCoordinate,
+ coordinate: AddressableCoordinate,
kind_tag_index: usize,
kind_raw_tag: Vec<String>,
kind: u32,
- relay: Option<RadrootsNostrRelayHint>,
+ relay: Option<NostrRelayHint>,
author: RadrootsInboundNip22Participant,
raw_tag: Vec<String>,
}
@@ -377,7 +374,7 @@ impl RadrootsInboundNip22TopLevelAddressReference {
self.tag_index
}
- pub const fn coordinate(&self) -> &RadrootsAddressableCoordinate {
+ pub const fn coordinate(&self) -> &AddressableCoordinate {
&self.coordinate
}
@@ -393,7 +390,7 @@ impl RadrootsInboundNip22TopLevelAddressReference {
self.kind
}
- pub const fn relay(&self) -> Option<&RadrootsNostrRelayHint> {
+ pub const fn relay(&self) -> Option<&NostrRelayHint> {
self.relay.as_ref()
}
@@ -411,7 +408,7 @@ impl RadrootsInboundNip22TopLevelEventReference {
self.tag_index
}
- pub const fn event_id(&self) -> &RadrootsEventId {
+ pub const fn event_id(&self) -> &EventId {
&self.event_id
}
@@ -427,7 +424,7 @@ impl RadrootsInboundNip22TopLevelEventReference {
self.kind
}
- pub const fn relay(&self) -> Option<&RadrootsNostrRelayHint> {
+ pub const fn relay(&self) -> Option<&NostrRelayHint> {
self.relay.as_ref()
}
@@ -543,7 +540,7 @@ pub enum RadrootsNip22CommentProjectionError {
},
RootEventIdInvalid {
tag_index: usize,
- error: RadrootsIdParseError,
+ error: ParseError,
},
RootCoordinateInvalid {
tag_index: usize,
@@ -566,7 +563,7 @@ pub enum RadrootsNip22CommentProjectionError {
},
ParentEventIdInvalid {
tag_index: usize,
- error: RadrootsIdParseError,
+ error: ParseError,
},
ParentCoordinateInvalid {
tag_index: usize,
@@ -582,7 +579,7 @@ pub enum RadrootsNip22CommentProjectionError {
},
RevisionEventIdInvalid {
tag_index: usize,
- error: RadrootsIdParseError,
+ error: ParseError,
},
ParentAuthorMissing,
ParentAuthorAmbiguous,
@@ -1091,16 +1088,16 @@ fn project_nip22_comment_parts(
type IndexedTag<'a> = (usize, &'a Vec<String>);
struct ParsedEventReference {
- event_id: RadrootsEventId,
- relay: Option<RadrootsNostrRelayHint>,
+ event_id: EventId,
+ relay: Option<NostrRelayHint>,
author_hint: Option<PublicKey>,
}
struct ParsedAddressReference {
- coordinate: RadrootsAddressableCoordinate,
+ coordinate: AddressableCoordinate,
author: PublicKey,
- kind: RadrootsNip22CommentRootKind,
- relay: Option<RadrootsNostrRelayHint>,
+ kind: Nip22CommentRootKind,
+ relay: Option<NostrRelayHint>,
}
#[derive(Clone, Copy)]
@@ -1142,7 +1139,7 @@ impl ReferenceRole {
const fn event_id_error(
self,
tag_index: usize,
- error: RadrootsIdParseError,
+ error: ParseError,
) -> RadrootsNip22CommentProjectionError {
match self {
Self::Root => {
@@ -1214,13 +1211,13 @@ fn exactly_one_authority_tag<'a>(
fn parse_root_kind(
(tag_index, tag): IndexedTag<'_>,
-) -> Result<RadrootsNip22CommentRootKind, RadrootsNip22CommentProjectionError> {
+) -> Result<Nip22CommentRootKind, RadrootsNip22CommentProjectionError> {
let kind = tag
.get(1)
.filter(|_| tag.len() == 2)
.and_then(|value| parse_canonical_kind_token(value))
.ok_or(RadrootsNip22CommentProjectionError::RootKindUnsupported { tag_index })?;
- RadrootsNip22CommentRootKind::parse(kind)
+ Nip22CommentRootKind::parse(kind)
.map_err(|_| RadrootsNip22CommentProjectionError::RootKindUnsupported { tag_index })
}
@@ -1232,7 +1229,7 @@ fn parse_parent_kind(
.filter(|_| tag.len() == 2)
.and_then(|value| parse_canonical_kind_token(value))
.ok_or(RadrootsNip22CommentProjectionError::ParentKindInvalid { tag_index })?;
- if kind == KIND_COMMENT || RadrootsNip22CommentRootKind::parse(kind).is_ok() {
+ if kind == KIND_COMMENT || Nip22CommentRootKind::parse(kind).is_ok() {
Ok(kind)
} else {
Err(RadrootsNip22CommentProjectionError::ParentKindInvalid { tag_index })
@@ -1319,7 +1316,7 @@ fn parse_event_reference(
return Err(role.reference_shape_error(tag_index));
}
let event_id =
- RadrootsEventId::parse(&tag[1]).map_err(|error| role.event_id_error(tag_index, error))?;
+ EventId::parse(&tag[1]).map_err(|error| role.event_id_error(tag_index, error))?;
let relay = project_relay(tag_index, tag, 2, role.relay_role(), diagnostics);
let author_hint = tag
.get(3)
@@ -1349,14 +1346,14 @@ fn parse_address_reference(
.split_once(':')
.and_then(|(kind, _)| parse_canonical_kind_token(kind))
.ok_or_else(|| role.coordinate_error(tag_index))?;
- let parts = RadrootsAddressableCoordinateParts::parse(&tag[1])
- .map_err(|_| role.coordinate_error(tag_index))?;
+ let parts =
+ AddressableCoordinateParts::parse(&tag[1]).map_err(|_| role.coordinate_error(tag_index))?;
if parts.kind != canonical_kind {
return Err(role.coordinate_error(tag_index));
}
- let kind = RadrootsNip22CommentRootKind::parse(parts.kind)
- .map_err(|_| role.coordinate_error(tag_index))?;
- let coordinate = RadrootsAddressableCoordinate::parse(format_coordinate(&parts))
+ let kind =
+ Nip22CommentRootKind::parse(parts.kind).map_err(|_| role.coordinate_error(tag_index))?;
+ let coordinate = AddressableCoordinate::parse(format_coordinate(&parts))
.map_err(|_| role.coordinate_error(tag_index))?;
let relay = project_relay(tag_index, tag, 2, role.relay_role(), diagnostics);
Ok(ParsedAddressReference {
@@ -1367,7 +1364,7 @@ fn parse_address_reference(
})
}
-fn format_coordinate(parts: &RadrootsAddressableCoordinateParts) -> String {
+fn format_coordinate(parts: &AddressableCoordinateParts) -> String {
format!("{}:{}:{}", parts.kind, parts.pubkey, parts.d_tag)
}
@@ -1378,7 +1375,7 @@ fn parse_current_revision(
if !matches!(tag.len(), 2 | 3) {
return Err(RadrootsNip22CommentProjectionError::RevisionShape { tag_index });
}
- let event_id = RadrootsEventId::parse(&tag[1]).map_err(|error| {
+ let event_id = EventId::parse(&tag[1]).map_err(|error| {
RadrootsNip22CommentProjectionError::RevisionEventIdInvalid { tag_index, error }
})?;
let relay = project_relay(tag_index, tag, 2, RelayRole::Revision, diagnostics);
@@ -1467,12 +1464,12 @@ fn project_relay(
element_index: usize,
role: RelayRole,
diagnostics: &mut Vec<RadrootsNip22CommentDiagnostic>,
-) -> Option<RadrootsNostrRelayHint> {
+) -> Option<NostrRelayHint> {
let value = tag.get(element_index)?;
if value.is_empty() {
return None;
}
- match RadrootsNostrRelayHint::parse(value) {
+ match NostrRelayHint::parse(value) {
Ok(relay) => Some(relay),
Err(_) => {
diagnostics.push(role.diagnostic(tag_index, tag.to_vec()));
diff --git a/crates/event_codec/src/coop/decode.rs b/crates/event_codec/src/coop/decode.rs
@@ -7,7 +7,7 @@ use alloc::{
vec::Vec,
};
-use radroots_event::{envelope::kind::KIND_COOP, farm::coop::RadrootsCoop, tag::name::TAG_D};
+use radroots_event::{envelope::kind::KIND_COOP, farm::coop::Coop, tag::name::TAG_D};
use crate::d_tag::validate_d_tag_tag;
use crate::error::EventParseError;
@@ -35,7 +35,7 @@ pub fn coop_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsCoop, EventParseError> {
+) -> Result<Coop, EventParseError> {
if kind != DEFAULT_KIND {
return Err(EventParseError::InvalidKind {
expected: "30360",
@@ -46,7 +46,7 @@ pub fn coop_from_event(
return Err(EventParseError::InvalidJson("content"));
}
let d_tag = parse_d_tag(tags)?;
- let mut coop: RadrootsCoop =
+ let mut coop: Coop =
serde_json::from_str(content).map_err(|_| EventParseError::InvalidJson("content"))?;
if coop.d_tag.trim().is_empty() {
@@ -65,7 +65,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsCoop>, EventParseError> {
+) -> Result<RadrootsParsedData<Coop>, EventParseError> {
let coop = coop_from_event(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -84,7 +84,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsCoop>, EventParseError> {
+) -> Result<RadrootsParsedEvent<Coop>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
diff --git a/crates/event_codec/src/coop/encode.rs b/crates/event_codec/src/coop/encode.rs
@@ -9,7 +9,7 @@ use alloc::{
use radroots_event::{
envelope::kind::KIND_COOP,
- farm::coop::{RadrootsCoop, RadrootsCoopRef},
+ farm::coop::{Coop, CoopRef},
tag::name::TAG_D,
};
@@ -17,7 +17,7 @@ use crate::d_tag::validate_d_tag;
use crate::error::EventEncodeError;
#[cfg(feature = "serde_json")]
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
const TAG_T: &str = "t";
const TAG_G: &str = "g";
@@ -26,7 +26,7 @@ fn push_tag(tags: &mut Vec<Vec<String>>, key: &str, value: &str) {
tags.push(vec![key.to_string(), value.to_string()]);
}
-pub fn coop_build_tags(coop: &RadrootsCoop) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn coop_build_tags(coop: &Coop) -> Result<Vec<Vec<String>>, EventEncodeError> {
if coop.d_tag.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("d_tag"));
}
@@ -51,7 +51,7 @@ pub fn coop_build_tags(coop: &RadrootsCoop) -> Result<Vec<Vec<String>>, EventEnc
Ok(tags)
}
-pub fn coop_ref_tags(coop: &RadrootsCoopRef) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn coop_ref_tags(coop: &CoopRef) -> Result<Vec<Vec<String>>, EventEncodeError> {
if coop.pubkey.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("coop.pubkey"));
}
@@ -72,21 +72,21 @@ pub fn coop_ref_tags(coop: &RadrootsCoopRef) -> Result<Vec<Vec<String>>, EventEn
}
#[cfg(feature = "serde_json")]
-pub fn to_wire_parts(coop: &RadrootsCoop) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+pub fn to_wire_parts(coop: &Coop) -> Result<Nip01EventWireParts, EventEncodeError> {
to_wire_parts_with_kind(coop, KIND_COOP)
}
#[cfg(feature = "serde_json")]
pub fn to_wire_parts_with_kind(
- coop: &RadrootsCoop,
+ coop: &Coop,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != KIND_COOP {
return Err(EventEncodeError::InvalidKind(kind));
}
let tags = coop_build_tags(coop)?;
let content = serde_json::to_string(coop).map_err(|_| EventEncodeError::Json)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content,
tags,
diff --git a/crates/event_codec/src/coop/list_sets.rs b/crates/event_codec/src/coop/list_sets.rs
@@ -9,9 +9,9 @@ use alloc::{
};
use radroots_event::envelope::kind::KIND_FARM;
-use radroots_event::farm::RadrootsFarmRef;
-use radroots_event::social::list::RadrootsListEntry;
-use radroots_event::social::list_set::RadrootsListSet;
+use radroots_event::farm::FarmRef;
+use radroots_event::social::list::ListEntry;
+use radroots_event::social::list_set::ListSet;
use crate::d_tag::validate_d_tag;
use crate::error::EventEncodeError;
@@ -27,7 +27,7 @@ fn coop_list_set_id(coop_id: &str, suffix: &str) -> Result<String, EventEncodeEr
Ok(format!("coop:{coop_id}:{suffix}"))
}
-fn list_entries<I, S>(tag: &str, values: I) -> Result<Vec<RadrootsListEntry>, EventEncodeError>
+fn list_entries<I, S>(tag: &str, values: I) -> Result<Vec<ListEntry>, EventEncodeError>
where
I: IntoIterator<Item = S>,
S: AsRef<str>,
@@ -38,7 +38,7 @@ where
if value.is_empty() {
return Err(EventEncodeError::EmptyRequiredField("entry.values"));
}
- entries.push(RadrootsListEntry {
+ entries.push(ListEntry {
tag: tag.to_string(),
values: vec![value.to_string()],
});
@@ -46,7 +46,7 @@ where
Ok(entries)
}
-fn farm_address(farm: &RadrootsFarmRef) -> Result<String, EventEncodeError> {
+fn farm_address(farm: &FarmRef) -> Result<String, EventEncodeError> {
if farm.pubkey.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("farm.pubkey"));
}
@@ -63,15 +63,12 @@ fn farm_address(farm: &RadrootsFarmRef) -> Result<String, EventEncodeError> {
Ok(addr)
}
-pub fn coop_members_list_set<I, S>(
- coop_id: &str,
- members: I,
-) -> Result<RadrootsListSet, EventEncodeError>
+pub fn coop_members_list_set<I, S>(coop_id: &str, members: I) -> Result<ListSet, EventEncodeError>
where
I: IntoIterator<Item = S>,
S: AsRef<str>,
{
- Ok(RadrootsListSet {
+ Ok(ListSet {
d_tag: coop_list_set_id(coop_id, "members")?,
content: String::new(),
entries: list_entries("p", members)?,
@@ -81,26 +78,23 @@ where
})
}
-pub fn coop_members_farms_list_set<I>(
- coop_id: &str,
- farms: I,
-) -> Result<RadrootsListSet, EventEncodeError>
+pub fn coop_members_farms_list_set<I>(coop_id: &str, farms: I) -> Result<ListSet, EventEncodeError>
where
- I: IntoIterator<Item = RadrootsFarmRef>,
+ I: IntoIterator<Item = FarmRef>,
{
let mut entries = Vec::new();
for farm in farms {
let address = farm_address(&farm)?;
- entries.push(RadrootsListEntry {
+ entries.push(ListEntry {
tag: "a".to_string(),
values: vec![address],
});
- entries.push(RadrootsListEntry {
+ entries.push(ListEntry {
tag: "p".to_string(),
values: vec![farm.pubkey],
});
}
- Ok(RadrootsListSet {
+ Ok(ListSet {
d_tag: coop_list_set_id(coop_id, "members.farms")?,
content: String::new(),
entries,
@@ -110,15 +104,12 @@ where
})
}
-pub fn coop_owners_list_set<I, S>(
- coop_id: &str,
- owners: I,
-) -> Result<RadrootsListSet, EventEncodeError>
+pub fn coop_owners_list_set<I, S>(coop_id: &str, owners: I) -> Result<ListSet, EventEncodeError>
where
I: IntoIterator<Item = S>,
S: AsRef<str>,
{
- Ok(RadrootsListSet {
+ Ok(ListSet {
d_tag: coop_list_set_id(coop_id, "members.owners")?,
content: String::new(),
entries: list_entries("p", owners)?,
@@ -128,15 +119,12 @@ where
})
}
-pub fn coop_admins_list_set<I, S>(
- coop_id: &str,
- admins: I,
-) -> Result<RadrootsListSet, EventEncodeError>
+pub fn coop_admins_list_set<I, S>(coop_id: &str, admins: I) -> Result<ListSet, EventEncodeError>
where
I: IntoIterator<Item = S>,
S: AsRef<str>,
{
- Ok(RadrootsListSet {
+ Ok(ListSet {
d_tag: coop_list_set_id(coop_id, "members.admins")?,
content: String::new(),
entries: list_entries("p", admins)?,
@@ -149,12 +137,12 @@ where
pub fn coop_items_list_set<I, S>(
coop_id: &str,
item_addresses: I,
-) -> Result<RadrootsListSet, EventEncodeError>
+) -> Result<ListSet, EventEncodeError>
where
I: IntoIterator<Item = S>,
S: AsRef<str>,
{
- Ok(RadrootsListSet {
+ Ok(ListSet {
d_tag: coop_list_set_id(coop_id, "items")?,
content: String::new(),
entries: list_entries("a", item_addresses)?,
@@ -164,12 +152,12 @@ where
})
}
-pub fn member_of_coops_list_set<I, S>(coop_pubkeys: I) -> Result<RadrootsListSet, EventEncodeError>
+pub fn member_of_coops_list_set<I, S>(coop_pubkeys: I) -> Result<ListSet, EventEncodeError>
where
I: IntoIterator<Item = S>,
S: AsRef<str>,
{
- Ok(RadrootsListSet {
+ Ok(ListSet {
d_tag: MEMBER_OF_COOPS.to_string(),
content: String::new(),
entries: list_entries("p", coop_pubkeys)?,
@@ -233,7 +221,7 @@ mod tests {
#[test]
fn farm_address_rejects_empty_and_invalid_d_tag() {
- let err = farm_address(&RadrootsFarmRef {
+ let err = farm_address(&FarmRef {
pubkey: " ".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
})
@@ -243,7 +231,7 @@ mod tests {
EventEncodeError::EmptyRequiredField("farm.pubkey")
));
- let err = farm_address(&RadrootsFarmRef {
+ let err = farm_address(&FarmRef {
pubkey: FIXTURE_ALICE_PUBLIC_KEY_HEX.to_string(),
d_tag: " ".to_string(),
})
@@ -253,7 +241,7 @@ mod tests {
EventEncodeError::EmptyRequiredField("farm.d_tag")
));
- let err = farm_address(&RadrootsFarmRef {
+ let err = farm_address(&FarmRef {
pubkey: FIXTURE_ALICE_PUBLIC_KEY_HEX.to_string(),
d_tag: "invalid".to_string(),
})
@@ -329,7 +317,7 @@ mod tests {
#[test]
fn coop_members_farms_list_set_covers_success_and_invalid_coop_id() {
- let farms = vec![RadrootsFarmRef {
+ let farms = vec![FarmRef {
pubkey: FIXTURE_ALICE_PUBLIC_KEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
}];
diff --git a/crates/event_codec/src/coop/mod.rs b/crates/event_codec/src/coop/mod.rs
@@ -16,35 +16,33 @@ mod tests {
use crate::error::EventEncodeError;
#[cfg(feature = "serde_json")]
use radroots_event::envelope::kind::KIND_COOP;
- use radroots_event::farm::RadrootsFarmRef;
- use radroots_event::farm::change_set::{
- RadrootsGcsLocation, RadrootsGeoJsonPoint, RadrootsGeoJsonPolygon,
- };
- use radroots_event::farm::coop::{RadrootsCoop, RadrootsCoopLocation, RadrootsCoopRef};
+ use radroots_event::farm::FarmRef;
+ use radroots_event::farm::change_set::{GcsLocation, GeoJsonPoint, GeoJsonPolygon};
+ use radroots_event::farm::coop::{Coop, CoopLocation, CoopRef};
#[test]
fn coop_tags_include_required_fields() {
- let coop = RadrootsCoop {
+ let coop = Coop {
d_tag: "BAAAAAAAAAAAAAAAAAAAAA".to_string(),
name: "Test Coop".to_string(),
about: None,
website: None,
picture: None,
banner: None,
- location: Some(RadrootsCoopLocation {
+ location: Some(CoopLocation {
primary: None,
city: None,
region: None,
country: None,
- gcs: RadrootsGcsLocation {
+ gcs: GcsLocation {
lat: 37.0,
lng: -122.0,
geohash: "9q8yy".to_string(),
- point: RadrootsGeoJsonPoint {
+ point: GeoJsonPoint {
r#type: "Point".to_string(),
coordinates: [-122.0, 37.0],
},
- polygon: RadrootsGeoJsonPolygon {
+ polygon: GeoJsonPolygon {
r#type: "Polygon".to_string(),
coordinates: vec![vec![
[-122.0, 37.0],
@@ -80,7 +78,7 @@ mod tests {
#[test]
fn coop_ref_tags_include_p_and_a() {
- let coop = RadrootsCoopRef {
+ let coop = CoopRef {
pubkey: "coop_pubkey".to_string(),
d_tag: "BAAAAAAAAAAAAAAAAAAAAA".to_string(),
};
@@ -95,7 +93,7 @@ mod tests {
assert!(has_a);
assert!(has_p);
- let err = coop_ref_tags(&RadrootsCoopRef {
+ let err = coop_ref_tags(&CoopRef {
pubkey: "coop_pubkey".to_string(),
d_tag: "invalid".to_string(),
})
@@ -105,7 +103,7 @@ mod tests {
#[test]
fn coop_build_tags_rejects_invalid_d_tag() {
- let coop = RadrootsCoop {
+ let coop = Coop {
d_tag: "invalid".to_string(),
name: "Test Coop".to_string(),
about: None,
@@ -123,7 +121,7 @@ mod tests {
#[test]
#[cfg(feature = "serde_json")]
fn coop_decode_rejects_empty_d_tag_and_content() {
- let coop = RadrootsCoop {
+ let coop = Coop {
d_tag: "BAAAAAAAAAAAAAAAAAAAAA".to_string(),
name: "Test Coop".to_string(),
about: None,
@@ -175,7 +173,7 @@ mod tests {
let farm_members = coop_members_farms_list_set(
"BAAAAAAAAAAAAAAAAAAAAA",
- [RadrootsFarmRef {
+ [FarmRef {
pubkey: "farm_pubkey".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
}],
diff --git a/crates/event_codec/src/deletion/authored.rs b/crates/event_codec/src/deletion/authored.rs
@@ -2,8 +2,8 @@
use alloc::{string::ToString, vec, vec::Vec};
use radroots_event::{
- envelope::kind::KIND_DELETION_REQUEST, post::deletion::RadrootsAuthoredNip09DeletionRequest,
- wire::RadrootsNip01EventWireParts,
+ envelope::kind::KIND_DELETION_REQUEST, post::deletion::AuthoredNip09DeletionRequest,
+ wire::Nip01EventWireParts,
};
/// Builds deterministic unsigned kind-5 wire parts for a strict NIP-09
@@ -13,8 +13,8 @@ use radroots_event::{
/// canonical address targets, followed by the complete unique ascending set of
/// target-kind advisories.
pub fn authored_nip09_deletion_request_to_wire_parts(
- request: &RadrootsAuthoredNip09DeletionRequest,
-) -> RadrootsNip01EventWireParts {
+ request: &AuthoredNip09DeletionRequest,
+) -> Nip01EventWireParts {
let mut tags = Vec::with_capacity(
request
.target_count()
@@ -39,7 +39,7 @@ pub fn authored_nip09_deletion_request_to_wire_parts(
.map(|kind| vec!["k".to_string(), kind.to_string()]),
);
- RadrootsNip01EventWireParts {
+ Nip01EventWireParts {
kind: KIND_DELETION_REQUEST,
content: request.content().to_string(),
tags,
@@ -50,8 +50,8 @@ pub fn authored_nip09_deletion_request_to_wire_parts(
mod tests {
use super::*;
use radroots_event::post::deletion::{
- RADROOTS_NIP09_DELETION_EVENT_WIRE_MAX_BYTES, RadrootsNip09DeletionAddressTarget,
- RadrootsNip09DeletionEventTarget,
+ Nip09DeletionAddressTarget, Nip09DeletionEventTarget,
+ RADROOTS_NIP09_DELETION_EVENT_WIRE_MAX_BYTES,
};
fn h(character: char) -> String {
@@ -60,16 +60,16 @@ mod tests {
#[test]
fn emits_exact_canonical_two_element_target_and_kind_tags() {
- let request = RadrootsAuthoredNip09DeletionRequest::new(
+ let request = AuthoredNip09DeletionRequest::new(
"superseded",
vec![
- RadrootsNip09DeletionEventTarget::parse(h('f'), 30_402).expect("event target"),
- RadrootsNip09DeletionEventTarget::parse(h('a'), 1).expect("event target"),
+ Nip09DeletionEventTarget::parse(h('f'), 30_402).expect("event target"),
+ Nip09DeletionEventTarget::parse(h('a'), 1).expect("event target"),
],
vec![
- RadrootsNip09DeletionAddressTarget::parse(format!("31923:{}:market", h('e')))
+ Nip09DeletionAddressTarget::parse(format!("31923:{}:market", h('e')))
.expect("address target"),
- RadrootsNip09DeletionAddressTarget::parse(format!("30402:{}:produce", h('b')))
+ Nip09DeletionAddressTarget::parse(format!("30402:{}:produce", h('b')))
.expect("address target"),
],
)
@@ -95,12 +95,12 @@ mod tests {
#[test]
fn core_wire_estimator_matches_emitted_json_at_the_strict_boundary() {
- let target = RadrootsNip09DeletionEventTarget::parse(h('a'), 1).expect("event target");
+ let target = Nip09DeletionEventTarget::parse(h('a'), 1).expect("event target");
let mut lower = 0usize;
let mut upper = radroots_event::post::deletion::RADROOTS_NIP09_DELETION_CONTENT_MAX_BYTES;
while lower < upper {
let candidate = lower + (upper - lower).div_ceil(2);
- if RadrootsAuthoredNip09DeletionRequest::new(
+ if AuthoredNip09DeletionRequest::new(
"\u{0001}".repeat(candidate),
vec![target.clone()],
Vec::new(),
@@ -113,12 +113,9 @@ mod tests {
}
}
- let request = RadrootsAuthoredNip09DeletionRequest::new(
- "\u{0001}".repeat(lower),
- vec![target],
- Vec::new(),
- )
- .expect("largest content fitting strict signed wire");
+ let request =
+ AuthoredNip09DeletionRequest::new("\u{0001}".repeat(lower), vec![target], Vec::new())
+ .expect("largest content fitting strict signed wire");
let parts = authored_nip09_deletion_request_to_wire_parts(&request);
let json = serde_json::json!({
"id": "0".repeat(64),
@@ -136,11 +133,11 @@ mod tests {
#[test]
fn strict_wire_size_equals_independent_max_u64_serialization_with_escaping() {
- let request = RadrootsAuthoredNip09DeletionRequest::new(
+ let request = AuthoredNip09DeletionRequest::new(
"reason \"quoted\" \\\n\u{0001} 🌱",
- vec![RadrootsNip09DeletionEventTarget::parse(h('A'), 5).expect("event target")],
+ vec![Nip09DeletionEventTarget::parse(h('A'), 5).expect("event target")],
vec![
- RadrootsNip09DeletionAddressTarget::parse(format!(
+ Nip09DeletionAddressTarget::parse(format!(
"30000:{}:victoria:\"crop\\row:\u{0002}:雪",
h('B')
))
diff --git a/crates/event_codec/src/deletion/reconciliation_v1.rs b/crates/event_codec/src/deletion/reconciliation_v1.rs
@@ -7,10 +7,8 @@ pub mod admission {
use core::fmt;
- use radroots_event::contract::registry_v7::{
- RadrootsEventContract, event_contract_registry_v7,
- };
- use radroots_event::envelope::RadrootsEventEnvelope;
+ use radroots_event::contract::registry_v7::{EventContract, event_contract_registry_v7};
+ use radroots_event::envelope::EventEnvelope;
use crate::{
deletion::reconciliation_v1::inbound::{
@@ -40,7 +38,7 @@ pub mod admission {
&self.verified_event
}
- pub fn event(&self) -> &RadrootsEventEnvelope {
+ pub fn event(&self) -> &EventEnvelope {
self.verified_event.event()
}
@@ -48,7 +46,7 @@ pub mod admission {
&self.projection
}
- pub fn contract(&self) -> &'static RadrootsEventContract {
+ pub fn contract(&self) -> &'static EventContract {
event_contract_registry_v7(self.projection.contract_id())
.expect("NIP-09 deletion request contract is registry-owned")
}
@@ -131,7 +129,7 @@ pub mod admission {
}
pub fn verify_and_admit_nip09_deletion_request_event(
- event: RadrootsEventEnvelope,
+ event: EventEnvelope,
) -> Result<RadrootsAdmittedNip09DeletionRequestEvent, RadrootsNip09DeletionAdmissionError>
{
admit_verified_nip09_deletion_request_event_v1(verify_nip01_event_v1(event)?)
@@ -149,7 +147,7 @@ pub mod evaluator {
use radroots_event::{
envelope::kind::KIND_DELETION_REQUEST,
- id::{RadrootsEventId, RadrootsNip01Coordinate},
+ id::{EventId, Nip01Coordinate},
};
use crate::verification::v1::RadrootsSignatureVerifiedEvent;
@@ -201,11 +199,11 @@ pub mod evaluator {
/// Canonical evidence for an authorized exact event-id reference.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsNip09EventReferenceEvidence {
- request_id: RadrootsEventId,
+ request_id: EventId,
}
impl RadrootsNip09EventReferenceEvidence {
- pub const fn request_id(&self) -> &RadrootsEventId {
+ pub const fn request_id(&self) -> &EventId {
&self.request_id
}
}
@@ -213,13 +211,13 @@ pub mod evaluator {
/// Canonical evidence for authorized address references.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsNip09AddressReferenceEvidence {
- coordinate: RadrootsNip01Coordinate,
+ coordinate: Nip01Coordinate,
inclusive_cutoff: u64,
- request_id: RadrootsEventId,
+ request_id: EventId,
}
impl RadrootsNip09AddressReferenceEvidence {
- pub const fn coordinate(&self) -> &RadrootsNip01Coordinate {
+ pub const fn coordinate(&self) -> &Nip01Coordinate {
&self.coordinate
}
@@ -227,7 +225,7 @@ pub mod evaluator {
self.inclusive_cutoff
}
- pub const fn request_id(&self) -> &RadrootsEventId {
+ pub const fn request_id(&self) -> &EventId {
&self.request_id
}
}
@@ -382,9 +380,7 @@ pub mod evaluator {
decision(outcome, reason, event_reference, address_reference)
}
- fn nip01_coordinate(
- target: &RadrootsSignatureVerifiedEvent,
- ) -> Option<RadrootsNip01Coordinate> {
+ fn nip01_coordinate(target: &RadrootsSignatureVerifiedEvent) -> Option<Nip01Coordinate> {
let event = target.event();
let kind = event.kind_u32();
let identifier = if matches!(kind, 0 | 3) || (10_000..=19_999).contains(&kind) {
@@ -400,7 +396,7 @@ pub mod evaluator {
} else {
return None;
};
- RadrootsNip01Coordinate::parse(format!("{kind}:{}:{identifier}", event.author())).ok()
+ Nip01Coordinate::parse(format!("{kind}:{}:{identifier}", event.author())).ok()
}
const fn decision(
@@ -440,10 +436,7 @@ pub mod inbound {
use radroots_event::{
envelope::kind::KIND_DELETION_REQUEST,
- id::{
- RadrootsEventId, RadrootsIdParseError, RadrootsNip01Coordinate,
- RadrootsNip01CoordinateParseError,
- },
+ id::{EventId, Nip01Coordinate, Nip01CoordinateParseError, ParseError},
post::deletion::{
RADROOTS_NIP09_DELETION_CONTENT_MAX_BYTES,
RADROOTS_NIP09_DELETION_EVENT_WIRE_MAX_BYTES,
@@ -529,7 +522,7 @@ pub mod inbound {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsInboundNip09DeletionEventTarget {
tag_index: usize,
- event_id: RadrootsEventId,
+ event_id: EventId,
raw_tag: Vec<String>,
}
@@ -538,7 +531,7 @@ pub mod inbound {
self.tag_index
}
- pub const fn event_id(&self) -> &RadrootsEventId {
+ pub const fn event_id(&self) -> &EventId {
&self.event_id
}
@@ -550,7 +543,7 @@ pub mod inbound {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsInboundNip09DeletionAddressTarget {
tag_index: usize,
- coordinate: RadrootsNip01Coordinate,
+ coordinate: Nip01Coordinate,
raw_tag: Vec<String>,
}
@@ -559,7 +552,7 @@ pub mod inbound {
self.tag_index
}
- pub const fn coordinate(&self) -> &RadrootsNip01Coordinate {
+ pub const fn coordinate(&self) -> &Nip01Coordinate {
&self.coordinate
}
@@ -666,14 +659,14 @@ pub mod inbound {
},
EventTargetInvalid {
tag_index: usize,
- error: RadrootsIdParseError,
+ error: ParseError,
},
AddressTargetShape {
tag_index: usize,
},
AddressTargetInvalid {
tag_index: usize,
- error: RadrootsNip01CoordinateParseError,
+ error: Nip01CoordinateParseError,
},
TargetMissing,
}
@@ -816,7 +809,7 @@ pub mod inbound {
tag_index,
});
};
- let event_id = RadrootsEventId::parse(value).map_err(|error| {
+ let event_id = EventId::parse(value).map_err(|error| {
RadrootsNip09DeletionProjectionError::EventTargetInvalid {
tag_index,
error,
@@ -836,7 +829,7 @@ pub mod inbound {
tag_index,
});
};
- let coordinate = RadrootsNip01Coordinate::parse(value).map_err(|error| {
+ let coordinate = Nip01Coordinate::parse(value).map_err(|error| {
RadrootsNip09DeletionProjectionError::AddressTargetInvalid {
tag_index,
error,
@@ -863,7 +856,7 @@ pub mod inbound {
let has_event_targets = !event_targets.is_empty();
let address_kinds = address_targets
.keys()
- .map(RadrootsNip01Coordinate::kind)
+ .map(Nip01Coordinate::kind)
.collect::<BTreeSet<_>>();
let mut kind_advisories = BTreeMap::new();
let mut diagnostics = Vec::new();
diff --git a/crates/event_codec/src/deletion/reconciliation_v1/admission/tests.rs b/crates/event_codec/src/deletion/reconciliation_v1/admission/tests.rs
@@ -6,7 +6,7 @@ fn admitted_contract_resolves_registry_entry() {
use nostr::secp256k1::Message;
use nostr::{Keys, SECP256K1};
use radroots_event::{
- envelope::RadrootsEventEnvelopeParts, envelope::kind::KIND_DELETION_REQUEST,
+ envelope::EventEnvelopeParts, envelope::kind::KIND_DELETION_REQUEST,
wire::compute_canonical_nip01_event_id,
};
use radroots_test_fixtures::FIXTURE_ALICE_SECRET_KEY_HEX;
@@ -28,7 +28,7 @@ fn admitted_contract_resolves_registry_entry() {
let nostr_id = nostr::EventId::from_hex(&id.to_hex()).expect("Nostr event id");
let message = Message::from_digest(nostr_id.to_bytes());
let signature = SECP256K1.sign_schnorr_no_aux_rand(&message, keys.key_pair(SECP256K1));
- let event = RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ let event = EventEnvelope::new(EventEnvelopeParts {
id: id.into_string(),
author,
created_at,
diff --git a/crates/event_codec/src/deletion/reconciliation_v1/evaluator/tests.rs b/crates/event_codec/src/deletion/reconciliation_v1/evaluator/tests.rs
@@ -2,8 +2,7 @@ use super::*;
use nostr::{Keys, SECP256K1, secp256k1::Message};
use radroots_event::{
- envelope::RadrootsEventEnvelope, envelope::RadrootsEventEnvelopeParts,
- wire::compute_canonical_nip01_event_id,
+ envelope::EventEnvelope, envelope::EventEnvelopeParts, wire::compute_canonical_nip01_event_id,
};
use crate::{
@@ -489,11 +488,8 @@ fn normalize_event_id(value: &str) -> String {
}
}
-fn coordinate_for(
- target: &RadrootsSignatureVerifiedEvent,
- identifier: &str,
-) -> RadrootsNip01Coordinate {
- RadrootsNip01Coordinate::parse(format!(
+fn coordinate_for(target: &RadrootsSignatureVerifiedEvent, identifier: &str) -> Nip01Coordinate {
+ Nip01Coordinate::parse(format!(
"{}:{}:{identifier}",
target.event().kind_u32(),
target.event().author().to_hex()
@@ -540,7 +536,7 @@ fn signed_event(
kind: u32,
tags: Vec<Vec<String>>,
content: &str,
-) -> RadrootsEventEnvelope {
+) -> EventEnvelope {
let keys = Keys::parse(secret_key_hex).expect("fixed fixture secret key must parse");
let author = keys.public_key().to_string();
let id = compute_canonical_nip01_event_id(author.as_str(), created_at, kind, &tags, content)
@@ -549,7 +545,7 @@ fn signed_event(
let message = Message::from_digest(nostr_id.to_bytes());
let signature = SECP256K1.sign_schnorr_no_aux_rand(&message, keys.key_pair(SECP256K1));
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ EventEnvelope::new(EventEnvelopeParts {
id: id.into_string(),
author,
created_at,
diff --git a/crates/event_codec/src/deletion/reconciliation_v1/inbound/tests.rs b/crates/event_codec/src/deletion/reconciliation_v1/inbound/tests.rs
@@ -350,12 +350,12 @@ fn error_codes_and_messages_are_stable() {
RadrootsNip09DeletionProjectionError::EventTargetShape { tag_index: 0 },
RadrootsNip09DeletionProjectionError::EventTargetInvalid {
tag_index: 0,
- error: RadrootsIdParseError::InvalidFormat,
+ error: ParseError::InvalidFormat,
},
RadrootsNip09DeletionProjectionError::AddressTargetShape { tag_index: 0 },
RadrootsNip09DeletionProjectionError::AddressTargetInvalid {
tag_index: 0,
- error: RadrootsNip01CoordinateParseError::InvalidFormat,
+ error: Nip01CoordinateParseError::InvalidFormat,
},
RadrootsNip09DeletionProjectionError::TargetMissing,
];
diff --git a/crates/event_codec/src/document/decode.rs b/crates/event_codec/src/document/decode.rs
@@ -7,9 +7,7 @@ use alloc::{
vec::Vec,
};
-use radroots_event::{
- envelope::kind::KIND_DOCUMENT, post::document::RadrootsDocument, tag::name::TAG_D,
-};
+use radroots_event::{envelope::kind::KIND_DOCUMENT, post::document::Document, tag::name::TAG_D};
use crate::d_tag::validate_d_tag_tag;
use crate::error::EventParseError;
@@ -69,7 +67,7 @@ pub fn document_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsDocument, EventParseError> {
+) -> Result<Document, EventParseError> {
if kind != DEFAULT_KIND {
return Err(EventParseError::InvalidKind {
expected: "30361",
@@ -82,7 +80,7 @@ pub fn document_from_event(
let d_tag = parse_d_tag(tags)?;
let subject_pubkey = parse_subject_pubkey(tags)?;
let subject_address = parse_subject_address(tags)?;
- let mut document: RadrootsDocument =
+ let mut document: Document =
serde_json::from_str(content).map_err(|_| EventParseError::InvalidJson("content"))?;
if document.d_tag.trim().is_empty() {
@@ -128,7 +126,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsDocument>, EventParseError> {
+) -> Result<RadrootsParsedData<Document>, EventParseError> {
let document = document_from_event(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -147,7 +145,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsDocument>, EventParseError> {
+) -> Result<RadrootsParsedEvent<Document>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
@@ -162,11 +160,11 @@ pub fn parsed_from_event(
#[cfg(test)]
mod tests {
use super::*;
- use radroots_event::post::document::{RadrootsDocument, RadrootsDocumentSubject};
+ use radroots_event::post::document::{Document, DocumentSubject};
#[test]
fn document_decode_accepts_subject_without_address() {
- let document = RadrootsDocument {
+ let document = Document {
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
doc_type: "policy".to_string(),
title: "Farm policy".to_string(),
@@ -174,7 +172,7 @@ mod tests {
summary: None,
effective_at: None,
body_markdown: None,
- subject: RadrootsDocumentSubject {
+ subject: DocumentSubject {
pubkey: "subject-pubkey".to_string(),
address: None,
},
diff --git a/crates/event_codec/src/document/encode.rs b/crates/event_codec/src/document/encode.rs
@@ -7,7 +7,7 @@ use alloc::{
vec::Vec,
};
-use radroots_event::{post::document::RadrootsDocument, tag::name::TAG_D};
+use radroots_event::{post::document::Document, tag::name::TAG_D};
use crate::d_tag::validate_d_tag;
use crate::error::EventEncodeError;
@@ -16,7 +16,7 @@ use crate::error::EventEncodeError;
use radroots_event::envelope::kind::KIND_DOCUMENT;
#[cfg(feature = "serde_json")]
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
const TAG_T: &str = "t";
const TAG_P: &str = "p";
@@ -26,9 +26,7 @@ fn push_tag(tags: &mut Vec<Vec<String>>, key: &str, value: &str) {
tags.push(vec![key.to_string(), value.to_string()]);
}
-pub fn document_build_tags(
- document: &RadrootsDocument,
-) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn document_build_tags(document: &Document) -> Result<Vec<Vec<String>>, EventEncodeError> {
if document.d_tag.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("d_tag"));
}
@@ -64,23 +62,21 @@ pub fn document_build_tags(
}
#[cfg(feature = "serde_json")]
-pub fn to_wire_parts(
- document: &RadrootsDocument,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+pub fn to_wire_parts(document: &Document) -> Result<Nip01EventWireParts, EventEncodeError> {
to_wire_parts_with_kind(document, KIND_DOCUMENT)
}
#[cfg(feature = "serde_json")]
pub fn to_wire_parts_with_kind(
- document: &RadrootsDocument,
+ document: &Document,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != KIND_DOCUMENT {
return Err(EventEncodeError::InvalidKind(kind));
}
let tags = document_build_tags(document)?;
let content = serde_json::to_string(document).map_err(|_| EventEncodeError::Json)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content,
tags,
@@ -91,14 +87,14 @@ pub fn to_wire_parts_with_kind(
mod tests {
use super::*;
use crate::test_fixtures::FIXTURE_ALICE_PUBLIC_KEY_HEX;
- use radroots_event::post::document::RadrootsDocumentSubject;
+ use radroots_event::post::document::DocumentSubject;
fn sample_document_address() -> String {
format!("30340:{FIXTURE_ALICE_PUBLIC_KEY_HEX}:AAAAAAAAAAAAAAAAAAAAAA")
}
- fn sample_document() -> RadrootsDocument {
- RadrootsDocument {
+ fn sample_document() -> Document {
+ Document {
d_tag: "AAAAAAAAAAAAAAAAAAAAAg".to_string(),
doc_type: "charter".to_string(),
title: "Charter".to_string(),
@@ -106,7 +102,7 @@ mod tests {
summary: None,
effective_at: None,
body_markdown: None,
- subject: RadrootsDocumentSubject {
+ subject: DocumentSubject {
pubkey: FIXTURE_ALICE_PUBLIC_KEY_HEX.to_string(),
address: Some(sample_document_address()),
},
diff --git a/crates/event_codec/src/document/mod.rs b/crates/event_codec/src/document/mod.rs
@@ -6,11 +6,11 @@ pub mod encode;
#[cfg(test)]
mod tests {
use crate::document::encode::document_build_tags;
- use radroots_event::post::document::{RadrootsDocument, RadrootsDocumentSubject};
+ use radroots_event::post::document::{Document, DocumentSubject};
#[test]
fn document_tags_include_required_fields() {
- let document = RadrootsDocument {
+ let document = Document {
d_tag: "EAAAAAAAAAAAAAAAAAAAAA".to_string(),
doc_type: "charter".to_string(),
title: "Sierra Co-op Charter".to_string(),
@@ -18,7 +18,7 @@ mod tests {
summary: None,
effective_at: None,
body_markdown: None,
- subject: RadrootsDocumentSubject {
+ subject: DocumentSubject {
pubkey: "coop_pubkey".to_string(),
address: Some("30360:coop_pubkey:BAAAAAAAAAAAAAAAAAAAAA".to_string()),
},
diff --git a/crates/event_codec/src/error.rs b/crates/event_codec/src/error.rs
@@ -51,8 +51,8 @@ impl std::error::Error for EventParseError {
}
}
-impl From<radroots_event::envelope::RadrootsEventEnvelopeError> for EventParseError {
- fn from(_: radroots_event::envelope::RadrootsEventEnvelopeError) -> Self {
+impl From<radroots_event::envelope::EventEnvelopeError> for EventParseError {
+ fn from(_: radroots_event::envelope::EventEnvelopeError) -> Self {
Self::InvalidEnvelope
}
}
@@ -97,12 +97,12 @@ impl std::error::Error for EventEncodeError {}
#[cfg(test)]
mod tests {
use super::EventParseError;
- use radroots_event::envelope::RadrootsEventEnvelopeError;
+ use radroots_event::envelope::EventEnvelopeError;
#[test]
#[cfg_attr(coverage_nightly, coverage(off))]
fn invalid_envelope_conversion_preserves_public_error_contract() {
- let error = EventParseError::from(RadrootsEventEnvelopeError::NonCanonicalId);
+ let error = EventParseError::from(EventEnvelopeError::NonCanonicalId);
assert_eq!(error.code(), "invalid_envelope");
assert_eq!(error.to_string(), "invalid event envelope");
diff --git a/crates/event_codec/src/event_ref.rs b/crates/event_codec/src/event_ref.rs
@@ -6,14 +6,14 @@ use alloc::{
};
use radroots_event::{
- id::{RadrootsDTag, RadrootsEventId, RadrootsRelayUrl},
- tag::RadrootsEventRef,
+ id::{DTag, EventId, RelayUrl},
+ tag::EventRef,
};
use radroots_identity::PublicKey;
use crate::error::EventParseError;
-pub fn build_event_ref_tag(tag: &str, event: &RadrootsEventRef) -> Vec<String> {
+pub fn build_event_ref_tag(tag: &str, event: &EventRef) -> Vec<String> {
let relays_len = event.relays.as_ref().map(|r| r.len()).unwrap_or(0);
let mut out = Vec::with_capacity(5 + relays_len);
out.push(tag.to_string());
@@ -30,7 +30,7 @@ pub fn build_event_ref_tag(tag: &str, event: &RadrootsEventRef) -> Vec<String> {
pub fn parse_event_ref_tag(
tag: &[String],
tag_name: &'static str,
-) -> Result<RadrootsEventRef, EventParseError> {
+) -> Result<EventRef, EventParseError> {
if tag.first().map(|s| s.as_str()) != Some(tag_name) {
return Err(EventParseError::InvalidTag(tag_name));
}
@@ -38,7 +38,7 @@ pub fn parse_event_ref_tag(
return Err(EventParseError::InvalidTag(tag_name));
}
let id = &tag[1];
- RadrootsEventId::parse(id).map_err(|_| EventParseError::InvalidTag(tag_name))?;
+ EventId::parse(id).map_err(|_| EventParseError::InvalidTag(tag_name))?;
let author = &tag[2];
let author = PublicKey::from_hex(author).map_err(|_| EventParseError::InvalidTag(tag_name))?;
let kind_s = &tag[3];
@@ -50,23 +50,23 @@ pub fn parse_event_ref_tag(
let d_tag = if d_tag_value.is_empty() {
None
} else {
- if RadrootsRelayUrl::parse(d_tag_value).is_ok() {
+ if RelayUrl::parse(d_tag_value).is_ok() {
return Err(EventParseError::InvalidTag(tag_name));
}
- RadrootsDTag::parse(d_tag_value).map_err(|_| EventParseError::InvalidTag(tag_name))?;
+ DTag::parse(d_tag_value).map_err(|_| EventParseError::InvalidTag(tag_name))?;
Some(d_tag_value.clone())
};
let relays = if tag.len() > 5 {
for relay in &tag[5..] {
- RadrootsRelayUrl::parse(relay).map_err(|_| EventParseError::InvalidTag(tag_name))?;
+ RelayUrl::parse(relay).map_err(|_| EventParseError::InvalidTag(tag_name))?;
}
Some(tag[5..].to_vec())
} else {
None
};
- Ok(RadrootsEventRef {
+ Ok(EventRef {
id: id.clone(),
author,
kind,
@@ -85,7 +85,7 @@ pub fn find_event_ref_tag<'a>(
pub fn push_nip10_ref_tags(
tags: &mut Vec<Vec<String>>,
- event: &RadrootsEventRef,
+ event: &EventRef,
tag_e: &'static str,
tag_p: &'static str,
tag_k: &'static str,
@@ -133,7 +133,7 @@ pub fn parse_nip10_ref_tags(
tag_p: &'static str,
tag_k: &'static str,
tag_a: &'static str,
-) -> Result<RadrootsEventRef, EventParseError> {
+) -> Result<EventRef, EventParseError> {
let e_tag = find_event_ref_tag(tags, tag_e).ok_or(EventParseError::MissingTag(tag_e))?;
let id = e_tag.get(1).ok_or(EventParseError::InvalidTag(tag_e))?;
if id.trim().is_empty() {
@@ -186,7 +186,7 @@ pub fn parse_nip10_ref_tags(
let relays = relays.or(addr_relays);
- Ok(RadrootsEventRef {
+ Ok(EventRef {
id: id.clone(),
author,
kind,
diff --git a/crates/event_codec/src/farm/decode.rs b/crates/event_codec/src/farm/decode.rs
@@ -8,7 +8,7 @@ use alloc::{
use radroots_event::{
envelope::kind::KIND_FARM,
- farm::RadrootsFarm,
+ farm::Farm,
farm::location::{has_textual_locality, is_public_geohash5},
tag::name::TAG_D,
};
@@ -40,7 +40,7 @@ pub fn farm_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsFarm, EventParseError> {
+) -> Result<Farm, EventParseError> {
if kind != DEFAULT_KIND {
return Err(EventParseError::InvalidKind {
expected: "30340",
@@ -53,7 +53,7 @@ pub fn farm_from_event(
let d_tag = parse_d_tag(tags)?;
reject_private_farm_location_tags(tags)?;
reject_private_farm_ops_content(content)?;
- let mut farm: RadrootsFarm =
+ let mut farm: Farm =
serde_json::from_str(content).map_err(|_| EventParseError::InvalidJson("content"))?;
if farm.d_tag.trim().is_empty() {
@@ -155,7 +155,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsFarm>, EventParseError> {
+) -> Result<RadrootsParsedData<Farm>, EventParseError> {
let farm = farm_from_event(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -174,7 +174,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsFarm>, EventParseError> {
+) -> Result<RadrootsParsedEvent<Farm>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
diff --git a/crates/event_codec/src/farm/encode.rs b/crates/event_codec/src/farm/encode.rs
@@ -8,7 +8,7 @@ use alloc::{
use radroots_event::{
envelope::kind::KIND_FARM,
farm::location::{has_textual_locality, is_public_geohash5},
- farm::{RadrootsFarm, RadrootsFarmRef},
+ farm::{Farm, FarmRef},
tag::name::TAG_D,
};
@@ -16,7 +16,7 @@ use crate::d_tag::validate_d_tag;
use crate::error::EventEncodeError;
#[cfg(feature = "serde_json")]
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
const TAG_T: &str = "t";
const TAG_G: &str = "g";
@@ -25,7 +25,7 @@ fn push_tag(tags: &mut Vec<Vec<String>>, key: &str, value: &str) {
tags.push(vec![key.to_string(), value.to_string()]);
}
-pub fn farm_build_tags(farm: &RadrootsFarm) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn farm_build_tags(farm: &Farm) -> Result<Vec<Vec<String>>, EventEncodeError> {
if farm.d_tag.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("d_tag"));
}
@@ -61,7 +61,7 @@ pub fn farm_build_tags(farm: &RadrootsFarm) -> Result<Vec<Vec<String>>, EventEnc
Ok(tags)
}
-pub fn farm_ref_tags(farm: &RadrootsFarmRef) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn farm_ref_tags(farm: &FarmRef) -> Result<Vec<Vec<String>>, EventEncodeError> {
if farm.pubkey.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("farm.pubkey"));
}
@@ -82,21 +82,21 @@ pub fn farm_ref_tags(farm: &RadrootsFarmRef) -> Result<Vec<Vec<String>>, EventEn
}
#[cfg(feature = "serde_json")]
-pub fn to_wire_parts(farm: &RadrootsFarm) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+pub fn to_wire_parts(farm: &Farm) -> Result<Nip01EventWireParts, EventEncodeError> {
to_wire_parts_with_kind(farm, KIND_FARM)
}
#[cfg(feature = "serde_json")]
pub fn to_wire_parts_with_kind(
- farm: &RadrootsFarm,
+ farm: &Farm,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != KIND_FARM {
return Err(EventEncodeError::InvalidKind(kind));
}
let tags = farm_build_tags(farm)?;
let content = serde_json::to_string(farm).map_err(|_| EventEncodeError::Json)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content,
tags,
diff --git a/crates/event_codec/src/farm/list_sets.rs b/crates/event_codec/src/farm/list_sets.rs
@@ -9,10 +9,10 @@ use alloc::{
};
use radroots_event::envelope::kind::KIND_CLASSIFIED_LISTING;
-use radroots_event::farm::plot::RadrootsPlot;
-use radroots_event::listing::operational::RadrootsOperationalListing;
-use radroots_event::social::list::RadrootsListEntry;
-use radroots_event::social::list_set::RadrootsListSet;
+use radroots_event::farm::plot::Plot;
+use radroots_event::listing::operational::OperationalListing;
+use radroots_event::social::list::ListEntry;
+use radroots_event::social::list_set::ListSet;
use crate::d_tag::validate_d_tag;
use crate::error::EventEncodeError;
@@ -29,7 +29,7 @@ fn farm_list_set_id(farm_id: &str, suffix: &str) -> Result<String, EventEncodeEr
Ok(format!("farm:{farm_id}:{suffix}"))
}
-fn list_entries<I, S>(tag: &str, values: I) -> Result<Vec<RadrootsListEntry>, EventEncodeError>
+fn list_entries<I, S>(tag: &str, values: I) -> Result<Vec<ListEntry>, EventEncodeError>
where
I: IntoIterator<Item = S>,
S: AsRef<str>,
@@ -40,7 +40,7 @@ where
if value.is_empty() {
return Err(EventEncodeError::EmptyRequiredField("entry.values"));
}
- entries.push(RadrootsListEntry {
+ entries.push(ListEntry {
tag: tag.to_string(),
values: vec![value.to_string()],
});
@@ -48,15 +48,12 @@ where
Ok(entries)
}
-pub fn farm_members_list_set<I, S>(
- farm_id: &str,
- members: I,
-) -> Result<RadrootsListSet, EventEncodeError>
+pub fn farm_members_list_set<I, S>(farm_id: &str, members: I) -> Result<ListSet, EventEncodeError>
where
I: IntoIterator<Item = S>,
S: AsRef<str>,
{
- Ok(RadrootsListSet {
+ Ok(ListSet {
d_tag: farm_list_set_id(farm_id, "members")?,
content: String::new(),
entries: list_entries("p", members)?,
@@ -66,15 +63,12 @@ where
})
}
-pub fn farm_owners_list_set<I, S>(
- farm_id: &str,
- owners: I,
-) -> Result<RadrootsListSet, EventEncodeError>
+pub fn farm_owners_list_set<I, S>(farm_id: &str, owners: I) -> Result<ListSet, EventEncodeError>
where
I: IntoIterator<Item = S>,
S: AsRef<str>,
{
- Ok(RadrootsListSet {
+ Ok(ListSet {
d_tag: farm_list_set_id(farm_id, "members.owners")?,
content: String::new(),
entries: list_entries("p", owners)?,
@@ -84,15 +78,12 @@ where
})
}
-pub fn farm_workers_list_set<I, S>(
- farm_id: &str,
- workers: I,
-) -> Result<RadrootsListSet, EventEncodeError>
+pub fn farm_workers_list_set<I, S>(farm_id: &str, workers: I) -> Result<ListSet, EventEncodeError>
where
I: IntoIterator<Item = S>,
S: AsRef<str>,
{
- Ok(RadrootsListSet {
+ Ok(ListSet {
d_tag: farm_list_set_id(farm_id, "members.workers")?,
content: String::new(),
entries: list_entries("p", workers)?,
@@ -106,7 +97,7 @@ pub fn farm_plots_list_set<I, S>(
farm_id: &str,
farm_pubkey: &str,
plot_ids: I,
-) -> Result<RadrootsListSet, EventEncodeError>
+) -> Result<ListSet, EventEncodeError>
where
I: IntoIterator<Item = S>,
S: AsRef<str>,
@@ -115,12 +106,12 @@ where
for plot_id in plot_ids {
let plot_id = plot_id.as_ref();
let address = plot_address(farm_pubkey, plot_id)?;
- entries.push(RadrootsListEntry {
+ entries.push(ListEntry {
tag: "a".to_string(),
values: vec![address],
});
}
- Ok(RadrootsListSet {
+ Ok(ListSet {
d_tag: farm_list_set_id(farm_id, "plots")?,
content: String::new(),
entries,
@@ -134,7 +125,7 @@ pub fn farm_operational_listings_list_set<I, S>(
farm_id: &str,
farm_pubkey: &str,
listing_ids: I,
-) -> Result<RadrootsListSet, EventEncodeError>
+) -> Result<ListSet, EventEncodeError>
where
I: IntoIterator<Item = S>,
S: AsRef<str>,
@@ -152,12 +143,12 @@ where
address.push_str(farm_pubkey);
address.push(':');
address.push_str(listing_id);
- entries.push(RadrootsListEntry {
+ entries.push(ListEntry {
tag: "a".to_string(),
values: vec![address],
});
}
- Ok(RadrootsListSet {
+ Ok(ListSet {
d_tag: farm_list_set_id(farm_id, "listings")?,
content: String::new(),
entries,
@@ -171,9 +162,9 @@ pub fn farm_operational_listings_list_set_from_listings<'a, I>(
farm_id: &str,
farm_pubkey: &str,
listings: I,
-) -> Result<RadrootsListSet, EventEncodeError>
+) -> Result<ListSet, EventEncodeError>
where
- I: IntoIterator<Item = &'a RadrootsOperationalListing>,
+ I: IntoIterator<Item = &'a OperationalListing>,
{
farm_operational_listings_list_set(
farm_id,
@@ -186,9 +177,9 @@ pub fn farm_plots_list_set_from_plots<'a, I>(
farm_id: &str,
farm_pubkey: &str,
plots: I,
-) -> Result<RadrootsListSet, EventEncodeError>
+) -> Result<ListSet, EventEncodeError>
where
- I: IntoIterator<Item = &'a RadrootsPlot>,
+ I: IntoIterator<Item = &'a Plot>,
{
farm_plots_list_set(
farm_id,
@@ -197,12 +188,12 @@ where
)
}
-pub fn member_of_farms_list_set<I, S>(farm_pubkeys: I) -> Result<RadrootsListSet, EventEncodeError>
+pub fn member_of_farms_list_set<I, S>(farm_pubkeys: I) -> Result<ListSet, EventEncodeError>
where
I: IntoIterator<Item = S>,
S: AsRef<str>,
{
- Ok(RadrootsListSet {
+ Ok(ListSet {
d_tag: MEMBER_OF_FARMS.to_string(),
content: String::new(),
entries: list_entries("p", farm_pubkeys)?,
diff --git a/crates/event_codec/src/farm/mod.rs b/crates/event_codec/src/farm/mod.rs
@@ -17,12 +17,11 @@ mod tests {
use radroots_core::{Currency, Decimal, Money, Quantity, QuantityPrice, Unit};
#[cfg(feature = "serde_json")]
use radroots_event::envelope::kind::KIND_FARM;
- use radroots_event::farm::plot::RadrootsPlot;
- use radroots_event::farm::{RadrootsFarm, RadrootsFarmPublicLocation, RadrootsFarmRef};
- use radroots_event::id::{RadrootsDTag, RadrootsInventoryBinId};
+ use radroots_event::farm::plot::Plot;
+ use radroots_event::farm::{Farm, FarmPublicLocation, FarmRef};
+ use radroots_event::id::{DTag, InventoryBinId};
use radroots_event::listing::operational::{
- RadrootsOperationalListing, RadrootsOperationalListingBin,
- RadrootsOperationalListingProduct,
+ OperationalListing, OperationalListingBin, OperationalListingProduct,
};
#[cfg(feature = "serde_json")]
@@ -35,24 +34,24 @@ mod tests {
"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
);
- fn d_tag(raw: &str) -> RadrootsDTag {
+ fn d_tag(raw: &str) -> DTag {
raw.parse().unwrap()
}
- fn bin_id(raw: &str) -> RadrootsInventoryBinId {
+ fn bin_id(raw: &str) -> InventoryBinId {
raw.parse().unwrap()
}
#[test]
fn farm_tags_include_required_fields() {
- let farm = RadrootsFarm {
+ let farm = Farm {
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
name: "Test Farm".to_string(),
about: None,
website: None,
picture: None,
banner: None,
- location: Some(RadrootsFarmPublicLocation {
+ location: Some(FarmPublicLocation {
primary: "Test Farm".to_string(),
city: Some("Santa Cruz".to_string()),
region: Some("California".to_string()),
@@ -70,7 +69,7 @@ mod tests {
#[test]
fn farm_tags_allow_missing_optional_fields() {
- let farm = RadrootsFarm {
+ let farm = Farm {
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
name: "Test Farm".to_string(),
about: None,
@@ -100,7 +99,7 @@ mod tests {
#[test]
fn farm_build_tags_rejects_invalid_d_tag() {
- let farm = RadrootsFarm {
+ let farm = Farm {
d_tag: "farm:invalid".to_string(),
name: "Test Farm".to_string(),
about: None,
@@ -119,7 +118,7 @@ mod tests {
#[cfg_attr(coverage_nightly, coverage(off))]
#[cfg(feature = "serde_json")]
fn farm_decode_rejects_empty_d_tag_and_content() {
- let farm = RadrootsFarm {
+ let farm = Farm {
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
name: "Test Farm".to_string(),
about: None,
@@ -182,7 +181,7 @@ mod tests {
#[test]
fn farm_ref_tags_include_p_and_a() {
- let farm = RadrootsFarmRef {
+ let farm = FarmRef {
pubkey: "farm_pubkey".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
};
@@ -197,7 +196,7 @@ mod tests {
assert!(has_a);
assert!(has_p);
- let err = farm_ref_tags(&RadrootsFarmRef {
+ let err = farm_ref_tags(&FarmRef {
pubkey: "farm_pubkey".to_string(),
d_tag: "invalid".to_string(),
})
@@ -207,14 +206,14 @@ mod tests {
#[test]
fn farm_encode_rejects_empty_required_fields() {
- let mut farm = RadrootsFarm {
+ let mut farm = Farm {
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
name: "Test Farm".to_string(),
about: None,
website: None,
picture: None,
banner: None,
- location: Some(RadrootsFarmPublicLocation {
+ location: Some(FarmPublicLocation {
primary: "Test Farm".to_string(),
city: Some("Santa Cruz".to_string()),
region: Some("California".to_string()),
@@ -248,7 +247,7 @@ mod tests {
EventEncodeError::InvalidField("location.geohash")
));
- let err = farm_ref_tags(&RadrootsFarmRef {
+ let err = farm_ref_tags(&FarmRef {
pubkey: " ".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
})
@@ -258,7 +257,7 @@ mod tests {
EventEncodeError::EmptyRequiredField("farm.pubkey")
));
- let err = farm_ref_tags(&RadrootsFarmRef {
+ let err = farm_ref_tags(&FarmRef {
pubkey: "farm_pubkey".to_string(),
d_tag: " ".to_string(),
})
@@ -268,14 +267,14 @@ mod tests {
EventEncodeError::EmptyRequiredField("farm.d_tag")
));
- let mut farm = RadrootsFarm {
+ let mut farm = Farm {
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
name: "Test Farm".to_string(),
about: None,
website: None,
picture: None,
banner: None,
- location: Some(RadrootsFarmPublicLocation {
+ location: Some(FarmPublicLocation {
primary: " ".to_string(),
city: Some("null".to_string()),
region: None,
@@ -304,14 +303,14 @@ mod tests {
#[cfg_attr(coverage_nightly, coverage(off))]
#[cfg(feature = "serde_json")]
fn farm_decode_rejects_private_location_and_ops_shapes() {
- let farm = RadrootsFarm {
+ let farm = Farm {
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
name: "Test Farm".to_string(),
about: None,
website: None,
picture: None,
banner: None,
- location: Some(RadrootsFarmPublicLocation {
+ location: Some(FarmPublicLocation {
primary: "Test Farm".to_string(),
city: Some("Santa Cruz".to_string()),
region: Some("California".to_string()),
@@ -449,9 +448,9 @@ mod tests {
#[test]
fn farm_plots_list_set_uses_plot_addresses() {
- let plots = vec![RadrootsPlot {
+ let plots = vec![Plot {
d_tag: "AAAAAAAAAAAAAAAAAAAAAQ".to_string(),
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: "farm_pubkey".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
},
@@ -475,14 +474,14 @@ mod tests {
#[test]
fn farm_listings_list_set_uses_listing_addresses() {
- let listings = vec![RadrootsOperationalListing {
+ let listings = vec![OperationalListing {
d_tag: d_tag("AAAAAAAAAAAAAAAAAAAAAg"),
published_at: None,
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: "farm_pubkey".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
},
- product: RadrootsOperationalListingProduct {
+ product: OperationalListingProduct {
key: "coffee".to_string(),
title: "Coffee".to_string(),
category: "coffee".to_string(),
@@ -494,7 +493,7 @@ mod tests {
year: None,
},
primary_bin_id: bin_id("bin-1"),
- bins: vec![RadrootsOperationalListingBin {
+ bins: vec![OperationalListingBin {
bin_id: bin_id("bin-1"),
quantity: Quantity::try_new(Decimal::from(1u32), Unit::Each).unwrap(),
price_per_canonical_unit: QuantityPrice::try_new(
diff --git a/crates/event_codec/src/farm_crdt/decode.rs b/crates/event_codec/src/farm_crdt/decode.rs
@@ -2,7 +2,7 @@
use alloc::{string::String, vec::Vec};
use radroots_event::{
- farm::crdt::{KIND_FARM_CRDT_CHANGE, RADROOTS_FARM_CRDT_TAG, RadrootsFarmCrdtChange},
+ farm::crdt::{FarmCrdtChange, KIND_FARM_CRDT_CHANGE, RADROOTS_FARM_CRDT_TAG},
farm::workspace::KIND_FARM_WORKSPACE_MANIFEST,
tag::name::{TAG_A, TAG_D, TAG_H, TAG_P, TAG_T},
};
@@ -22,7 +22,7 @@ pub fn farm_crdt_change_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsFarmCrdtChange, EventParseError> {
+) -> Result<FarmCrdtChange, EventParseError> {
farm_crdt_change_from_event_inner(kind, tags, content, None)
}
@@ -31,7 +31,7 @@ pub fn farm_crdt_change_from_event_with_author(
tags: &[Vec<String>],
content: &str,
author_pubkey: &str,
-) -> Result<RadrootsFarmCrdtChange, EventParseError> {
+) -> Result<FarmCrdtChange, EventParseError> {
validate_non_empty_tag_value(author_pubkey, TAG_P)?;
farm_crdt_change_from_event_inner(kind, tags, content, Some(author_pubkey))
}
@@ -43,7 +43,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsFarmCrdtChange>, EventParseError> {
+) -> Result<RadrootsParsedData<FarmCrdtChange>, EventParseError> {
let change = farm_crdt_change_from_event_with_author(kind, &tags, &content, &author)?;
Ok(RadrootsParsedData::new(
id,
@@ -62,7 +62,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsFarmCrdtChange>, EventParseError> {
+) -> Result<RadrootsParsedEvent<FarmCrdtChange>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
@@ -79,7 +79,7 @@ fn farm_crdt_change_from_event_inner(
tags: &[Vec<String>],
content: &str,
author_pubkey: Option<&str>,
-) -> Result<RadrootsFarmCrdtChange, EventParseError> {
+) -> Result<FarmCrdtChange, EventParseError> {
if kind != KIND_FARM_CRDT_CHANGE {
return Err(EventParseError::InvalidKind {
expected: EXPECTED_KIND,
@@ -110,7 +110,7 @@ fn farm_crdt_change_from_event_inner(
return Err(EventParseError::InvalidTag(TAG_P));
}
- let change: RadrootsFarmCrdtChange =
+ let change: FarmCrdtChange =
serde_json::from_str(content).map_err(|_| EventParseError::InvalidJson("content"))?;
validate_change(&change).map_err(encode_error_to_parse_error)?;
if change.farm_group_id != farm_group_id {
diff --git a/crates/event_codec/src/farm_crdt/encode.rs b/crates/event_codec/src/farm_crdt/encode.rs
@@ -4,9 +4,7 @@ use alloc::{format, string::String, vec::Vec};
#[cfg(feature = "serde_json")]
use radroots_event::farm::crdt::KIND_FARM_CRDT_CHANGE;
use radroots_event::{
- farm::crdt::{
- RADROOTS_FARM_CRDT_CHANGE_SCHEMA, RADROOTS_FARM_CRDT_TAG, RadrootsFarmCrdtChange,
- },
+ farm::crdt::{FarmCrdtChange, RADROOTS_FARM_CRDT_CHANGE_SCHEMA, RADROOTS_FARM_CRDT_TAG},
farm::workspace::KIND_FARM_WORKSPACE_MANIFEST,
tag::name::{TAG_A, TAG_D, TAG_H, TAG_P, TAG_T},
};
@@ -17,16 +15,16 @@ use crate::field_helpers::{
push_optional_tag, push_tag, validate_non_empty_base64url, validate_non_empty_field,
};
#[cfg(feature = "serde_json")]
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
pub fn farm_crdt_change_build_tags(
- change: &RadrootsFarmCrdtChange,
+ change: &FarmCrdtChange,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
farm_crdt_change_build_tags_with_author(change, None)
}
pub fn farm_crdt_change_build_tags_with_author(
- change: &RadrootsFarmCrdtChange,
+ change: &FarmCrdtChange,
author_pubkey: Option<&str>,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
validate_change(change)?;
@@ -47,47 +45,45 @@ pub fn farm_crdt_change_build_tags_with_author(
}
#[cfg(feature = "serde_json")]
-pub fn to_wire_parts(
- change: &RadrootsFarmCrdtChange,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+pub fn to_wire_parts(change: &FarmCrdtChange) -> Result<Nip01EventWireParts, EventEncodeError> {
to_wire_parts_with_kind(change, KIND_FARM_CRDT_CHANGE)
}
#[cfg(feature = "serde_json")]
pub fn to_wire_parts_with_author(
- change: &RadrootsFarmCrdtChange,
+ change: &FarmCrdtChange,
author_pubkey: &str,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
to_wire_parts_with_kind_and_author(change, KIND_FARM_CRDT_CHANGE, Some(author_pubkey))
}
#[cfg(feature = "serde_json")]
pub fn to_wire_parts_with_kind(
- change: &RadrootsFarmCrdtChange,
+ change: &FarmCrdtChange,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
to_wire_parts_with_kind_and_author(change, kind, None)
}
#[cfg(feature = "serde_json")]
pub fn to_wire_parts_with_kind_and_author(
- change: &RadrootsFarmCrdtChange,
+ change: &FarmCrdtChange,
kind: u32,
author_pubkey: Option<&str>,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != KIND_FARM_CRDT_CHANGE {
return Err(EventEncodeError::InvalidKind(kind));
}
let tags = farm_crdt_change_build_tags_with_author(change, author_pubkey)?;
let content = serde_json::to_string(change).map_err(|_| EventEncodeError::Json)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content,
tags,
})
}
-pub(crate) fn validate_change(change: &RadrootsFarmCrdtChange) -> Result<(), EventEncodeError> {
+pub(crate) fn validate_change(change: &FarmCrdtChange) -> Result<(), EventEncodeError> {
if change.schema != RADROOTS_FARM_CRDT_CHANGE_SCHEMA {
return Err(EventEncodeError::InvalidField("schema"));
}
diff --git a/crates/event_codec/src/farm_crdt/mod.rs b/crates/event_codec/src/farm_crdt/mod.rs
@@ -8,11 +8,10 @@ mod tests {
use radroots_event::{
envelope::kind::KIND_POST,
farm::crdt::{
+ CrdtBackend, FarmCrdtChange, FarmCrdtDocumentKind, FarmSemanticKind,
KIND_FARM_CRDT_CHANGE, RADROOTS_FARM_CRDT_CHANGE_SCHEMA, RADROOTS_FARM_CRDT_TAG,
- RadrootsCrdtBackend, RadrootsFarmCrdtChange, RadrootsFarmCrdtDocumentKind,
- RadrootsFarmSemanticKind,
},
- farm::workspace::{KIND_FARM_WORKSPACE_MANIFEST, RadrootsFarmWorkspaceRef},
+ farm::workspace::{FarmWorkspaceRef, KIND_FARM_WORKSPACE_MANIFEST},
};
use crate::error::{EventEncodeError, EventParseError};
@@ -68,68 +67,68 @@ mod tests {
fn farm_crdt_change_roundtrips_representative_mvp_semantics() {
let cases = vec![
(
- RadrootsFarmCrdtDocumentKind::FarmTask,
- RadrootsFarmSemanticKind::FarmTaskCreate,
+ FarmCrdtDocumentKind::FarmTask,
+ FarmSemanticKind::FarmTaskCreate,
),
(
- RadrootsFarmCrdtDocumentKind::FarmTask,
- RadrootsFarmSemanticKind::FarmTaskStatusSet,
+ FarmCrdtDocumentKind::FarmTask,
+ FarmSemanticKind::FarmTaskStatusSet,
),
(
- RadrootsFarmCrdtDocumentKind::FarmWorkSession,
- RadrootsFarmSemanticKind::FarmWorkSessionStart,
+ FarmCrdtDocumentKind::FarmWorkSession,
+ FarmSemanticKind::FarmWorkSessionStart,
),
(
- RadrootsFarmCrdtDocumentKind::FarmWorkSession,
- RadrootsFarmSemanticKind::FarmWorkSessionStop,
+ FarmCrdtDocumentKind::FarmWorkSession,
+ FarmSemanticKind::FarmWorkSessionStop,
),
(
- RadrootsFarmCrdtDocumentKind::FarmWorkSession,
- RadrootsFarmSemanticKind::FarmWorkSessionSubmit,
+ FarmCrdtDocumentKind::FarmWorkSession,
+ FarmSemanticKind::FarmWorkSessionSubmit,
),
(
- RadrootsFarmCrdtDocumentKind::FarmWorkSession,
- RadrootsFarmSemanticKind::FarmWorkSessionApprove,
+ FarmCrdtDocumentKind::FarmWorkSession,
+ FarmSemanticKind::FarmWorkSessionApprove,
),
(
- RadrootsFarmCrdtDocumentKind::FarmWorkSession,
- RadrootsFarmSemanticKind::FarmWorkSessionReject,
+ FarmCrdtDocumentKind::FarmWorkSession,
+ FarmSemanticKind::FarmWorkSessionReject,
),
(
- RadrootsFarmCrdtDocumentKind::FarmWorkSession,
- RadrootsFarmSemanticKind::FarmWorkSessionCorrect,
+ FarmCrdtDocumentKind::FarmWorkSession,
+ FarmSemanticKind::FarmWorkSessionCorrect,
),
(
- RadrootsFarmCrdtDocumentKind::FarmHarvestRecord,
- RadrootsFarmSemanticKind::FarmHarvestLineAdd,
+ FarmCrdtDocumentKind::FarmHarvestRecord,
+ FarmSemanticKind::FarmHarvestLineAdd,
),
(
- RadrootsFarmCrdtDocumentKind::FarmHarvestRecord,
- RadrootsFarmSemanticKind::FarmHarvestLineCorrect,
+ FarmCrdtDocumentKind::FarmHarvestRecord,
+ FarmSemanticKind::FarmHarvestLineCorrect,
),
(
- RadrootsFarmCrdtDocumentKind::FarmHarvestRecord,
- RadrootsFarmSemanticKind::FarmHarvestLineVoid,
+ FarmCrdtDocumentKind::FarmHarvestRecord,
+ FarmSemanticKind::FarmHarvestLineVoid,
),
(
- RadrootsFarmCrdtDocumentKind::FarmMembership,
- RadrootsFarmSemanticKind::FarmMemberInviteCreate,
+ FarmCrdtDocumentKind::FarmMembership,
+ FarmSemanticKind::FarmMemberInviteCreate,
),
(
- RadrootsFarmCrdtDocumentKind::FarmMembership,
- RadrootsFarmSemanticKind::FarmMemberApprove,
+ FarmCrdtDocumentKind::FarmMembership,
+ FarmSemanticKind::FarmMemberApprove,
),
(
- RadrootsFarmCrdtDocumentKind::FarmMembership,
- RadrootsFarmSemanticKind::FarmMemberRoleSet,
+ FarmCrdtDocumentKind::FarmMembership,
+ FarmSemanticKind::FarmMemberRoleSet,
),
(
- RadrootsFarmCrdtDocumentKind::FarmPayPeriod,
- RadrootsFarmSemanticKind::FarmPayPeriodClose,
+ FarmCrdtDocumentKind::FarmPayPeriod,
+ FarmSemanticKind::FarmPayPeriodClose,
),
(
- RadrootsFarmCrdtDocumentKind::FarmPayPeriod,
- RadrootsFarmSemanticKind::FarmReportExportMark,
+ FarmCrdtDocumentKind::FarmPayPeriod,
+ FarmSemanticKind::FarmReportExportMark,
),
];
@@ -547,29 +546,29 @@ mod tests {
assert_same_encode_error(wrong_kind, EventEncodeError::InvalidKind(KIND_POST));
}
- fn sample_change() -> RadrootsFarmCrdtChange {
+ fn sample_change() -> FarmCrdtChange {
sample_change_with(
DOCUMENT_ID,
- RadrootsFarmCrdtDocumentKind::FarmTask,
- RadrootsFarmSemanticKind::FarmTaskCreate,
+ FarmCrdtDocumentKind::FarmTask,
+ FarmSemanticKind::FarmTaskCreate,
)
}
fn sample_change_with(
document_id: &str,
- document_kind: RadrootsFarmCrdtDocumentKind,
- semantic_kind: RadrootsFarmSemanticKind,
- ) -> RadrootsFarmCrdtChange {
- RadrootsFarmCrdtChange {
+ document_kind: FarmCrdtDocumentKind,
+ semantic_kind: FarmSemanticKind,
+ ) -> FarmCrdtChange {
+ FarmCrdtChange {
schema: RADROOTS_FARM_CRDT_CHANGE_SCHEMA.to_string(),
- workspace: RadrootsFarmWorkspaceRef {
+ workspace: FarmWorkspaceRef {
pubkey: "workspace_pubkey".to_string(),
d_tag: WORKSPACE_D_TAG.to_string(),
},
farm_group_id: GROUP_ID.to_string(),
document_id: document_id.to_string(),
document_kind,
- crdt_backend: RadrootsCrdtBackend::Automerge,
+ crdt_backend: CrdtBackend::Automerge,
crdt_backend_version: Some("0.x".to_string()),
actor_id: "actor_abc".to_string(),
change_hash: "crdt_hash_abc".to_string(),
diff --git a/crates/event_codec/src/farm_file/decode.rs b/crates/event_codec/src/farm_file/decode.rs
@@ -5,11 +5,8 @@ use alloc::{
};
use radroots_event::{
- farm::crdt::RadrootsFarmCrdtDocumentKind,
- farm::file::{
- KIND_FARM_FILE_METADATA, RadrootsFarmFileDimensions, RadrootsFarmFileMetadata,
- RadrootsFarmFileSource,
- },
+ farm::crdt::FarmCrdtDocumentKind,
+ farm::file::{FarmFileDimensions, FarmFileMetadata, FarmFileSource, KIND_FARM_FILE_METADATA},
farm::workspace::KIND_FARM_WORKSPACE_MANIFEST,
tag::name::{TAG_A, TAG_D, TAG_H, TAG_MIME, TAG_ORIGINAL_SHA256, TAG_SHA256, TAG_URL},
};
@@ -37,7 +34,7 @@ pub fn farm_file_metadata_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsFarmFileMetadata, EventParseError> {
+) -> Result<FarmFileMetadata, EventParseError> {
if kind != KIND_FARM_FILE_METADATA {
return Err(EventParseError::InvalidKind {
expected: EXPECTED_KIND,
@@ -69,9 +66,9 @@ pub fn farm_file_metadata_from_event(
Some(content.to_string())
};
- let metadata = RadrootsFarmFileMetadata {
+ let metadata = FarmFileMetadata {
d_tag,
- workspace: radroots_event::farm::workspace::RadrootsFarmWorkspaceRef {
+ workspace: radroots_event::farm::workspace::FarmWorkspaceRef {
pubkey: workspace.pubkey,
d_tag: workspace.d_tag,
},
@@ -102,7 +99,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsFarmFileMetadata>, EventParseError> {
+) -> Result<RadrootsParsedData<FarmFileMetadata>, EventParseError> {
let metadata = farm_file_metadata_from_event(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -121,7 +118,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsFarmFileMetadata>, EventParseError> {
+) -> Result<RadrootsParsedEvent<FarmFileMetadata>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
@@ -160,7 +157,7 @@ fn optional_hash_tag(
fn parse_owner_document(
tags: &[Vec<String>],
-) -> Result<(String, RadrootsFarmCrdtDocumentKind), EventParseError> {
+) -> Result<(String, FarmCrdtDocumentKind), EventParseError> {
let tag = tags
.iter()
.find(|tag| tag.first().map(|value| value.as_str()) == Some(TAG_OWNER_DOCUMENT))
@@ -174,11 +171,11 @@ fn parse_owner_document(
Ok((document_id, kind))
}
-fn parse_document_kind_tag(value: &str) -> Result<RadrootsFarmCrdtDocumentKind, EventParseError> {
+fn parse_document_kind_tag(value: &str) -> Result<FarmCrdtDocumentKind, EventParseError> {
if value.trim().is_empty() {
Err(EventParseError::InvalidTag(TAG_OWNER_DOCUMENT))
} else {
- Ok(RadrootsFarmCrdtDocumentKind::from(value.to_string()))
+ Ok(FarmCrdtDocumentKind::from(value.to_string()))
}
}
@@ -194,17 +191,14 @@ fn parse_size(tags: &[Vec<String>]) -> Result<Option<u64>, EventParseError> {
fn parse_dimensions_tag(
tags: &[Vec<String>],
-) -> Result<Option<RadrootsFarmFileDimensions>, EventParseError> {
+) -> Result<Option<FarmFileDimensions>, EventParseError> {
let Some(value) = optional_tag_value(tags, TAG_DIMENSIONS)? else {
return Ok(None);
};
Ok(Some(parse_dimensions(&value, TAG_DIMENSIONS)?))
}
-fn parse_dimensions(
- value: &str,
- tag: &'static str,
-) -> Result<RadrootsFarmFileDimensions, EventParseError> {
+fn parse_dimensions(value: &str, tag: &'static str) -> Result<FarmFileDimensions, EventParseError> {
let (w, h) = value
.split_once('x')
.ok_or(EventParseError::InvalidTag(tag))?;
@@ -217,13 +211,13 @@ fn parse_dimensions(
if w == 0 || h == 0 {
return Err(EventParseError::InvalidTag(tag));
}
- Ok(RadrootsFarmFileDimensions { w, h })
+ Ok(FarmFileDimensions { w, h })
}
fn parse_source_tag(
tags: &[Vec<String>],
key: &'static str,
-) -> Result<Option<RadrootsFarmFileSource>, EventParseError> {
+) -> Result<Option<FarmFileSource>, EventParseError> {
let Some(tag) = tags
.iter()
.find(|tag| tag.first().map(|value| value.as_str()) == Some(key))
@@ -249,7 +243,7 @@ fn parse_source_tag(
validate_non_empty_tag_value(value, key)?;
dimensions = Some(parse_dimensions(value, key)?);
}
- Ok(Some(RadrootsFarmFileSource {
+ Ok(Some(FarmFileSource {
url,
mime_type,
dimensions,
diff --git a/crates/event_codec/src/farm_file/encode.rs b/crates/event_codec/src/farm_file/encode.rs
@@ -7,11 +7,8 @@ use alloc::{
};
use radroots_event::{
- farm::crdt::RadrootsFarmCrdtDocumentKind,
- farm::file::{
- KIND_FARM_FILE_METADATA, RadrootsFarmFileDimensions, RadrootsFarmFileMetadata,
- RadrootsFarmFileSource,
- },
+ farm::crdt::FarmCrdtDocumentKind,
+ farm::file::{FarmFileDimensions, FarmFileMetadata, FarmFileSource, KIND_FARM_FILE_METADATA},
farm::workspace::KIND_FARM_WORKSPACE_MANIFEST,
tag::name::{TAG_A, TAG_D, TAG_H, TAG_MIME, TAG_ORIGINAL_SHA256, TAG_SHA256, TAG_URL},
};
@@ -22,7 +19,7 @@ use crate::field_helpers::{
push_optional_tag, push_tag, push_tag_values, validate_lowercase_hex_64,
validate_non_empty_field,
};
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
const TAG_ALT: &str = "alt";
const TAG_BLURHASH: &str = "blurhash";
@@ -34,7 +31,7 @@ const TAG_SIZE: &str = "size";
const TAG_THUMB: &str = "thumb";
pub fn farm_file_metadata_build_tags(
- metadata: &RadrootsFarmFileMetadata,
+ metadata: &FarmFileMetadata,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
validate_metadata(metadata)?;
let workspace = format!(
@@ -78,30 +75,26 @@ pub fn farm_file_metadata_build_tags(
Ok(tags)
}
-pub fn to_wire_parts(
- metadata: &RadrootsFarmFileMetadata,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+pub fn to_wire_parts(metadata: &FarmFileMetadata) -> Result<Nip01EventWireParts, EventEncodeError> {
to_wire_parts_with_kind(metadata, KIND_FARM_FILE_METADATA)
}
pub fn to_wire_parts_with_kind(
- metadata: &RadrootsFarmFileMetadata,
+ metadata: &FarmFileMetadata,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != KIND_FARM_FILE_METADATA {
return Err(EventEncodeError::InvalidKind(kind));
}
let tags = farm_file_metadata_build_tags(metadata)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content: metadata.caption.clone().unwrap_or_default(),
tags,
})
}
-pub(crate) fn validate_metadata(
- metadata: &RadrootsFarmFileMetadata,
-) -> Result<(), EventEncodeError> {
+pub(crate) fn validate_metadata(metadata: &FarmFileMetadata) -> Result<(), EventEncodeError> {
validate_d_tag(&metadata.d_tag, "d_tag")?;
validate_non_empty_field(&metadata.farm_group_id, "farm_group_id")?;
validate_non_empty_field(&metadata.workspace.pubkey, "workspace.pubkey")?;
@@ -133,12 +126,12 @@ pub(crate) fn validate_metadata(
Ok(())
}
-pub(crate) fn document_kind_tag(kind: &RadrootsFarmCrdtDocumentKind) -> String {
+pub(crate) fn document_kind_tag(kind: &FarmCrdtDocumentKind) -> String {
kind.as_str().to_string()
}
fn validate_dimensions(
- dimensions: RadrootsFarmFileDimensions,
+ dimensions: FarmFileDimensions,
field: &'static str,
) -> Result<(), EventEncodeError> {
if dimensions.w == 0 || dimensions.h == 0 {
@@ -149,7 +142,7 @@ fn validate_dimensions(
}
fn validate_source(
- source: Option<&RadrootsFarmFileSource>,
+ source: Option<&FarmFileSource>,
field: &'static str,
) -> Result<(), EventEncodeError> {
let Some(source) = source else {
@@ -168,7 +161,7 @@ fn validate_source(
fn push_source_tag(
tags: &mut Vec<Vec<String>>,
key: &'static str,
- source: Option<&RadrootsFarmFileSource>,
+ source: Option<&FarmFileSource>,
) -> Result<(), EventEncodeError> {
let Some(source) = source else {
return Ok(());
@@ -185,6 +178,6 @@ fn push_source_tag(
Ok(())
}
-fn dimensions_tag(dimensions: RadrootsFarmFileDimensions) -> String {
+fn dimensions_tag(dimensions: FarmFileDimensions) -> String {
format!("{}x{}", dimensions.w, dimensions.h)
}
diff --git a/crates/event_codec/src/farm_file/mod.rs b/crates/event_codec/src/farm_file/mod.rs
@@ -5,12 +5,11 @@ pub mod encode;
mod tests {
use radroots_event::{
envelope::kind::KIND_POST,
- farm::crdt::RadrootsFarmCrdtDocumentKind,
+ farm::crdt::FarmCrdtDocumentKind,
farm::file::{
- KIND_FARM_FILE_METADATA, RadrootsFarmFileDimensions, RadrootsFarmFileMetadata,
- RadrootsFarmFileSource,
+ FarmFileDimensions, FarmFileMetadata, FarmFileSource, KIND_FARM_FILE_METADATA,
},
- farm::workspace::RadrootsFarmWorkspaceRef,
+ farm::workspace::FarmWorkspaceRef,
};
use crate::error::{EventEncodeError, EventParseError};
@@ -134,10 +133,10 @@ mod tests {
metadata.dimensions = None;
metadata.blurhash = None;
metadata.thumb = None;
- metadata.image = Some(RadrootsFarmFileSource {
+ metadata.image = Some(FarmFileSource {
url: "https://media.example.invalid/image/sha256".to_string(),
mime_type: None,
- dimensions: Some(RadrootsFarmFileDimensions { w: 640, h: 480 }),
+ dimensions: Some(FarmFileDimensions { w: 640, h: 480 }),
});
metadata.alt = None;
metadata.fallbacks.clear();
@@ -212,16 +211,16 @@ mod tests {
#[test]
fn farm_file_metadata_preserves_expanded_owner_document_kinds() {
for kind in [
- RadrootsFarmCrdtDocumentKind::FarmMembership,
- RadrootsFarmCrdtDocumentKind::FarmRolePolicy,
- RadrootsFarmCrdtDocumentKind::FarmActivity,
- RadrootsFarmCrdtDocumentKind::FarmLocation,
- RadrootsFarmCrdtDocumentKind::FarmCrop,
- RadrootsFarmCrdtDocumentKind::FarmCropVariety,
- RadrootsFarmCrdtDocumentKind::FarmCropCycle,
- RadrootsFarmCrdtDocumentKind::FarmAttachment,
- RadrootsFarmCrdtDocumentKind::FarmPayPeriod,
- RadrootsFarmCrdtDocumentKind::Other {
+ FarmCrdtDocumentKind::FarmMembership,
+ FarmCrdtDocumentKind::FarmRolePolicy,
+ FarmCrdtDocumentKind::FarmActivity,
+ FarmCrdtDocumentKind::FarmLocation,
+ FarmCrdtDocumentKind::FarmCrop,
+ FarmCrdtDocumentKind::FarmCropVariety,
+ FarmCrdtDocumentKind::FarmCropCycle,
+ FarmCrdtDocumentKind::FarmAttachment,
+ FarmCrdtDocumentKind::FarmPayPeriod,
+ FarmCrdtDocumentKind::Other {
value: "FarmSoilTest".to_string(),
},
] {
@@ -336,7 +335,7 @@ mod tests {
);
assert_eq!(
decoded.thumb.and_then(|source| source.dimensions),
- Some(RadrootsFarmFileDimensions { w: 320, h: 240 })
+ Some(FarmFileDimensions { w: 320, h: 240 })
);
let tags = replace_tag(
@@ -370,7 +369,7 @@ mod tests {
},
{
let mut metadata = sample_metadata();
- metadata.dimensions = Some(RadrootsFarmFileDimensions { w: 0, h: 1200 });
+ metadata.dimensions = Some(FarmFileDimensions { w: 0, h: 1200 });
(metadata, EventEncodeError::InvalidField("dimensions"))
},
{
@@ -380,7 +379,7 @@ mod tests {
},
{
let mut metadata = sample_metadata();
- metadata.thumb = Some(RadrootsFarmFileSource {
+ metadata.thumb = Some(FarmFileSource {
url: "".to_string(),
mime_type: None,
dimensions: None,
@@ -389,7 +388,7 @@ mod tests {
},
{
let mut metadata = sample_metadata();
- metadata.thumb = Some(RadrootsFarmFileSource {
+ metadata.thumb = Some(FarmFileSource {
url: "https://media.example.invalid/thumb/sha256".to_string(),
mime_type: Some("".to_string()),
dimensions: None,
@@ -398,10 +397,10 @@ mod tests {
},
{
let mut metadata = sample_metadata();
- metadata.thumb = Some(RadrootsFarmFileSource {
+ metadata.thumb = Some(FarmFileSource {
url: "https://media.example.invalid/thumb/sha256".to_string(),
mime_type: None,
- dimensions: Some(RadrootsFarmFileDimensions { w: 320, h: 0 }),
+ dimensions: Some(FarmFileDimensions { w: 320, h: 0 }),
});
(metadata, EventEncodeError::InvalidField("thumb"))
},
@@ -421,16 +420,16 @@ mod tests {
}
}
- fn sample_metadata() -> RadrootsFarmFileMetadata {
- RadrootsFarmFileMetadata {
+ fn sample_metadata() -> FarmFileMetadata {
+ FarmFileMetadata {
d_tag: FILE_D_TAG.to_string(),
- workspace: RadrootsFarmWorkspaceRef {
+ workspace: FarmWorkspaceRef {
pubkey: "workspace_pubkey".to_string(),
d_tag: WORKSPACE_D_TAG.to_string(),
},
farm_group_id: GROUP_ID.to_string(),
owner_document_id: OWNER_DOCUMENT_ID.to_string(),
- owner_document_kind: RadrootsFarmCrdtDocumentKind::FarmTask,
+ owner_document_kind: FarmCrdtDocumentKind::FarmTask,
caption: Some("Tomatoes harvested from Patch Y.".to_string()),
url: "https://media.example.invalid/blob/sha256".to_string(),
mime_type: "image/jpeg".to_string(),
@@ -439,12 +438,12 @@ mod tests {
"abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789".to_string(),
),
size_bytes: Some(123_456),
- dimensions: Some(RadrootsFarmFileDimensions { w: 1600, h: 1200 }),
+ dimensions: Some(FarmFileDimensions { w: 1600, h: 1200 }),
blurhash: Some("LEHV6nWB2yk8pyo0adR*.7kCMdnj".to_string()),
- thumb: Some(RadrootsFarmFileSource {
+ thumb: Some(FarmFileSource {
url: "https://media.example.invalid/thumb/sha256".to_string(),
mime_type: Some("image/jpeg".to_string()),
- dimensions: Some(RadrootsFarmFileDimensions { w: 320, h: 240 }),
+ dimensions: Some(FarmFileDimensions { w: 320, h: 240 }),
}),
image: None,
alt: Some("Harvested tomatoes in a crate".to_string()),
diff --git a/crates/event_codec/src/farm_workspace/decode.rs b/crates/event_codec/src/farm_workspace/decode.rs
@@ -4,7 +4,7 @@ use alloc::{string::String, vec::Vec};
use radroots_event::{
envelope::kind::KIND_FARM,
farm::workspace::{
- KIND_FARM_WORKSPACE_MANIFEST, RADROOTS_FARM_WORKSPACE_TAG, RadrootsFarmWorkspaceManifest,
+ FarmWorkspaceManifest, KIND_FARM_WORKSPACE_MANIFEST, RADROOTS_FARM_WORKSPACE_TAG,
},
tag::name::{TAG_A, TAG_D, TAG_H, TAG_P, TAG_T},
};
@@ -23,7 +23,7 @@ pub fn farm_workspace_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsFarmWorkspaceManifest, EventParseError> {
+) -> Result<FarmWorkspaceManifest, EventParseError> {
if kind != KIND_FARM_WORKSPACE_MANIFEST {
return Err(EventParseError::InvalidKind {
expected: EXPECTED_KIND,
@@ -36,7 +36,7 @@ pub fn farm_workspace_from_event(
let d_tag = required_tag_value(tags, TAG_D)?;
validate_d_tag_tag(&d_tag, TAG_D)?;
let farm_group_id = required_tag_value(tags, TAG_H)?;
- let manifest: RadrootsFarmWorkspaceManifest =
+ let manifest: FarmWorkspaceManifest =
serde_json::from_str(content).map_err(|_| EventParseError::InvalidJson("content"))?;
validate_manifest(&manifest).map_err(encode_error_to_parse_error)?;
@@ -78,7 +78,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsFarmWorkspaceManifest>, EventParseError> {
+) -> Result<RadrootsParsedData<FarmWorkspaceManifest>, EventParseError> {
let manifest = farm_workspace_from_event(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -97,7 +97,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsFarmWorkspaceManifest>, EventParseError> {
+) -> Result<RadrootsParsedEvent<FarmWorkspaceManifest>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
diff --git a/crates/event_codec/src/farm_workspace/encode.rs b/crates/event_codec/src/farm_workspace/encode.rs
@@ -4,8 +4,8 @@ use alloc::{string::String, vec::Vec};
use radroots_event::{
envelope::kind::{KIND_FARM, KIND_FARM_CRDT_CHANGE, KIND_FARM_FILE_METADATA},
farm::workspace::{
- KIND_FARM_WORKSPACE_MANIFEST, RADROOTS_FARM_WORKSPACE_SCHEMA, RADROOTS_FARM_WORKSPACE_TAG,
- RadrootsFarmWorkspaceManifest,
+ FarmWorkspaceManifest, KIND_FARM_WORKSPACE_MANIFEST, RADROOTS_FARM_WORKSPACE_SCHEMA,
+ RADROOTS_FARM_WORKSPACE_TAG,
},
tag::name::{TAG_A, TAG_D, TAG_H, TAG_P, TAG_T},
};
@@ -14,10 +14,10 @@ use crate::d_tag::validate_d_tag;
use crate::error::EventEncodeError;
use crate::field_helpers::{address_string, push_tag, validate_non_empty_field};
#[cfg(feature = "serde_json")]
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
pub fn farm_workspace_build_tags(
- manifest: &RadrootsFarmWorkspaceManifest,
+ manifest: &FarmWorkspaceManifest,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
validate_manifest(manifest)?;
let mut tags = Vec::new();
@@ -34,31 +34,29 @@ pub fn farm_workspace_build_tags(
#[cfg(feature = "serde_json")]
pub fn to_wire_parts(
- manifest: &RadrootsFarmWorkspaceManifest,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ manifest: &FarmWorkspaceManifest,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
to_wire_parts_with_kind(manifest, KIND_FARM_WORKSPACE_MANIFEST)
}
#[cfg(feature = "serde_json")]
pub fn to_wire_parts_with_kind(
- manifest: &RadrootsFarmWorkspaceManifest,
+ manifest: &FarmWorkspaceManifest,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != KIND_FARM_WORKSPACE_MANIFEST {
return Err(EventEncodeError::InvalidKind(kind));
}
let tags = farm_workspace_build_tags(manifest)?;
let content = serde_json::to_string(manifest).map_err(|_| EventEncodeError::Json)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content,
tags,
})
}
-pub(crate) fn validate_manifest(
- manifest: &RadrootsFarmWorkspaceManifest,
-) -> Result<(), EventEncodeError> {
+pub(crate) fn validate_manifest(manifest: &FarmWorkspaceManifest) -> Result<(), EventEncodeError> {
validate_d_tag(&manifest.d_tag, "d_tag")?;
validate_non_empty_field(&manifest.farm_group_id, "farm_group_id")?;
validate_non_empty_field(&manifest.name, "name")?;
diff --git a/crates/event_codec/src/farm_workspace/mod.rs b/crates/event_codec/src/farm_workspace/mod.rs
@@ -7,13 +7,13 @@ pub mod decode;
mod tests {
use radroots_event::{
envelope::kind::{KIND_FARM, KIND_FARM_FILE_METADATA, KIND_POST},
- farm::RadrootsFarmRef,
+ farm::FarmRef,
farm::crdt::KIND_FARM_CRDT_CHANGE,
farm::workspace::{
- KIND_FARM_WORKSPACE_MANIFEST, RADROOTS_FARM_WORKSPACE_PROTOCOL_VERSION,
- RADROOTS_FARM_WORKSPACE_SCHEMA, RADROOTS_FARM_WORKSPACE_TAG,
- RadrootsFarmWorkspaceManifest, RadrootsFarmWorkspaceMediaServer,
- RadrootsFarmWorkspaceRelay, RadrootsFarmWorkspaceRelayMode,
+ FarmWorkspaceManifest, FarmWorkspaceMediaServer, FarmWorkspaceRelay,
+ FarmWorkspaceRelayMode, KIND_FARM_WORKSPACE_MANIFEST,
+ RADROOTS_FARM_WORKSPACE_PROTOCOL_VERSION, RADROOTS_FARM_WORKSPACE_SCHEMA,
+ RADROOTS_FARM_WORKSPACE_TAG,
},
};
@@ -382,22 +382,22 @@ mod tests {
}
}
- fn sample_manifest() -> RadrootsFarmWorkspaceManifest {
- RadrootsFarmWorkspaceManifest {
+ fn sample_manifest() -> FarmWorkspaceManifest {
+ FarmWorkspaceManifest {
d_tag: D_TAG.to_string(),
schema: RADROOTS_FARM_WORKSPACE_SCHEMA.to_string(),
farm_group_id: GROUP_ID.to_string(),
name: "Small Regen Farm".to_string(),
owner_pubkey: "workspace_owner_pubkey".to_string(),
- farm: Some(RadrootsFarmRef {
+ farm: Some(FarmRef {
pubkey: "farm_pubkey".to_string(),
d_tag: FARM_D_TAG.to_string(),
}),
- relays: vec![RadrootsFarmWorkspaceRelay {
+ relays: vec![FarmWorkspaceRelay {
url: "wss://relay.example.invalid/farm/field-group".to_string(),
- mode: RadrootsFarmWorkspaceRelayMode::ReadWrite,
+ mode: FarmWorkspaceRelayMode::ReadWrite,
}],
- media_servers: vec![RadrootsFarmWorkspaceMediaServer {
+ media_servers: vec![FarmWorkspaceMediaServer {
url: "https://media.example.invalid/farm/field-group".to_string(),
service: "RadrootsPrivateMedia".to_string(),
}],
@@ -428,10 +428,7 @@ mod tests {
*tag = replacement;
}
- fn assert_same_manifest(
- actual: &RadrootsFarmWorkspaceManifest,
- expected: &RadrootsFarmWorkspaceManifest,
- ) {
+ fn assert_same_manifest(actual: &FarmWorkspaceManifest, expected: &FarmWorkspaceManifest) {
assert_eq!(
serde_json::to_value(actual).expect("actual manifest value"),
serde_json::to_value(expected).expect("expected manifest value")
diff --git a/crates/event_codec/src/file_metadata/decode.rs b/crates/event_codec/src/file_metadata/decode.rs
@@ -6,8 +6,8 @@ use alloc::{
use radroots_event::{
envelope::kind::KIND_PUBLIC_FILE_METADATA,
- media::file_metadata::RadrootsFileMetadata,
- social::RadrootsSocialMediaThumbnail,
+ media::file_metadata::FileMetadata,
+ social::SocialMediaThumbnail,
tag::name::{
TAG_ALT, TAG_BLURHASH, TAG_DIMENSIONS, TAG_FALLBACK, TAG_MAGNET, TAG_MIME,
TAG_ORIGINAL_SHA256, TAG_SERVICE, TAG_SHA256, TAG_SIZE, TAG_SUMMARY, TAG_THUMB, TAG_URL,
@@ -28,7 +28,7 @@ pub fn file_metadata_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsFileMetadata, EventParseError> {
+) -> Result<FileMetadata, EventParseError> {
if kind != KIND_PUBLIC_FILE_METADATA {
return Err(EventParseError::InvalidKind {
expected: EXPECTED_KIND,
@@ -52,7 +52,7 @@ pub fn file_metadata_from_event(
.map(|value| parse_dimensions_tag(&value, TAG_DIMENSIONS))
.transpose()?;
- Ok(RadrootsFileMetadata {
+ Ok(FileMetadata {
url,
mime_type,
sha256,
@@ -93,7 +93,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsFileMetadata>, EventParseError> {
+) -> Result<RadrootsParsedData<FileMetadata>, EventParseError> {
let metadata = file_metadata_from_event(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -112,7 +112,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsFileMetadata>, EventParseError> {
+) -> Result<RadrootsParsedEvent<FileMetadata>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
@@ -137,7 +137,7 @@ fn optional_hash_tag(
fn parse_thumbnails(
tags: &[Vec<String>],
-) -> Result<Option<Vec<RadrootsSocialMediaThumbnail>>, EventParseError> {
+) -> Result<Option<Vec<SocialMediaThumbnail>>, EventParseError> {
let thumbnails = tags
.iter()
.filter(|tag| tag.first().map(|value| value.as_str()) == Some(TAG_THUMB))
@@ -151,7 +151,7 @@ fn parse_thumbnails(
.filter(|value| !value.trim().is_empty())
.map(|value| parse_dimensions_tag(value, TAG_THUMB))
.transpose()?;
- Ok(RadrootsSocialMediaThumbnail { url, dimensions })
+ Ok(SocialMediaThumbnail { url, dimensions })
})
.collect::<Result<Vec<_>, EventParseError>>()?;
Ok(non_empty_vec(thumbnails))
diff --git a/crates/event_codec/src/file_metadata/encode.rs b/crates/event_codec/src/file_metadata/encode.rs
@@ -6,7 +6,7 @@ use alloc::{
use radroots_event::{
envelope::kind::KIND_PUBLIC_FILE_METADATA,
- media::file_metadata::RadrootsFileMetadata,
+ media::file_metadata::FileMetadata,
tag::name::{
TAG_ALT, TAG_BLURHASH, TAG_DIMENSIONS, TAG_FALLBACK, TAG_MAGNET, TAG_MIME,
TAG_ORIGINAL_SHA256, TAG_SERVICE, TAG_SHA256, TAG_SIZE, TAG_SUMMARY, TAG_URL,
@@ -18,12 +18,12 @@ use crate::field_helpers::{
push_optional_tag, push_tag, validate_lowercase_hex_64, validate_non_empty_field,
};
use crate::social_helpers::{dimensions_tag, push_thumbnail, validate_http_url};
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
const DEFAULT_KIND: u32 = KIND_PUBLIC_FILE_METADATA;
pub fn file_metadata_build_tags(
- metadata: &RadrootsFileMetadata,
+ metadata: &FileMetadata,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
validate_metadata(metadata)?;
let mut tags = Vec::new();
@@ -64,27 +64,25 @@ pub fn file_metadata_build_tags(
Ok(tags)
}
-pub fn to_wire_parts(
- metadata: &RadrootsFileMetadata,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+pub fn to_wire_parts(metadata: &FileMetadata) -> Result<Nip01EventWireParts, EventEncodeError> {
to_wire_parts_with_kind(metadata, DEFAULT_KIND)
}
pub fn to_wire_parts_with_kind(
- metadata: &RadrootsFileMetadata,
+ metadata: &FileMetadata,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != DEFAULT_KIND {
return Err(EventEncodeError::InvalidKind(kind));
}
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content: metadata.content.clone().unwrap_or_default(),
tags: file_metadata_build_tags(metadata)?,
})
}
-fn validate_metadata(metadata: &RadrootsFileMetadata) -> Result<(), EventEncodeError> {
+fn validate_metadata(metadata: &FileMetadata) -> Result<(), EventEncodeError> {
validate_http_url(&metadata.url, "url")?;
validate_non_empty_field(&metadata.mime_type, "mime_type")?;
validate_lowercase_hex_64(&metadata.sha256, "sha256")?;
diff --git a/crates/event_codec/src/follow/decode.rs b/crates/event_codec/src/follow/decode.rs
@@ -3,7 +3,7 @@ use alloc::{string::String, vec::Vec};
use radroots_event::{
envelope::kind::KIND_FOLLOW,
- social::follow::{RadrootsFollow, RadrootsFollowProfile},
+ social::follow::{Follow, FollowProfile},
};
use crate::error::EventParseError;
@@ -15,10 +15,7 @@ fn looks_like_ws_relay(s: &str) -> bool {
s.starts_with("ws://") || s.starts_with("wss://")
}
-fn parse_follow_tag(
- tag: &[String],
- published_at: u64,
-) -> Result<RadrootsFollowProfile, EventParseError> {
+fn parse_follow_tag(tag: &[String], published_at: u64) -> Result<FollowProfile, EventParseError> {
let public_key = tag.get(1).ok_or(EventParseError::InvalidTag("p"))?;
let (relay_url, contact_name) = match tag.get(2).filter(|s| !s.is_empty()) {
Some(value) if looks_like_ws_relay(value) => (
@@ -36,7 +33,7 @@ fn parse_follow_tag(
None => published_at,
};
- Ok(RadrootsFollowProfile {
+ Ok(FollowProfile {
published_at,
public_key: public_key.clone(),
relay_url,
@@ -48,7 +45,7 @@ pub fn follow_from_tags(
kind: u32,
tags: &[Vec<String>],
published_at: u64,
-) -> Result<RadrootsFollow, EventParseError> {
+) -> Result<Follow, EventParseError> {
if kind != DEFAULT_KIND {
return Err(EventParseError::InvalidKind {
expected: "3",
@@ -62,7 +59,7 @@ pub fn follow_from_tags(
{
list.push(parse_follow_tag(tag, published_at)?);
}
- Ok(RadrootsFollow { list })
+ Ok(Follow { list })
}
pub fn data_from_event(
@@ -72,7 +69,7 @@ pub fn data_from_event(
kind: u32,
_content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsFollow>, EventParseError> {
+) -> Result<RadrootsParsedData<Follow>, EventParseError> {
let follow = follow_from_tags(kind, &tags, published_at)?;
Ok(RadrootsParsedData::new(
id,
@@ -91,7 +88,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsFollow>, EventParseError> {
+) -> Result<RadrootsParsedEvent<Follow>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
diff --git a/crates/event_codec/src/follow/encode.rs b/crates/event_codec/src/follow/encode.rs
@@ -4,15 +4,15 @@ use alloc::{
vec::Vec,
};
-use radroots_event::social::follow::{RadrootsFollow, RadrootsFollowProfile};
+use radroots_event::social::follow::{Follow, FollowProfile};
use crate::error::EventEncodeError;
use radroots_event::envelope::kind::KIND_FOLLOW;
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
const DEFAULT_KIND: u32 = KIND_FOLLOW;
-fn follow_tag(profile: &RadrootsFollowProfile) -> Result<Vec<String>, EventEncodeError> {
+fn follow_tag(profile: &FollowProfile) -> Result<Vec<String>, EventEncodeError> {
if profile.public_key.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("follow.public_key"));
}
@@ -31,7 +31,7 @@ fn follow_tag(profile: &RadrootsFollowProfile) -> Result<Vec<String>, EventEncod
Ok(tag)
}
-pub fn follow_build_tags(follow: &RadrootsFollow) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn follow_build_tags(follow: &Follow) -> Result<Vec<Vec<String>>, EventEncodeError> {
let mut tags = Vec::with_capacity(follow.list.len());
for profile in &follow.list {
tags.push(follow_tag(profile)?);
@@ -58,28 +58,23 @@ pub enum FollowMutation {
},
}
-pub fn to_wire_parts(
- follow: &RadrootsFollow,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+pub fn to_wire_parts(follow: &Follow) -> Result<Nip01EventWireParts, EventEncodeError> {
to_wire_parts_with_kind(follow, DEFAULT_KIND)
}
pub fn to_wire_parts_with_kind(
- follow: &RadrootsFollow,
+ follow: &Follow,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
let tags = follow_build_tags(follow)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content: String::new(),
tags,
})
}
-pub fn follow_apply(
- follow: &RadrootsFollow,
- mutation: FollowMutation,
-) -> Result<RadrootsFollow, EventEncodeError> {
+pub fn follow_apply(follow: &Follow, mutation: FollowMutation) -> Result<Follow, EventEncodeError> {
let mut list = normalize_list(&follow.list)?;
match mutation {
@@ -108,7 +103,7 @@ pub fn follow_apply(
} else {
let relay_url = normalize_optional(relay_url);
let contact_name = normalize_optional(contact_name);
- list.push(RadrootsFollowProfile {
+ list.push(FollowProfile {
published_at: 0,
public_key,
relay_url,
@@ -118,13 +113,13 @@ pub fn follow_apply(
}
}
- Ok(RadrootsFollow { list })
+ Ok(Follow { list })
}
pub fn follow_to_wire_parts_after(
- follow: &RadrootsFollow,
+ follow: &Follow,
mutation: FollowMutation,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
let updated = follow_apply(follow, mutation)?;
to_wire_parts(&updated)
}
@@ -148,15 +143,13 @@ fn normalize_optional(value: Option<String>) -> Option<String> {
})
}
-fn normalize_list(
- list: &[RadrootsFollowProfile],
-) -> Result<Vec<RadrootsFollowProfile>, EventEncodeError> {
+fn normalize_list(list: &[FollowProfile]) -> Result<Vec<FollowProfile>, EventEncodeError> {
let mut out = Vec::with_capacity(list.len());
for entry in list {
let public_key = normalize_public_key(&entry.public_key)?;
if out
.iter()
- .any(|item: &RadrootsFollowProfile| item.public_key == public_key)
+ .any(|item: &FollowProfile| item.public_key == public_key)
{
continue;
}
@@ -170,7 +163,7 @@ fn normalize_list(
}
fn apply_follow(
- list: &mut Vec<RadrootsFollowProfile>,
+ list: &mut Vec<FollowProfile>,
public_key: String,
relay_url: Option<String>,
contact_name: Option<String>,
@@ -185,7 +178,7 @@ fn apply_follow(
}
list[pos] = entry;
} else {
- list.push(RadrootsFollowProfile {
+ list.push(FollowProfile {
published_at: 0,
public_key,
relay_url,
diff --git a/crates/event_codec/src/food_availability/admission.rs b/crates/event_codec/src/food_availability/admission.rs
@@ -4,9 +4,9 @@ use alloc::boxed::Box;
use core::fmt;
use radroots_event::{
- contract::RadrootsEventContract, envelope::RadrootsEventEnvelope,
+ contract::EventContract, envelope::EventEnvelope,
food::availability::RADROOTS_FOOD_AVAILABILITY_CONTRACT_ID,
- listing::classified::RadrootsClassifiedListingPartition,
+ listing::classified::ClassifiedListingPartition,
};
use crate::{
@@ -31,7 +31,7 @@ impl RadrootsAdmittedFoodAvailabilityEvent {
&self.verified_event
}
- pub fn event(&self) -> &RadrootsEventEnvelope {
+ pub fn event(&self) -> &EventEnvelope {
self.verified_event.event()
}
@@ -39,7 +39,7 @@ impl RadrootsAdmittedFoodAvailabilityEvent {
&self.projection
}
- pub fn contract(&self) -> &'static RadrootsEventContract {
+ pub fn contract(&self) -> &'static EventContract {
radroots_event::contract::event_contract(RADROOTS_FOOD_AVAILABILITY_CONTRACT_ID)
.expect("FoodAvailability contract ID is registry-owned")
}
@@ -58,7 +58,7 @@ impl RadrootsAdmittedFoodAvailabilityEvent {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsExcludedClassifiedListingCandidate {
verified_event: RadrootsSignatureVerifiedEvent,
- partition: RadrootsClassifiedListingPartition,
+ partition: ClassifiedListingPartition,
}
impl RadrootsExcludedClassifiedListingCandidate {
@@ -66,20 +66,15 @@ impl RadrootsExcludedClassifiedListingCandidate {
&self.verified_event
}
- pub fn event(&self) -> &RadrootsEventEnvelope {
+ pub fn event(&self) -> &EventEnvelope {
self.verified_event.event()
}
- pub const fn partition(&self) -> RadrootsClassifiedListingPartition {
+ pub const fn partition(&self) -> ClassifiedListingPartition {
self.partition
}
- pub fn into_parts(
- self,
- ) -> (
- RadrootsSignatureVerifiedEvent,
- RadrootsClassifiedListingPartition,
- ) {
+ pub fn into_parts(self) -> (RadrootsSignatureVerifiedEvent, ClassifiedListingPartition) {
(self.verified_event, self.partition)
}
}
@@ -154,8 +149,8 @@ pub fn admit_verified_food_availability_event(
RadrootsFoodAvailabilityProjectionOutcome::Excluded(partition) => {
debug_assert!(matches!(
partition,
- RadrootsClassifiedListingPartition::OperationalListing
- | RadrootsClassifiedListingPartition::GenericNip99
+ ClassifiedListingPartition::OperationalListing
+ | ClassifiedListingPartition::GenericNip99
));
Ok(RadrootsFoodAvailabilityAdmissionOutcome::Excluded(
RadrootsExcludedClassifiedListingCandidate {
@@ -169,7 +164,7 @@ pub fn admit_verified_food_availability_event(
/// Verifies NIP-01 id and signature before focused Food admission.
pub fn verify_and_admit_food_availability_event(
- event: RadrootsEventEnvelope,
+ event: EventEnvelope,
) -> Result<RadrootsFoodAvailabilityAdmissionOutcome, RadrootsFoodAvailabilityAdmissionError> {
admit_verified_food_availability_event(verify_nip01_event(event)?)
}
diff --git a/crates/event_codec/src/food_availability/authored.rs b/crates/event_codec/src/food_availability/authored.rs
@@ -3,16 +3,16 @@ use alloc::{string::String, string::ToString, vec, vec::Vec};
use core::fmt;
use radroots_event::{
- envelope::RadrootsEventEnvelopeError,
- envelope::RadrootsEventTags,
+ envelope::EventEnvelopeError,
+ envelope::EventTags,
envelope::kind::KIND_CLASSIFIED_LISTING,
- food::availability::{RadrootsFoodAvailabilityDetails, RadrootsFoodAvailabilityError},
+ food::availability::{FoodAvailabilityDetails, FoodAvailabilityError},
listing::classified::{TAG_RADROOTS_PRICE_UNIT, TAG_RADROOTS_QUANTITY},
tag::name::{
TAG_D, TAG_IMAGE, TAG_LOCATION, TAG_PRICE, TAG_PUBLISHED_AT, TAG_STATUS, TAG_SUMMARY,
TAG_TITLE,
},
- wire::{DEFAULT_RAW_JSON_MAX_BYTES, RadrootsNip01EventWireParts},
+ wire::{DEFAULT_RAW_JSON_MAX_BYTES, Nip01EventWireParts},
};
const FOOD_SIGNED_EVENT_FIXED_BYTES: usize = "{\"id\":\"".len()
@@ -29,8 +29,8 @@ const FOOD_SIGNED_EVENT_FIXED_BYTES: usize = "{\"id\":\"".len()
#[non_exhaustive]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum RadrootsFoodAvailabilityEncodeError {
- Domain(RadrootsFoodAvailabilityError),
- Wire(RadrootsEventEnvelopeError),
+ Domain(FoodAvailabilityError),
+ Wire(EventEnvelopeError),
EventWireTooLarge { max: usize, actual: usize },
}
@@ -38,12 +38,10 @@ impl RadrootsFoodAvailabilityEncodeError {
pub const fn code(&self) -> &'static str {
match self {
Self::Domain(error) => error.code(),
- Self::Wire(RadrootsEventEnvelopeError::TagElementTooLarge { .. }) => {
+ Self::Wire(EventEnvelopeError::TagElementTooLarge { .. }) => {
"food_tag_element_too_large"
}
- Self::Wire(RadrootsEventEnvelopeError::TagsTooLarge { .. }) => {
- "food_tag_bytes_exceeded"
- }
+ Self::Wire(EventEnvelopeError::TagsTooLarge { .. }) => "food_tag_bytes_exceeded",
Self::Wire(_) => "food_wire_invalid",
Self::EventWireTooLarge { .. } => "food_event_wire_too_large",
}
@@ -74,21 +72,21 @@ impl std::error::Error for RadrootsFoodAvailabilityEncodeError {
}
}
-impl From<RadrootsFoodAvailabilityError> for RadrootsFoodAvailabilityEncodeError {
- fn from(value: RadrootsFoodAvailabilityError) -> Self {
+impl From<FoodAvailabilityError> for RadrootsFoodAvailabilityEncodeError {
+ fn from(value: FoodAvailabilityError) -> Self {
Self::Domain(value)
}
}
-impl From<RadrootsEventEnvelopeError> for RadrootsFoodAvailabilityEncodeError {
- fn from(value: RadrootsEventEnvelopeError) -> Self {
+impl From<EventEnvelopeError> for RadrootsFoodAvailabilityEncodeError {
+ fn from(value: EventEnvelopeError) -> Self {
Self::Wire(value)
}
}
/// Builds exact canonical NIP-99 tags for strict FoodAvailability details.
pub fn authored_food_availability_build_tags(
- details: &RadrootsFoodAvailabilityDetails,
+ details: &FoodAvailabilityDetails,
created_at: u64,
) -> Result<Vec<Vec<String>>, RadrootsFoodAvailabilityEncodeError> {
details.validate_created_at(created_at)?;
@@ -130,7 +128,7 @@ pub fn authored_food_availability_build_tags(
]
}));
- RadrootsEventTags::new(tags.clone())?;
+ EventTags::new(tags.clone())?;
Ok(tags)
}
@@ -139,12 +137,12 @@ pub fn authored_food_availability_build_tags(
/// Every image is already byte-verified by the input typestate. A publication
/// runtime must still prove BUD-02 upload completion before signing.
pub fn authored_food_availability_to_wire_parts(
- details: &RadrootsFoodAvailabilityDetails,
+ details: &FoodAvailabilityDetails,
created_at: u64,
-) -> Result<RadrootsNip01EventWireParts, RadrootsFoodAvailabilityEncodeError> {
+) -> Result<Nip01EventWireParts, RadrootsFoodAvailabilityEncodeError> {
let tags = authored_food_availability_build_tags(details, created_at)?;
validate_compact_signed_wire_size(&tags, details.content().as_str(), created_at)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind: KIND_CLASSIFIED_LISTING,
content: details.content().as_str().into(),
tags,
@@ -213,9 +211,8 @@ fn canonical_json_string_bytes(value: &str) -> usize {
mod tests {
use super::*;
use radroots_event::food::availability::{
- RadrootsFoodAvailabilityDetailsParts, RadrootsFoodAvailabilityStatus, RadrootsFoodContent,
- RadrootsFoodCurrency, RadrootsFoodIdentifier, RadrootsFoodPrice, RadrootsFoodPublishedAt,
- RadrootsFoodQuantity, RadrootsFoodText, RadrootsFoodUnit,
+ FoodAvailabilityDetailsParts, FoodAvailabilityStatus, FoodContent, FoodCurrency,
+ FoodIdentifier, FoodPrice, FoodPublishedAt, FoodQuantity, FoodText, FoodUnit,
};
#[test]
@@ -260,22 +257,18 @@ mod tests {
);
}
- fn details(content: &str) -> RadrootsFoodAvailabilityDetails {
- RadrootsFoodAvailabilityDetails::new(RadrootsFoodAvailabilityDetailsParts {
- content: RadrootsFoodContent::new(content).unwrap(),
- identifier: RadrootsFoodIdentifier::parse("nantes-carrots").unwrap(),
- title: RadrootsFoodText::new("Nantes Carrots").unwrap(),
- summary: RadrootsFoodText::new("Fresh bunches").unwrap(),
- published_at: RadrootsFoodPublishedAt::new(100).unwrap(),
- location: RadrootsFoodText::new("Central Saanich, BC").unwrap(),
- price: RadrootsFoodPrice::new(
- "3",
- RadrootsFoodCurrency::parse("CAD").unwrap(),
- RadrootsFoodUnit::Pound,
- )
- .unwrap(),
- quantity: Some(RadrootsFoodQuantity::new("24", RadrootsFoodUnit::Pound).unwrap()),
- status: RadrootsFoodAvailabilityStatus::Active,
+ fn details(content: &str) -> FoodAvailabilityDetails {
+ FoodAvailabilityDetails::new(FoodAvailabilityDetailsParts {
+ content: FoodContent::new(content).unwrap(),
+ identifier: FoodIdentifier::parse("nantes-carrots").unwrap(),
+ title: FoodText::new("Nantes Carrots").unwrap(),
+ summary: FoodText::new("Fresh bunches").unwrap(),
+ published_at: FoodPublishedAt::new(100).unwrap(),
+ location: FoodText::new("Central Saanich, BC").unwrap(),
+ price: FoodPrice::new("3", FoodCurrency::parse("CAD").unwrap(), FoodUnit::Pound)
+ .unwrap(),
+ quantity: Some(FoodQuantity::new("24", FoodUnit::Pound).unwrap()),
+ status: FoodAvailabilityStatus::Active,
images: Vec::new(),
})
.unwrap()
diff --git a/crates/event_codec/src/food_availability/inbound/registry_v7.rs b/crates/event_codec/src/food_availability/inbound/registry_v7.rs
@@ -6,16 +6,15 @@ use alloc::{boxed::Box, string::String, string::ToString, vec::Vec};
use core::fmt;
use radroots_blossom::{BlobUrl, Sha256};
use radroots_event::{
- envelope::RadrootsEventTags,
+ envelope::EventTags,
envelope::kind::KIND_CLASSIFIED_LISTING,
food::availability::{
- RADROOTS_FOOD_DECIMAL_MAX_DIGITS, RADROOTS_FOOD_IMAGE_MAX_COUNT,
- RadrootsFoodAvailabilityError, RadrootsFoodAvailabilityStatus, RadrootsFoodContent,
- RadrootsFoodCurrency, RadrootsFoodIdentifier, RadrootsFoodImageDimensions,
- RadrootsFoodPrice, RadrootsFoodPublishedAt, RadrootsFoodQuantity, RadrootsFoodText,
- RadrootsFoodUnit, food_media_blossom_digest, food_media_http_url_is_valid,
+ FoodAvailabilityError, FoodAvailabilityStatus, FoodContent, FoodCurrency, FoodIdentifier,
+ FoodImageDimensions, FoodPrice, FoodPublishedAt, FoodQuantity, FoodText, FoodUnit,
+ RADROOTS_FOOD_DECIMAL_MAX_DIGITS, RADROOTS_FOOD_IMAGE_MAX_COUNT, food_media_blossom_digest,
+ food_media_http_url_is_valid,
},
- listing::classified::RadrootsClassifiedListingPartition,
+ listing::classified::ClassifiedListingPartition,
wire::DEFAULT_RAW_JSON_MAX_BYTES,
};
@@ -85,7 +84,7 @@ impl fmt::Display for RadrootsFoodAvailabilityImageDiagnostic {
pub struct RadrootsInboundFoodAvailabilityImage {
raw_tag: Vec<String>,
url: Option<String>,
- dimensions: Option<RadrootsFoodImageDimensions>,
+ dimensions: Option<FoodImageDimensions>,
diagnostics: Vec<RadrootsFoodAvailabilityImageDiagnostic>,
}
@@ -98,7 +97,7 @@ impl RadrootsInboundFoodAvailabilityImage {
self.url.as_deref()
}
- pub const fn dimensions(&self) -> Option<RadrootsFoodImageDimensions> {
+ pub const fn dimensions(&self) -> Option<FoodImageDimensions> {
self.dimensions
}
@@ -113,53 +112,53 @@ impl RadrootsInboundFoodAvailabilityImage {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsInboundFoodAvailabilityProjection {
- content: RadrootsFoodContent,
- identifier: RadrootsFoodIdentifier,
- title: RadrootsFoodText,
- summary: RadrootsFoodText,
- published_at: RadrootsFoodPublishedAt,
- location: RadrootsFoodText,
- price: RadrootsFoodPrice,
- quantity: Option<RadrootsFoodQuantity>,
- status: RadrootsFoodAvailabilityStatus,
+ content: FoodContent,
+ identifier: FoodIdentifier,
+ title: FoodText,
+ summary: FoodText,
+ published_at: FoodPublishedAt,
+ location: FoodText,
+ price: FoodPrice,
+ quantity: Option<FoodQuantity>,
+ status: FoodAvailabilityStatus,
images: Vec<RadrootsInboundFoodAvailabilityImage>,
diagnostics: Vec<RadrootsFoodAvailabilityImageDiagnostic>,
}
impl RadrootsInboundFoodAvailabilityProjection {
- pub fn content(&self) -> &RadrootsFoodContent {
+ pub fn content(&self) -> &FoodContent {
&self.content
}
- pub fn identifier(&self) -> &RadrootsFoodIdentifier {
+ pub fn identifier(&self) -> &FoodIdentifier {
&self.identifier
}
- pub fn title(&self) -> &RadrootsFoodText {
+ pub fn title(&self) -> &FoodText {
&self.title
}
- pub fn summary(&self) -> &RadrootsFoodText {
+ pub fn summary(&self) -> &FoodText {
&self.summary
}
- pub const fn published_at(&self) -> RadrootsFoodPublishedAt {
+ pub const fn published_at(&self) -> FoodPublishedAt {
self.published_at
}
- pub fn location(&self) -> &RadrootsFoodText {
+ pub fn location(&self) -> &FoodText {
&self.location
}
- pub fn price(&self) -> &RadrootsFoodPrice {
+ pub fn price(&self) -> &FoodPrice {
&self.price
}
- pub fn quantity(&self) -> Option<&RadrootsFoodQuantity> {
+ pub fn quantity(&self) -> Option<&FoodQuantity> {
self.quantity.as_ref()
}
- pub const fn status(&self) -> RadrootsFoodAvailabilityStatus {
+ pub const fn status(&self) -> FoodAvailabilityStatus {
self.status
}
@@ -176,7 +175,7 @@ impl RadrootsInboundFoodAvailabilityProjection {
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum RadrootsFoodAvailabilityProjectionOutcome {
Focused(Box<RadrootsInboundFoodAvailabilityProjection>),
- Excluded(RadrootsClassifiedListingPartition),
+ Excluded(ClassifiedListingPartition),
}
#[non_exhaustive]
@@ -189,7 +188,7 @@ pub enum RadrootsFoodAvailabilityProjectionError {
PriceFrequencyForbidden,
PriceUnitMissing,
EventWireTooLarge { max: usize, actual: usize },
- Domain(RadrootsFoodAvailabilityError),
+ Domain(FoodAvailabilityError),
}
impl RadrootsFoodAvailabilityProjectionError {
@@ -247,8 +246,8 @@ impl std::error::Error for RadrootsFoodAvailabilityProjectionError {
}
}
-impl From<RadrootsFoodAvailabilityError> for RadrootsFoodAvailabilityProjectionError {
- fn from(value: RadrootsFoodAvailabilityError) -> Self {
+impl From<FoodAvailabilityError> for RadrootsFoodAvailabilityProjectionError {
+ fn from(value: FoodAvailabilityError) -> Self {
Self::Domain(value)
}
}
@@ -279,7 +278,7 @@ pub fn project_verified_food_availability_event_registry_v7(
pub(crate) fn project_inbound_food_availability_parts(
kind: u32,
created_at: u64,
- tags: &RadrootsEventTags,
+ tags: &EventTags,
content: &str,
) -> Result<RadrootsFoodAvailabilityProjectionOutcome, RadrootsFoodAvailabilityProjectionError> {
if kind != KIND_CLASSIFIED_LISTING {
@@ -290,16 +289,16 @@ pub(crate) fn project_inbound_food_availability_parts(
}
match classify_classified_listing_tags_registry_v7(tags) {
- RadrootsClassifiedListingPartition::Ambiguous => {
+ ClassifiedListingPartition::Ambiguous => {
return Err(RadrootsFoodAvailabilityProjectionError::ProfileAmbiguous);
}
- partition @ (RadrootsClassifiedListingPartition::OperationalListing
- | RadrootsClassifiedListingPartition::GenericNip99) => {
+ partition @ (ClassifiedListingPartition::OperationalListing
+ | ClassifiedListingPartition::GenericNip99) => {
return Ok(RadrootsFoodAvailabilityProjectionOutcome::Excluded(
partition,
));
}
- RadrootsClassifiedListingPartition::FocusedFoodAvailability => {}
+ ClassifiedListingPartition::FocusedFoodAvailability => {}
}
let tags = tags.to_vec();
@@ -320,26 +319,26 @@ pub(crate) fn project_inbound_food_availability_parts(
let location_value = singleton_value(&tags, "location")?;
let status_value = singleton_value(&tags, "status")?;
- let content = RadrootsFoodContent::new(content.to_string())?;
- let identifier = RadrootsFoodIdentifier::parse(identifier_value)?;
- let title = RadrootsFoodText::new(title_value.to_string())?;
- let summary = RadrootsFoodText::new(summary_value.to_string())?;
- let published_at = RadrootsFoodPublishedAt::parse(published_at_value)?;
+ let content = FoodContent::new(content.to_string())?;
+ let identifier = FoodIdentifier::parse(identifier_value)?;
+ let title = FoodText::new(title_value.to_string())?;
+ let summary = FoodText::new(summary_value.to_string())?;
+ let published_at = FoodPublishedAt::parse(published_at_value)?;
published_at.validate_created_at(created_at)?;
- let location = RadrootsFoodText::new(location_value.to_string())?;
+ let location = FoodText::new(location_value.to_string())?;
let price_tags = matching_tags(&tags, "price");
let price_tag = match price_tags.as_slice() {
[tag] => *tag,
- _ => return Err(RadrootsFoodAvailabilityError::PriceInvalid.into()),
+ _ => return Err(FoodAvailabilityError::PriceInvalid.into()),
};
if price_tag.len() > 3 {
return Err(RadrootsFoodAvailabilityProjectionError::PriceFrequencyForbidden);
}
if price_tag.len() != 3 {
- return Err(RadrootsFoodAvailabilityError::PriceInvalid.into());
+ return Err(FoodAvailabilityError::PriceInvalid.into());
}
- let amount = normalize_decimal(&price_tag[1], RadrootsFoodAvailabilityError::PriceInvalid)?;
+ let amount = normalize_decimal(&price_tag[1], FoodAvailabilityError::PriceInvalid)?;
let currency = normalize_currency(&price_tag[2])?;
let price_unit_tags = matching_tags(&tags, "radroots:price_unit");
@@ -348,10 +347,10 @@ pub(crate) fn project_inbound_food_availability_parts(
}
let unit_value = match price_unit_tags.as_slice() {
[tag] if tag.len() == 2 => tag[1].as_str(),
- _ => return Err(RadrootsFoodAvailabilityError::PriceUnitInvalid.into()),
+ _ => return Err(FoodAvailabilityError::PriceUnitInvalid.into()),
};
- let unit = RadrootsFoodUnit::parse(unit_value)?;
- let price = RadrootsFoodPrice::new(amount, currency, unit)?;
+ let unit = FoodUnit::parse(unit_value)?;
+ let price = FoodPrice::new(amount, currency, unit)?;
let quantity_tags = matching_tags(&tags, "radroots:quantity");
let quantity = if quantity_tags.is_empty() {
@@ -360,19 +359,19 @@ pub(crate) fn project_inbound_food_availability_parts(
let tag = match quantity_tags.as_slice() {
[tag] if tag.len() == 3 => *tag,
_ => {
- return Err(RadrootsFoodAvailabilityError::QuantityInvalid.into());
+ return Err(FoodAvailabilityError::QuantityInvalid.into());
}
};
- let amount = normalize_decimal(&tag[1], RadrootsFoodAvailabilityError::QuantityInvalid)?;
- let quantity_unit = RadrootsFoodUnit::parse(&tag[2])
- .map_err(|_| RadrootsFoodAvailabilityError::QuantityInvalid)?;
+ let amount = normalize_decimal(&tag[1], FoodAvailabilityError::QuantityInvalid)?;
+ let quantity_unit =
+ FoodUnit::parse(&tag[2]).map_err(|_| FoodAvailabilityError::QuantityInvalid)?;
if quantity_unit != unit {
- return Err(RadrootsFoodAvailabilityError::QuantityInvalid.into());
+ return Err(FoodAvailabilityError::QuantityInvalid.into());
}
- Some(RadrootsFoodQuantity::new(amount, quantity_unit)?)
+ Some(FoodQuantity::new(amount, quantity_unit)?)
};
- let status = RadrootsFoodAvailabilityStatus::parse(status_value)?;
+ let status = FoodAvailabilityStatus::parse(status_value)?;
let image_tags = matching_tags(&tags, "image");
let (images, diagnostics) = project_images(&image_tags);
@@ -393,9 +392,7 @@ pub(crate) fn project_inbound_food_availability_parts(
))
}
-fn classify_classified_listing_tags_registry_v7(
- tags: &RadrootsEventTags,
-) -> RadrootsClassifiedListingPartition {
+fn classify_classified_listing_tags_registry_v7(tags: &EventTags) -> ClassifiedListingPartition {
let mut has_focused_marker = false;
let mut has_operational_marker = false;
@@ -413,15 +410,15 @@ fn classify_classified_listing_tags_registry_v7(
}
if has_focused_marker && has_operational_marker {
- return RadrootsClassifiedListingPartition::Ambiguous;
+ return ClassifiedListingPartition::Ambiguous;
}
}
match (has_focused_marker, has_operational_marker) {
- (true, false) => RadrootsClassifiedListingPartition::FocusedFoodAvailability,
- (false, true) => RadrootsClassifiedListingPartition::OperationalListing,
- (false, false) => RadrootsClassifiedListingPartition::GenericNip99,
- (true, true) => RadrootsClassifiedListingPartition::Ambiguous,
+ (true, false) => ClassifiedListingPartition::FocusedFoodAvailability,
+ (false, true) => ClassifiedListingPartition::OperationalListing,
+ (false, false) => ClassifiedListingPartition::GenericNip99,
+ (true, true) => ClassifiedListingPartition::Ambiguous,
}
}
@@ -459,7 +456,7 @@ fn exact_single_tag_from_matches(
fn normalize_decimal(
value: &str,
- error: RadrootsFoodAvailabilityError,
+ error: FoodAvailabilityError,
) -> Result<String, RadrootsFoodAvailabilityProjectionError> {
let mut digits = 0usize;
let mut dot = None;
@@ -496,16 +493,16 @@ fn normalize_decimal(
#[derive(Clone, Debug, PartialEq, Eq)]
pub(crate) struct RadrootsStrictFoodAvailabilityProjection {
- identifier: RadrootsFoodIdentifier,
- published_at: RadrootsFoodPublishedAt,
+ identifier: FoodIdentifier,
+ published_at: FoodPublishedAt,
}
impl RadrootsStrictFoodAvailabilityProjection {
- pub(crate) fn identifier(&self) -> &RadrootsFoodIdentifier {
+ pub(crate) fn identifier(&self) -> &FoodIdentifier {
&self.identifier
}
- pub(crate) const fn published_at(&self) -> RadrootsFoodPublishedAt {
+ pub(crate) const fn published_at(&self) -> FoodPublishedAt {
self.published_at
}
}
@@ -564,7 +561,7 @@ pub(crate) fn project_strict_verified_food_availability_event(
});
}
if classify_classified_listing_tags_registry_v7(event.tags())
- != RadrootsClassifiedListingPartition::FocusedFoodAvailability
+ != ClassifiedListingPartition::FocusedFoodAvailability
{
return Err(RadrootsFoodAvailabilityProjectionError::ProfileAmbiguous);
}
@@ -616,30 +613,28 @@ pub(crate) fn project_strict_verified_food_availability_event(
[tag] if tag.len() > 3 => {
return Err(RadrootsFoodAvailabilityProjectionError::PriceFrequencyForbidden);
}
- _ => return Err(RadrootsFoodAvailabilityError::PriceInvalid.into()),
+ _ => return Err(FoodAvailabilityError::PriceInvalid.into()),
};
- let normalized_price =
- normalize_decimal(&price[1], RadrootsFoodAvailabilityError::PriceInvalid)?;
+ let normalized_price = normalize_decimal(&price[1], FoodAvailabilityError::PriceInvalid)?;
if normalized_price != price[1] {
- return Err(RadrootsFoodAvailabilityError::PriceInvalid.into());
+ return Err(FoodAvailabilityError::PriceInvalid.into());
}
if normalize_currency(&price[2])?.as_str() != price[2] {
- return Err(RadrootsFoodAvailabilityError::PriceCurrencyInvalid.into());
+ return Err(FoodAvailabilityError::PriceCurrencyInvalid.into());
}
if let Some(quantity) = matching_tags(&tags, "radroots:quantity").first() {
if quantity.len() != 3 {
- return Err(RadrootsFoodAvailabilityError::QuantityInvalid.into());
+ return Err(FoodAvailabilityError::QuantityInvalid.into());
}
- let normalized =
- normalize_decimal(&quantity[1], RadrootsFoodAvailabilityError::QuantityInvalid)?;
+ let normalized = normalize_decimal(&quantity[1], FoodAvailabilityError::QuantityInvalid)?;
if normalized != quantity[1] {
- return Err(RadrootsFoodAvailabilityError::QuantityInvalid.into());
+ return Err(FoodAvailabilityError::QuantityInvalid.into());
}
}
if image_count > RADROOTS_FOOD_IMAGE_MAX_COUNT {
- return Err(RadrootsFoodAvailabilityError::ImageCountExceeded {
+ return Err(FoodAvailabilityError::ImageCountExceeded {
max: RADROOTS_FOOD_IMAGE_MAX_COUNT,
actual: image_count,
}
@@ -654,13 +649,13 @@ pub(crate) fn project_strict_verified_food_availability_event(
let url = BlobUrl::parse(&tag[1])
.and_then(BlobUrl::approve)
.map_err(|_| RadrootsFoodAvailabilityProjectionError::TagInvalid)?;
- RadrootsFoodImageDimensions::parse(&tag[2])?;
+ FoodImageDimensions::parse(&tag[2])?;
if seen_urls.iter().any(|seen| seen == &tag[1]) {
- return Err(RadrootsFoodAvailabilityError::ImageDuplicateUrl.into());
+ return Err(FoodAvailabilityError::ImageDuplicateUrl.into());
}
let digest = url.as_blob_url().hash_path().hash();
if seen_digests.contains(&digest) {
- return Err(RadrootsFoodAvailabilityError::ImageDuplicateDigest.into());
+ return Err(FoodAvailabilityError::ImageDuplicateDigest.into());
}
seen_urls.push(tag[1].clone());
seen_digests.push(digest);
@@ -686,11 +681,11 @@ pub(crate) fn project_strict_verified_food_availability_event(
fn normalize_currency(
value: &str,
-) -> Result<RadrootsFoodCurrency, RadrootsFoodAvailabilityProjectionError> {
+) -> Result<FoodCurrency, RadrootsFoodAvailabilityProjectionError> {
if value.len() != 3 || !value.bytes().all(|byte| byte.is_ascii_alphabetic()) {
- return Err(RadrootsFoodAvailabilityError::PriceCurrencyInvalid.into());
+ return Err(FoodAvailabilityError::PriceCurrencyInvalid.into());
}
- Ok(RadrootsFoodCurrency::parse(value.to_ascii_uppercase())?)
+ Ok(FoodCurrency::parse(value.to_ascii_uppercase())?)
}
fn project_images(
@@ -728,7 +723,7 @@ fn project_images(
image_diagnostics.push(RadrootsFoodAvailabilityImageDiagnostic::DimensionsMissing);
None
}
- Some(value) => match RadrootsFoodImageDimensions::parse(value) {
+ Some(value) => match FoodImageDimensions::parse(value) {
Ok(dimensions) => Some(dimensions),
Err(_) => {
image_diagnostics
diff --git a/crates/event_codec/src/food_availability/inbound/registry_v7/tests.rs b/crates/event_codec/src/food_availability/inbound/registry_v7/tests.rs
@@ -1,5 +1,5 @@
use super::*;
-use radroots_event::envelope::RadrootsEventTags;
+use radroots_event::envelope::EventTags;
const HASH: &str = "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824";
@@ -23,7 +23,7 @@ fn partitions_raw_markers_before_shape_or_capability_validation() {
assert_eq!(
project(&operational).unwrap(),
RadrootsFoodAvailabilityProjectionOutcome::Excluded(
- RadrootsClassifiedListingPartition::OperationalListing
+ ClassifiedListingPartition::OperationalListing
)
);
@@ -132,7 +132,7 @@ fn accepts_optional_standard_tags_but_bounds_raw_decimal_digits() {
}
fn project(
- tags: &RadrootsEventTags,
+ tags: &EventTags,
) -> Result<RadrootsFoodAvailabilityProjectionOutcome, RadrootsFoodAvailabilityProjectionError> {
project_inbound_food_availability_parts(
KIND_CLASSIFIED_LISTING,
@@ -153,7 +153,7 @@ fn focused(
}
}
-fn focused_tags(mut additional: Vec<Vec<String>>) -> RadrootsEventTags {
+fn focused_tags(mut additional: Vec<Vec<String>>) -> EventTags {
let mut values = base_tags();
if !additional
.iter()
@@ -183,8 +183,8 @@ fn base_tags() -> Vec<Vec<String>> {
]
}
-fn tags(values: Vec<Vec<String>>) -> RadrootsEventTags {
- RadrootsEventTags::new(values).unwrap()
+fn tags(values: Vec<Vec<String>>) -> EventTags {
+ EventTags::new(values).unwrap()
}
fn tag(values: &[&str]) -> Vec<String> {
diff --git a/crates/event_codec/src/geochat/decode.rs b/crates/event_codec/src/geochat/decode.rs
@@ -4,7 +4,7 @@ use alloc::{
vec::Vec,
};
-use radroots_event::{envelope::kind::KIND_GEOCHAT, social::geochat::RadrootsGeoChat};
+use radroots_event::{envelope::kind::KIND_GEOCHAT, social::geochat::GeoChat};
use crate::error::EventParseError;
use crate::parsed::{RadrootsParsedData, RadrootsParsedEvent};
@@ -62,7 +62,7 @@ pub fn geochat_from_tags(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsGeoChat, EventParseError> {
+) -> Result<GeoChat, EventParseError> {
if kind != DEFAULT_KIND {
return Err(EventParseError::InvalidKind {
expected: "20000",
@@ -77,7 +77,7 @@ pub fn geochat_from_tags(
let nickname = parse_nickname_tag(tags)?;
let teleported = parse_teleport_tag(tags)?;
- Ok(RadrootsGeoChat {
+ Ok(GeoChat {
geohash,
content: content.to_string(),
nickname,
@@ -92,7 +92,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsGeoChat>, EventParseError> {
+) -> Result<RadrootsParsedData<GeoChat>, EventParseError> {
let geochat = geochat_from_tags(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -111,7 +111,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsGeoChat>, EventParseError> {
+) -> Result<RadrootsParsedEvent<GeoChat>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
diff --git a/crates/event_codec/src/geochat/encode.rs b/crates/event_codec/src/geochat/encode.rs
@@ -7,10 +7,10 @@ use alloc::{
};
use radroots_event::envelope::kind::KIND_GEOCHAT;
-use radroots_event::social::geochat::RadrootsGeoChat;
+use radroots_event::social::geochat::GeoChat;
use crate::error::EventEncodeError;
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
const DEFAULT_KIND: u32 = KIND_GEOCHAT;
const TAG_G: &str = "g";
@@ -22,7 +22,7 @@ fn push_tag(tags: &mut Vec<Vec<String>>, key: &str, value: &str) {
tags.push(vec![key.to_string(), value.to_string()]);
}
-pub fn geochat_build_tags(geochat: &RadrootsGeoChat) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn geochat_build_tags(geochat: &GeoChat) -> Result<Vec<Vec<String>>, EventEncodeError> {
let geohash = geochat.geohash.trim();
if geohash.is_empty() {
return Err(EventEncodeError::EmptyRequiredField("geohash"));
@@ -48,14 +48,12 @@ pub fn geochat_build_tags(geochat: &RadrootsGeoChat) -> Result<Vec<Vec<String>>,
Ok(tags)
}
-pub fn to_wire_parts(
- geochat: &RadrootsGeoChat,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+pub fn to_wire_parts(geochat: &GeoChat) -> Result<Nip01EventWireParts, EventEncodeError> {
if geochat.content.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("content"));
}
let tags = geochat_build_tags(geochat)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind: DEFAULT_KIND,
content: geochat.content.clone(),
tags,
diff --git a/crates/event_codec/src/gift_wrap/decode.rs b/crates/event_codec/src/gift_wrap/decode.rs
@@ -6,7 +6,7 @@ use alloc::{
use radroots_event::{
envelope::kind::KIND_GIFT_WRAP,
- social::gift_wrap::{RadrootsGiftWrap, RadrootsGiftWrapRecipient},
+ social::gift_wrap::{GiftWrap, GiftWrapRecipient},
};
use crate::error::EventParseError;
@@ -14,7 +14,7 @@ use crate::parsed::{RadrootsParsedData, RadrootsParsedEvent};
const DEFAULT_KIND: u32 = KIND_GIFT_WRAP;
-fn parse_recipient(tags: &[Vec<String>]) -> Result<RadrootsGiftWrapRecipient, EventParseError> {
+fn parse_recipient(tags: &[Vec<String>]) -> Result<GiftWrapRecipient, EventParseError> {
let tag = tags
.iter()
.find(|t| t.first().map(|s| s.as_str()) == Some("p"))
@@ -28,7 +28,7 @@ fn parse_recipient(tags: &[Vec<String>]) -> Result<RadrootsGiftWrapRecipient, Ev
Some(value) => Some(value.clone()),
None => None,
};
- Ok(RadrootsGiftWrapRecipient {
+ Ok(GiftWrapRecipient {
public_key: public_key.clone(),
relay_url,
})
@@ -55,7 +55,7 @@ pub fn gift_wrap_from_tags(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsGiftWrap, EventParseError> {
+) -> Result<GiftWrap, EventParseError> {
if kind != DEFAULT_KIND {
return Err(EventParseError::InvalidKind {
expected: "1059",
@@ -67,7 +67,7 @@ pub fn gift_wrap_from_tags(
}
let recipient = parse_recipient(tags)?;
let expiration = parse_expiration(tags)?;
- Ok(RadrootsGiftWrap {
+ Ok(GiftWrap {
recipient,
content: content.to_string(),
expiration,
@@ -81,7 +81,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsGiftWrap>, EventParseError> {
+) -> Result<RadrootsParsedData<GiftWrap>, EventParseError> {
let gift_wrap = gift_wrap_from_tags(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -100,7 +100,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsGiftWrap>, EventParseError> {
+) -> Result<RadrootsParsedEvent<GiftWrap>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
diff --git a/crates/event_codec/src/gift_wrap/encode.rs b/crates/event_codec/src/gift_wrap/encode.rs
@@ -7,16 +7,14 @@ use alloc::{
};
use radroots_event::envelope::kind::KIND_GIFT_WRAP;
-use radroots_event::social::gift_wrap::{RadrootsGiftWrap, RadrootsGiftWrapRecipient};
+use radroots_event::social::gift_wrap::{GiftWrap, GiftWrapRecipient};
use crate::error::EventEncodeError;
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
const DEFAULT_KIND: u32 = KIND_GIFT_WRAP;
-fn validate_recipient(
- recipient: &RadrootsGiftWrapRecipient,
-) -> Result<Vec<String>, EventEncodeError> {
+fn validate_recipient(recipient: &GiftWrapRecipient) -> Result<Vec<String>, EventEncodeError> {
if recipient.public_key.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("recipient.public_key"));
}
@@ -32,9 +30,7 @@ fn validate_recipient(
Ok(tag)
}
-pub fn gift_wrap_build_tags(
- gift_wrap: &RadrootsGiftWrap,
-) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn gift_wrap_build_tags(gift_wrap: &GiftWrap) -> Result<Vec<Vec<String>>, EventEncodeError> {
let mut tags = Vec::with_capacity(2);
tags.push(validate_recipient(&gift_wrap.recipient)?);
if let Some(expiration) = gift_wrap.expiration {
@@ -43,14 +39,12 @@ pub fn gift_wrap_build_tags(
Ok(tags)
}
-pub fn to_wire_parts(
- gift_wrap: &RadrootsGiftWrap,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+pub fn to_wire_parts(gift_wrap: &GiftWrap) -> Result<Nip01EventWireParts, EventEncodeError> {
if gift_wrap.content.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("content"));
}
let tags = gift_wrap_build_tags(gift_wrap)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind: DEFAULT_KIND,
content: gift_wrap.content.clone(),
tags,
@@ -58,9 +52,9 @@ pub fn to_wire_parts(
}
pub fn to_wire_parts_with_kind(
- gift_wrap: &RadrootsGiftWrap,
+ gift_wrap: &GiftWrap,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != DEFAULT_KIND {
return Err(EventEncodeError::InvalidKind(kind));
}
diff --git a/crates/event_codec/src/group/decode.rs b/crates/event_codec/src/group/decode.rs
@@ -6,15 +6,13 @@ use alloc::{
use radroots_event::{
social::group::{
- KIND_GROUP_ADMINS, KIND_GROUP_CREATE_GROUP, KIND_GROUP_CREATE_INVITE,
+ GroupAdmins, GroupCreateGroup, GroupCreateInvite, GroupDeleteEvent, GroupDeleteGroup,
+ GroupEditMetadata, GroupEditableMetadata, GroupJoinRequest, GroupLeaveRequest,
+ GroupMembers, GroupMetadata, GroupPutUser, GroupRemoveUser, GroupRole, GroupRoles,
+ GroupUserRef, KIND_GROUP_ADMINS, KIND_GROUP_CREATE_GROUP, KIND_GROUP_CREATE_INVITE,
KIND_GROUP_DELETE_EVENT, KIND_GROUP_DELETE_GROUP, KIND_GROUP_EDIT_METADATA,
KIND_GROUP_JOIN_REQUEST, KIND_GROUP_LEAVE_REQUEST, KIND_GROUP_MEMBERS, KIND_GROUP_METADATA,
- KIND_GROUP_PUT_USER, KIND_GROUP_REMOVE_USER, KIND_GROUP_ROLES, RadrootsGroupAdmins,
- RadrootsGroupCreateGroup, RadrootsGroupCreateInvite, RadrootsGroupDeleteEvent,
- RadrootsGroupDeleteGroup, RadrootsGroupEditMetadata, RadrootsGroupEditableMetadata,
- RadrootsGroupJoinRequest, RadrootsGroupLeaveRequest, RadrootsGroupMembers,
- RadrootsGroupMetadata, RadrootsGroupPutUser, RadrootsGroupRemoveUser, RadrootsGroupRole,
- RadrootsGroupRoles, RadrootsGroupUserRef,
+ KIND_GROUP_PUT_USER, KIND_GROUP_REMOVE_USER, KIND_GROUP_ROLES,
},
tag::name::{TAG_D, TAG_E, TAG_H, TAG_P},
};
@@ -39,10 +37,10 @@ pub fn group_put_user_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsGroupPutUser, EventParseError> {
+) -> Result<GroupPutUser, EventParseError> {
require_kind(kind, KIND_GROUP_PUT_USER, "9000")?;
let (pubkey, roles) = required_user_tag(tags)?;
- Ok(RadrootsGroupPutUser {
+ Ok(GroupPutUser {
group_id: required_tag_value(tags, TAG_H)?,
message: optional_content(content),
pubkey,
@@ -54,10 +52,10 @@ pub fn group_remove_user_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsGroupRemoveUser, EventParseError> {
+) -> Result<GroupRemoveUser, EventParseError> {
require_kind(kind, KIND_GROUP_REMOVE_USER, "9001")?;
let (pubkey, _) = required_user_tag(tags)?;
- Ok(RadrootsGroupRemoveUser {
+ Ok(GroupRemoveUser {
group_id: required_tag_value(tags, TAG_H)?,
message: optional_content(content),
pubkey,
@@ -68,9 +66,9 @@ pub fn group_create_group_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsGroupCreateGroup, EventParseError> {
+) -> Result<GroupCreateGroup, EventParseError> {
require_kind(kind, KIND_GROUP_CREATE_GROUP, "9007")?;
- Ok(RadrootsGroupCreateGroup {
+ Ok(GroupCreateGroup {
group_id: required_tag_value(tags, TAG_H)?,
message: optional_content(content),
metadata: metadata_from_tags(tags)?,
@@ -81,9 +79,9 @@ pub fn group_edit_metadata_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsGroupEditMetadata, EventParseError> {
+) -> Result<GroupEditMetadata, EventParseError> {
require_kind(kind, KIND_GROUP_EDIT_METADATA, "9002")?;
- Ok(RadrootsGroupEditMetadata {
+ Ok(GroupEditMetadata {
group_id: required_tag_value(tags, TAG_H)?,
message: optional_content(content),
metadata: metadata_from_tags(tags)?,
@@ -94,9 +92,9 @@ pub fn group_delete_group_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsGroupDeleteGroup, EventParseError> {
+) -> Result<GroupDeleteGroup, EventParseError> {
require_kind(kind, KIND_GROUP_DELETE_GROUP, "9008")?;
- Ok(RadrootsGroupDeleteGroup {
+ Ok(GroupDeleteGroup {
group_id: required_tag_value(tags, TAG_H)?,
message: optional_content(content),
})
@@ -106,9 +104,9 @@ pub fn group_delete_event_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsGroupDeleteEvent, EventParseError> {
+) -> Result<GroupDeleteEvent, EventParseError> {
require_kind(kind, KIND_GROUP_DELETE_EVENT, "9005")?;
- Ok(RadrootsGroupDeleteEvent {
+ Ok(GroupDeleteEvent {
group_id: required_tag_value(tags, TAG_H)?,
message: optional_content(content),
event_id: required_tag_value(tags, TAG_E)?,
@@ -119,9 +117,9 @@ pub fn group_create_invite_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsGroupCreateInvite, EventParseError> {
+) -> Result<GroupCreateInvite, EventParseError> {
require_kind(kind, KIND_GROUP_CREATE_INVITE, "9009")?;
- Ok(RadrootsGroupCreateInvite {
+ Ok(GroupCreateInvite {
group_id: required_tag_value(tags, TAG_H)?,
message: optional_content(content),
code: required_tag_value(tags, TAG_CODE)?,
@@ -132,9 +130,9 @@ pub fn group_join_request_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsGroupJoinRequest, EventParseError> {
+) -> Result<GroupJoinRequest, EventParseError> {
require_kind(kind, KIND_GROUP_JOIN_REQUEST, "9021")?;
- Ok(RadrootsGroupJoinRequest {
+ Ok(GroupJoinRequest {
group_id: required_tag_value(tags, TAG_H)?,
message: optional_content(content),
code: optional_tag_value(tags, TAG_CODE)?,
@@ -145,9 +143,9 @@ pub fn group_leave_request_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsGroupLeaveRequest, EventParseError> {
+) -> Result<GroupLeaveRequest, EventParseError> {
require_kind(kind, KIND_GROUP_LEAVE_REQUEST, "9022")?;
- Ok(RadrootsGroupLeaveRequest {
+ Ok(GroupLeaveRequest {
group_id: required_tag_value(tags, TAG_H)?,
message: optional_content(content),
})
@@ -157,10 +155,10 @@ pub fn group_metadata_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsGroupMetadata, EventParseError> {
+) -> Result<GroupMetadata, EventParseError> {
require_kind(kind, KIND_GROUP_METADATA, "39000")?;
require_empty_content(content, "content")?;
- Ok(RadrootsGroupMetadata {
+ Ok(GroupMetadata {
d_tag: required_tag_value(tags, TAG_D)?,
metadata: metadata_from_tags(tags)?,
})
@@ -170,9 +168,9 @@ pub fn group_admins_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsGroupAdmins, EventParseError> {
+) -> Result<GroupAdmins, EventParseError> {
require_kind(kind, KIND_GROUP_ADMINS, "39001")?;
- Ok(RadrootsGroupAdmins {
+ Ok(GroupAdmins {
d_tag: required_tag_value(tags, TAG_D)?,
description: optional_content(content),
admins: user_refs_from_tags(tags)?,
@@ -183,9 +181,9 @@ pub fn group_members_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsGroupMembers, EventParseError> {
+) -> Result<GroupMembers, EventParseError> {
require_kind(kind, KIND_GROUP_MEMBERS, "39002")?;
- Ok(RadrootsGroupMembers {
+ Ok(GroupMembers {
d_tag: required_tag_value(tags, TAG_D)?,
description: optional_content(content),
members: user_refs_from_tags(tags)?,
@@ -196,9 +194,9 @@ pub fn group_roles_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsGroupRoles, EventParseError> {
+) -> Result<GroupRoles, EventParseError> {
require_kind(kind, KIND_GROUP_ROLES, "39003")?;
- Ok(RadrootsGroupRoles {
+ Ok(GroupRoles {
d_tag: required_tag_value(tags, TAG_D)?,
description: optional_content(content),
roles: roles_from_tags(tags)?,
@@ -220,10 +218,8 @@ fn require_kind(
}
}
-fn metadata_from_tags(
- tags: &[Vec<String>],
-) -> Result<RadrootsGroupEditableMetadata, EventParseError> {
- Ok(RadrootsGroupEditableMetadata {
+fn metadata_from_tags(tags: &[Vec<String>]) -> Result<GroupEditableMetadata, EventParseError> {
+ Ok(GroupEditableMetadata {
name: optional_tag_value(tags, TAG_NAME)?,
about: optional_tag_value(tags, TAG_ABOUT)?,
picture: optional_tag_value(tags, TAG_PICTURE)?,
@@ -279,12 +275,12 @@ fn required_user_tag(tags: &[Vec<String>]) -> Result<(String, Vec<String>), Even
user_from_tag(tag)
}
-fn user_refs_from_tags(tags: &[Vec<String>]) -> Result<Vec<RadrootsGroupUserRef>, EventParseError> {
+fn user_refs_from_tags(tags: &[Vec<String>]) -> Result<Vec<GroupUserRef>, EventParseError> {
tags.iter()
.filter(|tag| tag.first().map(|value| value.as_str()) == Some(TAG_P))
.map(|tag| {
let (pubkey, roles) = user_from_tag(tag)?;
- Ok(RadrootsGroupUserRef { pubkey, roles })
+ Ok(GroupUserRef { pubkey, roles })
})
.collect()
}
@@ -303,7 +299,7 @@ fn user_from_tag(tag: &[String]) -> Result<(String, Vec<String>), EventParseErro
Ok((pubkey, roles))
}
-fn roles_from_tags(tags: &[Vec<String>]) -> Result<Vec<RadrootsGroupRole>, EventParseError> {
+fn roles_from_tags(tags: &[Vec<String>]) -> Result<Vec<GroupRole>, EventParseError> {
tags.iter()
.filter(|tag| tag.first().map(|value| value.as_str()) == Some(TAG_ROLE))
.map(|tag| {
@@ -321,7 +317,7 @@ fn roles_from_tags(tags: &[Vec<String>]) -> Result<Vec<RadrootsGroupRole>, Event
validate_non_empty_tag_value(permission, TAG_ROLE)?;
permissions.push(permission.clone());
}
- Ok(RadrootsGroupRole {
+ Ok(GroupRole {
name,
description,
permissions,
diff --git a/crates/event_codec/src/group/encode.rs b/crates/event_codec/src/group/encode.rs
@@ -7,15 +7,13 @@ use alloc::{
use radroots_event::{
social::group::{
- KIND_GROUP_ADMINS, KIND_GROUP_CREATE_GROUP, KIND_GROUP_CREATE_INVITE,
+ GroupAdmins, GroupCreateGroup, GroupCreateInvite, GroupDeleteEvent, GroupDeleteGroup,
+ GroupEditMetadata, GroupEditableMetadata, GroupJoinRequest, GroupLeaveRequest,
+ GroupMembers, GroupMetadata, GroupPutUser, GroupRemoveUser, GroupRole, GroupRoles,
+ GroupUserRef, KIND_GROUP_ADMINS, KIND_GROUP_CREATE_GROUP, KIND_GROUP_CREATE_INVITE,
KIND_GROUP_DELETE_EVENT, KIND_GROUP_DELETE_GROUP, KIND_GROUP_EDIT_METADATA,
KIND_GROUP_JOIN_REQUEST, KIND_GROUP_LEAVE_REQUEST, KIND_GROUP_MEMBERS, KIND_GROUP_METADATA,
- KIND_GROUP_PUT_USER, KIND_GROUP_REMOVE_USER, KIND_GROUP_ROLES, RadrootsGroupAdmins,
- RadrootsGroupCreateGroup, RadrootsGroupCreateInvite, RadrootsGroupDeleteEvent,
- RadrootsGroupDeleteGroup, RadrootsGroupEditMetadata, RadrootsGroupEditableMetadata,
- RadrootsGroupJoinRequest, RadrootsGroupLeaveRequest, RadrootsGroupMembers,
- RadrootsGroupMetadata, RadrootsGroupPutUser, RadrootsGroupRemoveUser, RadrootsGroupRole,
- RadrootsGroupRoles, RadrootsGroupUserRef,
+ KIND_GROUP_PUT_USER, KIND_GROUP_REMOVE_USER, KIND_GROUP_ROLES,
},
tag::name::{TAG_D, TAG_E, TAG_H, TAG_P},
};
@@ -24,7 +22,7 @@ use crate::error::EventEncodeError;
use crate::field_helpers::{
push_optional_tag, push_tag, push_tag_values, validate_non_empty_field,
};
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
const TAG_ABOUT: &str = "about";
const TAG_CLOSED: &str = "closed";
@@ -38,7 +36,7 @@ const TAG_ROLE: &str = "role";
const TAG_SUPPORTED_KINDS: &str = "supported_kinds";
pub fn group_put_user_build_tags(
- event: &RadrootsGroupPutUser,
+ event: &GroupPutUser,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
let mut tags = h_tags(&event.group_id)?;
push_user_tag(&mut tags, &event.pubkey, &event.roles)?;
@@ -46,7 +44,7 @@ pub fn group_put_user_build_tags(
}
pub fn group_remove_user_build_tags(
- event: &RadrootsGroupRemoveUser,
+ event: &GroupRemoveUser,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
let mut tags = h_tags(&event.group_id)?;
push_tag(&mut tags, TAG_P, event.pubkey.as_str());
@@ -55,7 +53,7 @@ pub fn group_remove_user_build_tags(
}
pub fn group_create_group_build_tags(
- event: &RadrootsGroupCreateGroup,
+ event: &GroupCreateGroup,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
let mut tags = h_tags(&event.group_id)?;
push_metadata_tags(&mut tags, &event.metadata)?;
@@ -63,7 +61,7 @@ pub fn group_create_group_build_tags(
}
pub fn group_edit_metadata_build_tags(
- event: &RadrootsGroupEditMetadata,
+ event: &GroupEditMetadata,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
let mut tags = h_tags(&event.group_id)?;
push_metadata_tags(&mut tags, &event.metadata)?;
@@ -71,13 +69,13 @@ pub fn group_edit_metadata_build_tags(
}
pub fn group_delete_group_build_tags(
- event: &RadrootsGroupDeleteGroup,
+ event: &GroupDeleteGroup,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
h_tags(&event.group_id)
}
pub fn group_delete_event_build_tags(
- event: &RadrootsGroupDeleteEvent,
+ event: &GroupDeleteEvent,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
let mut tags = h_tags(&event.group_id)?;
validate_non_empty_field(&event.event_id, "event_id")?;
@@ -86,7 +84,7 @@ pub fn group_delete_event_build_tags(
}
pub fn group_create_invite_build_tags(
- event: &RadrootsGroupCreateInvite,
+ event: &GroupCreateInvite,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
let mut tags = h_tags(&event.group_id)?;
validate_non_empty_field(&event.code, "code")?;
@@ -95,7 +93,7 @@ pub fn group_create_invite_build_tags(
}
pub fn group_join_request_build_tags(
- event: &RadrootsGroupJoinRequest,
+ event: &GroupJoinRequest,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
let mut tags = h_tags(&event.group_id)?;
push_optional_tag(&mut tags, TAG_CODE, event.code.as_deref());
@@ -104,38 +102,34 @@ pub fn group_join_request_build_tags(
}
pub fn group_leave_request_build_tags(
- event: &RadrootsGroupLeaveRequest,
+ event: &GroupLeaveRequest,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
h_tags(&event.group_id)
}
pub fn group_metadata_build_tags(
- event: &RadrootsGroupMetadata,
+ event: &GroupMetadata,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
let mut tags = d_tags(&event.d_tag)?;
push_metadata_tags(&mut tags, &event.metadata)?;
Ok(tags)
}
-pub fn group_admins_build_tags(
- event: &RadrootsGroupAdmins,
-) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn group_admins_build_tags(event: &GroupAdmins) -> Result<Vec<Vec<String>>, EventEncodeError> {
let mut tags = d_tags(&event.d_tag)?;
push_user_refs(&mut tags, &event.admins)?;
Ok(tags)
}
pub fn group_members_build_tags(
- event: &RadrootsGroupMembers,
+ event: &GroupMembers,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
let mut tags = d_tags(&event.d_tag)?;
push_user_refs(&mut tags, &event.members)?;
Ok(tags)
}
-pub fn group_roles_build_tags(
- event: &RadrootsGroupRoles,
-) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn group_roles_build_tags(event: &GroupRoles) -> Result<Vec<Vec<String>>, EventEncodeError> {
let mut tags = d_tags(&event.d_tag)?;
for role in &event.roles {
validate_role(role)?;
@@ -150,8 +144,8 @@ pub fn group_roles_build_tags(
}
pub fn group_put_user_to_wire_parts(
- event: &RadrootsGroupPutUser,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ event: &GroupPutUser,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
message_wire(
KIND_GROUP_PUT_USER,
group_put_user_build_tags(event)?,
@@ -160,8 +154,8 @@ pub fn group_put_user_to_wire_parts(
}
pub fn group_remove_user_to_wire_parts(
- event: &RadrootsGroupRemoveUser,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ event: &GroupRemoveUser,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
message_wire(
KIND_GROUP_REMOVE_USER,
group_remove_user_build_tags(event)?,
@@ -170,8 +164,8 @@ pub fn group_remove_user_to_wire_parts(
}
pub fn group_create_group_to_wire_parts(
- event: &RadrootsGroupCreateGroup,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ event: &GroupCreateGroup,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
message_wire(
KIND_GROUP_CREATE_GROUP,
group_create_group_build_tags(event)?,
@@ -180,8 +174,8 @@ pub fn group_create_group_to_wire_parts(
}
pub fn group_edit_metadata_to_wire_parts(
- event: &RadrootsGroupEditMetadata,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ event: &GroupEditMetadata,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
message_wire(
KIND_GROUP_EDIT_METADATA,
group_edit_metadata_build_tags(event)?,
@@ -190,8 +184,8 @@ pub fn group_edit_metadata_to_wire_parts(
}
pub fn group_delete_group_to_wire_parts(
- event: &RadrootsGroupDeleteGroup,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ event: &GroupDeleteGroup,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
message_wire(
KIND_GROUP_DELETE_GROUP,
group_delete_group_build_tags(event)?,
@@ -200,8 +194,8 @@ pub fn group_delete_group_to_wire_parts(
}
pub fn group_delete_event_to_wire_parts(
- event: &RadrootsGroupDeleteEvent,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ event: &GroupDeleteEvent,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
message_wire(
KIND_GROUP_DELETE_EVENT,
group_delete_event_build_tags(event)?,
@@ -210,8 +204,8 @@ pub fn group_delete_event_to_wire_parts(
}
pub fn group_create_invite_to_wire_parts(
- event: &RadrootsGroupCreateInvite,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ event: &GroupCreateInvite,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
message_wire(
KIND_GROUP_CREATE_INVITE,
group_create_invite_build_tags(event)?,
@@ -220,8 +214,8 @@ pub fn group_create_invite_to_wire_parts(
}
pub fn group_join_request_to_wire_parts(
- event: &RadrootsGroupJoinRequest,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ event: &GroupJoinRequest,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
message_wire(
KIND_GROUP_JOIN_REQUEST,
group_join_request_build_tags(event)?,
@@ -230,8 +224,8 @@ pub fn group_join_request_to_wire_parts(
}
pub fn group_leave_request_to_wire_parts(
- event: &RadrootsGroupLeaveRequest,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ event: &GroupLeaveRequest,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
message_wire(
KIND_GROUP_LEAVE_REQUEST,
group_leave_request_build_tags(event)?,
@@ -240,14 +234,14 @@ pub fn group_leave_request_to_wire_parts(
}
pub fn group_metadata_to_wire_parts(
- event: &RadrootsGroupMetadata,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ event: &GroupMetadata,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
empty_wire(KIND_GROUP_METADATA, group_metadata_build_tags(event)?)
}
pub fn group_admins_to_wire_parts(
- event: &RadrootsGroupAdmins,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ event: &GroupAdmins,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
message_wire(
KIND_GROUP_ADMINS,
group_admins_build_tags(event)?,
@@ -256,8 +250,8 @@ pub fn group_admins_to_wire_parts(
}
pub fn group_members_to_wire_parts(
- event: &RadrootsGroupMembers,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ event: &GroupMembers,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
message_wire(
KIND_GROUP_MEMBERS,
group_members_build_tags(event)?,
@@ -266,8 +260,8 @@ pub fn group_members_to_wire_parts(
}
pub fn group_roles_to_wire_parts(
- event: &RadrootsGroupRoles,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ event: &GroupRoles,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
message_wire(
KIND_GROUP_ROLES,
group_roles_build_tags(event)?,
@@ -291,7 +285,7 @@ fn d_tags(d_tag: &str) -> Result<Vec<Vec<String>>, EventEncodeError> {
fn push_metadata_tags(
tags: &mut Vec<Vec<String>>,
- metadata: &RadrootsGroupEditableMetadata,
+ metadata: &GroupEditableMetadata,
) -> Result<(), EventEncodeError> {
push_optional_tag(tags, TAG_NAME, metadata.name.as_deref());
push_optional_tag(tags, TAG_ABOUT, metadata.about.as_deref());
@@ -327,7 +321,7 @@ fn push_marker_tag(tags: &mut Vec<Vec<String>>, key: &str) {
fn push_user_refs(
tags: &mut Vec<Vec<String>>,
- users: &[RadrootsGroupUserRef],
+ users: &[GroupUserRef],
) -> Result<(), EventEncodeError> {
for user in users {
push_user_tag(tags, &user.pubkey, &user.roles)?;
@@ -350,7 +344,7 @@ fn push_user_tag(
Ok(())
}
-fn validate_role(role: &RadrootsGroupRole) -> Result<(), EventEncodeError> {
+fn validate_role(role: &GroupRole) -> Result<(), EventEncodeError> {
validate_non_empty_field(&role.name, "role.name")?;
validate_optional(role.description.as_deref(), "role.description")?;
for permission in &role.permissions {
@@ -366,11 +360,8 @@ fn validate_optional(value: Option<&str>, field: &'static str) -> Result<(), Eve
Ok(())
}
-fn empty_wire(
- kind: u32,
- tags: Vec<Vec<String>>,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
- Ok(RadrootsNip01EventWireParts {
+fn empty_wire(kind: u32, tags: Vec<Vec<String>>) -> Result<Nip01EventWireParts, EventEncodeError> {
+ Ok(Nip01EventWireParts {
kind,
content: String::new(),
tags,
@@ -381,9 +372,9 @@ fn message_wire(
kind: u32,
tags: Vec<Vec<String>>,
message: Option<&str>,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
validate_optional(message, "message")?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content: message.unwrap_or_default().to_string(),
tags,
diff --git a/crates/event_codec/src/group/mod.rs b/crates/event_codec/src/group/mod.rs
@@ -4,15 +4,13 @@ pub mod encode;
#[cfg(test)]
mod tests {
use radroots_event::social::group::{
- KIND_GROUP_ADMINS, KIND_GROUP_CREATE_GROUP, KIND_GROUP_CREATE_INVITE,
+ GroupAdmins, GroupCreateGroup, GroupCreateInvite, GroupDeleteEvent, GroupDeleteGroup,
+ GroupEditMetadata, GroupEditableMetadata, GroupJoinRequest, GroupLeaveRequest,
+ GroupMembers, GroupMetadata, GroupPutUser, GroupRemoveUser, GroupRole, GroupRoles,
+ GroupUserRef, KIND_GROUP_ADMINS, KIND_GROUP_CREATE_GROUP, KIND_GROUP_CREATE_INVITE,
KIND_GROUP_DELETE_EVENT, KIND_GROUP_DELETE_GROUP, KIND_GROUP_EDIT_METADATA,
KIND_GROUP_JOIN_REQUEST, KIND_GROUP_LEAVE_REQUEST, KIND_GROUP_MEMBERS, KIND_GROUP_METADATA,
- KIND_GROUP_PUT_USER, KIND_GROUP_REMOVE_USER, KIND_GROUP_ROLES, RadrootsGroupAdmins,
- RadrootsGroupCreateGroup, RadrootsGroupCreateInvite, RadrootsGroupDeleteEvent,
- RadrootsGroupDeleteGroup, RadrootsGroupEditMetadata, RadrootsGroupEditableMetadata,
- RadrootsGroupJoinRequest, RadrootsGroupLeaveRequest, RadrootsGroupMembers,
- RadrootsGroupMetadata, RadrootsGroupPutUser, RadrootsGroupRemoveUser, RadrootsGroupRole,
- RadrootsGroupRoles, RadrootsGroupUserRef,
+ KIND_GROUP_PUT_USER, KIND_GROUP_REMOVE_USER, KIND_GROUP_ROLES,
};
use crate::error::{EventEncodeError, EventParseError};
@@ -34,13 +32,13 @@ mod tests {
#[test]
fn group_user_operations_use_h_group_id_routing() {
- let put = RadrootsGroupPutUser {
+ let put = GroupPutUser {
group_id: "field-group".to_string(),
message: Some("add member".to_string()),
pubkey: "member_pubkey".to_string(),
roles: vec!["member".to_string()],
};
- let remove = RadrootsGroupRemoveUser {
+ let remove = GroupRemoveUser {
group_id: "field-group".to_string(),
message: Some("remove member".to_string()),
pubkey: "member_pubkey".to_string(),
@@ -78,21 +76,21 @@ mod tests {
#[test]
fn group_metadata_and_lists_use_d_tag_routing() {
- let metadata = RadrootsGroupMetadata {
+ let metadata = GroupMetadata {
d_tag: "field-group".to_string(),
metadata: sample_metadata(),
};
- let admins = RadrootsGroupAdmins {
+ let admins = GroupAdmins {
d_tag: "field-group".to_string(),
description: Some("group admins".to_string()),
admins: vec![sample_user("admin_pubkey", "admin")],
};
- let members = RadrootsGroupMembers {
+ let members = GroupMembers {
d_tag: "field-group".to_string(),
description: Some("group members".to_string()),
members: vec![sample_user("member_pubkey", "member")],
};
- let roles = RadrootsGroupRoles {
+ let roles = GroupRoles {
d_tag: "field-group".to_string(),
description: Some("group roles".to_string()),
roles: vec![sample_role()],
@@ -156,12 +154,12 @@ mod tests {
#[test]
fn group_invites_and_join_requests_roundtrip_without_field_authorization() {
- let invite = RadrootsGroupCreateInvite {
+ let invite = GroupCreateInvite {
group_id: "field-group".to_string(),
message: Some("join the field group".to_string()),
code: "invite-code".to_string(),
};
- let join = RadrootsGroupJoinRequest {
+ let join = GroupJoinRequest {
group_id: "field-group".to_string(),
message: Some("requesting access".to_string()),
code: Some("invite-code".to_string()),
@@ -195,31 +193,31 @@ mod tests {
#[test]
fn group_lifecycle_and_moderation_events_roundtrip() {
- let metadata = RadrootsGroupEditableMetadata {
+ let metadata = GroupEditableMetadata {
is_private: true,
is_hidden: true,
..sample_metadata()
};
- let create = RadrootsGroupCreateGroup {
+ let create = GroupCreateGroup {
group_id: "field-group".to_string(),
message: Some("create group".to_string()),
metadata: metadata.clone(),
};
- let edit = RadrootsGroupEditMetadata {
+ let edit = GroupEditMetadata {
group_id: "field-group".to_string(),
message: Some("edit group".to_string()),
metadata,
};
- let delete_group = RadrootsGroupDeleteGroup {
+ let delete_group = GroupDeleteGroup {
group_id: "field-group".to_string(),
message: Some("delete group".to_string()),
};
- let delete_event = RadrootsGroupDeleteEvent {
+ let delete_event = GroupDeleteEvent {
group_id: "field-group".to_string(),
message: Some("delete event".to_string()),
event_id: "event_id".to_string(),
};
- let leave = RadrootsGroupLeaveRequest {
+ let leave = GroupLeaveRequest {
group_id: "field-group".to_string(),
message: None,
};
@@ -286,7 +284,7 @@ mod tests {
#[test]
fn group_codecs_reject_wrong_routing_tags() {
- let metadata = RadrootsGroupMetadata {
+ let metadata = GroupMetadata {
d_tag: "field-group".to_string(),
metadata: sample_metadata(),
};
@@ -303,7 +301,7 @@ mod tests {
.unwrap_err();
assert!(matches!(metadata_err, EventParseError::MissingTag("d")));
- let put = RadrootsGroupPutUser {
+ let put = GroupPutUser {
group_id: "field-group".to_string(),
message: None,
pubkey: "member_pubkey".to_string(),
@@ -349,7 +347,7 @@ mod tests {
#[test]
fn group_encoders_reject_empty_required_fields() {
assert_empty_required(
- group_put_user_to_wire_parts(&RadrootsGroupPutUser {
+ group_put_user_to_wire_parts(&GroupPutUser {
group_id: "".to_string(),
message: None,
pubkey: "member_pubkey".to_string(),
@@ -358,7 +356,7 @@ mod tests {
"group_id",
);
assert_empty_required(
- group_put_user_to_wire_parts(&RadrootsGroupPutUser {
+ group_put_user_to_wire_parts(&GroupPutUser {
group_id: "field-group".to_string(),
message: None,
pubkey: "".to_string(),
@@ -367,7 +365,7 @@ mod tests {
"pubkey",
);
assert_empty_required(
- group_put_user_to_wire_parts(&RadrootsGroupPutUser {
+ group_put_user_to_wire_parts(&GroupPutUser {
group_id: "field-group".to_string(),
message: None,
pubkey: "member_pubkey".to_string(),
@@ -376,7 +374,7 @@ mod tests {
"roles",
);
assert_empty_required(
- group_remove_user_to_wire_parts(&RadrootsGroupRemoveUser {
+ group_remove_user_to_wire_parts(&GroupRemoveUser {
group_id: "field-group".to_string(),
message: None,
pubkey: "".to_string(),
@@ -384,7 +382,7 @@ mod tests {
"pubkey",
);
assert_empty_required(
- group_create_group_to_wire_parts(&RadrootsGroupCreateGroup {
+ group_create_group_to_wire_parts(&GroupCreateGroup {
group_id: "field-group".to_string(),
message: Some("".to_string()),
metadata: sample_metadata(),
@@ -392,10 +390,10 @@ mod tests {
"message",
);
assert_empty_required(
- group_edit_metadata_to_wire_parts(&RadrootsGroupEditMetadata {
+ group_edit_metadata_to_wire_parts(&GroupEditMetadata {
group_id: "field-group".to_string(),
message: None,
- metadata: RadrootsGroupEditableMetadata {
+ metadata: GroupEditableMetadata {
name: Some("".to_string()),
..sample_metadata()
},
@@ -403,7 +401,7 @@ mod tests {
"name",
);
assert_empty_required(
- group_delete_event_to_wire_parts(&RadrootsGroupDeleteEvent {
+ group_delete_event_to_wire_parts(&GroupDeleteEvent {
group_id: "field-group".to_string(),
message: None,
event_id: "".to_string(),
@@ -411,7 +409,7 @@ mod tests {
"event_id",
);
assert_empty_required(
- group_create_invite_to_wire_parts(&RadrootsGroupCreateInvite {
+ group_create_invite_to_wire_parts(&GroupCreateInvite {
group_id: "field-group".to_string(),
message: None,
code: "".to_string(),
@@ -419,7 +417,7 @@ mod tests {
"code",
);
assert_empty_required(
- group_join_request_to_wire_parts(&RadrootsGroupJoinRequest {
+ group_join_request_to_wire_parts(&GroupJoinRequest {
group_id: "field-group".to_string(),
message: None,
code: Some("".to_string()),
@@ -427,24 +425,24 @@ mod tests {
"code",
);
assert_empty_required(
- group_leave_request_to_wire_parts(&RadrootsGroupLeaveRequest {
+ group_leave_request_to_wire_parts(&GroupLeaveRequest {
group_id: "".to_string(),
message: None,
}),
"group_id",
);
assert_empty_required(
- group_metadata_to_wire_parts(&RadrootsGroupMetadata {
+ group_metadata_to_wire_parts(&GroupMetadata {
d_tag: "".to_string(),
metadata: sample_metadata(),
}),
"d_tag",
);
assert_empty_required(
- group_admins_to_wire_parts(&RadrootsGroupAdmins {
+ group_admins_to_wire_parts(&GroupAdmins {
d_tag: "field-group".to_string(),
description: None,
- admins: vec![RadrootsGroupUserRef {
+ admins: vec![GroupUserRef {
pubkey: "".to_string(),
roles: vec![],
}],
@@ -452,7 +450,7 @@ mod tests {
"pubkey",
);
assert_empty_required(
- group_members_to_wire_parts(&RadrootsGroupMembers {
+ group_members_to_wire_parts(&GroupMembers {
d_tag: "field-group".to_string(),
description: Some("".to_string()),
members: vec![],
@@ -460,10 +458,10 @@ mod tests {
"message",
);
assert_empty_required(
- group_members_to_wire_parts(&RadrootsGroupMembers {
+ group_members_to_wire_parts(&GroupMembers {
d_tag: "field-group".to_string(),
description: None,
- members: vec![RadrootsGroupUserRef {
+ members: vec![GroupUserRef {
pubkey: "member_pubkey".to_string(),
roles: vec!["".to_string()],
}],
@@ -471,10 +469,10 @@ mod tests {
"roles",
);
assert_empty_required(
- group_roles_to_wire_parts(&RadrootsGroupRoles {
+ group_roles_to_wire_parts(&GroupRoles {
d_tag: "field-group".to_string(),
description: None,
- roles: vec![RadrootsGroupRole {
+ roles: vec![GroupRole {
name: "".to_string(),
description: None,
permissions: vec![],
@@ -483,10 +481,10 @@ mod tests {
"role.name",
);
assert_empty_required(
- group_roles_to_wire_parts(&RadrootsGroupRoles {
+ group_roles_to_wire_parts(&GroupRoles {
d_tag: "field-group".to_string(),
description: None,
- roles: vec![RadrootsGroupRole {
+ roles: vec![GroupRole {
name: "member".to_string(),
description: Some("".to_string()),
permissions: vec![],
@@ -495,10 +493,10 @@ mod tests {
"role.description",
);
assert_empty_required(
- group_roles_to_wire_parts(&RadrootsGroupRoles {
+ group_roles_to_wire_parts(&GroupRoles {
d_tag: "field-group".to_string(),
description: None,
- roles: vec![RadrootsGroupRole {
+ roles: vec![GroupRole {
name: "member".to_string(),
description: None,
permissions: vec!["".to_string()],
@@ -601,8 +599,8 @@ mod tests {
}
}
- fn sample_metadata() -> RadrootsGroupEditableMetadata {
- RadrootsGroupEditableMetadata {
+ fn sample_metadata() -> GroupEditableMetadata {
+ GroupEditableMetadata {
name: Some("Small Regen Farm".to_string()),
about: Some("Field app group".to_string()),
picture: Some("https://media.example.invalid/group.png".to_string()),
@@ -614,15 +612,15 @@ mod tests {
}
}
- fn sample_user(pubkey: &str, role: &str) -> RadrootsGroupUserRef {
- RadrootsGroupUserRef {
+ fn sample_user(pubkey: &str, role: &str) -> GroupUserRef {
+ GroupUserRef {
pubkey: pubkey.to_string(),
roles: vec![role.to_string()],
}
}
- fn sample_role() -> RadrootsGroupRole {
- RadrootsGroupRole {
+ fn sample_role() -> GroupRole {
+ GroupRole {
name: "member".to_string(),
description: Some("can read and write group events".to_string()),
permissions: vec!["read".to_string(), "write".to_string()],
diff --git a/crates/event_codec/src/http_auth/decode.rs b/crates/event_codec/src/http_auth/decode.rs
@@ -2,7 +2,7 @@
use alloc::{string::String, vec::Vec};
use radroots_event::{
- social::http_auth::{KIND_HTTP_AUTH, RadrootsHttpAuth},
+ social::http_auth::{HttpAuth, KIND_HTTP_AUTH},
tag::name::{TAG_METHOD, TAG_PAYLOAD, TAG_URL_AUTH},
};
@@ -19,7 +19,7 @@ pub fn http_auth_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsHttpAuth, EventParseError> {
+) -> Result<HttpAuth, EventParseError> {
if kind != KIND_HTTP_AUTH {
return Err(EventParseError::InvalidKind {
expected: EXPECTED_KIND,
@@ -31,7 +31,7 @@ pub fn http_auth_from_event(
if let Some(payload) = payload_sha256.as_deref() {
validate_lowercase_hex_64_tag(payload, TAG_PAYLOAD)?;
}
- Ok(RadrootsHttpAuth {
+ Ok(HttpAuth {
url: required_unique_tag_value(tags, TAG_URL_AUTH)?,
method: required_unique_tag_value(tags, TAG_METHOD)?,
payload_sha256,
@@ -45,7 +45,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsHttpAuth>, EventParseError> {
+) -> Result<RadrootsParsedData<HttpAuth>, EventParseError> {
let auth = http_auth_from_event(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -64,7 +64,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsHttpAuth>, EventParseError> {
+) -> Result<RadrootsParsedEvent<HttpAuth>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
diff --git a/crates/event_codec/src/http_auth/encode.rs b/crates/event_codec/src/http_auth/encode.rs
@@ -2,7 +2,7 @@
use alloc::{string::String, vec::Vec};
use radroots_event::{
- social::http_auth::{KIND_HTTP_AUTH, RadrootsHttpAuth},
+ social::http_auth::{HttpAuth, KIND_HTTP_AUTH},
tag::name::{TAG_METHOD, TAG_PAYLOAD, TAG_URL_AUTH},
};
@@ -10,9 +10,9 @@ use crate::error::EventEncodeError;
use crate::field_helpers::{
push_optional_tag, push_tag, validate_lowercase_hex_64, validate_non_empty_field,
};
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
-pub fn http_auth_build_tags(auth: &RadrootsHttpAuth) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn http_auth_build_tags(auth: &HttpAuth) -> Result<Vec<Vec<String>>, EventEncodeError> {
validate_non_empty_field(&auth.url, "url")?;
validate_non_empty_field(&auth.method, "method")?;
if let Some(payload) = auth.payload_sha256.as_deref() {
@@ -25,21 +25,19 @@ pub fn http_auth_build_tags(auth: &RadrootsHttpAuth) -> Result<Vec<Vec<String>>,
Ok(tags)
}
-pub fn to_wire_parts(
- auth: &RadrootsHttpAuth,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+pub fn to_wire_parts(auth: &HttpAuth) -> Result<Nip01EventWireParts, EventEncodeError> {
to_wire_parts_with_kind(auth, KIND_HTTP_AUTH)
}
pub fn to_wire_parts_with_kind(
- auth: &RadrootsHttpAuth,
+ auth: &HttpAuth,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != KIND_HTTP_AUTH {
return Err(EventEncodeError::InvalidKind(kind));
}
let tags = http_auth_build_tags(auth)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content: String::new(),
tags,
diff --git a/crates/event_codec/src/http_auth/mod.rs b/crates/event_codec/src/http_auth/mod.rs
@@ -3,7 +3,7 @@ pub mod encode;
#[cfg(test)]
mod tests {
- use radroots_event::{envelope::kind::KIND_POST, social::http_auth::RadrootsHttpAuth};
+ use radroots_event::{envelope::kind::KIND_POST, social::http_auth::HttpAuth};
use crate::error::{EventEncodeError, EventParseError};
use crate::http_auth::decode::{data_from_event, http_auth_from_event, parsed_from_event};
@@ -19,7 +19,7 @@ mod tests {
#[test]
fn http_auth_encodes_and_decodes_get_without_payload() {
- let auth = RadrootsHttpAuth {
+ let auth = HttpAuth {
url: "https://media.example.invalid/download".to_string(),
method: "GET".to_string(),
payload_sha256: None,
@@ -38,7 +38,7 @@ mod tests {
#[test]
fn http_auth_encodes_and_decodes_post_with_payload() {
- let auth = RadrootsHttpAuth {
+ let auth = HttpAuth {
url: "https://media.example.invalid/upload".to_string(),
method: "POST".to_string(),
payload_sha256: Some(PAYLOAD.to_string()),
@@ -53,7 +53,7 @@ mod tests {
#[test]
fn http_auth_rejects_missing_url_missing_method_bad_payload_and_content() {
- let auth = RadrootsHttpAuth {
+ let auth = HttpAuth {
url: "https://media.example.invalid/upload".to_string(),
method: "POST".to_string(),
payload_sha256: Some(PAYLOAD.to_string()),
@@ -126,7 +126,7 @@ mod tests {
#[test]
fn http_auth_rejects_wrong_kind() {
- let auth = RadrootsHttpAuth {
+ let auth = HttpAuth {
url: "https://media.example.invalid/upload".to_string(),
method: "POST".to_string(),
payload_sha256: Some(PAYLOAD.to_string()),
@@ -151,7 +151,7 @@ mod tests {
#[test]
#[cfg_attr(coverage_nightly, coverage(off))]
fn http_auth_rejects_duplicate_security_tags() {
- let auth = RadrootsHttpAuth {
+ let auth = HttpAuth {
url: "https://media.example.invalid/upload".to_string(),
method: "POST".to_string(),
payload_sha256: Some(PAYLOAD.to_string()),
@@ -171,7 +171,7 @@ mod tests {
#[test]
fn http_auth_wrappers_preserve_event_metadata() {
- let auth = RadrootsHttpAuth {
+ let auth = HttpAuth {
url: "https://media.example.invalid/upload".to_string(),
method: "POST".to_string(),
payload_sha256: Some(PAYLOAD.to_string()),
diff --git a/crates/event_codec/src/job/feedback/decode.rs b/crates/event_codec/src/job/feedback/decode.rs
@@ -1,6 +1,6 @@
use radroots_event::{
envelope::kind::KIND_JOB_FEEDBACK, social::job::JobPaymentRequest,
- social::job_feedback::RadrootsJobFeedback, tag::RadrootsEventPtr,
+ social::job_feedback::JobFeedback, tag::EventPtr,
};
#[cfg(not(feature = "std"))]
@@ -19,7 +19,7 @@ pub fn job_feedback_from_tags(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsJobFeedback, JobParseError> {
+) -> Result<JobFeedback, JobParseError> {
let kind = u16::try_from(kind).map_err(|_| JobParseError::KindOutOfRange(kind))?;
let etag = tags
.iter()
@@ -56,11 +56,11 @@ pub fn job_feedback_from_tags(
.find(|t| t.first().map(|s| s.as_str()) == Some("p"))
.and_then(|t| t.get(1).cloned());
- Ok(RadrootsJobFeedback {
+ Ok(JobFeedback {
kind,
status,
extra_info,
- request_event: RadrootsEventPtr {
+ request_event: EventPtr {
id: req_id,
relays: relay_hint,
},
@@ -82,7 +82,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsJobFeedback>, JobParseError> {
+) -> Result<RadrootsParsedData<JobFeedback>, JobParseError> {
if kind != KIND_JOB_FEEDBACK {
return Err(JobParseError::InvalidTag("kind (expected 7000)"));
}
@@ -104,7 +104,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsJobFeedback>, JobParseError> {
+) -> Result<RadrootsParsedEvent<JobFeedback>, JobParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
diff --git a/crates/event_codec/src/job/feedback/encode.rs b/crates/event_codec/src/job/feedback/encode.rs
@@ -1,10 +1,8 @@
-use radroots_event::{
- envelope::kind::KIND_JOB_FEEDBACK, social::job_feedback::RadrootsJobFeedback,
-};
+use radroots_event::{envelope::kind::KIND_JOB_FEEDBACK, social::job_feedback::JobFeedback};
use crate::job::encode::{JobEncodeError, canonicalize_tags};
use crate::job::util::{feedback_status_tag, push_amount_tag_msat};
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
#[cfg(not(feature = "std"))]
use alloc::{
@@ -13,7 +11,7 @@ use alloc::{
vec::Vec,
};
-pub fn job_feedback_build_tags(fb: &RadrootsJobFeedback) -> Vec<Vec<String>> {
+pub fn job_feedback_build_tags(fb: &JobFeedback) -> Vec<Vec<String>> {
let mut tags: Vec<Vec<String>> = Vec::with_capacity(
2 + usize::from(fb.customer_pubkey.is_some())
+ usize::from(fb.payment.is_some())
@@ -52,9 +50,9 @@ pub fn job_feedback_build_tags(fb: &RadrootsJobFeedback) -> Vec<Vec<String>> {
}
pub fn to_wire_parts(
- fb: &RadrootsJobFeedback,
+ fb: &JobFeedback,
content: &str,
-) -> Result<RadrootsNip01EventWireParts, JobEncodeError> {
+) -> Result<Nip01EventWireParts, JobEncodeError> {
let kind = fb.kind as u32;
if kind != KIND_JOB_FEEDBACK {
return Err(JobEncodeError::InvalidKind(kind));
@@ -63,7 +61,7 @@ pub fn to_wire_parts(
let mut tags = job_feedback_build_tags(fb);
canonicalize_tags(&mut tags);
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content: content.to_string(),
tags,
diff --git a/crates/event_codec/src/job/request/decode.rs b/crates/event_codec/src/job/request/decode.rs
@@ -1,6 +1,6 @@
use radroots_event::{
envelope::kind::is_request_kind,
- social::job_request::{RadrootsJobInput, RadrootsJobParam, RadrootsJobRequest},
+ social::job_request::{JobInput, JobParam, JobRequest},
};
#[cfg(not(feature = "std"))]
@@ -12,19 +12,16 @@ use crate::job::{
};
use crate::parsed::{RadrootsParsedData, RadrootsParsedEvent};
-pub fn job_request_from_tags(
- kind: u32,
- tags: &[Vec<String>],
-) -> Result<RadrootsJobRequest, JobParseError> {
+pub fn job_request_from_tags(kind: u32, tags: &[Vec<String>]) -> Result<JobRequest, JobParseError> {
let kind = u16::try_from(kind).map_err(|_| JobParseError::KindOutOfRange(kind))?;
- let inputs: Vec<RadrootsJobInput> = parse_i_tags(tags);
+ let inputs: Vec<JobInput> = parse_i_tags(tags);
let output = tags
.iter()
.find(|t| t.first().map(|s| s.as_str()) == Some("output"))
.and_then(|t| t.get(1).cloned());
- let params: Vec<RadrootsJobParam> = parse_params(tags);
+ let params: Vec<JobParam> = parse_params(tags);
let bid_sat = parse_bid_tag_sat(tags)?;
@@ -52,7 +49,7 @@ pub fn job_request_from_tags(
return Err(JobParseError::MissingTag("p"));
}
- Ok(RadrootsJobRequest {
+ Ok(JobRequest {
kind,
inputs,
output,
@@ -71,7 +68,7 @@ pub fn data_from_event(
published_at: u64,
kind: u32,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsJobRequest>, JobParseError> {
+) -> Result<RadrootsParsedData<JobRequest>, JobParseError> {
if !is_request_kind(kind) {
return Err(JobParseError::InvalidTag("kind (expected 5000-5999)"));
}
@@ -93,7 +90,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsJobRequest>, JobParseError> {
+) -> Result<RadrootsParsedEvent<JobRequest>, JobParseError> {
let data = data_from_event(id.clone(), author.clone(), published_at, kind, tags.clone())?;
RadrootsParsedEvent::from_event_parts(id, author, published_at, kind, content, tags, sig, data)
.map_err(|_| JobParseError::InvalidTag("event_envelope"))
diff --git a/crates/event_codec/src/job/request/encode.rs b/crates/event_codec/src/job/request/encode.rs
@@ -1,8 +1,8 @@
-use radroots_event::{envelope::kind::is_request_kind, social::job_request::RadrootsJobRequest};
+use radroots_event::{envelope::kind::is_request_kind, social::job_request::JobRequest};
use crate::job::encode::{JobEncodeError, canonicalize_tags};
use crate::job::util::{job_input_type_tag, push_bid_tag_sat};
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
#[cfg(not(feature = "std"))]
use alloc::{
@@ -11,7 +11,7 @@ use alloc::{
vec::Vec,
};
-pub fn job_request_build_tags(req: &RadrootsJobRequest) -> Vec<Vec<String>> {
+pub fn job_request_build_tags(req: &JobRequest) -> Vec<Vec<String>> {
let mut tags: Vec<Vec<String>> = Vec::with_capacity(
req.inputs.len()
+ req.params.len()
@@ -69,9 +69,9 @@ pub fn job_request_build_tags(req: &RadrootsJobRequest) -> Vec<Vec<String>> {
}
pub fn to_wire_parts(
- req: &RadrootsJobRequest,
+ req: &JobRequest,
content: &str,
-) -> Result<RadrootsNip01EventWireParts, JobEncodeError> {
+) -> Result<Nip01EventWireParts, JobEncodeError> {
let kind = req.kind as u32;
if !is_request_kind(kind) {
return Err(JobEncodeError::InvalidKind(kind));
@@ -83,7 +83,7 @@ pub fn to_wire_parts(
let mut tags = job_request_build_tags(req);
canonicalize_tags(&mut tags);
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content: content.to_string(),
tags,
diff --git a/crates/event_codec/src/job/result/decode.rs b/crates/event_codec/src/job/result/decode.rs
@@ -1,7 +1,6 @@
use radroots_event::{
- envelope::kind::is_result_kind, social::job::JobPaymentRequest,
- social::job_request::RadrootsJobInput, social::job_result::RadrootsJobResult,
- tag::RadrootsEventPtr,
+ envelope::kind::is_result_kind, social::job::JobPaymentRequest, social::job_request::JobInput,
+ social::job_result::JobResult, tag::EventPtr,
};
#[cfg(not(feature = "std"))]
@@ -20,7 +19,7 @@ pub fn job_result_from_tags(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsJobResult, JobParseError> {
+) -> Result<JobResult, JobParseError> {
let kind = u16::try_from(kind).map_err(|_| JobParseError::KindOutOfRange(kind))?;
let etag = tags
.iter()
@@ -39,7 +38,7 @@ pub fn job_result_from_tags(
.find(|t| t.first().map(|s| s.as_str()) == Some("request"))
.and_then(|t| t.get(1).cloned());
- let inputs: Vec<RadrootsJobInput> = parse_i_tags(tags);
+ let inputs: Vec<JobInput> = parse_i_tags(tags);
let payment = parse_amount_tag_sat(tags)?.map(|(sat, bolt11)| JobPaymentRequest {
amount_sat: sat,
@@ -53,9 +52,9 @@ pub fn job_result_from_tags(
.find(|t| t.first().map(|s| s.as_str()) == Some("p"))
.and_then(|t| t.get(1).cloned());
- Ok(RadrootsJobResult {
+ Ok(JobResult {
kind,
- request_event: RadrootsEventPtr {
+ request_event: EventPtr {
id: req_id,
relays: relay_hint,
},
@@ -79,7 +78,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsJobResult>, JobParseError> {
+) -> Result<RadrootsParsedData<JobResult>, JobParseError> {
if !is_result_kind(kind) {
return Err(JobParseError::InvalidTag("kind (expected 6000-6999)"));
}
@@ -101,7 +100,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsJobResult>, JobParseError> {
+) -> Result<RadrootsParsedEvent<JobResult>, JobParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
diff --git a/crates/event_codec/src/job/result/encode.rs b/crates/event_codec/src/job/result/encode.rs
@@ -1,8 +1,8 @@
-use radroots_event::{envelope::kind::is_result_kind, social::job_result::RadrootsJobResult};
+use radroots_event::{envelope::kind::is_result_kind, social::job_result::JobResult};
use crate::job::encode::{JobEncodeError, canonicalize_tags};
use crate::job::util::{job_input_type_tag, push_amount_tag_msat};
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
#[cfg(not(feature = "std"))]
use alloc::{
@@ -11,7 +11,7 @@ use alloc::{
vec::Vec,
};
-pub fn job_result_build_tags(res: &RadrootsJobResult) -> Vec<Vec<String>> {
+pub fn job_result_build_tags(res: &JobResult) -> Vec<Vec<String>> {
let mut tags: Vec<Vec<String>> = Vec::with_capacity(
2 + res.inputs.len()
+ usize::from(res.customer_pubkey.is_some())
@@ -63,9 +63,9 @@ pub fn job_result_build_tags(res: &RadrootsJobResult) -> Vec<Vec<String>> {
}
pub fn to_wire_parts(
- res: &RadrootsJobResult,
+ res: &JobResult,
content: &str,
-) -> Result<RadrootsNip01EventWireParts, JobEncodeError> {
+) -> Result<Nip01EventWireParts, JobEncodeError> {
let kind = res.kind as u32;
if !is_result_kind(kind) {
return Err(JobEncodeError::InvalidKind(kind));
@@ -78,7 +78,7 @@ pub fn to_wire_parts(
canonicalize_tags(&mut tags);
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content: content.to_string(),
tags,
diff --git a/crates/event_codec/src/job/traits.rs b/crates/event_codec/src/job/traits.rs
@@ -5,8 +5,8 @@ use crate::parsed::{RadrootsParsedData, RadrootsParsedEvent};
#[cfg(not(feature = "std"))]
use alloc::{borrow::ToOwned, string::String, vec::Vec};
use radroots_event::{
- social::job_feedback::RadrootsJobFeedback, social::job_request::RadrootsJobRequest,
- social::job_result::RadrootsJobResult,
+ social::job_feedback::JobFeedback, social::job_request::JobRequest,
+ social::job_result::JobResult,
};
use crate::job::{
@@ -33,9 +33,7 @@ pub trait JobEventLike {
fn raw_tags(&self) -> Vec<Vec<String>>;
fn raw_sig(&self) -> String;
- fn to_job_request_metadata(
- &self,
- ) -> Result<RadrootsParsedData<RadrootsJobRequest>, JobParseError> {
+ fn to_job_request_metadata(&self) -> Result<RadrootsParsedData<JobRequest>, JobParseError> {
request_metadata_from_event(
self.raw_id(),
self.raw_author(),
@@ -45,9 +43,7 @@ pub trait JobEventLike {
)
}
- fn to_job_request_event_index(
- &self,
- ) -> Result<RadrootsParsedEvent<RadrootsJobRequest>, JobParseError> {
+ fn to_job_request_event_index(&self) -> Result<RadrootsParsedEvent<JobRequest>, JobParseError> {
request_index_from_event(
self.raw_id(),
self.raw_author(),
@@ -59,9 +55,7 @@ pub trait JobEventLike {
)
}
- fn to_job_result_metadata(
- &self,
- ) -> Result<RadrootsParsedData<RadrootsJobResult>, JobParseError> {
+ fn to_job_result_metadata(&self) -> Result<RadrootsParsedData<JobResult>, JobParseError> {
result_metadata_from_event(
self.raw_id(),
self.raw_author(),
@@ -72,9 +66,7 @@ pub trait JobEventLike {
)
}
- fn to_job_result_event_index(
- &self,
- ) -> Result<RadrootsParsedEvent<RadrootsJobResult>, JobParseError> {
+ fn to_job_result_event_index(&self) -> Result<RadrootsParsedEvent<JobResult>, JobParseError> {
result_index_from_event(
self.raw_id(),
self.raw_author(),
@@ -86,9 +78,7 @@ pub trait JobEventLike {
)
}
- fn to_job_feedback_metadata(
- &self,
- ) -> Result<RadrootsParsedData<RadrootsJobFeedback>, JobParseError> {
+ fn to_job_feedback_metadata(&self) -> Result<RadrootsParsedData<JobFeedback>, JobParseError> {
feedback_metadata_from_event(
self.raw_id(),
self.raw_author(),
@@ -101,7 +91,7 @@ pub trait JobEventLike {
fn to_job_feedback_event_index(
&self,
- ) -> Result<RadrootsParsedEvent<RadrootsJobFeedback>, JobParseError> {
+ ) -> Result<RadrootsParsedEvent<JobFeedback>, JobParseError> {
feedback_index_from_event(
self.raw_id(),
self.raw_author(),
@@ -176,7 +166,7 @@ impl<'a, E: JobEventBorrow<'a>> JobEventLike for BorrowedEventAdapter<'a, E> {
}
}
-impl<'a> JobEventBorrow<'a> for radroots_event::envelope::RadrootsEventEnvelope {
+impl<'a> JobEventBorrow<'a> for radroots_event::envelope::EventEnvelope {
#[inline]
fn raw_id(&'a self) -> String {
self.id_hex()
diff --git a/crates/event_codec/src/job/util.rs b/crates/event_codec/src/job/util.rs
@@ -7,7 +7,7 @@ use alloc::{
use radroots_event::{
social::job::{JobFeedbackStatus, JobInputType},
- social::job_request::{RadrootsJobInput, RadrootsJobParam},
+ social::job_request::{JobInput, JobParam},
};
use crate::job::error::JobParseError;
@@ -86,7 +86,7 @@ pub fn feedback_status_from_tag(s: &str) -> Option<JobFeedbackStatus> {
}
}
-pub fn parse_i_tags(tags: &[Vec<String>]) -> Vec<RadrootsJobInput> {
+pub fn parse_i_tags(tags: &[Vec<String>]) -> Vec<JobInput> {
let mut out = Vec::new();
for t in tags
.iter()
@@ -149,7 +149,7 @@ pub fn parse_i_tags(tags: &[Vec<String>]) -> Vec<RadrootsJobInput> {
}
}
- out.push(RadrootsJobInput {
+ out.push(JobInput {
data,
input_type,
relay,
@@ -159,14 +159,14 @@ pub fn parse_i_tags(tags: &[Vec<String>]) -> Vec<RadrootsJobInput> {
out
}
-pub fn parse_params(tags: &[Vec<String>]) -> Vec<RadrootsJobParam> {
+pub fn parse_params(tags: &[Vec<String>]) -> Vec<JobParam> {
let mut params = Vec::new();
for t in tags
.iter()
.filter(|t| t.first().map(|s| s.as_str()) == Some("param"))
{
if t.len() >= 3 {
- params.push(RadrootsJobParam {
+ params.push(JobParam {
key: t[1].clone(),
value: t[2].clone(),
});
diff --git a/crates/event_codec/src/knowledge/decode.rs b/crates/event_codec/src/knowledge/decode.rs
@@ -11,15 +11,14 @@ use radroots_event::envelope::kind::{
KIND_WIKI_REDIRECT,
};
use radroots_event::knowledge::{
- RADROOTS_CONTRIBUTION_ATTESTATION_SCHEMA, RADROOTS_EVIDENCE_BOUNTY_SCHEMA,
- RADROOTS_KNOWLEDGE_CHANGE_PROPOSAL_SCHEMA, RADROOTS_KNOWLEDGE_CLAIM_SCHEMA,
- RADROOTS_KNOWLEDGE_FIELD_REPORT_SCHEMA, RADROOTS_KNOWLEDGE_RELATION_SCHEMA,
- RADROOTS_KNOWLEDGE_REVIEW_SCHEMA, RADROOTS_KNOWLEDGE_SOURCE_SCHEMA, RadrootsAddressableRef,
- RadrootsContributionAttestation, RadrootsEvidenceBounty, RadrootsKnowledgeChangeProposal,
- RadrootsKnowledgeClaim, RadrootsKnowledgeFieldReport, RadrootsKnowledgeRelation,
- RadrootsKnowledgeReview, RadrootsKnowledgeSource, RadrootsKnowledgeValidationError,
- RadrootsWikiArticle, RadrootsWikiArticleVersionRef, RadrootsWikiMergeRequest,
- RadrootsWikiRedirect, validate_contribution_attestation, validate_evidence_bounty,
+ AddressableRef, ContributionAttestation, EvidenceBounty, KnowledgeChangeProposal,
+ KnowledgeClaim, KnowledgeFieldReport, KnowledgeRelation, KnowledgeReview, KnowledgeSource,
+ KnowledgeValidationError, RADROOTS_CONTRIBUTION_ATTESTATION_SCHEMA,
+ RADROOTS_EVIDENCE_BOUNTY_SCHEMA, RADROOTS_KNOWLEDGE_CHANGE_PROPOSAL_SCHEMA,
+ RADROOTS_KNOWLEDGE_CLAIM_SCHEMA, RADROOTS_KNOWLEDGE_FIELD_REPORT_SCHEMA,
+ RADROOTS_KNOWLEDGE_RELATION_SCHEMA, RADROOTS_KNOWLEDGE_REVIEW_SCHEMA,
+ RADROOTS_KNOWLEDGE_SOURCE_SCHEMA, WikiArticle, WikiArticleVersionRef, WikiMergeRequest,
+ WikiRedirect, validate_contribution_attestation, validate_evidence_bounty,
validate_knowledge_change_proposal, validate_knowledge_claim, validate_knowledge_field_report,
validate_knowledge_relation, validate_knowledge_review, validate_knowledge_source,
validate_wiki_article, validate_wiki_d_tag, validate_wiki_merge_request,
@@ -28,7 +27,7 @@ use radroots_event::knowledge::{
use radroots_event::tag::name::{
TAG_A, TAG_CONTRACT, TAG_D, TAG_E, TAG_G, TAG_P, TAG_SUMMARY, TAG_T,
};
-use radroots_event::{envelope::RadrootsEventEnvelope, tag::RadrootsEventRef};
+use radroots_event::{envelope::EventEnvelope, tag::EventRef};
use serde::de::DeserializeOwned;
use crate::error::EventParseError;
@@ -173,10 +172,7 @@ fn ensure_mirrored_tags(
}
}
-fn event_refs(
- tags: &[Vec<String>],
- name: &'static str,
-) -> Result<Vec<RadrootsEventRef>, EventParseError> {
+fn event_refs(tags: &[Vec<String>], name: &'static str) -> Result<Vec<EventRef>, EventParseError> {
matching_tags(tags, name)
.into_iter()
.map(|tag| parse_event_ref_tag(tag, name))
@@ -233,10 +229,7 @@ fn unmarked_tags<'a>(tags: &'a [Vec<String>], name: &'static str) -> Vec<&'a Vec
.collect()
}
-fn address_from_tag(
- tag: &[String],
- name: &'static str,
-) -> Result<RadrootsAddressableRef, EventParseError> {
+fn address_from_tag(tag: &[String], name: &'static str) -> Result<AddressableRef, EventParseError> {
let value = tag.get(1).ok_or(EventParseError::InvalidTag(name))?;
let mut parts = value.splitn(3, ':');
let kind = parts
@@ -257,7 +250,7 @@ fn address_from_tag(
} else {
tag.len()
};
- Ok(RadrootsAddressableRef {
+ Ok(AddressableRef {
kind,
pubkey: pubkey.to_string(),
d_tag: d_tag.to_string(),
@@ -277,7 +270,7 @@ fn address_from_tag(
fn address_from_a_tag(
tags: &[Vec<String>],
name: &'static str,
-) -> Result<RadrootsAddressableRef, EventParseError> {
+) -> Result<AddressableRef, EventParseError> {
let matches = unmarked_tags(tags, name);
if matches.is_empty() {
return Err(EventParseError::MissingTag(name));
@@ -291,7 +284,7 @@ fn address_from_a_tag(
fn wiki_version_refs(
tags: &[Vec<String>],
marker_name: &'static str,
-) -> Result<Vec<RadrootsWikiArticleVersionRef>, EventParseError> {
+) -> Result<Vec<WikiArticleVersionRef>, EventParseError> {
let mut refs = Vec::new();
let mut index = 0;
while let Some(tag) = tags.get(index) {
@@ -327,7 +320,7 @@ fn wiki_version_refs(
.filter(|value| !value.trim().is_empty())
.ok_or(EventParseError::InvalidTag(TAG_E))?
.clone();
- refs.push(RadrootsWikiArticleVersionRef {
+ refs.push(WikiArticleVersionRef {
event_id,
address_ref,
});
@@ -377,7 +370,7 @@ fn json_content<T: DeserializeOwned>(content: &str) -> Result<T, EventParseError
serde_json::from_str(content).map_err(|_| EventParseError::InvalidJson("content"))
}
-fn parsed<T>(event: RadrootsEventEnvelope, data: T) -> RadrootsParsedEvent<T> {
+fn parsed<T>(event: EventEnvelope, data: T) -> RadrootsParsedEvent<T> {
let parsed_data = RadrootsParsedData::new(
event.id_hex(),
event.author().to_hex().to_string(),
@@ -400,7 +393,7 @@ fn require_contract_tag(
}
}
-fn parse_validation_error(error: RadrootsKnowledgeValidationError) -> EventParseError {
+fn parse_validation_error(error: KnowledgeValidationError) -> EventParseError {
match error.field() {
"d_tag" => EventParseError::InvalidTag(TAG_D),
"references" => EventParseError::InvalidTag(TAG_SOURCE),
@@ -444,8 +437,8 @@ fn contains_private_coordinate_key(value: &serde_json::Value) -> bool {
}
pub fn wiki_article_from_event(
- event: RadrootsEventEnvelope,
-) -> Result<RadrootsParsedEvent<RadrootsWikiArticle>, EventParseError> {
+ event: EventEnvelope,
+) -> Result<RadrootsParsedEvent<WikiArticle>, EventParseError> {
ensure_kind(event.kind_u32(), KIND_WIKI_ARTICLE, "wiki article")?;
let d_tag = required_one_value(&event.tags_as_vec(), TAG_D)?;
validate_wiki_d_tag(&d_tag).map_err(|_| EventParseError::InvalidTag(TAG_D))?;
@@ -459,7 +452,7 @@ pub fn wiki_article_from_event(
return Err(EventParseError::InvalidTag(TAG_A));
}
let deferred_to = deferred_refs.pop();
- let article = RadrootsWikiArticle {
+ let article = WikiArticle {
d_tag,
title,
content_djot: event.content().to_string(),
@@ -474,8 +467,8 @@ pub fn wiki_article_from_event(
}
pub fn wiki_redirect_from_event(
- event: RadrootsEventEnvelope,
-) -> Result<RadrootsParsedEvent<RadrootsWikiRedirect>, EventParseError> {
+ event: EventEnvelope,
+) -> Result<RadrootsParsedEvent<WikiRedirect>, EventParseError> {
ensure_kind(event.kind_u32(), KIND_WIKI_REDIRECT, "wiki redirect")?;
if !event.content().is_empty() {
return Err(EventParseError::InvalidJson("content"));
@@ -486,14 +479,14 @@ pub fn wiki_redirect_from_event(
if target.kind != KIND_WIKI_ARTICLE {
return Err(EventParseError::InvalidTag(TAG_A));
}
- let redirect = RadrootsWikiRedirect { d_tag, target };
+ let redirect = WikiRedirect { d_tag, target };
validate_wiki_redirect(&redirect).map_err(parse_validation_error)?;
Ok(parsed(event, redirect))
}
pub fn wiki_merge_request_from_event(
- event: RadrootsEventEnvelope,
-) -> Result<RadrootsParsedEvent<RadrootsWikiMergeRequest>, EventParseError> {
+ event: EventEnvelope,
+) -> Result<RadrootsParsedEvent<WikiMergeRequest>, EventParseError> {
ensure_kind(
event.kind_u32(),
KIND_WIKI_MERGE_REQUEST,
@@ -511,7 +504,7 @@ pub fn wiki_merge_request_from_event(
} else {
Some(event.content().to_string())
};
- let request = RadrootsWikiMergeRequest {
+ let request = WikiMergeRequest {
target_article,
destination_pubkey,
base_version_event_id,
@@ -523,11 +516,11 @@ pub fn wiki_merge_request_from_event(
}
pub fn knowledge_source_from_event(
- event: RadrootsEventEnvelope,
-) -> Result<RadrootsParsedEvent<RadrootsKnowledgeSource>, EventParseError> {
+ event: EventEnvelope,
+) -> Result<RadrootsParsedEvent<KnowledgeSource>, EventParseError> {
ensure_kind(event.kind_u32(), KIND_KNOWLEDGE_SOURCE, "knowledge source")?;
require_contract_tag(&event.tags_as_vec(), RADROOTS_KNOWLEDGE_SOURCE_SCHEMA)?;
- let source: RadrootsKnowledgeSource = json_content(event.content())?;
+ let source: KnowledgeSource = json_content(event.content())?;
let d_tag = required_one_value(&event.tags_as_vec(), TAG_D)?;
if d_tag != source.d_tag {
return Err(EventParseError::InvalidTag(TAG_D));
@@ -544,11 +537,11 @@ pub fn knowledge_source_from_event(
}
pub fn evidence_bounty_from_event(
- event: RadrootsEventEnvelope,
-) -> Result<RadrootsParsedEvent<RadrootsEvidenceBounty>, EventParseError> {
+ event: EventEnvelope,
+) -> Result<RadrootsParsedEvent<EvidenceBounty>, EventParseError> {
ensure_kind(event.kind_u32(), KIND_EVIDENCE_BOUNTY, "evidence bounty")?;
require_contract_tag(&event.tags_as_vec(), RADROOTS_EVIDENCE_BOUNTY_SCHEMA)?;
- let bounty: RadrootsEvidenceBounty = json_content(event.content())?;
+ let bounty: EvidenceBounty = json_content(event.content())?;
let d_tag = required_one_value(&event.tags_as_vec(), TAG_D)?;
if d_tag != bounty.d_tag {
return Err(EventParseError::InvalidTag(TAG_D));
@@ -565,11 +558,11 @@ pub fn evidence_bounty_from_event(
}
pub fn knowledge_claim_from_event(
- event: RadrootsEventEnvelope,
-) -> Result<RadrootsParsedEvent<RadrootsKnowledgeClaim>, EventParseError> {
+ event: EventEnvelope,
+) -> Result<RadrootsParsedEvent<KnowledgeClaim>, EventParseError> {
ensure_kind(event.kind_u32(), KIND_KNOWLEDGE_CLAIM, "knowledge claim")?;
require_contract_tag(&event.tags_as_vec(), RADROOTS_KNOWLEDGE_CLAIM_SCHEMA)?;
- let claim: RadrootsKnowledgeClaim = json_content(event.content())?;
+ let claim: KnowledgeClaim = json_content(event.content())?;
validate_knowledge_claim(&claim).map_err(parse_validation_error)?;
let expected_tags =
knowledge_claim_build_tags(&claim).map_err(|_| EventParseError::InvalidTag(TAG_SOURCE))?;
@@ -582,15 +575,15 @@ pub fn knowledge_claim_from_event(
}
pub fn knowledge_relation_from_event(
- event: RadrootsEventEnvelope,
-) -> Result<RadrootsParsedEvent<RadrootsKnowledgeRelation>, EventParseError> {
+ event: EventEnvelope,
+) -> Result<RadrootsParsedEvent<KnowledgeRelation>, EventParseError> {
ensure_kind(
event.kind_u32(),
KIND_KNOWLEDGE_RELATION,
"knowledge relation",
)?;
require_contract_tag(&event.tags_as_vec(), RADROOTS_KNOWLEDGE_RELATION_SCHEMA)?;
- let relation: RadrootsKnowledgeRelation = json_content(event.content())?;
+ let relation: KnowledgeRelation = json_content(event.content())?;
validate_knowledge_relation(&relation).map_err(parse_validation_error)?;
let expected_tags = knowledge_relation_build_tags(&relation)
.map_err(|_| EventParseError::InvalidTag(TAG_SOURCE))?;
@@ -599,12 +592,12 @@ pub fn knowledge_relation_from_event(
}
pub fn knowledge_review_from_event(
- event: RadrootsEventEnvelope,
-) -> Result<RadrootsParsedEvent<RadrootsKnowledgeReview>, EventParseError> {
+ event: EventEnvelope,
+) -> Result<RadrootsParsedEvent<KnowledgeReview>, EventParseError> {
ensure_kind(event.kind_u32(), KIND_KNOWLEDGE_REVIEW, "knowledge review")?;
require_contract_tag(&event.tags_as_vec(), RADROOTS_KNOWLEDGE_REVIEW_SCHEMA)?;
required_one_value(&event.tags_as_vec(), TAG_REVIEW_TARGET)?;
- let review: RadrootsKnowledgeReview = json_content(event.content())?;
+ let review: KnowledgeReview = json_content(event.content())?;
validate_knowledge_review(&review).map_err(parse_validation_error)?;
let expected_tags = knowledge_review_build_tags(&review)
.map_err(|_| EventParseError::InvalidTag(TAG_REVIEW_TARGET))?;
@@ -617,8 +610,8 @@ pub fn knowledge_review_from_event(
}
pub fn knowledge_field_report_from_event(
- event: RadrootsEventEnvelope,
-) -> Result<RadrootsParsedEvent<RadrootsKnowledgeFieldReport>, EventParseError> {
+ event: EventEnvelope,
+) -> Result<RadrootsParsedEvent<KnowledgeFieldReport>, EventParseError> {
ensure_kind(
event.kind_u32(),
KIND_KNOWLEDGE_FIELD_REPORT,
@@ -626,7 +619,7 @@ pub fn knowledge_field_report_from_event(
)?;
require_contract_tag(&event.tags_as_vec(), RADROOTS_KNOWLEDGE_FIELD_REPORT_SCHEMA)?;
reject_private_coordinate_keys(event.content())?;
- let report: RadrootsKnowledgeFieldReport = json_content(event.content())?;
+ let report: KnowledgeFieldReport = json_content(event.content())?;
validate_knowledge_field_report(&report).map_err(parse_validation_error)?;
let expected_tags = knowledge_field_report_build_tags(&report)
.map_err(|_| EventParseError::InvalidTag(TAG_EVIDENCE))?;
@@ -639,8 +632,8 @@ pub fn knowledge_field_report_from_event(
}
pub fn knowledge_change_proposal_from_event(
- event: RadrootsEventEnvelope,
-) -> Result<RadrootsParsedEvent<RadrootsKnowledgeChangeProposal>, EventParseError> {
+ event: EventEnvelope,
+) -> Result<RadrootsParsedEvent<KnowledgeChangeProposal>, EventParseError> {
ensure_kind(
event.kind_u32(),
KIND_KNOWLEDGE_CHANGE_PROPOSAL,
@@ -650,7 +643,7 @@ pub fn knowledge_change_proposal_from_event(
&event.tags_as_vec(),
RADROOTS_KNOWLEDGE_CHANGE_PROPOSAL_SCHEMA,
)?;
- let proposal: RadrootsKnowledgeChangeProposal = json_content(event.content())?;
+ let proposal: KnowledgeChangeProposal = json_content(event.content())?;
validate_knowledge_change_proposal(&proposal).map_err(parse_validation_error)?;
let expected_tags = knowledge_change_proposal_build_tags(&proposal)
.map_err(|_| EventParseError::InvalidTag(TAG_EVIDENCE))?;
@@ -659,8 +652,8 @@ pub fn knowledge_change_proposal_from_event(
}
pub fn contribution_attestation_from_event(
- event: RadrootsEventEnvelope,
-) -> Result<RadrootsParsedEvent<RadrootsContributionAttestation>, EventParseError> {
+ event: EventEnvelope,
+) -> Result<RadrootsParsedEvent<ContributionAttestation>, EventParseError> {
ensure_kind(
event.kind_u32(),
KIND_CONTRIBUTION_ATTESTATION,
@@ -670,7 +663,7 @@ pub fn contribution_attestation_from_event(
&event.tags_as_vec(),
RADROOTS_CONTRIBUTION_ATTESTATION_SCHEMA,
)?;
- let attestation: RadrootsContributionAttestation = json_content(event.content())?;
+ let attestation: ContributionAttestation = json_content(event.content())?;
validate_contribution_attestation(&attestation).map_err(parse_validation_error)?;
let expected_tags = contribution_attestation_build_tags(&attestation)
.map_err(|_| EventParseError::InvalidTag(TAG_EVIDENCE))?;
diff --git a/crates/event_codec/src/knowledge/encode.rs b/crates/event_codec/src/knowledge/encode.rs
@@ -13,21 +13,20 @@ use radroots_event::envelope::kind::{
KIND_WIKI_REDIRECT,
};
use radroots_event::knowledge::{
+ AddressableRef, ContributionAttestation, EvidenceBounty, KnowledgeChangeProposal,
+ KnowledgeClaim, KnowledgeFieldReport, KnowledgeRelation, KnowledgeReview,
+ KnowledgeReviewTarget, KnowledgeSource, KnowledgeValidationError,
RADROOTS_CONTRIBUTION_ATTESTATION_SCHEMA, RADROOTS_EVIDENCE_BOUNTY_SCHEMA,
RADROOTS_KNOWLEDGE_CHANGE_PROPOSAL_SCHEMA, RADROOTS_KNOWLEDGE_CLAIM_SCHEMA,
RADROOTS_KNOWLEDGE_FIELD_REPORT_SCHEMA, RADROOTS_KNOWLEDGE_RELATION_SCHEMA,
- RADROOTS_KNOWLEDGE_REVIEW_SCHEMA, RADROOTS_KNOWLEDGE_SOURCE_SCHEMA, RadrootsAddressableRef,
- RadrootsContributionAttestation, RadrootsEvidenceBounty, RadrootsKnowledgeChangeProposal,
- RadrootsKnowledgeClaim, RadrootsKnowledgeFieldReport, RadrootsKnowledgeRelation,
- RadrootsKnowledgeReview, RadrootsKnowledgeReviewTarget, RadrootsKnowledgeSource,
- RadrootsKnowledgeValidationError, RadrootsWikiArticle, RadrootsWikiArticleVersionRef,
- RadrootsWikiMergeRequest, RadrootsWikiRedirect, validate_contribution_attestation,
+ RADROOTS_KNOWLEDGE_REVIEW_SCHEMA, RADROOTS_KNOWLEDGE_SOURCE_SCHEMA, WikiArticle,
+ WikiArticleVersionRef, WikiMergeRequest, WikiRedirect, validate_contribution_attestation,
validate_evidence_bounty, validate_knowledge_change_proposal, validate_knowledge_claim,
validate_knowledge_field_report, validate_knowledge_relation, validate_knowledge_review,
validate_knowledge_source, validate_wiki_article, validate_wiki_merge_request,
validate_wiki_redirect,
};
-use radroots_event::tag::RadrootsEventRef;
+use radroots_event::tag::EventRef;
use radroots_event::tag::name::{
TAG_A, TAG_CONTRACT, TAG_D, TAG_E, TAG_G, TAG_P, TAG_SUMMARY, TAG_T,
};
@@ -36,7 +35,7 @@ use serde::Serialize;
use crate::error::EventEncodeError;
use crate::event_ref::build_event_ref_tag;
use crate::wire::empty_content;
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
use radroots_identity::PublicKey;
const TAG_TITLE: &str = "title";
@@ -66,17 +65,17 @@ fn push_topics(tags: &mut Vec<Vec<String>>, topics: &[String]) {
}
}
-fn push_event_refs(tags: &mut Vec<Vec<String>>, tag_name: &str, refs: &[RadrootsEventRef]) {
+fn push_event_refs(tags: &mut Vec<Vec<String>>, tag_name: &str, refs: &[EventRef]) {
for event_ref in refs {
tags.push(build_event_ref_tag(tag_name, event_ref));
}
}
-fn address_coordinate(address: &RadrootsAddressableRef) -> String {
+fn address_coordinate(address: &AddressableRef) -> String {
format!("{}:{}:{}", address.kind, address.pubkey, address.d_tag)
}
-fn address_tag(tag_name: &str, address: &RadrootsAddressableRef) -> Vec<String> {
+fn address_tag(tag_name: &str, address: &AddressableRef) -> Vec<String> {
let mut tag = Vec::with_capacity(2 + address.relays.len());
tag.push(tag_name.to_string());
tag.push(address_coordinate(address));
@@ -84,7 +83,7 @@ fn address_tag(tag_name: &str, address: &RadrootsAddressableRef) -> Vec<String>
tag
}
-fn marker_address_tag(address: &RadrootsAddressableRef, marker: &'static str) -> Vec<String> {
+fn marker_address_tag(address: &AddressableRef, marker: &'static str) -> Vec<String> {
let mut tag = Vec::with_capacity(4 + address.relays.len());
tag.push(TAG_A.to_string());
tag.push(address_coordinate(address));
@@ -97,10 +96,7 @@ fn marker_address_tag(address: &RadrootsAddressableRef, marker: &'static str) ->
tag
}
-fn marker_event_tag(
- version_ref: &RadrootsWikiArticleVersionRef,
- marker: &'static str,
-) -> Vec<String> {
+fn marker_event_tag(version_ref: &WikiArticleVersionRef, marker: &'static str) -> Vec<String> {
let mut tag = Vec::with_capacity(4 + version_ref.address_ref.relays.len());
tag.push(TAG_E.to_string());
tag.push(version_ref.event_id.clone());
@@ -115,17 +111,15 @@ fn marker_event_tag(
fn push_wiki_version_ref_tags(
tags: &mut Vec<Vec<String>>,
- version_ref: &RadrootsWikiArticleVersionRef,
+ version_ref: &WikiArticleVersionRef,
marker: &'static str,
) {
tags.push(marker_address_tag(&version_ref.address_ref, marker));
tags.push(marker_event_tag(version_ref, marker));
}
-fn review_target_ref(
- target: &RadrootsKnowledgeReviewTarget,
-) -> Result<RadrootsEventRef, EventEncodeError> {
- Ok(RadrootsEventRef {
+fn review_target_ref(target: &KnowledgeReviewTarget) -> Result<EventRef, EventEncodeError> {
+ Ok(EventRef {
id: target.event_id.clone(),
author: PublicKey::from_hex(&target.author_pubkey)
.map_err(|_| EventEncodeError::InvalidField("review_target"))?,
@@ -146,14 +140,10 @@ fn json_content<T: Serialize>(value: &T) -> Result<String, EventEncodeError> {
serde_json::to_string(value).map_err(|_| EventEncodeError::Json)
}
-fn encode_validation_error(error: RadrootsKnowledgeValidationError) -> EventEncodeError {
+fn encode_validation_error(error: KnowledgeValidationError) -> EventEncodeError {
match error {
- RadrootsKnowledgeValidationError::EmptyField(field) => {
- EventEncodeError::EmptyRequiredField(field)
- }
- RadrootsKnowledgeValidationError::InvalidField(field) => {
- EventEncodeError::InvalidField(field)
- }
+ KnowledgeValidationError::EmptyField(field) => EventEncodeError::EmptyRequiredField(field),
+ KnowledgeValidationError::InvalidField(field) => EventEncodeError::InvalidField(field),
}
}
@@ -162,7 +152,7 @@ fn custom_tags(contract_id: &'static str) -> Vec<Vec<String>> {
}
pub fn wiki_article_build_tags(
- article: &RadrootsWikiArticle,
+ article: &WikiArticle,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
validate_wiki_article(article).map_err(encode_validation_error)?;
let mut tags = Vec::new();
@@ -181,9 +171,9 @@ pub fn wiki_article_build_tags(
}
pub fn wiki_article_to_wire_parts(
- article: &RadrootsWikiArticle,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
- Ok(RadrootsNip01EventWireParts {
+ article: &WikiArticle,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
+ Ok(Nip01EventWireParts {
kind: KIND_WIKI_ARTICLE,
content: article.content_djot.clone(),
tags: wiki_article_build_tags(article)?,
@@ -191,7 +181,7 @@ pub fn wiki_article_to_wire_parts(
}
pub fn wiki_redirect_build_tags(
- redirect: &RadrootsWikiRedirect,
+ redirect: &WikiRedirect,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
validate_wiki_redirect(redirect).map_err(encode_validation_error)?;
let tags = vec![
@@ -202,9 +192,9 @@ pub fn wiki_redirect_build_tags(
}
pub fn wiki_redirect_to_wire_parts(
- redirect: &RadrootsWikiRedirect,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
- Ok(RadrootsNip01EventWireParts {
+ redirect: &WikiRedirect,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
+ Ok(Nip01EventWireParts {
kind: KIND_WIKI_REDIRECT,
content: empty_content(),
tags: wiki_redirect_build_tags(redirect)?,
@@ -212,7 +202,7 @@ pub fn wiki_redirect_to_wire_parts(
}
pub fn wiki_merge_request_build_tags(
- request: &RadrootsWikiMergeRequest,
+ request: &WikiMergeRequest,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
validate_wiki_merge_request(request).map_err(encode_validation_error)?;
let mut tags = Vec::new();
@@ -235,9 +225,9 @@ pub fn wiki_merge_request_build_tags(
}
pub fn wiki_merge_request_to_wire_parts(
- request: &RadrootsWikiMergeRequest,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
- Ok(RadrootsNip01EventWireParts {
+ request: &WikiMergeRequest,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
+ Ok(Nip01EventWireParts {
kind: KIND_WIKI_MERGE_REQUEST,
content: request.explanation.clone().unwrap_or_default(),
tags: wiki_merge_request_build_tags(request)?,
@@ -245,7 +235,7 @@ pub fn wiki_merge_request_to_wire_parts(
}
pub fn knowledge_source_build_tags(
- source: &RadrootsKnowledgeSource,
+ source: &KnowledgeSource,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
validate_knowledge_source(source).map_err(encode_validation_error)?;
let mut tags = custom_tags(RADROOTS_KNOWLEDGE_SOURCE_SCHEMA);
@@ -256,9 +246,9 @@ pub fn knowledge_source_build_tags(
}
pub fn knowledge_source_to_wire_parts(
- source: &RadrootsKnowledgeSource,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
- Ok(RadrootsNip01EventWireParts {
+ source: &KnowledgeSource,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
+ Ok(Nip01EventWireParts {
kind: KIND_KNOWLEDGE_SOURCE,
content: json_content(source)?,
tags: knowledge_source_build_tags(source)?,
@@ -266,7 +256,7 @@ pub fn knowledge_source_to_wire_parts(
}
pub fn evidence_bounty_build_tags(
- bounty: &RadrootsEvidenceBounty,
+ bounty: &EvidenceBounty,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
validate_evidence_bounty(bounty).map_err(encode_validation_error)?;
let mut tags = custom_tags(RADROOTS_EVIDENCE_BOUNTY_SCHEMA);
@@ -277,9 +267,9 @@ pub fn evidence_bounty_build_tags(
}
pub fn evidence_bounty_to_wire_parts(
- bounty: &RadrootsEvidenceBounty,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
- Ok(RadrootsNip01EventWireParts {
+ bounty: &EvidenceBounty,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
+ Ok(Nip01EventWireParts {
kind: KIND_EVIDENCE_BOUNTY,
content: json_content(bounty)?,
tags: evidence_bounty_build_tags(bounty)?,
@@ -287,7 +277,7 @@ pub fn evidence_bounty_to_wire_parts(
}
pub fn knowledge_claim_build_tags(
- claim: &RadrootsKnowledgeClaim,
+ claim: &KnowledgeClaim,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
validate_knowledge_claim(claim).map_err(encode_validation_error)?;
let mut tags = custom_tags(RADROOTS_KNOWLEDGE_CLAIM_SCHEMA);
@@ -302,9 +292,9 @@ pub fn knowledge_claim_build_tags(
}
pub fn knowledge_claim_to_wire_parts(
- claim: &RadrootsKnowledgeClaim,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
- Ok(RadrootsNip01EventWireParts {
+ claim: &KnowledgeClaim,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
+ Ok(Nip01EventWireParts {
kind: KIND_KNOWLEDGE_CLAIM,
content: json_content(claim)?,
tags: knowledge_claim_build_tags(claim)?,
@@ -312,7 +302,7 @@ pub fn knowledge_claim_to_wire_parts(
}
pub fn knowledge_relation_build_tags(
- relation: &RadrootsKnowledgeRelation,
+ relation: &KnowledgeRelation,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
validate_knowledge_relation(relation).map_err(encode_validation_error)?;
let mut tags = custom_tags(RADROOTS_KNOWLEDGE_RELATION_SCHEMA);
@@ -321,9 +311,9 @@ pub fn knowledge_relation_build_tags(
}
pub fn knowledge_relation_to_wire_parts(
- relation: &RadrootsKnowledgeRelation,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
- Ok(RadrootsNip01EventWireParts {
+ relation: &KnowledgeRelation,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
+ Ok(Nip01EventWireParts {
kind: KIND_KNOWLEDGE_RELATION,
content: json_content(relation)?,
tags: knowledge_relation_build_tags(relation)?,
@@ -331,7 +321,7 @@ pub fn knowledge_relation_to_wire_parts(
}
pub fn knowledge_review_build_tags(
- review: &RadrootsKnowledgeReview,
+ review: &KnowledgeReview,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
validate_knowledge_review(review).map_err(encode_validation_error)?;
let mut tags = custom_tags(RADROOTS_KNOWLEDGE_REVIEW_SCHEMA);
@@ -344,9 +334,9 @@ pub fn knowledge_review_build_tags(
}
pub fn knowledge_review_to_wire_parts(
- review: &RadrootsKnowledgeReview,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
- Ok(RadrootsNip01EventWireParts {
+ review: &KnowledgeReview,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
+ Ok(Nip01EventWireParts {
kind: KIND_KNOWLEDGE_REVIEW,
content: json_content(review)?,
tags: knowledge_review_build_tags(review)?,
@@ -354,7 +344,7 @@ pub fn knowledge_review_to_wire_parts(
}
pub fn knowledge_field_report_build_tags(
- report: &RadrootsKnowledgeFieldReport,
+ report: &KnowledgeFieldReport,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
validate_knowledge_field_report(report).map_err(encode_validation_error)?;
let mut tags = custom_tags(RADROOTS_KNOWLEDGE_FIELD_REPORT_SCHEMA);
@@ -370,9 +360,9 @@ pub fn knowledge_field_report_build_tags(
}
pub fn knowledge_field_report_to_wire_parts(
- report: &RadrootsKnowledgeFieldReport,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
- Ok(RadrootsNip01EventWireParts {
+ report: &KnowledgeFieldReport,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
+ Ok(Nip01EventWireParts {
kind: KIND_KNOWLEDGE_FIELD_REPORT,
content: json_content(report)?,
tags: knowledge_field_report_build_tags(report)?,
@@ -380,7 +370,7 @@ pub fn knowledge_field_report_to_wire_parts(
}
pub fn knowledge_change_proposal_build_tags(
- proposal: &RadrootsKnowledgeChangeProposal,
+ proposal: &KnowledgeChangeProposal,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
validate_knowledge_change_proposal(proposal).map_err(encode_validation_error)?;
let mut tags = custom_tags(RADROOTS_KNOWLEDGE_CHANGE_PROPOSAL_SCHEMA);
@@ -389,9 +379,9 @@ pub fn knowledge_change_proposal_build_tags(
}
pub fn knowledge_change_proposal_to_wire_parts(
- proposal: &RadrootsKnowledgeChangeProposal,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
- Ok(RadrootsNip01EventWireParts {
+ proposal: &KnowledgeChangeProposal,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
+ Ok(Nip01EventWireParts {
kind: KIND_KNOWLEDGE_CHANGE_PROPOSAL,
content: json_content(proposal)?,
tags: knowledge_change_proposal_build_tags(proposal)?,
@@ -399,7 +389,7 @@ pub fn knowledge_change_proposal_to_wire_parts(
}
pub fn contribution_attestation_build_tags(
- attestation: &RadrootsContributionAttestation,
+ attestation: &ContributionAttestation,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
validate_contribution_attestation(attestation).map_err(encode_validation_error)?;
let mut tags = custom_tags(RADROOTS_CONTRIBUTION_ATTESTATION_SCHEMA);
@@ -408,9 +398,9 @@ pub fn contribution_attestation_build_tags(
}
pub fn contribution_attestation_to_wire_parts(
- attestation: &RadrootsContributionAttestation,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
- Ok(RadrootsNip01EventWireParts {
+ attestation: &ContributionAttestation,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
+ Ok(Nip01EventWireParts {
kind: KIND_CONTRIBUTION_ATTESTATION,
content: json_content(attestation)?,
tags: contribution_attestation_build_tags(attestation)?,
diff --git a/crates/event_codec/src/knowledge/verification.rs b/crates/event_codec/src/knowledge/verification.rs
@@ -3,13 +3,12 @@ use alloc::string::{String, ToString};
use core::fmt;
-use radroots_event::contract::RadrootsContractValidationError;
-use radroots_event::envelope::RadrootsEventEnvelope;
+use radroots_event::contract::ContractValidationError;
+use radroots_event::envelope::EventEnvelope;
use radroots_event::knowledge::{
- RadrootsContributionAttestation, RadrootsEvidenceBounty, RadrootsKnowledgeChangeProposal,
- RadrootsKnowledgeClaim, RadrootsKnowledgeFieldReport, RadrootsKnowledgeRelation,
- RadrootsKnowledgeReview, RadrootsKnowledgeSource, RadrootsWikiArticle,
- RadrootsWikiMergeRequest, RadrootsWikiRedirect,
+ ContributionAttestation, EvidenceBounty, KnowledgeChangeProposal, KnowledgeClaim,
+ KnowledgeFieldReport, KnowledgeRelation, KnowledgeReview, KnowledgeSource, WikiArticle,
+ WikiMergeRequest, WikiRedirect,
};
use crate::error::EventParseError;
@@ -27,7 +26,7 @@ use crate::verification::{RadrootsNip01VerificationError, verify_nip01_event};
#[derive(Debug)]
pub enum RadrootsDecodeError {
Nip01Verification(RadrootsNip01VerificationError),
- ContractValidation(RadrootsContractValidationError),
+ ContractValidation(ContractValidationError),
EventParse(EventParseError),
UnsupportedContract { contract_id: String },
}
@@ -77,8 +76,8 @@ impl From<RadrootsNip01VerificationError> for RadrootsDecodeError {
}
}
-impl From<RadrootsContractValidationError> for RadrootsDecodeError {
- fn from(value: RadrootsContractValidationError) -> Self {
+impl From<ContractValidationError> for RadrootsDecodeError {
+ fn from(value: ContractValidationError) -> Self {
Self::ContractValidation(value)
}
}
@@ -86,21 +85,21 @@ impl From<RadrootsContractValidationError> for RadrootsDecodeError {
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug)]
pub enum RadrootsDecodedEvent {
- WikiArticle(RadrootsParsedEvent<RadrootsWikiArticle>),
- WikiRedirect(RadrootsParsedEvent<RadrootsWikiRedirect>),
- WikiMergeRequest(RadrootsParsedEvent<RadrootsWikiMergeRequest>),
- KnowledgeSource(RadrootsParsedEvent<RadrootsKnowledgeSource>),
- KnowledgeClaim(RadrootsParsedEvent<RadrootsKnowledgeClaim>),
- KnowledgeRelation(RadrootsParsedEvent<RadrootsKnowledgeRelation>),
- KnowledgeReview(RadrootsParsedEvent<RadrootsKnowledgeReview>),
- KnowledgeFieldReport(RadrootsParsedEvent<RadrootsKnowledgeFieldReport>),
- EvidenceBounty(RadrootsParsedEvent<RadrootsEvidenceBounty>),
- KnowledgeChangeProposal(RadrootsParsedEvent<RadrootsKnowledgeChangeProposal>),
- ContributionAttestation(RadrootsParsedEvent<RadrootsContributionAttestation>),
+ WikiArticle(RadrootsParsedEvent<WikiArticle>),
+ WikiRedirect(RadrootsParsedEvent<WikiRedirect>),
+ WikiMergeRequest(RadrootsParsedEvent<WikiMergeRequest>),
+ KnowledgeSource(RadrootsParsedEvent<KnowledgeSource>),
+ KnowledgeClaim(RadrootsParsedEvent<KnowledgeClaim>),
+ KnowledgeRelation(RadrootsParsedEvent<KnowledgeRelation>),
+ KnowledgeReview(RadrootsParsedEvent<KnowledgeReview>),
+ KnowledgeFieldReport(RadrootsParsedEvent<KnowledgeFieldReport>),
+ EvidenceBounty(RadrootsParsedEvent<EvidenceBounty>),
+ KnowledgeChangeProposal(RadrootsParsedEvent<KnowledgeChangeProposal>),
+ ContributionAttestation(RadrootsParsedEvent<ContributionAttestation>),
}
impl RadrootsDecodedEvent {
- pub fn event(&self) -> &RadrootsEventEnvelope {
+ pub fn event(&self) -> &EventEnvelope {
match self {
Self::WikiArticle(parsed) => &parsed.event,
Self::WikiRedirect(parsed) => &parsed.event,
@@ -168,7 +167,7 @@ pub fn decode_validated_event(
/// Verifies NIP-01 identity before applying the knowledge contract and decoder.
pub fn verify_and_decode_radroots_event(
- event: RadrootsEventEnvelope,
+ event: EventEnvelope,
) -> Result<RadrootsDecodedEvent, RadrootsDecodeError> {
let verified = verify_nip01_event(event)?;
let contract_validated = validate_event_contract(verified)?;
diff --git a/crates/event_codec/src/list/decode.rs b/crates/event_codec/src/list/decode.rs
@@ -3,7 +3,7 @@ use alloc::{string::String, vec::Vec};
use radroots_event::{
envelope::kind::KIND_LIST_READ_WRITE_RELAYS,
- social::list::{RadrootsList, RadrootsListEntry},
+ social::list::{List, ListEntry},
tag::name::TAG_R,
};
@@ -11,7 +11,7 @@ use super::is_generic_list_codec_kind;
use crate::error::EventParseError;
use crate::parsed::{RadrootsParsedData, RadrootsParsedEvent};
-fn entry_from_tag(tag: &[String]) -> Result<RadrootsListEntry, EventParseError> {
+fn entry_from_tag(tag: &[String]) -> Result<ListEntry, EventParseError> {
let name = &tag[0];
if name.trim().is_empty() {
return Err(EventParseError::InvalidTag("tag"));
@@ -20,15 +20,13 @@ fn entry_from_tag(tag: &[String]) -> Result<RadrootsListEntry, EventParseError>
if value.trim().is_empty() {
return Err(EventParseError::InvalidTag("tag"));
}
- Ok(RadrootsListEntry {
+ Ok(ListEntry {
tag: name.clone(),
values: tag[1..].to_vec(),
})
}
-pub fn list_entries_from_tags(
- tags: &[Vec<String>],
-) -> Result<Vec<RadrootsListEntry>, EventParseError> {
+pub fn list_entries_from_tags(tags: &[Vec<String>]) -> Result<Vec<ListEntry>, EventParseError> {
let mut entries = Vec::with_capacity(tags.len());
for tag in tags.iter().filter(|t| t.len() >= 2) {
entries.push(entry_from_tag(tag)?);
@@ -40,7 +38,7 @@ pub fn list_from_tags(
kind: u32,
content: String,
tags: &[Vec<String>],
-) -> Result<RadrootsList, EventParseError> {
+) -> Result<List, EventParseError> {
if !is_generic_list_codec_kind(kind) {
return Err(EventParseError::InvalidKind {
expected: "generic nip51 standard or non-calendar list-set kind",
@@ -51,7 +49,7 @@ pub fn list_from_tags(
validate_relay_tags(tags)?;
}
let entries = list_entries_from_tags(tags)?;
- Ok(RadrootsList { content, entries })
+ Ok(List { content, entries })
}
fn validate_relay_tags(tags: &[Vec<String>]) -> Result<(), EventParseError> {
@@ -93,7 +91,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsList>, EventParseError> {
+) -> Result<RadrootsParsedData<List>, EventParseError> {
let list = list_from_tags(kind, content, &tags)?;
Ok(RadrootsParsedData::new(
id,
@@ -112,7 +110,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsList>, EventParseError> {
+) -> Result<RadrootsParsedEvent<List>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
@@ -125,9 +123,7 @@ pub fn parsed_from_event(
}
#[cfg(feature = "serde_json")]
-pub fn list_private_entries_from_json(
- content: &str,
-) -> Result<Vec<RadrootsListEntry>, EventParseError> {
+pub fn list_private_entries_from_json(content: &str) -> Result<Vec<ListEntry>, EventParseError> {
let tags: Vec<Vec<String>> =
serde_json::from_str(content).map_err(|_| EventParseError::InvalidJson("content"))?;
list_entries_from_tags(&tags)
diff --git a/crates/event_codec/src/list/encode.rs b/crates/event_codec/src/list/encode.rs
@@ -3,15 +3,15 @@ use alloc::{string::String, vec::Vec};
use radroots_event::{
envelope::kind::KIND_LIST_READ_WRITE_RELAYS,
- social::list::{RadrootsList, RadrootsListEntry},
+ social::list::{List, ListEntry},
tag::name::TAG_R,
};
use super::is_generic_list_codec_kind;
use crate::error::EventEncodeError;
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
-fn entry_tag(entry: &RadrootsListEntry) -> Result<Vec<String>, EventEncodeError> {
+fn entry_tag(entry: &ListEntry) -> Result<Vec<String>, EventEncodeError> {
if entry.tag.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("entry.tag"));
}
@@ -28,9 +28,7 @@ fn entry_tag(entry: &RadrootsListEntry) -> Result<Vec<String>, EventEncodeError>
Ok(tag)
}
-pub fn list_entries_to_tags(
- entries: &[RadrootsListEntry],
-) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn list_entries_to_tags(entries: &[ListEntry]) -> Result<Vec<Vec<String>>, EventEncodeError> {
let mut tags = Vec::with_capacity(entries.len());
for entry in entries {
tags.push(entry_tag(entry)?);
@@ -38,14 +36,14 @@ pub fn list_entries_to_tags(
Ok(tags)
}
-pub fn list_build_tags(list: &RadrootsList) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn list_build_tags(list: &List) -> Result<Vec<Vec<String>>, EventEncodeError> {
list_entries_to_tags(&list.entries)
}
pub fn to_wire_parts_with_kind(
- list: &RadrootsList,
+ list: &List,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if !is_generic_list_codec_kind(kind) {
return Err(EventEncodeError::InvalidKind(kind));
}
@@ -53,14 +51,14 @@ pub fn to_wire_parts_with_kind(
validate_relay_entries(&list.entries)?;
}
let tags = list_build_tags(list)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content: list.content.clone(),
tags,
})
}
-fn validate_relay_entries(entries: &[RadrootsListEntry]) -> Result<(), EventEncodeError> {
+fn validate_relay_entries(entries: &[ListEntry]) -> Result<(), EventEncodeError> {
if entries.is_empty() {
return Err(EventEncodeError::EmptyRequiredField("relay.entries"));
}
@@ -93,9 +91,7 @@ fn is_ws_relay_url(value: &str) -> bool {
}
#[cfg(feature = "serde_json")]
-pub fn list_private_entries_json(
- entries: &[RadrootsListEntry],
-) -> Result<String, EventEncodeError> {
+pub fn list_private_entries_json(entries: &[ListEntry]) -> Result<String, EventEncodeError> {
let tags = list_entries_to_tags(entries)?;
serde_json::to_string(&tags).map_err(|_| EventEncodeError::Json)
}
diff --git a/crates/event_codec/src/list/mod.rs b/crates/event_codec/src/list/mod.rs
@@ -14,19 +14,19 @@ mod tests {
use super::{decode::list_from_tags, encode::list_build_tags, is_generic_list_codec_kind};
use radroots_event::{
envelope::kind::{KIND_CALENDAR, KIND_LIST_MUTE, KIND_LIST_SET_FOLLOW, KIND_POST},
- social::list::{RadrootsList, RadrootsListEntry},
+ social::list::{List, ListEntry},
};
#[test]
fn list_tags_round_trip() {
- let list = RadrootsList {
+ let list = List {
content: "private".to_string(),
entries: vec![
- RadrootsListEntry {
+ ListEntry {
tag: "p".to_string(),
values: vec!["abc".to_string(), "wss://relay".to_string()],
},
- RadrootsListEntry {
+ ListEntry {
tag: "t".to_string(),
values: vec!["radroots".to_string()],
},
diff --git a/crates/event_codec/src/list_set/decode.rs b/crates/event_codec/src/list_set/decode.rs
@@ -1,7 +1,7 @@
#[cfg(not(feature = "std"))]
use alloc::{string::String, vec::Vec};
-use radroots_event::{social::list::RadrootsListEntry, social::list_set::RadrootsListSet};
+use radroots_event::{social::list::ListEntry, social::list_set::ListSet};
use crate::error::EventParseError;
#[cfg(feature = "serde_json")]
@@ -13,13 +13,13 @@ const TAG_TITLE: &str = "title";
const TAG_DESCRIPTION: &str = "description";
const TAG_IMAGE: &str = "image";
-fn entry_from_tag(tag: &[String]) -> Result<RadrootsListEntry, EventParseError> {
+fn entry_from_tag(tag: &[String]) -> Result<ListEntry, EventParseError> {
let name = &tag[0];
let value = &tag[1];
if value.trim().is_empty() {
return Err(EventParseError::InvalidTag("tag"));
}
- Ok(RadrootsListEntry {
+ Ok(ListEntry {
tag: name.clone(),
values: tag[1..].to_vec(),
})
@@ -33,7 +33,7 @@ pub fn list_set_from_tags(
kind: u32,
content: String,
tags: &[Vec<String>],
-) -> Result<RadrootsListSet, EventParseError> {
+) -> Result<ListSet, EventParseError> {
if !super::is_generic_list_set_codec_kind(kind) {
return Err(EventParseError::InvalidKind {
expected: "generic nip51 list-set kind",
@@ -86,7 +86,7 @@ pub fn list_set_from_tags(
if !super::list_set_base64_id_is_valid(&d_tag) {
return Err(EventParseError::InvalidTag("d"));
}
- Ok(RadrootsListSet {
+ Ok(ListSet {
d_tag,
content,
entries,
@@ -103,7 +103,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsListSet>, EventParseError> {
+) -> Result<RadrootsParsedData<ListSet>, EventParseError> {
let list_set = list_set_from_tags(kind, content, &tags)?;
Ok(RadrootsParsedData::new(
id,
@@ -122,7 +122,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsListSet>, EventParseError> {
+) -> Result<RadrootsParsedEvent<ListSet>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
@@ -137,7 +137,7 @@ pub fn parsed_from_event(
#[cfg(feature = "serde_json")]
pub fn list_set_private_entries_from_json(
content: &str,
-) -> Result<Vec<RadrootsListEntry>, EventParseError> {
+) -> Result<Vec<ListEntry>, EventParseError> {
let tags: Vec<Vec<String>> =
serde_json::from_str(content).map_err(|_| EventParseError::InvalidJson("content"))?;
list_entries_from_tags(&tags)
diff --git a/crates/event_codec/src/list_set/encode.rs b/crates/event_codec/src/list_set/encode.rs
@@ -5,12 +5,12 @@ use alloc::{
vec::Vec,
};
-use radroots_event::social::list_set::RadrootsListSet;
+use radroots_event::social::list_set::ListSet;
use crate::error::EventEncodeError;
#[cfg(feature = "serde_json")]
use crate::list::encode::list_entries_to_tags;
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
const TAG_D: &str = "d";
const TAG_TITLE: &str = "title";
@@ -21,7 +21,7 @@ fn push_tag(tags: &mut Vec<Vec<String>>, key: &str, value: &str) {
tags.push(vec![key.to_string(), value.to_string()]);
}
-pub fn list_set_build_tags(list: &RadrootsListSet) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn list_set_build_tags(list: &ListSet) -> Result<Vec<Vec<String>>, EventEncodeError> {
if list.d_tag.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("d_tag"));
}
@@ -59,14 +59,14 @@ pub fn list_set_build_tags(list: &RadrootsListSet) -> Result<Vec<Vec<String>>, E
}
pub fn to_wire_parts_with_kind(
- list: &RadrootsListSet,
+ list: &ListSet,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if !super::is_generic_list_set_codec_kind(kind) {
return Err(EventEncodeError::InvalidKind(kind));
}
let tags = list_set_build_tags(list)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content: list.content.clone(),
tags,
@@ -75,7 +75,7 @@ pub fn to_wire_parts_with_kind(
#[cfg(feature = "serde_json")]
pub fn list_set_private_entries_json(
- entries: &[radroots_event::social::list::RadrootsListEntry],
+ entries: &[radroots_event::social::list::ListEntry],
) -> Result<String, EventEncodeError> {
let tags = list_entries_to_tags(entries)?;
serde_json::to_string(&tags).map_err(|_| EventEncodeError::Json)
diff --git a/crates/event_codec/src/list_set/mod.rs b/crates/event_codec/src/list_set/mod.rs
@@ -31,8 +31,8 @@ mod tests {
use crate::error::{EventEncodeError, EventParseError};
use radroots_event::{
envelope::kind::{KIND_CALENDAR, KIND_LIST_SET_FOLLOW, KIND_POST, is_nip51_list_set_kind},
- social::list::RadrootsListEntry,
- social::list_set::RadrootsListSet,
+ social::list::ListEntry,
+ social::list_set::ListSet,
};
#[test]
@@ -45,15 +45,15 @@ mod tests {
#[test]
fn list_set_tags_round_trip() {
- let list = RadrootsListSet {
+ let list = ListSet {
d_tag: "members.owners".to_string(),
content: "".to_string(),
entries: vec![
- RadrootsListEntry {
+ ListEntry {
tag: "p".to_string(),
values: vec!["owner_pubkey".to_string()],
},
- RadrootsListEntry {
+ ListEntry {
tag: "p".to_string(),
values: vec!["worker_pubkey".to_string(), "wss://relay".to_string()],
},
@@ -73,10 +73,10 @@ mod tests {
#[test]
fn list_set_rejects_invalid_farm_d_tag_on_encode() {
- let list = RadrootsListSet {
+ let list = ListSet {
d_tag: "farm:invalid:members".to_string(),
content: "".to_string(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "p".to_string(),
values: vec!["pubkey".to_string()],
}],
@@ -101,10 +101,10 @@ mod tests {
#[test]
fn list_set_accepts_resource_base64_d_tag() {
- let list = RadrootsListSet {
+ let list = ListSet {
d_tag: "resource:AAAAAAAAAAAAAAAAAAAAAA:members".to_string(),
content: "".to_string(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "p".to_string(),
values: vec!["pubkey".to_string()],
}],
@@ -120,10 +120,10 @@ mod tests {
#[test]
fn list_set_rejects_empty_prefixed_id_or_suffix() {
- let list = RadrootsListSet {
+ let list = ListSet {
d_tag: "farm::members".to_string(),
content: "".to_string(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "p".to_string(),
values: vec!["pubkey".to_string()],
}],
diff --git a/crates/event_codec/src/manifest.rs b/crates/event_codec/src/manifest.rs
@@ -7,10 +7,9 @@ use alloc::{
use radroots_event::contract::VERSION;
use radroots_event::contract::{
- RADROOTS_EVENT_CONTRACT_REGISTRY_VERSION, RadrootsContentSchema, RadrootsContractFamily,
- RadrootsEventClass, RadrootsEventContract, RadrootsEventDiscriminator, RadrootsEventPrivacy,
- RadrootsEventStability, RadrootsNostrStandard, RadrootsReducer, RadrootsTagCardinality,
- RadrootsTagContract, RadrootsTagSemantic, RadrootsTagValueType, all_event_contracts,
+ ContentSchema, ContractFamily, EventClass, EventContract, EventDiscriminator, EventPrivacy,
+ EventStability, NostrStandard, RADROOTS_EVENT_CONTRACT_REGISTRY_VERSION, Reducer,
+ TagCardinality, TagContract, TagSemantic, TagValueType, all_event_contracts,
event_contract_family, kind_contract,
};
use serde::{Deserialize, Serialize};
@@ -125,9 +124,7 @@ pub struct RadrootsKnowledgeManifestCodecSupport {
pub fn knowledge_contract_manifest() -> RadrootsKnowledgeContractManifest {
let mut contracts = all_event_contracts()
.iter()
- .filter(|contract| {
- event_contract_family(contract) == Some(RadrootsContractFamily::Knowledge)
- })
+ .filter(|contract| event_contract_family(contract) == Some(ContractFamily::Knowledge))
.map(manifest_entry)
.collect::<Vec<_>>();
contracts.sort_by(|left, right| left.contract_id.cmp(&right.contract_id));
@@ -153,7 +150,7 @@ pub fn contract_manifest_sha256() -> Result<String, serde_json::Error> {
Ok(hex::encode(Sha256::digest(json.as_bytes())))
}
-fn manifest_entry(contract: &RadrootsEventContract) -> RadrootsKnowledgeContractManifestEntry {
+fn manifest_entry(contract: &EventContract) -> RadrootsKnowledgeContractManifestEntry {
let standard = kind_contract(contract.kind)
.map(|contract| standard_label(contract.standard))
.unwrap_or("unknown");
@@ -217,72 +214,66 @@ fn mvp_sdk_and_wasm_tag_support(contract_id: &str) -> bool {
}
fn discriminator_manifest(
- discriminator: &RadrootsEventDiscriminator,
+ discriminator: &EventDiscriminator,
) -> RadrootsKnowledgeManifestDiscriminator {
match discriminator {
- RadrootsEventDiscriminator::KindOnly => RadrootsKnowledgeManifestDiscriminator::KindOnly,
- RadrootsEventDiscriminator::AdmissionOnly => {
- RadrootsKnowledgeManifestDiscriminator::AdmissionOnly
- }
- RadrootsEventDiscriminator::ClassifiedListingPartition(value) => {
+ EventDiscriminator::KindOnly => RadrootsKnowledgeManifestDiscriminator::KindOnly,
+ EventDiscriminator::AdmissionOnly => RadrootsKnowledgeManifestDiscriminator::AdmissionOnly,
+ EventDiscriminator::ClassifiedListingPartition(value) => {
RadrootsKnowledgeManifestDiscriminator::ClassifiedListingPartition {
value: classified_listing_partition_label(*value).to_string(),
}
}
- RadrootsEventDiscriminator::DTagExact(value) => {
- RadrootsKnowledgeManifestDiscriminator::DTagExact {
- value: (*value).to_string(),
- }
- }
- RadrootsEventDiscriminator::DTagPrefix(prefix) => {
+ EventDiscriminator::DTagExact(value) => RadrootsKnowledgeManifestDiscriminator::DTagExact {
+ value: (*value).to_string(),
+ },
+ EventDiscriminator::DTagPrefix(prefix) => {
RadrootsKnowledgeManifestDiscriminator::DTagPrefix {
prefix: (*prefix).to_string(),
}
}
- RadrootsEventDiscriminator::DTagSuffix(suffix) => {
+ EventDiscriminator::DTagSuffix(suffix) => {
RadrootsKnowledgeManifestDiscriminator::DTagSuffix {
suffix: (*suffix).to_string(),
}
}
- RadrootsEventDiscriminator::TagEquals { name, value } => {
+ EventDiscriminator::TagEquals { name, value } => {
RadrootsKnowledgeManifestDiscriminator::TagEquals {
name: (*name).to_string(),
value: (*value).to_string(),
}
}
- RadrootsEventDiscriminator::ContentJsonFieldEquals { field, value } => {
+ EventDiscriminator::ContentJsonFieldEquals { field, value } => {
RadrootsKnowledgeManifestDiscriminator::ContentJsonFieldEquals {
field: (*field).to_string(),
value: (*value).to_string(),
}
}
- RadrootsEventDiscriminator::EnvelopeType(value) => {
+ EventDiscriminator::EnvelopeType(value) => {
RadrootsKnowledgeManifestDiscriminator::EnvelopeType {
value: (*value).to_string(),
}
}
- RadrootsEventDiscriminator::Composite(parts) => {
- RadrootsKnowledgeManifestDiscriminator::Composite {
- parts: parts.iter().map(discriminator_manifest).collect(),
- }
- }
+ EventDiscriminator::Composite(parts) => RadrootsKnowledgeManifestDiscriminator::Composite {
+ parts: parts.iter().map(discriminator_manifest).collect(),
+ },
}
}
fn classified_listing_partition_label(
- value: radroots_event::listing::classified::RadrootsClassifiedListingPartition,
+ value: radroots_event::listing::classified::ClassifiedListingPartition,
) -> &'static str {
- use radroots_event::listing::classified::RadrootsClassifiedListingPartition;
+ use radroots_event::listing::classified::ClassifiedListingPartition;
match value {
- RadrootsClassifiedListingPartition::FocusedFoodAvailability => "focused_food_availability",
- RadrootsClassifiedListingPartition::OperationalListing => "operational_listing",
- RadrootsClassifiedListingPartition::GenericNip99 => "generic_nip99",
- RadrootsClassifiedListingPartition::Ambiguous => "ambiguous",
+ ClassifiedListingPartition::FocusedFoodAvailability => "focused_food_availability",
+ ClassifiedListingPartition::OperationalListing => "operational_listing",
+ ClassifiedListingPartition::GenericNip99 => "generic_nip99",
+ ClassifiedListingPartition::Ambiguous => "ambiguous",
}
}
-fn tag_contract_manifest(contract: &RadrootsTagContract) -> RadrootsKnowledgeManifestTagContract {
+fn tag_contract_manifest(contract: &TagContract) -> RadrootsKnowledgeManifestTagContract {
RadrootsKnowledgeManifestTagContract {
name: contract.name.to_string(),
cardinality: tag_cardinality_label(contract.cardinality).to_string(),
@@ -292,171 +283,171 @@ fn tag_contract_manifest(contract: &RadrootsTagContract) -> RadrootsKnowledgeMan
}
}
-fn class_label(value: RadrootsEventClass) -> &'static str {
+fn class_label(value: EventClass) -> &'static str {
match value {
- RadrootsEventClass::Regular => "regular",
- RadrootsEventClass::Replaceable => "replaceable",
- RadrootsEventClass::Addressable => "addressable",
- RadrootsEventClass::Ephemeral => "ephemeral",
+ EventClass::Regular => "regular",
+ EventClass::Replaceable => "replaceable",
+ EventClass::Addressable => "addressable",
+ EventClass::Ephemeral => "ephemeral",
}
}
-fn standard_label(value: RadrootsNostrStandard) -> &'static str {
+fn standard_label(value: NostrStandard) -> &'static str {
match value {
- RadrootsNostrStandard::Nip01 => "nip01",
- RadrootsNostrStandard::Nip09 => "nip09",
- RadrootsNostrStandard::Nip17 => "nip17",
- RadrootsNostrStandard::Nip18 => "nip18",
- RadrootsNostrStandard::Nip22 => "nip22",
- RadrootsNostrStandard::Nip23 => "nip23",
- RadrootsNostrStandard::Nip25 => "nip25",
- RadrootsNostrStandard::Nip28 => "nip28",
- RadrootsNostrStandard::Nip29 => "nip29",
- RadrootsNostrStandard::Nip42 => "nip42",
- RadrootsNostrStandard::Nip51 => "nip51",
- RadrootsNostrStandard::Nip52 => "nip52",
- RadrootsNostrStandard::Nip53 => "nip53",
- RadrootsNostrStandard::Nip54 => "nip54",
- RadrootsNostrStandard::Nip56 => "nip56",
- RadrootsNostrStandard::Nip57 => "nip57",
- RadrootsNostrStandard::Nip78 => "nip78",
- RadrootsNostrStandard::Nip90 => "nip90",
- RadrootsNostrStandard::Nip94 => "nip94",
- RadrootsNostrStandard::Nip98 => "nip98",
- RadrootsNostrStandard::Nip99 => "nip99",
- RadrootsNostrStandard::Radroots => "radroots",
+ NostrStandard::Nip01 => "nip01",
+ NostrStandard::Nip09 => "nip09",
+ NostrStandard::Nip17 => "nip17",
+ NostrStandard::Nip18 => "nip18",
+ NostrStandard::Nip22 => "nip22",
+ NostrStandard::Nip23 => "nip23",
+ NostrStandard::Nip25 => "nip25",
+ NostrStandard::Nip28 => "nip28",
+ NostrStandard::Nip29 => "nip29",
+ NostrStandard::Nip42 => "nip42",
+ NostrStandard::Nip51 => "nip51",
+ NostrStandard::Nip52 => "nip52",
+ NostrStandard::Nip53 => "nip53",
+ NostrStandard::Nip54 => "nip54",
+ NostrStandard::Nip56 => "nip56",
+ NostrStandard::Nip57 => "nip57",
+ NostrStandard::Nip78 => "nip78",
+ NostrStandard::Nip90 => "nip90",
+ NostrStandard::Nip94 => "nip94",
+ NostrStandard::Nip98 => "nip98",
+ NostrStandard::Nip99 => "nip99",
+ NostrStandard::Radroots => "radroots",
}
}
-fn stability_label(value: RadrootsEventStability) -> &'static str {
+fn stability_label(value: EventStability) -> &'static str {
match value {
- RadrootsEventStability::Stable => "stable",
- RadrootsEventStability::Experimental => "experimental",
+ EventStability::Stable => "stable",
+ EventStability::Experimental => "experimental",
}
}
-fn privacy_label(value: RadrootsEventPrivacy) -> &'static str {
+fn privacy_label(value: EventPrivacy) -> &'static str {
match value {
- RadrootsEventPrivacy::Public => "public",
- RadrootsEventPrivacy::Encrypted => "encrypted",
- RadrootsEventPrivacy::LocalOnly => "local_only",
- RadrootsEventPrivacy::Secret => "secret",
+ EventPrivacy::Public => "public",
+ EventPrivacy::Encrypted => "encrypted",
+ EventPrivacy::LocalOnly => "local_only",
+ EventPrivacy::Secret => "secret",
}
}
-fn content_schema_label(value: RadrootsContentSchema) -> &'static str {
+fn content_schema_label(value: ContentSchema) -> &'static str {
match value {
- RadrootsContentSchema::Empty => "empty",
- RadrootsContentSchema::JsonObject => "json_object",
- RadrootsContentSchema::PlainText => "plain_text",
- RadrootsContentSchema::Markdown => "markdown",
- RadrootsContentSchema::Djot => "djot",
- RadrootsContentSchema::Encrypted => "encrypted",
- RadrootsContentSchema::BinaryReference => "binary_reference",
+ ContentSchema::Empty => "empty",
+ ContentSchema::JsonObject => "json_object",
+ ContentSchema::PlainText => "plain_text",
+ ContentSchema::Markdown => "markdown",
+ ContentSchema::Djot => "djot",
+ ContentSchema::Encrypted => "encrypted",
+ ContentSchema::BinaryReference => "binary_reference",
}
}
-fn tag_cardinality_label(value: RadrootsTagCardinality) -> &'static str {
+fn tag_cardinality_label(value: TagCardinality) -> &'static str {
match value {
- RadrootsTagCardinality::RequiredOne => "required_one",
- RadrootsTagCardinality::OptionalOne => "optional_one",
- RadrootsTagCardinality::OptionalMany => "optional_many",
- RadrootsTagCardinality::RequiredMany => "required_many",
+ TagCardinality::RequiredOne => "required_one",
+ TagCardinality::OptionalOne => "optional_one",
+ TagCardinality::OptionalMany => "optional_many",
+ TagCardinality::RequiredMany => "required_many",
}
}
-fn tag_semantic_label(value: RadrootsTagSemantic) -> &'static str {
+fn tag_semantic_label(value: TagSemantic) -> &'static str {
match value {
- RadrootsTagSemantic::AddressableCoordinate => "addressable_coordinate",
- RadrootsTagSemantic::CalendarEventAuthor => "calendar_event_author",
- RadrootsTagSemantic::CalendarEventReference => "calendar_event_reference",
- RadrootsTagSemantic::CalendarEventRevision => "calendar_event_revision",
- RadrootsTagSemantic::CalendarInclusionRequest => "calendar_inclusion_request",
- RadrootsTagSemantic::CalendarEnd => "calendar_end",
- RadrootsTagSemantic::CalendarStart => "calendar_start",
- RadrootsTagSemantic::Category => "category",
- RadrootsTagSemantic::Citation => "citation",
- RadrootsTagSemantic::Contract => "contract",
- RadrootsTagSemantic::Counterparty => "counterparty",
- RadrootsTagSemantic::Evidence => "evidence",
- RadrootsTagSemantic::EventPointer => "event_pointer",
- RadrootsTagSemantic::FreeBusy => "free_busy",
- RadrootsTagSemantic::Geohash => "geohash",
- RadrootsTagSemantic::GroupId => "group_id",
- RadrootsTagSemantic::Identifier => "identifier",
- RadrootsTagSemantic::Image => "image",
- RadrootsTagSemantic::Kind => "kind",
- RadrootsTagSemantic::ClassifiedListingAddress => "listing_address",
- RadrootsTagSemantic::OperationalListingSnapshot => "listing_snapshot",
- RadrootsTagSemantic::ListDescription => "list_description",
- RadrootsTagSemantic::Location => "location",
- RadrootsTagSemantic::Nip01Coordinate => "nip01_coordinate",
- RadrootsTagSemantic::Participant => "participant",
- RadrootsTagSemantic::PreviousEvent => "previous_event",
- RadrootsTagSemantic::Price => "price",
- RadrootsTagSemantic::PublishedAt => "published_at",
- RadrootsTagSemantic::Relay => "relay",
- RadrootsTagSemantic::Reference => "reference",
- RadrootsTagSemantic::ReviewTarget => "review_target",
- RadrootsTagSemantic::RootEvent => "root_event",
- RadrootsTagSemantic::ServiceInput => "service_input",
- RadrootsTagSemantic::ServiceOutput => "service_output",
- RadrootsTagSemantic::Source => "source",
- RadrootsTagSemantic::Status => "status",
- RadrootsTagSemantic::Summary => "summary",
- RadrootsTagSemantic::Title => "title",
- RadrootsTagSemantic::Topic => "topic",
- RadrootsTagSemantic::TimeZone => "time_zone",
- RadrootsTagSemantic::Url => "url",
- RadrootsTagSemantic::UtcDayCoverage => "utc_day_coverage",
+ TagSemantic::AddressableCoordinate => "addressable_coordinate",
+ TagSemantic::CalendarEventAuthor => "calendar_event_author",
+ TagSemantic::CalendarEventReference => "calendar_event_reference",
+ TagSemantic::CalendarEventRevision => "calendar_event_revision",
+ TagSemantic::CalendarInclusionRequest => "calendar_inclusion_request",
+ TagSemantic::CalendarEnd => "calendar_end",
+ TagSemantic::CalendarStart => "calendar_start",
+ TagSemantic::Category => "category",
+ TagSemantic::Citation => "citation",
+ TagSemantic::Contract => "contract",
+ TagSemantic::Counterparty => "counterparty",
+ TagSemantic::Evidence => "evidence",
+ TagSemantic::EventPointer => "event_pointer",
+ TagSemantic::FreeBusy => "free_busy",
+ TagSemantic::Geohash => "geohash",
+ TagSemantic::GroupId => "group_id",
+ TagSemantic::Identifier => "identifier",
+ TagSemantic::Image => "image",
+ TagSemantic::Kind => "kind",
+ TagSemantic::ClassifiedListingAddress => "listing_address",
+ TagSemantic::OperationalListingSnapshot => "listing_snapshot",
+ TagSemantic::ListDescription => "list_description",
+ TagSemantic::Location => "location",
+ TagSemantic::Nip01Coordinate => "nip01_coordinate",
+ TagSemantic::Participant => "participant",
+ TagSemantic::PreviousEvent => "previous_event",
+ TagSemantic::Price => "price",
+ TagSemantic::PublishedAt => "published_at",
+ TagSemantic::Relay => "relay",
+ TagSemantic::Reference => "reference",
+ TagSemantic::ReviewTarget => "review_target",
+ TagSemantic::RootEvent => "root_event",
+ TagSemantic::ServiceInput => "service_input",
+ TagSemantic::ServiceOutput => "service_output",
+ TagSemantic::Source => "source",
+ TagSemantic::Status => "status",
+ TagSemantic::Summary => "summary",
+ TagSemantic::Title => "title",
+ TagSemantic::Topic => "topic",
+ TagSemantic::TimeZone => "time_zone",
+ TagSemantic::Url => "url",
+ TagSemantic::UtcDayCoverage => "utc_day_coverage",
}
}
-fn tag_value_type_label(value: RadrootsTagValueType) -> &'static str {
+fn tag_value_type_label(value: TagValueType) -> &'static str {
match value {
- RadrootsTagValueType::AddressableCoordinate => "addressable_coordinate",
- RadrootsTagValueType::CalendarDate => "calendar_date",
- RadrootsTagValueType::CalendarEventCoordinate => "calendar_event_coordinate",
- RadrootsTagValueType::CalendarFreeBusy => "calendar_free_busy",
- RadrootsTagValueType::CalendarRsvpStatus => "calendar_rsvp_status",
- RadrootsTagValueType::CalendarUid => "calendar_uid",
- RadrootsTagValueType::ContractId => "contract_id",
- RadrootsTagValueType::DTag => "d_tag",
- RadrootsTagValueType::EventId => "event_id",
- RadrootsTagValueType::EventPointer => "event_pointer",
- RadrootsTagValueType::Geohash => "geohash",
- RadrootsTagValueType::IanaTimeZoneId => "iana_time_zone_id",
- RadrootsTagValueType::Kind => "kind",
- RadrootsTagValueType::Nip01Coordinate => "nip01_coordinate",
- RadrootsTagValueType::PublicKey => "public_key",
- RadrootsTagValueType::RelayUrl => "relay_url",
- RadrootsTagValueType::Sha256 => "sha256",
- RadrootsTagValueType::Text => "text",
- RadrootsTagValueType::UnixTimestamp => "unix_timestamp",
- RadrootsTagValueType::Uri => "uri",
- RadrootsTagValueType::Url => "url",
- RadrootsTagValueType::UtcDayIndex => "utc_day_index",
- RadrootsTagValueType::Uuid => "uuid",
+ TagValueType::AddressableCoordinate => "addressable_coordinate",
+ TagValueType::CalendarDate => "calendar_date",
+ TagValueType::CalendarEventCoordinate => "calendar_event_coordinate",
+ TagValueType::CalendarFreeBusy => "calendar_free_busy",
+ TagValueType::CalendarRsvpStatus => "calendar_rsvp_status",
+ TagValueType::CalendarUid => "calendar_uid",
+ TagValueType::ContractId => "contract_id",
+ TagValueType::DTag => "d_tag",
+ TagValueType::EventId => "event_id",
+ TagValueType::EventPointer => "event_pointer",
+ TagValueType::Geohash => "geohash",
+ TagValueType::IanaTimeZoneId => "iana_time_zone_id",
+ TagValueType::Kind => "kind",
+ TagValueType::Nip01Coordinate => "nip01_coordinate",
+ TagValueType::PublicKey => "public_key",
+ TagValueType::RelayUrl => "relay_url",
+ TagValueType::Sha256 => "sha256",
+ TagValueType::Text => "text",
+ TagValueType::UnixTimestamp => "unix_timestamp",
+ TagValueType::Uri => "uri",
+ TagValueType::Url => "url",
+ TagValueType::UtcDayIndex => "utc_day_index",
+ TagValueType::Uuid => "uuid",
}
}
-fn reducer_label(value: RadrootsReducer) -> &'static str {
+fn reducer_label(value: Reducer) -> &'static str {
match value {
- RadrootsReducer::CalendarProjection => "calendar_projection",
- RadrootsReducer::FarmOpsProjection => "farm_ops_projection",
- RadrootsReducer::GroupProjection => "group_projection",
- RadrootsReducer::KnowledgeProjection => "knowledge_projection",
- RadrootsReducer::OperationalListingInventoryAccounting => {
+ Reducer::CalendarProjection => "calendar_projection",
+ Reducer::FarmOpsProjection => "farm_ops_projection",
+ Reducer::GroupProjection => "group_projection",
+ Reducer::KnowledgeProjection => "knowledge_projection",
+ Reducer::OperationalListingInventoryAccounting => {
"operational_listing_inventory_accounting"
}
- RadrootsReducer::OperationalListingProjection => "operational_listing_projection",
- RadrootsReducer::MarketProjection => "market_projection",
- RadrootsReducer::OrderProjection => "order_projection",
- RadrootsReducer::ProfileProjection => "profile_projection",
- RadrootsReducer::NostrRelayPolicyProjection => "nostr_relay_policy_projection",
- RadrootsReducer::SocialProjection => "social_projection",
- RadrootsReducer::TradeProjection => "trade_projection",
- RadrootsReducer::TradeValidation => "trade_validation",
+ Reducer::OperationalListingProjection => "operational_listing_projection",
+ Reducer::MarketProjection => "market_projection",
+ Reducer::OrderProjection => "order_projection",
+ Reducer::ProfileProjection => "profile_projection",
+ Reducer::NostrRelayPolicyProjection => "nostr_relay_policy_projection",
+ Reducer::SocialProjection => "social_projection",
+ Reducer::TradeProjection => "trade_projection",
+ Reducer::TradeValidation => "trade_validation",
}
}
@@ -464,23 +455,23 @@ fn reducer_label(value: RadrootsReducer) -> &'static str {
mod tests {
use super::{discriminator_manifest, reducer_label, standard_label};
use radroots_event::{
- contract::{RadrootsEventDiscriminator, RadrootsNostrStandard, RadrootsReducer},
- listing::classified::RadrootsClassifiedListingPartition,
+ contract::{EventDiscriminator, NostrStandard, Reducer},
+ listing::classified::ClassifiedListingPartition,
};
#[test]
fn classified_listing_standard_label_is_nip99() {
- assert_eq!(standard_label(RadrootsNostrStandard::Nip99), "nip99");
+ assert_eq!(standard_label(NostrStandard::Nip99), "nip99");
}
#[test]
fn operational_listing_reducer_labels_are_unambiguous() {
assert_eq!(
- reducer_label(RadrootsReducer::OperationalListingProjection),
+ reducer_label(Reducer::OperationalListingProjection),
"operational_listing_projection"
);
assert_eq!(
- reducer_label(RadrootsReducer::OperationalListingInventoryAccounting),
+ reducer_label(Reducer::OperationalListingInventoryAccounting),
"operational_listing_inventory_accounting"
);
}
@@ -489,22 +480,18 @@ mod tests {
fn classified_listing_partition_discriminators_render_exactly() {
for (partition, expected) in [
(
- RadrootsClassifiedListingPartition::FocusedFoodAvailability,
+ ClassifiedListingPartition::FocusedFoodAvailability,
"focused_food_availability",
),
(
- RadrootsClassifiedListingPartition::OperationalListing,
+ ClassifiedListingPartition::OperationalListing,
"operational_listing",
),
- (
- RadrootsClassifiedListingPartition::GenericNip99,
- "generic_nip99",
- ),
- (RadrootsClassifiedListingPartition::Ambiguous, "ambiguous"),
+ (ClassifiedListingPartition::GenericNip99, "generic_nip99"),
+ (ClassifiedListingPartition::Ambiguous, "ambiguous"),
] {
- let manifest = discriminator_manifest(
- &RadrootsEventDiscriminator::ClassifiedListingPartition(partition),
- );
+ let manifest =
+ discriminator_manifest(&EventDiscriminator::ClassifiedListingPartition(partition));
assert_eq!(
serde_json::to_value(manifest).expect("serialized discriminator"),
serde_json::json!({
diff --git a/crates/event_codec/src/manifest/registry_v7.rs b/crates/event_codec/src/manifest/registry_v7.rs
@@ -7,13 +7,12 @@ use alloc::{
use radroots_event::{
contract::{
- AuthorRole, RadrootsContentSchema, RadrootsEventAuthoringPolicy, RadrootsEventClass,
- RadrootsEventContract, RadrootsEventDiscriminator, RadrootsEventPrivacy,
- RadrootsEventStability, RadrootsKindContract, RadrootsNostrStandard, RadrootsReducer,
- RadrootsTagCardinality, RadrootsTagContract, RadrootsTagSemantic, RadrootsTagValueType,
- all_event_contracts_registry_v7, all_kind_contracts_registry_v7,
+ AuthorRole, ContentSchema, EventAuthoringPolicy, EventClass, EventContract,
+ EventDiscriminator, EventPrivacy, EventStability, KindContract, NostrStandard, Reducer,
+ TagCardinality, TagContract, TagSemantic, TagValueType, all_event_contracts_registry_v7,
+ all_kind_contracts_registry_v7,
},
- listing::classified::RadrootsClassifiedListingPartition,
+ listing::classified::ClassifiedListingPartition,
};
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
@@ -349,7 +348,7 @@ pub fn parse_event_contract_registry_v7_inventory_json(
fn kind_inventory_entry(
ordinal: usize,
- contract: &RadrootsKindContract,
+ contract: &KindContract,
) -> RadrootsKindContractRegistryV7InventoryEntry {
RadrootsKindContractRegistryV7InventoryEntry {
ordinal,
@@ -368,7 +367,7 @@ fn kind_inventory_entry(
fn event_inventory_entry(
ordinal: usize,
- contract: &RadrootsEventContract,
+ contract: &EventContract,
) -> RadrootsEventContractRegistryV7InventoryEntry {
RadrootsEventContractRegistryV7InventoryEntry {
ordinal,
@@ -393,57 +392,55 @@ fn event_inventory_entry(
}
}
-fn class_inventory(value: RadrootsEventClass) -> RadrootsEventContractRegistryV7Class {
+fn class_inventory(value: EventClass) -> RadrootsEventContractRegistryV7Class {
match value {
- RadrootsEventClass::Regular => RadrootsEventContractRegistryV7Class::Regular,
- RadrootsEventClass::Replaceable => RadrootsEventContractRegistryV7Class::Replaceable,
- RadrootsEventClass::Addressable => RadrootsEventContractRegistryV7Class::Addressable,
- RadrootsEventClass::Ephemeral => RadrootsEventContractRegistryV7Class::Ephemeral,
+ EventClass::Regular => RadrootsEventContractRegistryV7Class::Regular,
+ EventClass::Replaceable => RadrootsEventContractRegistryV7Class::Replaceable,
+ EventClass::Addressable => RadrootsEventContractRegistryV7Class::Addressable,
+ EventClass::Ephemeral => RadrootsEventContractRegistryV7Class::Ephemeral,
}
}
-fn standard_inventory(value: RadrootsNostrStandard) -> RadrootsEventContractRegistryV7Standard {
+fn standard_inventory(value: NostrStandard) -> RadrootsEventContractRegistryV7Standard {
match value {
- RadrootsNostrStandard::Nip01 => RadrootsEventContractRegistryV7Standard::Nip01,
- RadrootsNostrStandard::Nip09 => RadrootsEventContractRegistryV7Standard::Nip09,
- RadrootsNostrStandard::Nip17 => RadrootsEventContractRegistryV7Standard::Nip17,
- RadrootsNostrStandard::Nip18 => RadrootsEventContractRegistryV7Standard::Nip18,
- RadrootsNostrStandard::Nip22 => RadrootsEventContractRegistryV7Standard::Nip22,
- RadrootsNostrStandard::Nip23 => RadrootsEventContractRegistryV7Standard::Nip23,
- RadrootsNostrStandard::Nip25 => RadrootsEventContractRegistryV7Standard::Nip25,
- RadrootsNostrStandard::Nip28 => RadrootsEventContractRegistryV7Standard::Nip28,
- RadrootsNostrStandard::Nip29 => RadrootsEventContractRegistryV7Standard::Nip29,
- RadrootsNostrStandard::Nip42 => RadrootsEventContractRegistryV7Standard::Nip42,
- RadrootsNostrStandard::Nip51 => RadrootsEventContractRegistryV7Standard::Nip51,
- RadrootsNostrStandard::Nip52 => RadrootsEventContractRegistryV7Standard::Nip52,
- RadrootsNostrStandard::Nip53 => RadrootsEventContractRegistryV7Standard::Nip53,
- RadrootsNostrStandard::Nip54 => RadrootsEventContractRegistryV7Standard::Nip54,
- RadrootsNostrStandard::Nip56 => RadrootsEventContractRegistryV7Standard::Nip56,
- RadrootsNostrStandard::Nip57 => RadrootsEventContractRegistryV7Standard::Nip57,
- RadrootsNostrStandard::Nip78 => RadrootsEventContractRegistryV7Standard::Nip78,
- RadrootsNostrStandard::Nip90 => RadrootsEventContractRegistryV7Standard::Nip90,
- RadrootsNostrStandard::Nip94 => RadrootsEventContractRegistryV7Standard::Nip94,
- RadrootsNostrStandard::Nip98 => RadrootsEventContractRegistryV7Standard::Nip98,
- RadrootsNostrStandard::Nip99 => RadrootsEventContractRegistryV7Standard::Nip99,
- RadrootsNostrStandard::Radroots => RadrootsEventContractRegistryV7Standard::Radroots,
+ NostrStandard::Nip01 => RadrootsEventContractRegistryV7Standard::Nip01,
+ NostrStandard::Nip09 => RadrootsEventContractRegistryV7Standard::Nip09,
+ NostrStandard::Nip17 => RadrootsEventContractRegistryV7Standard::Nip17,
+ NostrStandard::Nip18 => RadrootsEventContractRegistryV7Standard::Nip18,
+ NostrStandard::Nip22 => RadrootsEventContractRegistryV7Standard::Nip22,
+ NostrStandard::Nip23 => RadrootsEventContractRegistryV7Standard::Nip23,
+ NostrStandard::Nip25 => RadrootsEventContractRegistryV7Standard::Nip25,
+ NostrStandard::Nip28 => RadrootsEventContractRegistryV7Standard::Nip28,
+ NostrStandard::Nip29 => RadrootsEventContractRegistryV7Standard::Nip29,
+ NostrStandard::Nip42 => RadrootsEventContractRegistryV7Standard::Nip42,
+ NostrStandard::Nip51 => RadrootsEventContractRegistryV7Standard::Nip51,
+ NostrStandard::Nip52 => RadrootsEventContractRegistryV7Standard::Nip52,
+ NostrStandard::Nip53 => RadrootsEventContractRegistryV7Standard::Nip53,
+ NostrStandard::Nip54 => RadrootsEventContractRegistryV7Standard::Nip54,
+ NostrStandard::Nip56 => RadrootsEventContractRegistryV7Standard::Nip56,
+ NostrStandard::Nip57 => RadrootsEventContractRegistryV7Standard::Nip57,
+ NostrStandard::Nip78 => RadrootsEventContractRegistryV7Standard::Nip78,
+ NostrStandard::Nip90 => RadrootsEventContractRegistryV7Standard::Nip90,
+ NostrStandard::Nip94 => RadrootsEventContractRegistryV7Standard::Nip94,
+ NostrStandard::Nip98 => RadrootsEventContractRegistryV7Standard::Nip98,
+ NostrStandard::Nip99 => RadrootsEventContractRegistryV7Standard::Nip99,
+ NostrStandard::Radroots => RadrootsEventContractRegistryV7Standard::Radroots,
}
}
-fn stability_inventory(value: RadrootsEventStability) -> RadrootsEventContractRegistryV7Stability {
+fn stability_inventory(value: EventStability) -> RadrootsEventContractRegistryV7Stability {
match value {
- RadrootsEventStability::Stable => RadrootsEventContractRegistryV7Stability::Stable,
- RadrootsEventStability::Experimental => {
- RadrootsEventContractRegistryV7Stability::Experimental
- }
+ EventStability::Stable => RadrootsEventContractRegistryV7Stability::Stable,
+ EventStability::Experimental => RadrootsEventContractRegistryV7Stability::Experimental,
}
}
-fn privacy_inventory(value: RadrootsEventPrivacy) -> RadrootsEventContractRegistryV7Privacy {
+fn privacy_inventory(value: EventPrivacy) -> RadrootsEventContractRegistryV7Privacy {
match value {
- RadrootsEventPrivacy::Public => RadrootsEventContractRegistryV7Privacy::Public,
- RadrootsEventPrivacy::Encrypted => RadrootsEventContractRegistryV7Privacy::Encrypted,
- RadrootsEventPrivacy::LocalOnly => RadrootsEventContractRegistryV7Privacy::LocalOnly,
- RadrootsEventPrivacy::Secret => RadrootsEventContractRegistryV7Privacy::Secret,
+ EventPrivacy::Public => RadrootsEventContractRegistryV7Privacy::Public,
+ EventPrivacy::Encrypted => RadrootsEventContractRegistryV7Privacy::Encrypted,
+ EventPrivacy::LocalOnly => RadrootsEventContractRegistryV7Privacy::LocalOnly,
+ EventPrivacy::Secret => RadrootsEventContractRegistryV7Privacy::Secret,
}
}
@@ -461,88 +458,80 @@ fn author_role_inventory(value: AuthorRole) -> RadrootsEventContractRegistryV7Ac
}
}
-fn content_schema_inventory(
- value: RadrootsContentSchema,
-) -> RadrootsEventContractRegistryV7ContentSchema {
+fn content_schema_inventory(value: ContentSchema) -> RadrootsEventContractRegistryV7ContentSchema {
match value {
- RadrootsContentSchema::Empty => RadrootsEventContractRegistryV7ContentSchema::Empty,
- RadrootsContentSchema::JsonObject => {
- RadrootsEventContractRegistryV7ContentSchema::JsonObject
- }
- RadrootsContentSchema::PlainText => RadrootsEventContractRegistryV7ContentSchema::PlainText,
- RadrootsContentSchema::Markdown => RadrootsEventContractRegistryV7ContentSchema::Markdown,
- RadrootsContentSchema::Djot => RadrootsEventContractRegistryV7ContentSchema::Djot,
- RadrootsContentSchema::Encrypted => RadrootsEventContractRegistryV7ContentSchema::Encrypted,
- RadrootsContentSchema::BinaryReference => {
+ ContentSchema::Empty => RadrootsEventContractRegistryV7ContentSchema::Empty,
+ ContentSchema::JsonObject => RadrootsEventContractRegistryV7ContentSchema::JsonObject,
+ ContentSchema::PlainText => RadrootsEventContractRegistryV7ContentSchema::PlainText,
+ ContentSchema::Markdown => RadrootsEventContractRegistryV7ContentSchema::Markdown,
+ ContentSchema::Djot => RadrootsEventContractRegistryV7ContentSchema::Djot,
+ ContentSchema::Encrypted => RadrootsEventContractRegistryV7ContentSchema::Encrypted,
+ ContentSchema::BinaryReference => {
RadrootsEventContractRegistryV7ContentSchema::BinaryReference
}
}
}
fn authoring_policy_inventory(
- value: RadrootsEventAuthoringPolicy,
+ value: EventAuthoringPolicy,
) -> RadrootsEventContractRegistryV7AuthoringPolicy {
match value {
- RadrootsEventAuthoringPolicy::GenericDraft => {
+ EventAuthoringPolicy::GenericDraft => {
RadrootsEventContractRegistryV7AuthoringPolicy::GenericDraft
}
- RadrootsEventAuthoringPolicy::TypedOnly => {
+ EventAuthoringPolicy::TypedOnly => {
RadrootsEventContractRegistryV7AuthoringPolicy::TypedOnly
}
- RadrootsEventAuthoringPolicy::ReadOnly => {
- RadrootsEventContractRegistryV7AuthoringPolicy::ReadOnly
- }
+ EventAuthoringPolicy::ReadOnly => RadrootsEventContractRegistryV7AuthoringPolicy::ReadOnly,
}
}
fn discriminator_inventory(
- value: &RadrootsEventDiscriminator,
+ value: &EventDiscriminator,
) -> RadrootsEventContractRegistryV7Discriminator {
match value {
- RadrootsEventDiscriminator::KindOnly => {
- RadrootsEventContractRegistryV7Discriminator::KindOnly
- }
- RadrootsEventDiscriminator::AdmissionOnly => {
+ EventDiscriminator::KindOnly => RadrootsEventContractRegistryV7Discriminator::KindOnly,
+ EventDiscriminator::AdmissionOnly => {
RadrootsEventContractRegistryV7Discriminator::AdmissionOnly
}
- RadrootsEventDiscriminator::ClassifiedListingPartition(value) => {
+ EventDiscriminator::ClassifiedListingPartition(value) => {
RadrootsEventContractRegistryV7Discriminator::ClassifiedListingPartition {
value: classified_listing_partition_inventory(*value),
}
}
- RadrootsEventDiscriminator::DTagExact(value) => {
+ EventDiscriminator::DTagExact(value) => {
RadrootsEventContractRegistryV7Discriminator::DTagExact {
value: (*value).to_string(),
}
}
- RadrootsEventDiscriminator::DTagPrefix(prefix) => {
+ EventDiscriminator::DTagPrefix(prefix) => {
RadrootsEventContractRegistryV7Discriminator::DTagPrefix {
prefix: (*prefix).to_string(),
}
}
- RadrootsEventDiscriminator::DTagSuffix(suffix) => {
+ EventDiscriminator::DTagSuffix(suffix) => {
RadrootsEventContractRegistryV7Discriminator::DTagSuffix {
suffix: (*suffix).to_string(),
}
}
- RadrootsEventDiscriminator::TagEquals { name, value } => {
+ EventDiscriminator::TagEquals { name, value } => {
RadrootsEventContractRegistryV7Discriminator::TagEquals {
name: (*name).to_string(),
value: (*value).to_string(),
}
}
- RadrootsEventDiscriminator::ContentJsonFieldEquals { field, value } => {
+ EventDiscriminator::ContentJsonFieldEquals { field, value } => {
RadrootsEventContractRegistryV7Discriminator::ContentJsonFieldEquals {
field: (*field).to_string(),
value: (*value).to_string(),
}
}
- RadrootsEventDiscriminator::EnvelopeType(value) => {
+ EventDiscriminator::EnvelopeType(value) => {
RadrootsEventContractRegistryV7Discriminator::EnvelopeType {
value: (*value).to_string(),
}
}
- RadrootsEventDiscriminator::Composite(parts) => {
+ EventDiscriminator::Composite(parts) => {
RadrootsEventContractRegistryV7Discriminator::Composite {
parts: parts.iter().map(discriminator_inventory).collect(),
}
@@ -666,25 +655,25 @@ fn discriminator_string_field(
}
fn classified_listing_partition_inventory(
- value: RadrootsClassifiedListingPartition,
+ value: ClassifiedListingPartition,
) -> RadrootsEventContractRegistryV7ClassifiedListingPartition {
match value {
- RadrootsClassifiedListingPartition::FocusedFoodAvailability => {
+ ClassifiedListingPartition::FocusedFoodAvailability => {
RadrootsEventContractRegistryV7ClassifiedListingPartition::FocusedFoodAvailability
}
- RadrootsClassifiedListingPartition::OperationalListing => {
+ ClassifiedListingPartition::OperationalListing => {
RadrootsEventContractRegistryV7ClassifiedListingPartition::OperationalListing
}
- RadrootsClassifiedListingPartition::GenericNip99 => {
+ ClassifiedListingPartition::GenericNip99 => {
RadrootsEventContractRegistryV7ClassifiedListingPartition::GenericNip99
}
- RadrootsClassifiedListingPartition::Ambiguous => {
+ ClassifiedListingPartition::Ambiguous => {
RadrootsEventContractRegistryV7ClassifiedListingPartition::Ambiguous
}
}
}
-fn tag_inventory(contract: &RadrootsTagContract) -> RadrootsEventContractRegistryV7Tag {
+fn tag_inventory(contract: &TagContract) -> RadrootsEventContractRegistryV7Tag {
RadrootsEventContractRegistryV7Tag {
name: contract.name.to_string(),
cardinality: tag_cardinality_inventory(contract.cardinality),
@@ -695,192 +684,136 @@ fn tag_inventory(contract: &RadrootsTagContract) -> RadrootsEventContractRegistr
}
fn tag_cardinality_inventory(
- value: RadrootsTagCardinality,
+ value: TagCardinality,
) -> RadrootsEventContractRegistryV7TagCardinality {
match value {
- RadrootsTagCardinality::RequiredOne => {
- RadrootsEventContractRegistryV7TagCardinality::RequiredOne
- }
- RadrootsTagCardinality::OptionalOne => {
- RadrootsEventContractRegistryV7TagCardinality::OptionalOne
- }
- RadrootsTagCardinality::OptionalMany => {
- RadrootsEventContractRegistryV7TagCardinality::OptionalMany
- }
- RadrootsTagCardinality::RequiredMany => {
- RadrootsEventContractRegistryV7TagCardinality::RequiredMany
- }
+ TagCardinality::RequiredOne => RadrootsEventContractRegistryV7TagCardinality::RequiredOne,
+ TagCardinality::OptionalOne => RadrootsEventContractRegistryV7TagCardinality::OptionalOne,
+ TagCardinality::OptionalMany => RadrootsEventContractRegistryV7TagCardinality::OptionalMany,
+ TagCardinality::RequiredMany => RadrootsEventContractRegistryV7TagCardinality::RequiredMany,
}
}
-fn tag_semantic_inventory(
- value: RadrootsTagSemantic,
-) -> RadrootsEventContractRegistryV7TagSemantic {
+fn tag_semantic_inventory(value: TagSemantic) -> RadrootsEventContractRegistryV7TagSemantic {
match value {
- RadrootsTagSemantic::AddressableCoordinate => {
+ TagSemantic::AddressableCoordinate => {
RadrootsEventContractRegistryV7TagSemantic::AddressableCoordinate
}
- RadrootsTagSemantic::CalendarEventAuthor => {
+ TagSemantic::CalendarEventAuthor => {
RadrootsEventContractRegistryV7TagSemantic::CalendarEventAuthor
}
- RadrootsTagSemantic::CalendarEventReference => {
+ TagSemantic::CalendarEventReference => {
RadrootsEventContractRegistryV7TagSemantic::CalendarEventReference
}
- RadrootsTagSemantic::CalendarEventRevision => {
+ TagSemantic::CalendarEventRevision => {
RadrootsEventContractRegistryV7TagSemantic::CalendarEventRevision
}
- RadrootsTagSemantic::CalendarInclusionRequest => {
+ TagSemantic::CalendarInclusionRequest => {
RadrootsEventContractRegistryV7TagSemantic::CalendarInclusionRequest
}
- RadrootsTagSemantic::CalendarEnd => RadrootsEventContractRegistryV7TagSemantic::CalendarEnd,
- RadrootsTagSemantic::CalendarStart => {
- RadrootsEventContractRegistryV7TagSemantic::CalendarStart
- }
- RadrootsTagSemantic::Category => RadrootsEventContractRegistryV7TagSemantic::Category,
- RadrootsTagSemantic::Citation => RadrootsEventContractRegistryV7TagSemantic::Citation,
- RadrootsTagSemantic::Contract => RadrootsEventContractRegistryV7TagSemantic::Contract,
- RadrootsTagSemantic::Counterparty => {
- RadrootsEventContractRegistryV7TagSemantic::Counterparty
- }
- RadrootsTagSemantic::Evidence => RadrootsEventContractRegistryV7TagSemantic::Evidence,
- RadrootsTagSemantic::EventPointer => {
- RadrootsEventContractRegistryV7TagSemantic::EventPointer
- }
- RadrootsTagSemantic::FreeBusy => RadrootsEventContractRegistryV7TagSemantic::FreeBusy,
- RadrootsTagSemantic::Geohash => RadrootsEventContractRegistryV7TagSemantic::Geohash,
- RadrootsTagSemantic::GroupId => RadrootsEventContractRegistryV7TagSemantic::GroupId,
- RadrootsTagSemantic::Identifier => RadrootsEventContractRegistryV7TagSemantic::Identifier,
- RadrootsTagSemantic::Image => RadrootsEventContractRegistryV7TagSemantic::Image,
- RadrootsTagSemantic::Kind => RadrootsEventContractRegistryV7TagSemantic::Kind,
- RadrootsTagSemantic::ClassifiedListingAddress => {
+ TagSemantic::CalendarEnd => RadrootsEventContractRegistryV7TagSemantic::CalendarEnd,
+ TagSemantic::CalendarStart => RadrootsEventContractRegistryV7TagSemantic::CalendarStart,
+ TagSemantic::Category => RadrootsEventContractRegistryV7TagSemantic::Category,
+ TagSemantic::Citation => RadrootsEventContractRegistryV7TagSemantic::Citation,
+ TagSemantic::Contract => RadrootsEventContractRegistryV7TagSemantic::Contract,
+ TagSemantic::Counterparty => RadrootsEventContractRegistryV7TagSemantic::Counterparty,
+ TagSemantic::Evidence => RadrootsEventContractRegistryV7TagSemantic::Evidence,
+ TagSemantic::EventPointer => RadrootsEventContractRegistryV7TagSemantic::EventPointer,
+ TagSemantic::FreeBusy => RadrootsEventContractRegistryV7TagSemantic::FreeBusy,
+ TagSemantic::Geohash => RadrootsEventContractRegistryV7TagSemantic::Geohash,
+ TagSemantic::GroupId => RadrootsEventContractRegistryV7TagSemantic::GroupId,
+ TagSemantic::Identifier => RadrootsEventContractRegistryV7TagSemantic::Identifier,
+ TagSemantic::Image => RadrootsEventContractRegistryV7TagSemantic::Image,
+ TagSemantic::Kind => RadrootsEventContractRegistryV7TagSemantic::Kind,
+ TagSemantic::ClassifiedListingAddress => {
RadrootsEventContractRegistryV7TagSemantic::ClassifiedListingAddress
}
- RadrootsTagSemantic::OperationalListingSnapshot => {
+ TagSemantic::OperationalListingSnapshot => {
RadrootsEventContractRegistryV7TagSemantic::OperationalListingSnapshot
}
- RadrootsTagSemantic::ListDescription => {
- RadrootsEventContractRegistryV7TagSemantic::ListDescription
- }
- RadrootsTagSemantic::Location => RadrootsEventContractRegistryV7TagSemantic::Location,
- RadrootsTagSemantic::Nip01Coordinate => {
- RadrootsEventContractRegistryV7TagSemantic::Nip01Coordinate
- }
- RadrootsTagSemantic::Participant => RadrootsEventContractRegistryV7TagSemantic::Participant,
- RadrootsTagSemantic::PreviousEvent => {
- RadrootsEventContractRegistryV7TagSemantic::PreviousEvent
- }
- RadrootsTagSemantic::Price => RadrootsEventContractRegistryV7TagSemantic::Price,
- RadrootsTagSemantic::PublishedAt => RadrootsEventContractRegistryV7TagSemantic::PublishedAt,
- RadrootsTagSemantic::Relay => RadrootsEventContractRegistryV7TagSemantic::Relay,
- RadrootsTagSemantic::Reference => RadrootsEventContractRegistryV7TagSemantic::Reference,
- RadrootsTagSemantic::ReviewTarget => {
- RadrootsEventContractRegistryV7TagSemantic::ReviewTarget
- }
- RadrootsTagSemantic::RootEvent => RadrootsEventContractRegistryV7TagSemantic::RootEvent,
- RadrootsTagSemantic::ServiceInput => {
- RadrootsEventContractRegistryV7TagSemantic::ServiceInput
- }
- RadrootsTagSemantic::ServiceOutput => {
- RadrootsEventContractRegistryV7TagSemantic::ServiceOutput
- }
- RadrootsTagSemantic::Source => RadrootsEventContractRegistryV7TagSemantic::Source,
- RadrootsTagSemantic::Status => RadrootsEventContractRegistryV7TagSemantic::Status,
- RadrootsTagSemantic::Summary => RadrootsEventContractRegistryV7TagSemantic::Summary,
- RadrootsTagSemantic::Title => RadrootsEventContractRegistryV7TagSemantic::Title,
- RadrootsTagSemantic::Topic => RadrootsEventContractRegistryV7TagSemantic::Topic,
- RadrootsTagSemantic::TimeZone => RadrootsEventContractRegistryV7TagSemantic::TimeZone,
- RadrootsTagSemantic::Url => RadrootsEventContractRegistryV7TagSemantic::Url,
- RadrootsTagSemantic::UtcDayCoverage => {
- RadrootsEventContractRegistryV7TagSemantic::UtcDayCoverage
- }
+ TagSemantic::ListDescription => RadrootsEventContractRegistryV7TagSemantic::ListDescription,
+ TagSemantic::Location => RadrootsEventContractRegistryV7TagSemantic::Location,
+ TagSemantic::Nip01Coordinate => RadrootsEventContractRegistryV7TagSemantic::Nip01Coordinate,
+ TagSemantic::Participant => RadrootsEventContractRegistryV7TagSemantic::Participant,
+ TagSemantic::PreviousEvent => RadrootsEventContractRegistryV7TagSemantic::PreviousEvent,
+ TagSemantic::Price => RadrootsEventContractRegistryV7TagSemantic::Price,
+ TagSemantic::PublishedAt => RadrootsEventContractRegistryV7TagSemantic::PublishedAt,
+ TagSemantic::Relay => RadrootsEventContractRegistryV7TagSemantic::Relay,
+ TagSemantic::Reference => RadrootsEventContractRegistryV7TagSemantic::Reference,
+ TagSemantic::ReviewTarget => RadrootsEventContractRegistryV7TagSemantic::ReviewTarget,
+ TagSemantic::RootEvent => RadrootsEventContractRegistryV7TagSemantic::RootEvent,
+ TagSemantic::ServiceInput => RadrootsEventContractRegistryV7TagSemantic::ServiceInput,
+ TagSemantic::ServiceOutput => RadrootsEventContractRegistryV7TagSemantic::ServiceOutput,
+ TagSemantic::Source => RadrootsEventContractRegistryV7TagSemantic::Source,
+ TagSemantic::Status => RadrootsEventContractRegistryV7TagSemantic::Status,
+ TagSemantic::Summary => RadrootsEventContractRegistryV7TagSemantic::Summary,
+ TagSemantic::Title => RadrootsEventContractRegistryV7TagSemantic::Title,
+ TagSemantic::Topic => RadrootsEventContractRegistryV7TagSemantic::Topic,
+ TagSemantic::TimeZone => RadrootsEventContractRegistryV7TagSemantic::TimeZone,
+ TagSemantic::Url => RadrootsEventContractRegistryV7TagSemantic::Url,
+ TagSemantic::UtcDayCoverage => RadrootsEventContractRegistryV7TagSemantic::UtcDayCoverage,
}
}
-fn tag_value_type_inventory(
- value: RadrootsTagValueType,
-) -> RadrootsEventContractRegistryV7TagValueType {
+fn tag_value_type_inventory(value: TagValueType) -> RadrootsEventContractRegistryV7TagValueType {
match value {
- RadrootsTagValueType::AddressableCoordinate => {
+ TagValueType::AddressableCoordinate => {
RadrootsEventContractRegistryV7TagValueType::AddressableCoordinate
}
- RadrootsTagValueType::CalendarDate => {
- RadrootsEventContractRegistryV7TagValueType::CalendarDate
- }
- RadrootsTagValueType::CalendarEventCoordinate => {
+ TagValueType::CalendarDate => RadrootsEventContractRegistryV7TagValueType::CalendarDate,
+ TagValueType::CalendarEventCoordinate => {
RadrootsEventContractRegistryV7TagValueType::CalendarEventCoordinate
}
- RadrootsTagValueType::CalendarFreeBusy => {
+ TagValueType::CalendarFreeBusy => {
RadrootsEventContractRegistryV7TagValueType::CalendarFreeBusy
}
- RadrootsTagValueType::CalendarRsvpStatus => {
+ TagValueType::CalendarRsvpStatus => {
RadrootsEventContractRegistryV7TagValueType::CalendarRsvpStatus
}
- RadrootsTagValueType::CalendarUid => {
- RadrootsEventContractRegistryV7TagValueType::CalendarUid
- }
- RadrootsTagValueType::ContractId => RadrootsEventContractRegistryV7TagValueType::ContractId,
- RadrootsTagValueType::DTag => RadrootsEventContractRegistryV7TagValueType::DTag,
- RadrootsTagValueType::EventId => RadrootsEventContractRegistryV7TagValueType::EventId,
- RadrootsTagValueType::EventPointer => {
- RadrootsEventContractRegistryV7TagValueType::EventPointer
- }
- RadrootsTagValueType::Geohash => RadrootsEventContractRegistryV7TagValueType::Geohash,
- RadrootsTagValueType::IanaTimeZoneId => {
- RadrootsEventContractRegistryV7TagValueType::IanaTimeZoneId
- }
- RadrootsTagValueType::Kind => RadrootsEventContractRegistryV7TagValueType::Kind,
- RadrootsTagValueType::Nip01Coordinate => {
+ TagValueType::CalendarUid => RadrootsEventContractRegistryV7TagValueType::CalendarUid,
+ TagValueType::ContractId => RadrootsEventContractRegistryV7TagValueType::ContractId,
+ TagValueType::DTag => RadrootsEventContractRegistryV7TagValueType::DTag,
+ TagValueType::EventId => RadrootsEventContractRegistryV7TagValueType::EventId,
+ TagValueType::EventPointer => RadrootsEventContractRegistryV7TagValueType::EventPointer,
+ TagValueType::Geohash => RadrootsEventContractRegistryV7TagValueType::Geohash,
+ TagValueType::IanaTimeZoneId => RadrootsEventContractRegistryV7TagValueType::IanaTimeZoneId,
+ TagValueType::Kind => RadrootsEventContractRegistryV7TagValueType::Kind,
+ TagValueType::Nip01Coordinate => {
RadrootsEventContractRegistryV7TagValueType::Nip01Coordinate
}
- RadrootsTagValueType::PublicKey => RadrootsEventContractRegistryV7TagValueType::PublicKey,
- RadrootsTagValueType::RelayUrl => RadrootsEventContractRegistryV7TagValueType::RelayUrl,
- RadrootsTagValueType::Sha256 => RadrootsEventContractRegistryV7TagValueType::Sha256,
- RadrootsTagValueType::Text => RadrootsEventContractRegistryV7TagValueType::Text,
- RadrootsTagValueType::UnixTimestamp => {
- RadrootsEventContractRegistryV7TagValueType::UnixTimestamp
- }
- RadrootsTagValueType::Uri => RadrootsEventContractRegistryV7TagValueType::Uri,
- RadrootsTagValueType::Url => RadrootsEventContractRegistryV7TagValueType::Url,
- RadrootsTagValueType::UtcDayIndex => {
- RadrootsEventContractRegistryV7TagValueType::UtcDayIndex
- }
- RadrootsTagValueType::Uuid => RadrootsEventContractRegistryV7TagValueType::Uuid,
+ TagValueType::PublicKey => RadrootsEventContractRegistryV7TagValueType::PublicKey,
+ TagValueType::RelayUrl => RadrootsEventContractRegistryV7TagValueType::RelayUrl,
+ TagValueType::Sha256 => RadrootsEventContractRegistryV7TagValueType::Sha256,
+ TagValueType::Text => RadrootsEventContractRegistryV7TagValueType::Text,
+ TagValueType::UnixTimestamp => RadrootsEventContractRegistryV7TagValueType::UnixTimestamp,
+ TagValueType::Uri => RadrootsEventContractRegistryV7TagValueType::Uri,
+ TagValueType::Url => RadrootsEventContractRegistryV7TagValueType::Url,
+ TagValueType::UtcDayIndex => RadrootsEventContractRegistryV7TagValueType::UtcDayIndex,
+ TagValueType::Uuid => RadrootsEventContractRegistryV7TagValueType::Uuid,
}
}
-fn reducer_inventory(value: RadrootsReducer) -> RadrootsEventContractRegistryV7Reducer {
+fn reducer_inventory(value: Reducer) -> RadrootsEventContractRegistryV7Reducer {
match value {
- RadrootsReducer::CalendarProjection => {
- RadrootsEventContractRegistryV7Reducer::CalendarProjection
- }
- RadrootsReducer::FarmOpsProjection => {
- RadrootsEventContractRegistryV7Reducer::FarmOpsProjection
- }
- RadrootsReducer::GroupProjection => RadrootsEventContractRegistryV7Reducer::GroupProjection,
- RadrootsReducer::KnowledgeProjection => {
- RadrootsEventContractRegistryV7Reducer::KnowledgeProjection
- }
- RadrootsReducer::OperationalListingInventoryAccounting => {
+ Reducer::CalendarProjection => RadrootsEventContractRegistryV7Reducer::CalendarProjection,
+ Reducer::FarmOpsProjection => RadrootsEventContractRegistryV7Reducer::FarmOpsProjection,
+ Reducer::GroupProjection => RadrootsEventContractRegistryV7Reducer::GroupProjection,
+ Reducer::KnowledgeProjection => RadrootsEventContractRegistryV7Reducer::KnowledgeProjection,
+ Reducer::OperationalListingInventoryAccounting => {
RadrootsEventContractRegistryV7Reducer::OperationalListingInventoryAccounting
}
- RadrootsReducer::OperationalListingProjection => {
+ Reducer::OperationalListingProjection => {
RadrootsEventContractRegistryV7Reducer::OperationalListingProjection
}
- RadrootsReducer::MarketProjection => {
- RadrootsEventContractRegistryV7Reducer::MarketProjection
- }
- RadrootsReducer::OrderProjection => RadrootsEventContractRegistryV7Reducer::OrderProjection,
- RadrootsReducer::ProfileProjection => {
- RadrootsEventContractRegistryV7Reducer::ProfileProjection
- }
- RadrootsReducer::NostrRelayPolicyProjection => {
+ Reducer::MarketProjection => RadrootsEventContractRegistryV7Reducer::MarketProjection,
+ Reducer::OrderProjection => RadrootsEventContractRegistryV7Reducer::OrderProjection,
+ Reducer::ProfileProjection => RadrootsEventContractRegistryV7Reducer::ProfileProjection,
+ Reducer::NostrRelayPolicyProjection => {
RadrootsEventContractRegistryV7Reducer::NostrRelayPolicyProjection
}
- RadrootsReducer::SocialProjection => {
- RadrootsEventContractRegistryV7Reducer::SocialProjection
- }
- RadrootsReducer::TradeProjection => RadrootsEventContractRegistryV7Reducer::TradeProjection,
- RadrootsReducer::TradeValidation => RadrootsEventContractRegistryV7Reducer::TradeValidation,
+ Reducer::SocialProjection => RadrootsEventContractRegistryV7Reducer::SocialProjection,
+ Reducer::TradeProjection => RadrootsEventContractRegistryV7Reducer::TradeProjection,
+ Reducer::TradeValidation => RadrootsEventContractRegistryV7Reducer::TradeValidation,
}
}
diff --git a/crates/event_codec/src/message/decode.rs b/crates/event_codec/src/message/decode.rs
@@ -4,7 +4,7 @@ use alloc::{
vec::Vec,
};
-use radroots_event::{envelope::kind::KIND_MESSAGE, social::message::RadrootsMessage};
+use radroots_event::{envelope::kind::KIND_MESSAGE, social::message::Message};
use crate::error::EventParseError;
use crate::message::tags::{parse_recipients, parse_reply_tag, parse_subject_tag};
@@ -16,7 +16,7 @@ pub fn message_from_tags(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsMessage, EventParseError> {
+) -> Result<Message, EventParseError> {
if kind != DEFAULT_KIND {
return Err(EventParseError::InvalidKind {
expected: "14",
@@ -33,7 +33,7 @@ pub fn message_from_tags(
let subject = parse_subject_tag(tags)?;
- Ok(RadrootsMessage {
+ Ok(Message {
recipients,
content: content.to_string(),
reply_to,
@@ -48,7 +48,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsMessage>, EventParseError> {
+) -> Result<RadrootsParsedData<Message>, EventParseError> {
let message = message_from_tags(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -67,7 +67,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsMessage>, EventParseError> {
+) -> Result<RadrootsParsedEvent<Message>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
diff --git a/crates/event_codec/src/message/encode.rs b/crates/event_codec/src/message/encode.rs
@@ -2,15 +2,15 @@
use alloc::{string::String, vec::Vec};
use radroots_event::envelope::kind::KIND_MESSAGE;
-use radroots_event::social::message::RadrootsMessage;
+use radroots_event::social::message::Message;
use crate::error::EventEncodeError;
use crate::message::tags::{build_recipient_tags, build_reply_tag, build_subject_tag};
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
const DEFAULT_KIND: u32 = KIND_MESSAGE;
-pub fn message_build_tags(message: &RadrootsMessage) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn message_build_tags(message: &Message) -> Result<Vec<Vec<String>>, EventEncodeError> {
let mut tags = build_recipient_tags(&message.recipients)?;
if let Some(tag) = build_reply_tag(&message.reply_to)? {
tags.push(tag);
@@ -21,14 +21,12 @@ pub fn message_build_tags(message: &RadrootsMessage) -> Result<Vec<Vec<String>>,
Ok(tags)
}
-pub fn to_wire_parts(
- message: &RadrootsMessage,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+pub fn to_wire_parts(message: &Message) -> Result<Nip01EventWireParts, EventEncodeError> {
if message.content.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("content"));
}
let tags = message_build_tags(message)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind: DEFAULT_KIND,
content: message.content.clone(),
tags,
diff --git a/crates/event_codec/src/message/tags.rs b/crates/event_codec/src/message/tags.rs
@@ -6,11 +6,11 @@ use alloc::{
vec::Vec,
};
-use radroots_event::{social::message::RadrootsMessageRecipient, tag::RadrootsEventPtr};
+use radroots_event::{social::message::MessageRecipient, tag::EventPtr};
use crate::error::{EventEncodeError, EventParseError};
-fn validate_recipient(recipient: &RadrootsMessageRecipient) -> Result<(), EventEncodeError> {
+fn validate_recipient(recipient: &MessageRecipient) -> Result<(), EventEncodeError> {
if recipient.public_key.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField(
"recipients.public_key",
@@ -25,7 +25,7 @@ fn validate_recipient(recipient: &RadrootsMessageRecipient) -> Result<(), EventE
}
pub(crate) fn build_recipient_tags(
- recipients: &[RadrootsMessageRecipient],
+ recipients: &[MessageRecipient],
) -> Result<Vec<Vec<String>>, EventEncodeError> {
if recipients.is_empty() {
return Err(EventEncodeError::EmptyRequiredField("recipients"));
@@ -46,7 +46,7 @@ pub(crate) fn build_recipient_tags(
}
pub(crate) fn build_reply_tag(
- reply_to: &Option<RadrootsEventPtr>,
+ reply_to: &Option<EventPtr>,
) -> Result<Option<Vec<String>>, EventEncodeError> {
let reply_to = match reply_to {
Some(reply_to) => reply_to,
@@ -80,7 +80,7 @@ pub(crate) fn build_subject_tag(
Ok(Some(vec!["subject".to_string(), subject.clone()]))
}
-fn parse_recipient_tag(tag: &[String]) -> Result<RadrootsMessageRecipient, EventParseError> {
+fn parse_recipient_tag(tag: &[String]) -> Result<MessageRecipient, EventParseError> {
let public_key = tag.get(1).ok_or(EventParseError::InvalidTag("p"))?;
if public_key.trim().is_empty() {
return Err(EventParseError::InvalidTag("p"));
@@ -90,7 +90,7 @@ fn parse_recipient_tag(tag: &[String]) -> Result<RadrootsMessageRecipient, Event
Some(value) => Some(value.clone()),
None => None,
};
- Ok(RadrootsMessageRecipient {
+ Ok(MessageRecipient {
public_key: public_key.clone(),
relay_url,
})
@@ -98,7 +98,7 @@ fn parse_recipient_tag(tag: &[String]) -> Result<RadrootsMessageRecipient, Event
pub(crate) fn parse_recipients(
tags: &[Vec<String>],
-) -> Result<Vec<RadrootsMessageRecipient>, EventParseError> {
+) -> Result<Vec<MessageRecipient>, EventParseError> {
let mut recipients = Vec::new();
for tag in tags
.iter()
@@ -112,9 +112,7 @@ pub(crate) fn parse_recipients(
Ok(recipients)
}
-pub(crate) fn parse_reply_tag(
- tags: &[Vec<String>],
-) -> Result<Option<RadrootsEventPtr>, EventParseError> {
+pub(crate) fn parse_reply_tag(tags: &[Vec<String>]) -> Result<Option<EventPtr>, EventParseError> {
let tag = match tags
.iter()
.find(|t| t.first().map(|s| s.as_str()) == Some("e"))
@@ -131,7 +129,7 @@ pub(crate) fn parse_reply_tag(
Some(value) => Some(value.clone()),
None => None,
};
- Ok(Some(RadrootsEventPtr {
+ Ok(Some(EventPtr {
id: id.clone(),
relays: relay,
}))
@@ -156,7 +154,7 @@ pub(crate) fn parse_subject_tag(tags: &[Vec<String>]) -> Result<Option<String>,
mod tests {
use super::*;
use crate::test_fixtures::RELAY_PRIMARY_WSS;
- use radroots_event::{social::message::RadrootsMessageRecipient, tag::RadrootsEventPtr};
+ use radroots_event::{social::message::MessageRecipient, tag::EventPtr};
#[test]
fn parse_recipients_rejects_missing_p_tags() {
@@ -185,7 +183,7 @@ mod tests {
parse_reply_tag(&[vec!["e".to_string(), " ".to_string()]]).expect_err("empty reply id");
assert!(matches!(err, EventParseError::InvalidTag("e")));
- let err = build_reply_tag(&Some(RadrootsEventPtr {
+ let err = build_reply_tag(&Some(EventPtr {
id: " ".to_string(),
relays: None,
}))
@@ -198,7 +196,7 @@ mod tests {
#[test]
fn build_and_parse_reply_tags_cover_optional_relay_paths() {
- let tag = build_reply_tag(&Some(RadrootsEventPtr {
+ let tag = build_reply_tag(&Some(EventPtr {
id: "reply".to_string(),
relays: Some(RELAY_PRIMARY_WSS.to_string()),
}))
@@ -211,7 +209,7 @@ mod tests {
Some(RELAY_PRIMARY_WSS.to_string())
);
- let tag = build_reply_tag(&Some(RadrootsEventPtr {
+ let tag = build_reply_tag(&Some(EventPtr {
id: "reply".to_string(),
relays: None,
}))
@@ -226,7 +224,7 @@ mod tests {
.expect("parse reply tag without relay");
assert_eq!(
parsed,
- Some(RadrootsEventPtr {
+ Some(EventPtr {
id: "reply".to_string(),
relays: None,
})
@@ -235,7 +233,7 @@ mod tests {
#[test]
fn recipient_and_subject_tag_builders_cover_error_paths() {
- let tags = build_recipient_tags(&[RadrootsMessageRecipient {
+ let tags = build_recipient_tags(&[MessageRecipient {
public_key: "recipient-without-relay".to_string(),
relay_url: None,
}])
@@ -243,7 +241,7 @@ mod tests {
assert_eq!(tags.len(), 1);
assert_eq!(tags[0].len(), 2);
- let tags = build_recipient_tags(&[RadrootsMessageRecipient {
+ let tags = build_recipient_tags(&[MessageRecipient {
public_key: "recipient".to_string(),
relay_url: Some(RELAY_PRIMARY_WSS.to_string()),
}])
@@ -257,7 +255,7 @@ mod tests {
EventEncodeError::EmptyRequiredField("recipients")
));
- let err = build_recipient_tags(&[RadrootsMessageRecipient {
+ let err = build_recipient_tags(&[MessageRecipient {
public_key: " ".to_string(),
relay_url: None,
}])
@@ -267,7 +265,7 @@ mod tests {
EventEncodeError::EmptyRequiredField("recipients.public_key")
));
- let err = build_recipient_tags(&[RadrootsMessageRecipient {
+ let err = build_recipient_tags(&[MessageRecipient {
public_key: "recipient".to_string(),
relay_url: Some(" ".to_string()),
}])
@@ -315,7 +313,7 @@ mod tests {
.expect_err("invalid recipient relay");
assert!(matches!(err, EventParseError::InvalidTag("p")));
- let err = build_reply_tag(&Some(RadrootsEventPtr {
+ let err = build_reply_tag(&Some(EventPtr {
id: "reply".to_string(),
relays: Some(" ".to_string()),
}))
diff --git a/crates/event_codec/src/message_file/decode.rs b/crates/event_codec/src/message_file/decode.rs
@@ -6,7 +6,7 @@ use alloc::{
use radroots_event::{
envelope::kind::KIND_MESSAGE_FILE,
- social::message_file::{RadrootsMessageFile, RadrootsMessageFileDimensions},
+ social::message_file::{MessageFile, MessageFileDimensions},
};
use crate::error::EventParseError;
@@ -42,7 +42,7 @@ fn optional_tag_value(
}
}
-fn parse_dimensions(value: &str) -> Result<RadrootsMessageFileDimensions, EventParseError> {
+fn parse_dimensions(value: &str) -> Result<MessageFileDimensions, EventParseError> {
let (w, h) = value
.split_once('x')
.ok_or(EventParseError::InvalidTag("dim"))?;
@@ -52,7 +52,7 @@ fn parse_dimensions(value: &str) -> Result<RadrootsMessageFileDimensions, EventP
let h = h
.parse::<u32>()
.map_err(|_| EventParseError::InvalidTag("dim"))?;
- Ok(RadrootsMessageFileDimensions { w, h })
+ Ok(MessageFileDimensions { w, h })
}
fn parse_size(tags: &[Vec<String>]) -> Result<Option<u64>, EventParseError> {
@@ -74,7 +74,7 @@ fn parse_size(tags: &[Vec<String>]) -> Result<Option<u64>, EventParseError> {
fn parse_dimensions_tag(
tags: &[Vec<String>],
-) -> Result<Option<RadrootsMessageFileDimensions>, EventParseError> {
+) -> Result<Option<MessageFileDimensions>, EventParseError> {
let value = tags
.iter()
.find(|t| t.first().map(|s| s.as_str()) == Some("dim"))
@@ -107,7 +107,7 @@ pub fn message_file_from_tags(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsMessageFile, EventParseError> {
+) -> Result<MessageFile, EventParseError> {
if kind != DEFAULT_KIND {
return Err(EventParseError::InvalidKind {
expected: "15",
@@ -133,7 +133,7 @@ pub fn message_file_from_tags(
let thumb = optional_tag_value(tags, "thumb")?;
let fallbacks = parse_fallbacks(tags)?;
- Ok(RadrootsMessageFile {
+ Ok(MessageFile {
recipients,
file_url: content.to_string(),
reply_to,
@@ -159,7 +159,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsMessageFile>, EventParseError> {
+) -> Result<RadrootsParsedData<MessageFile>, EventParseError> {
let message_file = message_file_from_tags(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -178,7 +178,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsMessageFile>, EventParseError> {
+) -> Result<RadrootsParsedEvent<MessageFile>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
diff --git a/crates/event_codec/src/message_file/encode.rs b/crates/event_codec/src/message_file/encode.rs
@@ -8,11 +8,11 @@ use alloc::{
};
use radroots_event::envelope::kind::KIND_MESSAGE_FILE;
-use radroots_event::social::message_file::{RadrootsMessageFile, RadrootsMessageFileDimensions};
+use radroots_event::social::message_file::{MessageFile, MessageFileDimensions};
use crate::error::EventEncodeError;
use crate::message::tags::{build_recipient_tags, build_reply_tag, build_subject_tag};
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
const DEFAULT_KIND: u32 = KIND_MESSAGE_FILE;
@@ -40,10 +40,7 @@ fn push_optional_tag(tags: &mut Vec<Vec<String>>, key: &'static str, value: &Opt
}
}
-fn push_dimensions_tag(
- tags: &mut Vec<Vec<String>>,
- dimensions: &Option<RadrootsMessageFileDimensions>,
-) {
+fn push_dimensions_tag(tags: &mut Vec<Vec<String>>, dimensions: &Option<MessageFileDimensions>) {
if let Some(dimensions) = dimensions {
tags.push(vec![
"dim".to_string(),
@@ -53,7 +50,7 @@ fn push_dimensions_tag(
}
pub fn message_file_build_tags(
- message: &RadrootsMessageFile,
+ message: &MessageFile,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
let mut tags = build_recipient_tags(&message.recipients)?;
if let Some(tag) = build_reply_tag(&message.reply_to)? {
@@ -99,12 +96,10 @@ pub fn message_file_build_tags(
Ok(tags)
}
-pub fn to_wire_parts(
- message: &RadrootsMessageFile,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+pub fn to_wire_parts(message: &MessageFile) -> Result<Nip01EventWireParts, EventEncodeError> {
validate_required(&message.file_url, "file_url")?;
let tags = message_file_build_tags(message)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind: DEFAULT_KIND,
content: message.file_url.clone(),
tags,
@@ -112,9 +107,9 @@ pub fn to_wire_parts(
}
pub fn to_wire_parts_with_kind(
- message: &RadrootsMessageFile,
+ message: &MessageFile,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != DEFAULT_KIND {
return Err(EventEncodeError::InvalidKind(kind));
}
diff --git a/crates/event_codec/src/operational_listing/decode.rs b/crates/event_codec/src/operational_listing/decode.rs
@@ -7,20 +7,18 @@ use alloc::{
use radroots_core::pricing::Discount;
use radroots_core::{Currency, Decimal, Money, Quantity, QuantityPrice, Unit};
use radroots_event::{
- envelope::RadrootsEventEnvelope,
+ envelope::EventEnvelope,
envelope::kind::{KIND_FARM, KIND_PLOT, KIND_RESOURCE_AREA, is_classified_listing_kind},
- farm::RadrootsFarmRef,
+ farm::FarmRef,
farm::location::is_public_geohash5,
- farm::plot::RadrootsPlotRef,
- farm::resource_area::RadrootsResourceAreaRef,
- id::{RadrootsDTag, RadrootsInventoryBinId},
- listing::operational::RadrootsOperationalListingParseError,
+ farm::plot::PlotRef,
+ farm::resource_area::ResourceAreaRef,
+ id::{DTag, InventoryBinId},
+ listing::operational::OperationalListingParseError,
listing::operational::{
- RadrootsOperationalListing, RadrootsOperationalListingAvailability,
- RadrootsOperationalListingBin, RadrootsOperationalListingDeliveryMethod,
- RadrootsOperationalListingImage, RadrootsOperationalListingImageSize,
- RadrootsOperationalListingProduct, RadrootsOperationalListingPublicLocation,
- RadrootsOperationalListingStatus,
+ OperationalListing, OperationalListingAvailability, OperationalListingBin,
+ OperationalListingDeliveryMethod, OperationalListingImage, OperationalListingImageSize,
+ OperationalListingProduct, OperationalListingPublicLocation, OperationalListingStatus,
},
tag::name::{TAG_D, TAG_PUBLISHED_AT},
};
@@ -66,25 +64,21 @@ enum OperationalListingDecodeError {
}
impl OperationalListingDecodeError {
- fn into_listing_parse_error(self) -> RadrootsOperationalListingParseError {
+ fn into_listing_parse_error(self) -> OperationalListingParseError {
match self {
- Self::MissingTag(field) => {
- RadrootsOperationalListingParseError::MissingTag(field.to_string())
- }
- Self::InvalidTag(field) => {
- RadrootsOperationalListingParseError::InvalidTag(field.to_string())
- }
+ Self::MissingTag(field) => OperationalListingParseError::MissingTag(field.to_string()),
+ Self::InvalidTag(field) => OperationalListingParseError::InvalidTag(field.to_string()),
Self::InvalidNumber(field) => {
- RadrootsOperationalListingParseError::InvalidNumber(field.to_string())
+ OperationalListingParseError::InvalidNumber(field.to_string())
}
- Self::InvalidUnit(_) => RadrootsOperationalListingParseError::InvalidUnit,
- Self::InvalidCurrency(_) => RadrootsOperationalListingParseError::InvalidCurrency,
+ Self::InvalidUnit(_) => OperationalListingParseError::InvalidUnit,
+ Self::InvalidCurrency(_) => OperationalListingParseError::InvalidCurrency,
Self::InvalidJson(field) => {
- RadrootsOperationalListingParseError::InvalidJson(field.to_string())
+ OperationalListingParseError::InvalidJson(field.to_string())
}
#[cfg(feature = "serde_json")]
Self::InvalidDiscount(field) => {
- RadrootsOperationalListingParseError::InvalidDiscount(field.to_string())
+ OperationalListingParseError::InvalidDiscount(field.to_string())
}
}
}
@@ -197,7 +191,7 @@ fn parse_d_tag(tags: &[Vec<String>]) -> Result<String, OperationalListingDecodeE
Ok(value)
}
-fn parse_farm_ref(tags: &[Vec<String>]) -> Result<RadrootsFarmRef, OperationalListingDecodeError> {
+fn parse_farm_ref(tags: &[Vec<String>]) -> Result<FarmRef, OperationalListingDecodeError> {
for tag in tags
.iter()
.filter(|tag| tag.first().map(|value| value.as_str()) == Some(TAG_A))
@@ -227,7 +221,7 @@ fn parse_farm_ref(tags: &[Vec<String>]) -> Result<RadrootsFarmRef, OperationalLi
}
validate_d_tag_tag(&d_tag, TAG_A)
.map_err(|_| OperationalListingDecodeError::InvalidTag(TAG_A))?;
- return Ok(RadrootsFarmRef { pubkey, d_tag });
+ return Ok(FarmRef { pubkey, d_tag });
}
Err(OperationalListingDecodeError::MissingTag(TAG_A))
}
@@ -249,7 +243,7 @@ fn parse_farm_pubkey(tags: &[Vec<String>]) -> Result<String, OperationalListingD
fn parse_resource_area(
tags: &[Vec<String>],
-) -> Result<Option<RadrootsResourceAreaRef>, OperationalListingDecodeError> {
+) -> Result<Option<ResourceAreaRef>, OperationalListingDecodeError> {
let tag = tags
.iter()
.find(|tag| tag.first().map(|value| value.as_str()) == Some(TAG_RADROOTS_RESOURCE_AREA));
@@ -287,12 +281,10 @@ fn parse_resource_area(
}
validate_d_tag_tag(&d_tag, TAG_RADROOTS_RESOURCE_AREA)
.map_err(|_| OperationalListingDecodeError::InvalidTag(TAG_RADROOTS_RESOURCE_AREA))?;
- Ok(Some(RadrootsResourceAreaRef { pubkey, d_tag }))
+ Ok(Some(ResourceAreaRef { pubkey, d_tag }))
}
-fn parse_plot_ref(
- tags: &[Vec<String>],
-) -> Result<Option<RadrootsPlotRef>, OperationalListingDecodeError> {
+fn parse_plot_ref(tags: &[Vec<String>]) -> Result<Option<PlotRef>, OperationalListingDecodeError> {
let tag = tags
.iter()
.find(|tag| tag.first().map(|value| value.as_str()) == Some(TAG_RADROOTS_PLOT));
@@ -324,14 +316,14 @@ fn parse_plot_ref(
}
validate_d_tag_tag(&d_tag, TAG_RADROOTS_PLOT)
.map_err(|_| OperationalListingDecodeError::InvalidTag(TAG_RADROOTS_PLOT))?;
- Ok(Some(RadrootsPlotRef { pubkey, d_tag }))
+ Ok(Some(PlotRef { pubkey, d_tag }))
}
pub fn operational_listing_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsOperationalListing, EventParseError> {
+) -> Result<OperationalListing, EventParseError> {
if !is_classified_listing_kind(kind) {
return Err(EventParseError::InvalidKind {
expected: EXPECTED_CLASSIFIED_LISTING_KINDS,
@@ -345,18 +337,16 @@ pub fn operational_listing_from_event(
pub fn operational_listing_from_event_parts(
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsOperationalListing, RadrootsOperationalListingParseError> {
+) -> Result<OperationalListing, OperationalListingParseError> {
decode_operational_listing_from_event_parts(tags, content)
.map_err(OperationalListingDecodeError::into_listing_parse_error)
}
pub fn operational_listing_from_nostr_event(
- event: &RadrootsEventEnvelope,
-) -> Result<RadrootsOperationalListing, RadrootsOperationalListingParseError> {
+ event: &EventEnvelope,
+) -> Result<OperationalListing, OperationalListingParseError> {
if !is_classified_listing_kind(event.kind_u32()) {
- return Err(RadrootsOperationalListingParseError::InvalidKind(
- event.kind_u32(),
- ));
+ return Err(OperationalListingParseError::InvalidKind(event.kind_u32()));
}
operational_listing_from_event_parts(&event.tags_as_vec(), event.content())
}
@@ -364,7 +354,7 @@ pub fn operational_listing_from_nostr_event(
fn decode_operational_listing_from_event_parts(
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsOperationalListing, OperationalListingDecodeError> {
+) -> Result<OperationalListing, OperationalListingDecodeError> {
reject_private_listing_location_content(content)?;
let d_tag = parse_d_tag(tags)?;
let farm_ref = parse_farm_ref(tags)?;
@@ -372,7 +362,7 @@ fn decode_operational_listing_from_event_parts(
let resource_area = parse_resource_area(tags)?;
let plot = parse_plot_ref(tags)?;
- let mut product = RadrootsOperationalListingProduct {
+ let mut product = OperationalListingProduct {
key: String::new(),
title: String::new(),
category: String::new(),
@@ -389,11 +379,11 @@ fn decode_operational_listing_from_event_parts(
let mut discounts: Vec<Discount> = Vec::new();
let mut location: Option<OperationalListingLocationDraft> = None;
let mut inventory_available: Option<Decimal> = None;
- let mut availability_status: Option<RadrootsOperationalListingStatus> = None;
+ let mut availability_status: Option<OperationalListingStatus> = None;
let mut availability_start: Option<u64> = None;
let mut availability_end: Option<u64> = None;
- let mut delivery_method: Option<RadrootsOperationalListingDeliveryMethod> = None;
- let mut images: Vec<RadrootsOperationalListingImage> = Vec::new();
+ let mut delivery_method: Option<OperationalListingDeliveryMethod> = None;
+ let mut images: Vec<OperationalListingImage> = Vec::new();
let mut geohash: Option<String> = None;
let mut published_at: Option<u64> = None;
@@ -597,16 +587,16 @@ fn decode_operational_listing_from_event_parts(
.and_then(|value| clean_value(value))
.unwrap_or_default();
delivery_method = Some(match method.as_str() {
- "pickup" => RadrootsOperationalListingDeliveryMethod::Pickup,
- "local_delivery" => RadrootsOperationalListingDeliveryMethod::LocalDelivery,
- "shipping" => RadrootsOperationalListingDeliveryMethod::Shipping,
- "other" => RadrootsOperationalListingDeliveryMethod::Other {
+ "pickup" => OperationalListingDeliveryMethod::Pickup,
+ "local_delivery" => OperationalListingDeliveryMethod::LocalDelivery,
+ "shipping" => OperationalListingDeliveryMethod::Shipping,
+ "other" => OperationalListingDeliveryMethod::Other {
method: tag
.get(2)
.and_then(|value| clean_value(value))
.unwrap_or_default(),
},
- other => RadrootsOperationalListingDeliveryMethod::Other {
+ other => OperationalListingDeliveryMethod::Other {
method: other.to_string(),
},
});
@@ -618,7 +608,7 @@ fn decode_operational_listing_from_event_parts(
if url.trim().is_empty() {
continue;
}
- images.push(RadrootsOperationalListingImage {
+ images.push(OperationalListingImage {
url: url.to_string(),
size: tag.get(2).and_then(|value| parse_image_size(value)),
});
@@ -628,18 +618,18 @@ fn decode_operational_listing_from_event_parts(
}
let availability = match availability_status {
- Some(status) => Some(RadrootsOperationalListingAvailability::Status { status }),
+ Some(status) => Some(OperationalListingAvailability::Status { status }),
None => match (availability_start, availability_end) {
(None, None) => None,
- (start, end) => Some(RadrootsOperationalListingAvailability::Window { start, end }),
+ (start, end) => Some(OperationalListingAvailability::Window { start, end }),
},
};
let location = location
.map(|location| {
let geohash = geohash.ok_or(OperationalListingDecodeError::InvalidTag(TAG_GEOHASH))?;
- Ok::<RadrootsOperationalListingPublicLocation, OperationalListingDecodeError>(
- RadrootsOperationalListingPublicLocation {
+ Ok::<OperationalListingPublicLocation, OperationalListingDecodeError>(
+ OperationalListingPublicLocation {
primary: location.primary,
city: location.city,
region: location.region,
@@ -664,12 +654,12 @@ fn decode_operational_listing_from_event_parts(
));
}
- let d_tag = RadrootsDTag::parse(&d_tag)
- .map_err(|_| OperationalListingDecodeError::InvalidTag(TAG_D))?;
- let primary_bin_id = RadrootsInventoryBinId::parse(&primary_bin_id)
+ let d_tag =
+ DTag::parse(&d_tag).map_err(|_| OperationalListingDecodeError::InvalidTag(TAG_D))?;
+ let primary_bin_id = InventoryBinId::parse(&primary_bin_id)
.map_err(|_| OperationalListingDecodeError::InvalidTag(TAG_RADROOTS_PRIMARY_BIN))?;
- Ok(RadrootsOperationalListing {
+ Ok(OperationalListing {
d_tag,
published_at,
farm: farm_ref,
@@ -702,7 +692,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsOperationalListing>, EventParseError> {
+) -> Result<RadrootsParsedData<OperationalListing>, EventParseError> {
let listing = operational_listing_from_event(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -721,7 +711,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsOperationalListing>, EventParseError> {
+) -> Result<RadrootsParsedEvent<OperationalListing>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
@@ -743,8 +733,8 @@ pub fn parsed_from_event(
}
pub fn data_from_nostr_event(
- event: &RadrootsEventEnvelope,
-) -> Result<RadrootsParsedData<RadrootsOperationalListing>, EventParseError> {
+ event: &EventEnvelope,
+) -> Result<RadrootsParsedData<OperationalListing>, EventParseError> {
data_from_event(
event.id_hex(),
event.author().to_hex().to_string(),
@@ -756,8 +746,8 @@ pub fn data_from_nostr_event(
}
pub fn parsed_from_nostr_event(
- event: &RadrootsEventEnvelope,
-) -> Result<RadrootsParsedEvent<RadrootsOperationalListing>, EventParseError> {
+ event: &EventEnvelope,
+) -> Result<RadrootsParsedEvent<OperationalListing>, EventParseError> {
parsed_from_event(
event.id_hex(),
event.author().to_hex().to_string(),
@@ -794,21 +784,21 @@ fn set_optional(target: &mut Option<String>, value: Option<&String>) {
}
}
-fn parse_status(value: &str) -> RadrootsOperationalListingStatus {
+fn parse_status(value: &str) -> OperationalListingStatus {
match value.trim().to_ascii_lowercase().as_str() {
- "active" => RadrootsOperationalListingStatus::Active,
- "sold" => RadrootsOperationalListingStatus::Sold,
- other => RadrootsOperationalListingStatus::Other {
+ "active" => OperationalListingStatus::Active,
+ "sold" => OperationalListingStatus::Sold,
+ other => OperationalListingStatus::Other {
value: other.to_string(),
},
}
}
-fn parse_image_size(value: &str) -> Option<RadrootsOperationalListingImageSize> {
+fn parse_image_size(value: &str) -> Option<OperationalListingImageSize> {
let (w_raw, h_raw) = value.split_once('x')?;
let w = w_raw.parse::<u32>().ok()?;
let h = h_raw.parse::<u32>().ok()?;
- Some(RadrootsOperationalListingImageSize { w, h })
+ Some(OperationalListingImageSize { w, h })
}
fn parse_discount(payload: &str) -> Result<Discount, OperationalListingDecodeError> {
@@ -863,7 +853,7 @@ fn upsert_bin<'a>(
fn build_bins(
mut drafts: Vec<BinDraft>,
-) -> Result<Vec<RadrootsOperationalListingBin>, OperationalListingDecodeError> {
+) -> Result<Vec<OperationalListingBin>, OperationalListingDecodeError> {
drafts.sort_by_key(|draft| draft.order_index);
let mut bins = Vec::with_capacity(drafts.len());
for draft in drafts {
@@ -881,8 +871,8 @@ fn build_bins(
TAG_RADROOTS_PRICE,
));
}
- bins.push(RadrootsOperationalListingBin {
- bin_id: RadrootsInventoryBinId::parse(&draft.bin_id)
+ bins.push(OperationalListingBin {
+ bin_id: InventoryBinId::parse(&draft.bin_id)
.map_err(|_| OperationalListingDecodeError::InvalidTag(TAG_RADROOTS_BIN))?,
quantity,
price_per_canonical_unit: price,
diff --git a/crates/event_codec/src/operational_listing/encode.rs b/crates/event_codec/src/operational_listing/encode.rs
@@ -7,42 +7,42 @@ use alloc::{string::String, vec::Vec};
#[cfg(feature = "serde_json")]
use radroots_event::envelope::kind::{KIND_CLASSIFIED_LISTING, is_classified_listing_kind};
-use radroots_event::listing::operational::RadrootsOperationalListing;
+use radroots_event::listing::operational::OperationalListing;
use crate::error::EventEncodeError;
use crate::operational_listing::tags::operational_listing_tags;
#[cfg(feature = "serde_json")]
use crate::operational_listing::tags::operational_listing_tags_full;
#[cfg(feature = "serde_json")]
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
#[cfg(feature = "serde_json")]
const DEFAULT_KIND: u32 = KIND_CLASSIFIED_LISTING;
pub fn operational_listing_build_tags(
- listing: &RadrootsOperationalListing,
+ listing: &OperationalListing,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
operational_listing_tags(listing)
}
#[cfg(feature = "serde_json")]
pub fn to_wire_parts(
- listing: &RadrootsOperationalListing,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ listing: &OperationalListing,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
to_wire_parts_with_kind(listing, DEFAULT_KIND)
}
#[cfg(feature = "serde_json")]
pub fn to_wire_parts_with_kind(
- listing: &RadrootsOperationalListing,
+ listing: &OperationalListing,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if !is_classified_listing_kind(kind) {
return Err(EventEncodeError::InvalidKind(kind));
}
let tags = operational_listing_tags_full(listing)?;
let content = operational_listing_markdown_content(listing);
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content,
tags,
@@ -50,7 +50,7 @@ pub fn to_wire_parts_with_kind(
}
#[cfg(feature = "serde_json")]
-fn operational_listing_markdown_content(listing: &RadrootsOperationalListing) -> String {
+fn operational_listing_markdown_content(listing: &OperationalListing) -> String {
let title = listing.product.title.trim();
let summary = listing
.product
@@ -73,24 +73,24 @@ mod tests {
use core::str::FromStr;
use radroots_core::{Currency, Decimal, Money, Quantity, QuantityPrice, Unit};
use radroots_event::{
- farm::RadrootsFarmRef,
- id::{RadrootsDTag, RadrootsInventoryBinId},
- listing::operational::{RadrootsOperationalListingBin, RadrootsOperationalListingProduct},
+ farm::FarmRef,
+ id::{DTag, InventoryBinId},
+ listing::operational::{OperationalListingBin, OperationalListingProduct},
};
fn decimal(value: &str) -> Decimal {
Decimal::from_str(value).expect("decimal")
}
- fn listing_with(title: &str, summary: Option<&str>) -> RadrootsOperationalListing {
- RadrootsOperationalListing {
- d_tag: RadrootsDTag::parse("AAAAAAAAAAAAAAAAAAAAAA").expect("d tag"),
+ fn listing_with(title: &str, summary: Option<&str>) -> OperationalListing {
+ OperationalListing {
+ d_tag: DTag::parse("AAAAAAAAAAAAAAAAAAAAAA").expect("d tag"),
published_at: None,
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: "a".repeat(64),
d_tag: "AAAAAAAAAAAAAAAAAAAAAQ".to_string(),
},
- product: RadrootsOperationalListingProduct {
+ product: OperationalListingProduct {
key: "coffee".to_string(),
title: title.to_string(),
category: "produce".to_string(),
@@ -101,9 +101,9 @@ mod tests {
profile: None,
year: None,
},
- primary_bin_id: RadrootsInventoryBinId::parse("bin-1").expect("bin id"),
- bins: vec![RadrootsOperationalListingBin {
- bin_id: RadrootsInventoryBinId::parse("bin-1").expect("bin id"),
+ primary_bin_id: InventoryBinId::parse("bin-1").expect("bin id"),
+ bins: vec![OperationalListingBin {
+ bin_id: InventoryBinId::parse("bin-1").expect("bin id"),
quantity: Quantity::try_new(decimal("1"), Unit::MassG).unwrap(),
price_per_canonical_unit: QuantityPrice::try_new(
Money::try_new(decimal("1"), Currency::USD).unwrap(),
diff --git a/crates/event_codec/src/operational_listing/tags.rs b/crates/event_codec/src/operational_listing/tags.rs
@@ -12,15 +12,14 @@ use radroots_core::Money;
#[cfg(any(feature = "serde_json", test))]
use radroots_core::pricing::Discount;
use radroots_event::envelope::kind::{KIND_FARM, KIND_PLOT, KIND_RESOURCE_AREA};
-use radroots_event::farm::RadrootsFarmRef;
+use radroots_event::farm::FarmRef;
use radroots_event::farm::location::{has_textual_locality, is_public_geohash5};
-use radroots_event::farm::plot::RadrootsPlotRef;
-use radroots_event::farm::resource_area::RadrootsResourceAreaRef;
+use radroots_event::farm::plot::PlotRef;
+use radroots_event::farm::resource_area::ResourceAreaRef;
use radroots_event::listing::operational::{
- RadrootsOperationalListing, RadrootsOperationalListingAvailability,
- RadrootsOperationalListingBin, RadrootsOperationalListingDeliveryMethod,
- RadrootsOperationalListingImage, RadrootsOperationalListingPublicLocation,
- RadrootsOperationalListingStatus,
+ OperationalListing, OperationalListingAvailability, OperationalListingBin,
+ OperationalListingDeliveryMethod, OperationalListingImage, OperationalListingPublicLocation,
+ OperationalListingStatus,
};
use radroots_event::tag::name::{TAG_D, TAG_PUBLISHED_AT};
@@ -77,13 +76,13 @@ impl OperationalListingTagOptions {
}
pub fn operational_listing_tags(
- listing: &RadrootsOperationalListing,
+ listing: &OperationalListing,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
operational_listing_tags_with_options(listing, OperationalListingTagOptions::default())
}
pub fn operational_listing_tags_full(
- listing: &RadrootsOperationalListing,
+ listing: &OperationalListing,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
operational_listing_tags_with_options(
listing,
@@ -92,7 +91,7 @@ pub fn operational_listing_tags_full(
}
pub fn operational_listing_tags_with_options(
- listing: &RadrootsOperationalListing,
+ listing: &OperationalListing,
options: OperationalListingTagOptions,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
let d_tag = listing.d_tag.as_str();
@@ -142,7 +141,7 @@ pub fn operational_listing_tags_with_options(
listing.primary_bin_id.to_string(),
]);
- let mut bins: Vec<&RadrootsOperationalListingBin> = listing.bins.iter().collect();
+ let mut bins: Vec<&OperationalListingBin> = listing.bins.iter().collect();
if let Some(pos) = bins
.iter()
.position(|bin| bin.bin_id == listing.primary_bin_id)
@@ -184,13 +183,13 @@ pub fn operational_listing_tags_with_options(
&& let Some(availability) = &listing.availability
{
match availability {
- RadrootsOperationalListingAvailability::Status { status } => {
+ OperationalListingAvailability::Status { status } => {
tags.push(vec![
TAG_STATUS.to_string(),
status_as_str(status).to_string(),
]);
}
- RadrootsOperationalListingAvailability::Window { start, end } => {
+ OperationalListingAvailability::Window { start, end } => {
if let Some(start) = start {
tags.push(vec![
TAG_RADROOTS_AVAILABILITY_START.to_string(),
@@ -210,12 +209,10 @@ pub fn operational_listing_tags_with_options(
let mut tag = Vec::with_capacity(3);
tag.push(TAG_DELIVERY.to_string());
match method {
- RadrootsOperationalListingDeliveryMethod::Pickup => tag.push("pickup".into()),
- RadrootsOperationalListingDeliveryMethod::LocalDelivery => {
- tag.push("local_delivery".into())
- }
- RadrootsOperationalListingDeliveryMethod::Shipping => tag.push("shipping".into()),
- RadrootsOperationalListingDeliveryMethod::Other { method } => {
+ OperationalListingDeliveryMethod::Pickup => tag.push("pickup".into()),
+ OperationalListingDeliveryMethod::LocalDelivery => tag.push("local_delivery".into()),
+ OperationalListingDeliveryMethod::Shipping => tag.push("shipping".into()),
+ OperationalListingDeliveryMethod::Other { method } => {
tag.push("other".into());
tag.push(method.clone());
}
@@ -263,10 +260,7 @@ pub fn operational_listing_tags_with_options(
Ok(tags)
}
-fn push_farm_tags(
- tags: &mut Vec<Vec<String>>,
- farm: &RadrootsFarmRef,
-) -> Result<(), EventEncodeError> {
+fn push_farm_tags(tags: &mut Vec<Vec<String>>, farm: &FarmRef) -> Result<(), EventEncodeError> {
if farm.pubkey.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("farm.pubkey"));
}
@@ -285,9 +279,7 @@ fn push_farm_tags(
Ok(())
}
-fn tag_listing_resource_area(
- area: &RadrootsResourceAreaRef,
-) -> Result<Vec<String>, EventEncodeError> {
+fn tag_listing_resource_area(area: &ResourceAreaRef) -> Result<Vec<String>, EventEncodeError> {
if area.pubkey.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("resource_area.pubkey"));
}
@@ -304,7 +296,7 @@ fn tag_listing_resource_area(
Ok(vec![TAG_RADROOTS_RESOURCE_AREA.to_string(), address])
}
-fn tag_listing_plot(plot: &RadrootsPlotRef) -> Result<Vec<String>, EventEncodeError> {
+fn tag_listing_plot(plot: &PlotRef) -> Result<Vec<String>, EventEncodeError> {
if plot.pubkey.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("plot.pubkey"));
}
@@ -321,7 +313,7 @@ fn tag_listing_plot(plot: &RadrootsPlotRef) -> Result<Vec<String>, EventEncodeEr
Ok(vec![TAG_RADROOTS_PLOT.to_string(), address])
}
-fn tag_listing_bin(bin: &RadrootsOperationalListingBin) -> Result<Vec<String>, EventEncodeError> {
+fn tag_listing_bin(bin: &OperationalListingBin) -> Result<Vec<String>, EventEncodeError> {
let unit = bin.quantity.unit();
if unit != unit.canonical_unit() {
return Err(EventEncodeError::EmptyRequiredField("bin.quantity"));
@@ -351,7 +343,7 @@ fn tag_listing_bin(bin: &RadrootsOperationalListingBin) -> Result<Vec<String>, E
Ok(tag)
}
-fn tag_listing_price(bin: &RadrootsOperationalListingBin) -> Result<Vec<String>, EventEncodeError> {
+fn tag_listing_price(bin: &OperationalListingBin) -> Result<Vec<String>, EventEncodeError> {
let price = &bin.price_per_canonical_unit;
if !price.is_price_per_canonical_unit() {
return Err(EventEncodeError::EmptyRequiredField(
@@ -384,7 +376,7 @@ fn tag_listing_price(bin: &RadrootsOperationalListingBin) -> Result<Vec<String>,
Ok(tag)
}
-fn bin_total_price(bin: &RadrootsOperationalListingBin) -> Result<Money, EventEncodeError> {
+fn bin_total_price(bin: &OperationalListingBin) -> Result<Money, EventEncodeError> {
bin.price_per_canonical_unit
.try_cost_for_quantity_in(&bin.quantity)
.map_err(|_| EventEncodeError::EmptyRequiredField("bin.price_per_canonical_unit"))
@@ -398,7 +390,7 @@ fn tag_listing_price_generic(price: &Money) -> Vec<String> {
tag
}
-fn tag_listing_image(image: &RadrootsOperationalListingImage) -> Option<Vec<String>> {
+fn tag_listing_image(image: &OperationalListingImage) -> Option<Vec<String>> {
let url = clean_value(&image.url)?;
let mut tag = Vec::with_capacity(3);
tag.push(TAG_IMAGE.to_string());
@@ -411,7 +403,7 @@ fn tag_listing_image(image: &RadrootsOperationalListingImage) -> Option<Vec<Stri
fn push_location_geotag(
tags: &mut Vec<Vec<String>>,
- location: &RadrootsOperationalListingPublicLocation,
+ location: &OperationalListingPublicLocation,
) -> Result<(), EventEncodeError> {
let geohash = clean_value(&location.geohash)
.ok_or(EventEncodeError::EmptyRequiredField("location.geohash"))?;
@@ -444,11 +436,11 @@ fn discount_tag_payload(discount: &Discount) -> Result<String, EventEncodeError>
}
}
-fn status_as_str(status: &RadrootsOperationalListingStatus) -> &str {
+fn status_as_str(status: &OperationalListingStatus) -> &str {
match status {
- RadrootsOperationalListingStatus::Active => "active",
- RadrootsOperationalListingStatus::Sold => "sold",
- RadrootsOperationalListingStatus::Other { value } => value.as_str(),
+ OperationalListingStatus::Active => "active",
+ OperationalListingStatus::Sold => "sold",
+ OperationalListingStatus::Other { value } => value.as_str(),
}
}
@@ -462,10 +454,9 @@ mod tests {
};
use radroots_core::pricing::{DiscountScope, DiscountThreshold, DiscountValue};
use radroots_core::{Currency, Decimal, Quantity, QuantityPrice, Unit};
- use radroots_event::id::{RadrootsDTag, RadrootsInventoryBinId};
+ use radroots_event::id::{DTag, InventoryBinId};
use radroots_event::listing::operational::{
- RadrootsOperationalListingImageSize, RadrootsOperationalListingProduct,
- RadrootsOperationalListingStatus,
+ OperationalListingImageSize, OperationalListingProduct, OperationalListingStatus,
};
const TEST_NPUB: &str = FIXTURE_ALICE_NPUB;
@@ -493,16 +484,16 @@ mod tests {
QuantityPrice::try_new(amount, quantity).unwrap()
}
- fn d_tag(raw: &str) -> RadrootsDTag {
+ fn d_tag(raw: &str) -> DTag {
raw.parse().unwrap()
}
- fn bin_id(raw: &str) -> RadrootsInventoryBinId {
+ fn bin_id(raw: &str) -> InventoryBinId {
raw.parse().unwrap()
}
- fn base_product() -> RadrootsOperationalListingProduct {
- RadrootsOperationalListingProduct {
+ fn base_product() -> OperationalListingProduct {
+ OperationalListingProduct {
key: "coffee".to_string(),
title: "Coffee".to_string(),
category: "agri".to_string(),
@@ -515,8 +506,8 @@ mod tests {
}
}
- fn base_bin() -> RadrootsOperationalListingBin {
- RadrootsOperationalListingBin {
+ fn base_bin() -> OperationalListingBin {
+ OperationalListingBin {
bin_id: bin_id("bin-1"),
quantity: quantity(decimal("1000"), Unit::MassG).with_label("bag"),
price_per_canonical_unit: price(
@@ -531,33 +522,33 @@ mod tests {
}
}
- fn base_listing() -> RadrootsOperationalListing {
- RadrootsOperationalListing {
+ fn base_listing() -> OperationalListing {
+ OperationalListing {
d_tag: d_tag(TEST_D_TAG),
published_at: None,
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: TEST_FARM_D_TAG.to_string(),
},
product: base_product(),
primary_bin_id: bin_id("bin-1"),
bins: vec![base_bin()],
- resource_area: Some(RadrootsResourceAreaRef {
+ resource_area: Some(ResourceAreaRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
}),
- plot: Some(RadrootsPlotRef {
+ plot: Some(PlotRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAQ".to_string(),
}),
discounts: None,
inventory_available: Some(decimal("2")),
- availability: Some(RadrootsOperationalListingAvailability::Window {
+ availability: Some(OperationalListingAvailability::Window {
start: Some(10),
end: Some(20),
}),
- delivery_method: Some(RadrootsOperationalListingDeliveryMethod::Pickup),
- location: Some(RadrootsOperationalListingPublicLocation {
+ delivery_method: Some(OperationalListingDeliveryMethod::Pickup),
+ location: Some(OperationalListingPublicLocation {
primary: "Moyobamba".to_string(),
city: Some("Moyobamba".to_string()),
region: Some("San Martin".to_string()),
@@ -565,11 +556,11 @@ mod tests {
geohash: "9q8yy".to_string(),
}),
images: Some(vec![
- RadrootsOperationalListingImage {
+ OperationalListingImage {
url: cdn_url("a.jpg"),
- size: Some(RadrootsOperationalListingImageSize { w: 1200, h: 800 }),
+ size: Some(OperationalListingImageSize { w: 1200, h: 800 }),
},
- RadrootsOperationalListingImage {
+ OperationalListingImage {
url: " ".to_string(),
size: None,
},
@@ -614,7 +605,7 @@ mod tests {
#[test]
fn location_geotag_accepts_public_geohash5() {
let mut tags = Vec::new();
- let location = RadrootsOperationalListingPublicLocation {
+ let location = OperationalListingPublicLocation {
primary: "Test".to_string(),
city: Some("Town".to_string()),
region: None,
@@ -631,7 +622,7 @@ mod tests {
#[test]
fn location_geotag_rejects_blank_geohash() {
let mut tags = Vec::new();
- let location = RadrootsOperationalListingPublicLocation {
+ let location = OperationalListingPublicLocation {
primary: "Test".to_string(),
city: Some("Town".to_string()),
region: None,
@@ -649,7 +640,7 @@ mod tests {
#[test]
fn location_geotag_rejects_non_public_geohash() {
let mut tags = Vec::new();
- let location = RadrootsOperationalListingPublicLocation {
+ let location = OperationalListingPublicLocation {
primary: "Test".to_string(),
city: Some("Town".to_string()),
region: None,
@@ -666,15 +657,15 @@ mod tests {
#[test]
fn image_and_status_helpers_cover_variants() {
- let with_size = tag_listing_image(&RadrootsOperationalListingImage {
+ let with_size = tag_listing_image(&OperationalListingImage {
url: format!(" {CDN_PRIMARY_HTTPS}/a.jpg "),
- size: Some(RadrootsOperationalListingImageSize { w: 10, h: 20 }),
+ size: Some(OperationalListingImageSize { w: 10, h: 20 }),
})
.expect("image tag");
assert_eq!(with_size[0], "image");
assert_eq!(with_size[2], "10x20");
- let without_size = tag_listing_image(&RadrootsOperationalListingImage {
+ let without_size = tag_listing_image(&OperationalListingImage {
url: cdn_url("b.jpg"),
size: None,
})
@@ -682,23 +673,17 @@ mod tests {
assert_eq!(without_size.len(), 2);
assert!(
- tag_listing_image(&RadrootsOperationalListingImage {
+ tag_listing_image(&OperationalListingImage {
url: "null".to_string(),
size: None,
})
.is_none()
);
+ assert_eq!(status_as_str(&OperationalListingStatus::Active), "active");
+ assert_eq!(status_as_str(&OperationalListingStatus::Sold), "sold");
assert_eq!(
- status_as_str(&RadrootsOperationalListingStatus::Active),
- "active"
- );
- assert_eq!(
- status_as_str(&RadrootsOperationalListingStatus::Sold),
- "sold"
- );
- assert_eq!(
- status_as_str(&RadrootsOperationalListingStatus::Other {
+ status_as_str(&OperationalListingStatus::Other {
value: "paused".to_string()
}),
"paused"
@@ -732,7 +717,7 @@ mod tests {
let mut tags = Vec::new();
push_farm_tags(
&mut tags,
- &RadrootsFarmRef {
+ &FarmRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: TEST_FARM_D_TAG.to_string(),
},
@@ -743,7 +728,7 @@ mod tests {
let err = push_farm_tags(
&mut Vec::new(),
- &RadrootsFarmRef {
+ &FarmRef {
pubkey: "".to_string(),
d_tag: TEST_FARM_D_TAG.to_string(),
},
@@ -756,7 +741,7 @@ mod tests {
let err = push_farm_tags(
&mut Vec::new(),
- &RadrootsFarmRef {
+ &FarmRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "".to_string(),
},
@@ -769,7 +754,7 @@ mod tests {
let err = push_farm_tags(
&mut Vec::new(),
- &RadrootsFarmRef {
+ &FarmRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "farm:invalid".to_string(),
},
@@ -777,14 +762,14 @@ mod tests {
.expect_err("invalid farm d_tag");
assert!(matches!(err, EventEncodeError::InvalidField("farm.d_tag")));
- let area = tag_listing_resource_area(&RadrootsResourceAreaRef {
+ let area = tag_listing_resource_area(&ResourceAreaRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
})
.expect("resource area");
assert_eq!(area[0], "radroots:resource_area");
- let plot = tag_listing_plot(&RadrootsPlotRef {
+ let plot = tag_listing_plot(&PlotRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAQ".to_string(),
})
@@ -943,7 +928,7 @@ mod tests {
let mut listing = base_listing();
listing.discounts = None;
- listing.resource_area = Some(RadrootsResourceAreaRef {
+ listing.resource_area = Some(ResourceAreaRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "invalid".to_string(),
});
@@ -1013,8 +998,8 @@ mod tests {
let mut status_listing = base_listing();
status_listing.discounts = None;
- status_listing.availability = Some(RadrootsOperationalListingAvailability::Status {
- status: RadrootsOperationalListingStatus::Other {
+ status_listing.availability = Some(OperationalListingAvailability::Status {
+ status: OperationalListingStatus::Other {
value: "paused".to_string(),
},
});
@@ -1025,10 +1010,10 @@ mod tests {
}));
for method in [
- RadrootsOperationalListingDeliveryMethod::Pickup,
- RadrootsOperationalListingDeliveryMethod::LocalDelivery,
- RadrootsOperationalListingDeliveryMethod::Shipping,
- RadrootsOperationalListingDeliveryMethod::Other {
+ OperationalListingDeliveryMethod::Pickup,
+ OperationalListingDeliveryMethod::LocalDelivery,
+ OperationalListingDeliveryMethod::Shipping,
+ OperationalListingDeliveryMethod::Other {
method: "scheduled".to_string(),
},
] {
@@ -1057,11 +1042,10 @@ mod tests {
let mut empty_window_availability = base_listing();
empty_window_availability.discounts = None;
- empty_window_availability.availability =
- Some(RadrootsOperationalListingAvailability::Window {
- start: None,
- end: None,
- });
+ empty_window_availability.availability = Some(OperationalListingAvailability::Window {
+ start: None,
+ end: None,
+ });
let empty_window_tags = operational_listing_tags_with_options(
&empty_window_availability,
OperationalListingTagOptions {
@@ -1147,7 +1131,7 @@ mod tests {
));
listing = base_listing();
- listing.resource_area = Some(RadrootsResourceAreaRef {
+ listing.resource_area = Some(ResourceAreaRef {
pubkey: "".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
});
@@ -1158,7 +1142,7 @@ mod tests {
));
listing = base_listing();
- listing.resource_area = Some(RadrootsResourceAreaRef {
+ listing.resource_area = Some(ResourceAreaRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "".to_string(),
});
@@ -1169,7 +1153,7 @@ mod tests {
));
listing = base_listing();
- listing.plot = Some(RadrootsPlotRef {
+ listing.plot = Some(PlotRef {
pubkey: "".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAQ".to_string(),
});
@@ -1180,7 +1164,7 @@ mod tests {
));
listing = base_listing();
- listing.plot = Some(RadrootsPlotRef {
+ listing.plot = Some(PlotRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "".to_string(),
});
@@ -1191,7 +1175,7 @@ mod tests {
));
listing = base_listing();
- listing.plot = Some(RadrootsPlotRef {
+ listing.plot = Some(PlotRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "plot:invalid".to_string(),
});
@@ -1237,7 +1221,7 @@ mod tests {
listing.product.location = Some(" null ".to_string());
listing.product.profile = Some(" ".to_string());
listing.location = None;
- listing.images = Some(vec![RadrootsOperationalListingImage {
+ listing.images = Some(vec![OperationalListingImage {
url: "null".to_string(),
size: None,
}]);
@@ -1252,7 +1236,7 @@ mod tests {
let mut listing = base_listing();
listing.discounts = None;
listing.images = None;
- listing.location = Some(RadrootsOperationalListingPublicLocation {
+ listing.location = Some(OperationalListingPublicLocation {
primary: "Moyobamba".to_string(),
city: Some("Moyobamba".to_string()),
region: Some("San Martin".to_string()),
@@ -1315,7 +1299,7 @@ mod tests {
fn operational_listing_tags_location_handles_partial_optional_components() {
let mut listing = base_listing();
listing.discounts = None;
- listing.location = Some(RadrootsOperationalListingPublicLocation {
+ listing.location = Some(OperationalListingPublicLocation {
primary: "Moyobamba".to_string(),
city: Some(" ".to_string()),
region: Some("San Martin".to_string()),
@@ -1330,7 +1314,7 @@ mod tests {
assert_eq!(location.get(2).map(|v| v.as_str()), Some("San Martin"));
assert_eq!(location.len(), 3);
- listing.location = Some(RadrootsOperationalListingPublicLocation {
+ listing.location = Some(OperationalListingPublicLocation {
primary: "Moyobamba".to_string(),
city: Some("Moyobamba".to_string()),
region: Some(" ".to_string()),
diff --git a/crates/event_codec/src/order/decode.rs b/crates/event_codec/src/order/decode.rs
@@ -3,15 +3,14 @@ use alloc::{string::String, vec::Vec};
#[cfg(feature = "serde_json")]
use radroots_event::{
- envelope::RadrootsEventEnvelope,
+ envelope::EventEnvelope,
envelope::kind::is_order_event_kind,
- id::{RadrootsClassifiedListingAddress, RadrootsEventId, RadrootsIdParseError},
- tag::RadrootsEventPtr,
+ id::{ClassifiedListingAddress, EventId, ParseError},
+ tag::EventPtr,
tag::name::{TAG_D, TAG_E_PREV, TAG_E_ROOT},
trade::order::{
- RadrootsOrderCancellation, RadrootsOrderDecision, RadrootsOrderEnvelope,
- RadrootsOrderEnvelopeError, RadrootsOrderEventType, RadrootsOrderPayloadError,
- RadrootsOrderRequest,
+ OrderCancellation, OrderDecision, OrderEnvelope, OrderEnvelopeError, OrderEventType,
+ OrderPayloadError, OrderRequest,
},
};
#[cfg(feature = "serde_json")]
@@ -30,11 +29,11 @@ use crate::order::tags::{
pub enum RadrootsOrderEnvelopeParseError {
InvalidKind(u32),
InvalidJson,
- InvalidEnvelope(RadrootsOrderEnvelopeError),
- InvalidPayload(RadrootsOrderPayloadError),
+ InvalidEnvelope(OrderEnvelopeError),
+ InvalidPayload(OrderPayloadError),
MessageTypeKindMismatch {
event_kind: u32,
- message_type: RadrootsOrderEventType,
+ message_type: OrderEventType,
},
MissingTag(&'static str),
InvalidTag(&'static str),
@@ -43,7 +42,7 @@ pub enum RadrootsOrderEnvelopeParseError {
PayloadBindingMismatch(&'static str),
AuthorMismatch,
CounterpartyTagMismatch,
- InvalidListingAddr(RadrootsIdParseError),
+ InvalidListingAddr(ParseError),
}
#[cfg(feature = "serde_json")]
@@ -97,21 +96,21 @@ impl std::error::Error for RadrootsOrderEnvelopeParseError {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsOrderEventContext {
pub counterparty_pubkey: PublicKey,
- pub listing_event: Option<RadrootsEventPtr>,
- pub root_event_id: Option<RadrootsEventId>,
- pub prev_event_id: Option<RadrootsEventId>,
+ pub listing_event: Option<EventPtr>,
+ pub root_event_id: Option<EventId>,
+ pub prev_event_id: Option<EventId>,
}
#[cfg(feature = "serde_json")]
pub fn order_envelope_from_event<T: DeserializeOwned>(
- event: &RadrootsEventEnvelope,
-) -> Result<RadrootsOrderEnvelope<T>, RadrootsOrderEnvelopeParseError> {
+ event: &EventEnvelope,
+) -> Result<OrderEnvelope<T>, RadrootsOrderEnvelopeParseError> {
let event_kind = event.kind_u32();
let event_tags = event.tags_as_vec();
if !is_order_event_kind(event_kind) {
return Err(RadrootsOrderEnvelopeParseError::InvalidKind(event_kind));
}
- let envelope = serde_json::from_str::<RadrootsOrderEnvelope<T>>(event.content())
+ let envelope = serde_json::from_str::<OrderEnvelope<T>>(event.content())
.map_err(|_| RadrootsOrderEnvelopeParseError::InvalidJson)?;
envelope
.validate()
@@ -127,7 +126,7 @@ pub fn order_envelope_from_event<T: DeserializeOwned>(
if envelope.listing_addr != listing_addr {
return Err(RadrootsOrderEnvelopeParseError::ListingAddrTagMismatch);
}
- RadrootsClassifiedListingAddress::parse(&envelope.listing_addr)
+ ClassifiedListingAddress::parse(&envelope.listing_addr)
.map_err(RadrootsOrderEnvelopeParseError::InvalidListingAddr)?;
let tag_order_id = required_order_tag_value(&event_tags, TAG_D)?;
@@ -141,10 +140,10 @@ pub fn order_envelope_from_event<T: DeserializeOwned>(
#[cfg(feature = "serde_json")]
pub fn order_request_from_event(
- event: &RadrootsEventEnvelope,
-) -> Result<RadrootsOrderEnvelope<RadrootsOrderRequest>, RadrootsOrderEnvelopeParseError> {
- let envelope = order_envelope_from_event::<RadrootsOrderRequest>(event)?;
- if envelope.message_type != RadrootsOrderEventType::OrderRequested {
+ event: &EventEnvelope,
+) -> Result<OrderEnvelope<OrderRequest>, RadrootsOrderEnvelopeParseError> {
+ let envelope = order_envelope_from_event::<OrderRequest>(event)?;
+ if envelope.message_type != OrderEventType::OrderRequested {
return Err(RadrootsOrderEnvelopeParseError::MessageTypeKindMismatch {
event_kind: event.kind_u32(),
message_type: envelope.message_type,
@@ -167,10 +166,10 @@ pub fn order_request_from_event(
#[cfg(feature = "serde_json")]
pub fn order_decision_from_event(
- event: &RadrootsEventEnvelope,
-) -> Result<RadrootsOrderEnvelope<RadrootsOrderDecision>, RadrootsOrderEnvelopeParseError> {
- let envelope = order_envelope_from_event::<RadrootsOrderDecision>(event)?;
- if envelope.message_type != RadrootsOrderEventType::OrderDecision {
+ event: &EventEnvelope,
+) -> Result<OrderEnvelope<OrderDecision>, RadrootsOrderEnvelopeParseError> {
+ let envelope = order_envelope_from_event::<OrderDecision>(event)?;
+ if envelope.message_type != OrderEventType::OrderDecision {
return Err(RadrootsOrderEnvelopeParseError::MessageTypeKindMismatch {
event_kind: event.kind_u32(),
message_type: envelope.message_type,
@@ -193,10 +192,10 @@ pub fn order_decision_from_event(
#[cfg(feature = "serde_json")]
pub fn order_cancellation_from_event(
- event: &RadrootsEventEnvelope,
-) -> Result<RadrootsOrderEnvelope<RadrootsOrderCancellation>, RadrootsOrderEnvelopeParseError> {
- let envelope = order_envelope_from_event::<RadrootsOrderCancellation>(event)?;
- if envelope.message_type != RadrootsOrderEventType::OrderCancelled {
+ event: &EventEnvelope,
+) -> Result<OrderEnvelope<OrderCancellation>, RadrootsOrderEnvelopeParseError> {
+ let envelope = order_envelope_from_event::<OrderCancellation>(event)?;
+ if envelope.message_type != OrderEventType::OrderCancelled {
return Err(RadrootsOrderEnvelopeParseError::MessageTypeKindMismatch {
event_kind: event.kind_u32(),
message_type: envelope.message_type,
@@ -219,7 +218,7 @@ pub fn order_cancellation_from_event(
#[cfg(feature = "serde_json")]
pub fn order_event_context_from_tags(
- message_type: RadrootsOrderEventType,
+ message_type: OrderEventType,
tags: &[Vec<String>],
) -> Result<RadrootsOrderEventContext, RadrootsOrderEnvelopeParseError> {
let counterparty_pubkey =
@@ -232,16 +231,14 @@ pub fn order_event_context_from_tags(
parse_order_root_tag(tags).map_err(map_tag_parse_error_for_order_envelope)?;
let root_event_id = root_event_id
.map(|id| {
- RadrootsEventId::parse(id)
- .map_err(|_| RadrootsOrderEnvelopeParseError::InvalidTag(TAG_E_ROOT))
+ EventId::parse(id).map_err(|_| RadrootsOrderEnvelopeParseError::InvalidTag(TAG_E_ROOT))
})
.transpose()?;
let prev_event_id =
parse_order_prev_tag(tags).map_err(map_tag_parse_error_for_order_envelope)?;
let prev_event_id = prev_event_id
.map(|id| {
- RadrootsEventId::parse(id)
- .map_err(|_| RadrootsOrderEnvelopeParseError::InvalidTag(TAG_E_PREV))
+ EventId::parse(id).map_err(|_| RadrootsOrderEnvelopeParseError::InvalidTag(TAG_E_PREV))
})
.transpose()?;
@@ -313,8 +310,8 @@ fn map_tag_parse_error_for_order_envelope(
#[cfg(feature = "serde_json")]
fn validate_order_binding<T>(
- event: &RadrootsEventEnvelope,
- envelope: &RadrootsOrderEnvelope<T>,
+ event: &EventEnvelope,
+ envelope: &OrderEnvelope<T>,
payload_order_id: &str,
payload_listing_addr: &str,
expected_author: &PublicKey,
@@ -353,21 +350,17 @@ mod tests {
use crate::order::tags::TAG_LISTING_EVENT;
use radroots_core::{Currency, Decimal, Money, Unit};
use radroots_event::{
- envelope::RadrootsEventEnvelope,
- envelope::RadrootsEventEnvelopeParts,
+ envelope::EventEnvelope,
+ envelope::EventEnvelopeParts,
envelope::kind::{KIND_ORDER_CANCELLATION, KIND_ORDER_DECISION, KIND_ORDER_REQUEST},
- id::{
- RadrootsClassifiedListingAddress, RadrootsEventId, RadrootsInventoryBinId,
- RadrootsOrderId, RadrootsOrderQuoteId,
- },
- tag::RadrootsEventPtr,
+ id::{ClassifiedListingAddress, EventId, InventoryBinId, OrderId, OrderQuoteId},
+ tag::EventPtr,
tag::name::{TAG_D, TAG_E_PREV, TAG_E_ROOT},
trade::order::{
- RadrootsOrderCancellation, RadrootsOrderDecision, RadrootsOrderDecisionOutcome,
- RadrootsOrderEconomicItem, RadrootsOrderEconomicLine, RadrootsOrderEconomics,
- RadrootsOrderEnvelope, RadrootsOrderEnvelopeError, RadrootsOrderEventType,
- RadrootsOrderInventoryCommitment, RadrootsOrderItem, RadrootsOrderPayloadError,
- RadrootsOrderPricingBasis, RadrootsOrderRequest,
+ OrderCancellation, OrderDecision, OrderDecisionOutcome, OrderEconomicItem,
+ OrderEconomicLine, OrderEconomics, OrderEnvelope, OrderEnvelopeError, OrderEventType,
+ OrderInventoryCommitment, OrderItem, OrderPayloadError, OrderPricingBasis,
+ OrderRequest,
},
};
use radroots_identity::PublicKey;
@@ -394,7 +387,7 @@ mod tests {
seller_pubkey().to_hex()
}
- fn listing_addr() -> RadrootsClassifiedListingAddress {
+ fn listing_addr() -> ClassifiedListingAddress {
format!("30402:{}:AAAAAAAAAAAAAAAAAAAAAg", seller_pubkey_wire())
.parse()
.unwrap()
@@ -404,19 +397,19 @@ mod tests {
listing_addr().into_string()
}
- fn order_id(raw: &str) -> RadrootsOrderId {
+ fn order_id(raw: &str) -> OrderId {
raw.parse().unwrap()
}
- fn quote_id(raw: &str) -> RadrootsOrderQuoteId {
+ fn quote_id(raw: &str) -> OrderQuoteId {
raw.parse().unwrap()
}
- fn bin_id(raw: &str) -> RadrootsInventoryBinId {
+ fn bin_id(raw: &str) -> InventoryBinId {
raw.parse().unwrap()
}
- fn event_id(character: char) -> RadrootsEventId {
+ fn event_id(character: char) -> EventId {
core::iter::repeat_n(character, 64)
.collect::<String>()
.parse()
@@ -436,8 +429,8 @@ mod tests {
kind: u32,
tags: Vec<Vec<String>>,
content: String,
- ) -> RadrootsEventEnvelope {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ ) -> EventEnvelope {
+ EventEnvelope::new(EventEnvelopeParts {
id: event_id_wire('e'),
author,
created_at: 1,
@@ -449,13 +442,13 @@ mod tests {
.unwrap()
}
- fn order_request() -> RadrootsOrderRequest {
- RadrootsOrderRequest {
+ fn order_request() -> OrderRequest {
+ OrderRequest {
order_id: order_id("order-1"),
listing_addr: listing_addr(),
buyer_pubkey: buyer_pubkey(),
seller_pubkey: seller_pubkey(),
- items: vec![RadrootsOrderItem {
+ items: vec![OrderItem {
bin_id: bin_id("lb"),
bin_count: 3,
}],
@@ -471,13 +464,13 @@ mod tests {
Money::try_new(decimal(raw), Currency::USD).unwrap()
}
- fn request_economics() -> RadrootsOrderEconomics {
- RadrootsOrderEconomics {
+ fn request_economics() -> OrderEconomics {
+ OrderEconomics {
quote_id: quote_id("quote-1"),
quote_version: 1,
- pricing_basis: RadrootsOrderPricingBasis::ListingEvent,
+ pricing_basis: OrderPricingBasis::ListingEvent,
currency: Currency::USD,
- items: vec![RadrootsOrderEconomicItem {
+ items: vec![OrderEconomicItem {
bin_id: bin_id("lb"),
bin_count: 3,
quantity_amount: decimal("1"),
@@ -486,8 +479,8 @@ mod tests {
unit_price_currency: Currency::USD,
line_subtotal: usd("15"),
}],
- discounts: Vec::<RadrootsOrderEconomicLine>::new(),
- adjustments: Vec::<RadrootsOrderEconomicLine>::new(),
+ discounts: Vec::<OrderEconomicLine>::new(),
+ adjustments: Vec::<OrderEconomicLine>::new(),
subtotal: usd("15"),
discount_total: usd("0"),
adjustment_total: usd("0"),
@@ -495,14 +488,14 @@ mod tests {
}
}
- fn order_decision() -> RadrootsOrderDecision {
- RadrootsOrderDecision {
+ fn order_decision() -> OrderDecision {
+ OrderDecision {
order_id: order_id("order-1"),
listing_addr: listing_addr(),
buyer_pubkey: buyer_pubkey(),
seller_pubkey: seller_pubkey(),
- decision: RadrootsOrderDecisionOutcome::Accepted {
- inventory_commitments: vec![RadrootsOrderInventoryCommitment {
+ decision: OrderDecisionOutcome::Accepted {
+ inventory_commitments: vec![OrderInventoryCommitment {
bin_id: bin_id("lb"),
bin_count: 3,
}],
@@ -510,8 +503,8 @@ mod tests {
}
}
- fn order_cancelled() -> RadrootsOrderCancellation {
- RadrootsOrderCancellation {
+ fn order_cancelled() -> OrderCancellation {
+ OrderCancellation {
order_id: order_id("order-1"),
listing_addr: listing_addr(),
buyer_pubkey: buyer_pubkey(),
@@ -520,8 +513,8 @@ mod tests {
}
}
- fn listing_event_ptr() -> RadrootsEventPtr {
- RadrootsEventPtr {
+ fn listing_event_ptr() -> EventPtr {
+ EventPtr {
id: event_id_wire('a'),
relays: Some("wss://relay.example.com".into()),
}
@@ -549,13 +542,13 @@ mod tests {
fn order_event_with_envelope<T: serde::Serialize>(
kind: u32,
author: String,
- message_type: RadrootsOrderEventType,
+ message_type: OrderEventType,
listing_addr: impl Into<String>,
order_id: impl Into<String>,
payload: &T,
tags: Vec<Vec<String>>,
- ) -> RadrootsEventEnvelope {
- let envelope = RadrootsOrderEnvelope::new(message_type, listing_addr, order_id, payload);
+ ) -> EventEnvelope {
+ let envelope = OrderEnvelope::new(message_type, listing_addr, order_id, payload);
event_envelope(
author,
kind,
@@ -567,7 +560,7 @@ mod tests {
#[test]
fn listing_address_roundtrips() {
let raw = format!("30402:{}:listing-1", seller_pubkey_wire());
- let addr = RadrootsClassifiedListingAddress::parse(&raw).expect("parse listing address");
+ let addr = ClassifiedListingAddress::parse(&raw).expect("parse listing address");
assert_eq!(addr.as_str(), raw);
}
@@ -575,14 +568,10 @@ mod tests {
fn order_request_builder_emits_canonical_shape() {
let payload = order_request();
let built = order_request_event_build(&listing_event_ptr(), &payload).unwrap();
- let envelope: RadrootsOrderEnvelope<RadrootsOrderRequest> =
- serde_json::from_str(&built.content).unwrap();
+ let envelope: OrderEnvelope<OrderRequest> = serde_json::from_str(&built.content).unwrap();
assert_eq!(built.kind, KIND_ORDER_REQUEST);
- assert_eq!(
- envelope.message_type,
- RadrootsOrderEventType::OrderRequested
- );
+ assert_eq!(envelope.message_type, OrderEventType::OrderRequested);
assert_eq!(envelope.order_id, "order-1");
assert_eq!(built.tags[0], vec!["p".to_string(), seller_pubkey_wire()]);
assert_eq!(built.tags[1], vec!["a".to_string(), listing_addr_wire()]);
@@ -612,11 +601,10 @@ mod tests {
let root_event_id = event_id('1');
let prev_event_id = event_id('9');
let built = order_decision_event_build(&root_event_id, &prev_event_id, &payload).unwrap();
- let envelope: RadrootsOrderEnvelope<RadrootsOrderDecision> =
- serde_json::from_str(&built.content).unwrap();
+ let envelope: OrderEnvelope<OrderDecision> = serde_json::from_str(&built.content).unwrap();
assert_eq!(built.kind, KIND_ORDER_DECISION);
- assert_eq!(envelope.message_type, RadrootsOrderEventType::OrderDecision);
+ assert_eq!(envelope.message_type, OrderEventType::OrderDecision);
assert_eq!(built.tags[0], vec!["p".to_string(), buyer_pubkey_wire()]);
assert_eq!(
built.tags[2],
@@ -643,14 +631,11 @@ mod tests {
let prev_event_id = event_id('9');
let built =
order_cancellation_event_build(&root_event_id, &prev_event_id, &payload).unwrap();
- let envelope: RadrootsOrderEnvelope<RadrootsOrderCancellation> =
+ let envelope: OrderEnvelope<OrderCancellation> =
serde_json::from_str(&built.content).unwrap();
assert_eq!(built.kind, KIND_ORDER_CANCELLATION);
- assert_eq!(
- envelope.message_type,
- RadrootsOrderEventType::OrderCancelled
- );
+ assert_eq!(envelope.message_type, OrderEventType::OrderCancelled);
assert_eq!(envelope.payload.reason, payload.reason);
assert_eq!(built.tags[0], vec!["p".to_string(), seller_pubkey_wire()]);
assert_eq!(
@@ -679,10 +664,7 @@ mod tests {
let envelope = order_request_from_event(&event).unwrap();
assert_eq!(envelope.payload, payload);
- assert_eq!(
- envelope.message_type,
- RadrootsOrderEventType::OrderRequested
- );
+ assert_eq!(envelope.message_type, OrderEventType::OrderRequested);
}
#[test]
@@ -690,8 +672,8 @@ mod tests {
let mut payload = order_request();
let built = order_request_event_build(&listing_event_ptr(), &payload).unwrap();
payload.economics.items[0].bin_id = bin_id("other-bin");
- let envelope = RadrootsOrderEnvelope::new(
- RadrootsOrderEventType::OrderRequested,
+ let envelope = OrderEnvelope::new(
+ OrderEventType::OrderRequested,
payload.listing_addr.clone(),
payload.order_id.clone(),
payload,
@@ -706,7 +688,7 @@ mod tests {
assert_eq!(
err,
RadrootsOrderEnvelopeParseError::InvalidPayload(
- RadrootsOrderPayloadError::InvalidOrderEconomicsBinding {
+ OrderPayloadError::InvalidOrderEconomicsBinding {
field: "items.bin_id"
}
)
@@ -723,7 +705,7 @@ mod tests {
let envelope = order_decision_from_event(&event).unwrap();
assert_eq!(envelope.payload, payload);
- assert_eq!(envelope.message_type, RadrootsOrderEventType::OrderDecision);
+ assert_eq!(envelope.message_type, OrderEventType::OrderDecision);
}
#[test]
@@ -737,10 +719,7 @@ mod tests {
let envelope = order_cancellation_from_event(&event).unwrap();
assert_eq!(envelope.payload, payload);
- assert_eq!(
- envelope.message_type,
- RadrootsOrderEventType::OrderCancelled
- );
+ assert_eq!(envelope.message_type, OrderEventType::OrderCancelled);
}
#[cfg(feature = "std")]
@@ -748,14 +727,12 @@ mod tests {
fn order_parse_error_display_and_source_cover_variants() {
use std::error::Error as _;
- let invalid_envelope = RadrootsOrderEnvelopeParseError::InvalidEnvelope(
- RadrootsOrderEnvelopeError::MissingOrderId,
- );
- let invalid_payload = RadrootsOrderEnvelopeParseError::InvalidPayload(
- RadrootsOrderPayloadError::MissingItems,
- );
+ let invalid_envelope =
+ RadrootsOrderEnvelopeParseError::InvalidEnvelope(OrderEnvelopeError::MissingOrderId);
+ let invalid_payload =
+ RadrootsOrderEnvelopeParseError::InvalidPayload(OrderPayloadError::MissingItems);
let invalid_listing_addr = RadrootsOrderEnvelopeParseError::InvalidListingAddr(
- RadrootsClassifiedListingAddress::parse("not-a-listing-address").unwrap_err(),
+ ClassifiedListingAddress::parse("not-a-listing-address").unwrap_err(),
);
let errors = [
RadrootsOrderEnvelopeParseError::InvalidKind(3431),
@@ -764,7 +741,7 @@ mod tests {
invalid_payload.clone(),
RadrootsOrderEnvelopeParseError::MessageTypeKindMismatch {
event_kind: KIND_ORDER_REQUEST,
- message_type: RadrootsOrderEventType::OrderDecision,
+ message_type: OrderEventType::OrderDecision,
},
RadrootsOrderEnvelopeParseError::MissingTag("a"),
RadrootsOrderEnvelopeParseError::InvalidTag("p"),
@@ -803,8 +780,8 @@ mod tests {
RadrootsOrderEnvelopeParseError::InvalidJson
);
- let mut invalid_version_envelope = RadrootsOrderEnvelope::new(
- RadrootsOrderEventType::OrderRequested,
+ let mut invalid_version_envelope = OrderEnvelope::new(
+ OrderEventType::OrderRequested,
listing_addr_wire(),
"order-1",
&payload,
@@ -819,14 +796,14 @@ mod tests {
assert!(matches!(
order_envelope_from_event::<serde_json::Value>(&invalid_version).unwrap_err(),
RadrootsOrderEnvelopeParseError::InvalidEnvelope(
- RadrootsOrderEnvelopeError::InvalidVersion { .. }
+ OrderEnvelopeError::InvalidVersion { .. }
)
));
let message_type_mismatch = order_event_with_envelope(
KIND_ORDER_REQUEST,
buyer_pubkey_wire(),
- RadrootsOrderEventType::OrderDecision,
+ OrderEventType::OrderDecision,
listing_addr_wire(),
"order-1",
&payload,
@@ -836,14 +813,14 @@ mod tests {
order_envelope_from_event::<serde_json::Value>(&message_type_mismatch).unwrap_err(),
RadrootsOrderEnvelopeParseError::MessageTypeKindMismatch {
event_kind: KIND_ORDER_REQUEST,
- message_type: RadrootsOrderEventType::OrderDecision
+ message_type: OrderEventType::OrderDecision
}
);
let listing_addr_mismatch = order_event_with_envelope(
KIND_ORDER_REQUEST,
buyer_pubkey_wire(),
- RadrootsOrderEventType::OrderRequested,
+ OrderEventType::OrderRequested,
listing_addr_wire(),
"order-1",
&payload,
@@ -860,7 +837,7 @@ mod tests {
let order_id_mismatch = order_event_with_envelope(
KIND_ORDER_REQUEST,
buyer_pubkey_wire(),
- RadrootsOrderEventType::OrderRequested,
+ OrderEventType::OrderRequested,
listing_addr_wire(),
"order-1",
&payload,
@@ -882,7 +859,7 @@ mod tests {
let event = order_event_with_envelope(
KIND_ORDER_REQUEST,
buyer_pubkey_wire(),
- RadrootsOrderEventType::OrderRequested,
+ OrderEventType::OrderRequested,
listing_addr_wire(),
"order-1",
&payload,
@@ -899,7 +876,7 @@ mod tests {
let invalid_listing_addr = order_event_with_envelope(
KIND_ORDER_REQUEST,
buyer_pubkey_wire(),
- RadrootsOrderEventType::OrderRequested,
+ OrderEventType::OrderRequested,
"not-a-listing-address",
"order-1",
&payload,
@@ -923,7 +900,7 @@ mod tests {
let request_as_decision = order_event_with_envelope(
KIND_ORDER_DECISION,
buyer_pubkey_wire(),
- RadrootsOrderEventType::OrderDecision,
+ OrderEventType::OrderDecision,
listing_addr_wire(),
"order-1",
&request_payload,
@@ -937,7 +914,7 @@ mod tests {
let decision_as_request = order_event_with_envelope(
KIND_ORDER_REQUEST,
seller_pubkey_wire(),
- RadrootsOrderEventType::OrderRequested,
+ OrderEventType::OrderRequested,
listing_addr_wire(),
"order-1",
&decision_payload,
@@ -951,7 +928,7 @@ mod tests {
let cancellation_as_decision = order_event_with_envelope(
KIND_ORDER_DECISION,
buyer_pubkey_wire(),
- RadrootsOrderEventType::OrderDecision,
+ OrderEventType::OrderDecision,
listing_addr_wire(),
"order-1",
&cancellation_payload,
@@ -974,8 +951,8 @@ mod tests {
buyer_pubkey_wire(),
request_built.kind,
request_built.tags.clone(),
- serde_json::to_string(&RadrootsOrderEnvelope::new(
- RadrootsOrderEventType::OrderRequested,
+ serde_json::to_string(&OrderEnvelope::new(
+ OrderEventType::OrderRequested,
listing_addr_wire(),
"order-1",
&request_payload,
@@ -996,8 +973,8 @@ mod tests {
buyer_pubkey_wire(),
request_built.kind,
request_built.tags,
- serde_json::to_string(&RadrootsOrderEnvelope::new(
- RadrootsOrderEventType::OrderRequested,
+ serde_json::to_string(&OrderEnvelope::new(
+ OrderEventType::OrderRequested,
listing_addr_wire(),
"order-1",
&request_payload,
@@ -1017,8 +994,8 @@ mod tests {
seller_pubkey_wire(),
decision_built.kind,
decision_built.tags,
- serde_json::to_string(&RadrootsOrderEnvelope::new(
- RadrootsOrderEventType::OrderDecision,
+ serde_json::to_string(&OrderEnvelope::new(
+ OrderEventType::OrderDecision,
listing_addr_wire(),
"order-1",
&decision_payload,
@@ -1035,7 +1012,7 @@ mod tests {
#[cfg_attr(coverage_nightly, coverage(off))]
fn order_event_context_and_parse_error_mapping_cover_missing_context() {
let err = order_event_context_from_tags(
- RadrootsOrderEventType::OrderRequested,
+ OrderEventType::OrderRequested,
&[vec!["p".into(), seller_pubkey_wire()]],
)
.unwrap_err();
@@ -1045,7 +1022,7 @@ mod tests {
);
let err = order_event_context_from_tags(
- RadrootsOrderEventType::OrderDecision,
+ OrderEventType::OrderDecision,
&[
vec!["p".into(), buyer_pubkey_wire()],
vec![TAG_E_PREV.into(), event_id_wire('2')],
@@ -1055,7 +1032,7 @@ mod tests {
assert_eq!(err, RadrootsOrderEnvelopeParseError::MissingTag(TAG_E_ROOT));
let err = order_event_context_from_tags(
- RadrootsOrderEventType::OrderDecision,
+ OrderEventType::OrderDecision,
&[
vec!["p".into(), buyer_pubkey_wire()],
vec![TAG_E_ROOT.into(), event_id_wire('1')],
diff --git a/crates/event_codec/src/order/encode.rs b/crates/event_codec/src/order/encode.rs
@@ -1,75 +1,70 @@
#[cfg(feature = "serde_json")]
use radroots_event::{
- id::RadrootsEventId,
- tag::RadrootsEventPtr,
+ id::EventId,
+ tag::EventPtr,
trade::order::{
- RadrootsOrderCancellation, RadrootsOrderDecision, RadrootsOrderEnvelope,
- RadrootsOrderEnvelopeError, RadrootsOrderEventType, RadrootsOrderPayloadError,
- RadrootsOrderRequest,
+ OrderCancellation, OrderDecision, OrderEnvelope, OrderEnvelopeError, OrderEventType,
+ OrderPayloadError, OrderRequest,
},
};
#[cfg(feature = "serde_json")]
use crate::{error::EventEncodeError, order::tags::order_envelope_tags};
#[cfg(feature = "serde_json")]
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
#[cfg(feature = "serde_json")]
use radroots_identity::PublicKey;
#[cfg(feature = "serde_json")]
-fn map_order_envelope_error(error: RadrootsOrderEnvelopeError) -> EventEncodeError {
+fn map_order_envelope_error(error: OrderEnvelopeError) -> EventEncodeError {
match error {
- RadrootsOrderEnvelopeError::MissingOrderId => {
- EventEncodeError::EmptyRequiredField("order_id")
- }
- RadrootsOrderEnvelopeError::MissingListingAddr => {
+ OrderEnvelopeError::MissingOrderId => EventEncodeError::EmptyRequiredField("order_id"),
+ OrderEnvelopeError::MissingListingAddr => {
EventEncodeError::EmptyRequiredField("listing_addr")
}
- RadrootsOrderEnvelopeError::InvalidVersion { .. } => {
- EventEncodeError::InvalidField("version")
- }
+ OrderEnvelopeError::InvalidVersion { .. } => EventEncodeError::InvalidField("version"),
}
}
#[cfg(feature = "serde_json")]
-fn map_order_payload_error(error: RadrootsOrderPayloadError) -> EventEncodeError {
+fn map_order_payload_error(error: OrderPayloadError) -> EventEncodeError {
match error {
- RadrootsOrderPayloadError::EmptyField(field) => EventEncodeError::EmptyRequiredField(field),
- RadrootsOrderPayloadError::MissingItems => EventEncodeError::EmptyRequiredField("items"),
- RadrootsOrderPayloadError::InvalidItemBinCount { .. } => {
+ OrderPayloadError::EmptyField(field) => EventEncodeError::EmptyRequiredField(field),
+ OrderPayloadError::MissingItems => EventEncodeError::EmptyRequiredField("items"),
+ OrderPayloadError::InvalidItemBinCount { .. } => {
EventEncodeError::InvalidField("items.bin_count")
}
- RadrootsOrderPayloadError::MissingEconomicItems => {
+ OrderPayloadError::MissingEconomicItems => {
EventEncodeError::EmptyRequiredField("economics.items")
}
- RadrootsOrderPayloadError::InvalidEconomicItemBinCount { .. } => {
+ OrderPayloadError::InvalidEconomicItemBinCount { .. } => {
EventEncodeError::InvalidField("economics.items.bin_count")
}
- RadrootsOrderPayloadError::InvalidEconomicItemQuantity { .. } => {
+ OrderPayloadError::InvalidEconomicItemQuantity { .. } => {
EventEncodeError::InvalidField("economics.items.quantity_amount")
}
- RadrootsOrderPayloadError::InvalidEconomicItemPrice { .. } => {
+ OrderPayloadError::InvalidEconomicItemPrice { .. } => {
EventEncodeError::InvalidField("economics.items.unit_price_amount")
}
- RadrootsOrderPayloadError::InvalidEconomicItemSubtotal { .. } => {
+ OrderPayloadError::InvalidEconomicItemSubtotal { .. } => {
EventEncodeError::InvalidField("economics.items.line_subtotal")
}
- RadrootsOrderPayloadError::InvalidEconomicLineAmount { field, .. }
- | RadrootsOrderPayloadError::InvalidEconomicLineKind { field, .. }
- | RadrootsOrderPayloadError::InvalidEconomicLineEffect { field, .. }
- | RadrootsOrderPayloadError::InvalidEconomicCurrency { field }
- | RadrootsOrderPayloadError::InvalidEconomicOrdering { field }
- | RadrootsOrderPayloadError::InvalidEconomicTotal { field }
- | RadrootsOrderPayloadError::InvalidOrderEconomicsBinding { field } => {
+ OrderPayloadError::InvalidEconomicLineAmount { field, .. }
+ | OrderPayloadError::InvalidEconomicLineKind { field, .. }
+ | OrderPayloadError::InvalidEconomicLineEffect { field, .. }
+ | OrderPayloadError::InvalidEconomicCurrency { field }
+ | OrderPayloadError::InvalidEconomicOrdering { field }
+ | OrderPayloadError::InvalidEconomicTotal { field }
+ | OrderPayloadError::InvalidOrderEconomicsBinding { field } => {
EventEncodeError::InvalidField(field)
}
- RadrootsOrderPayloadError::InvalidQuoteVersion => {
+ OrderPayloadError::InvalidQuoteVersion => {
EventEncodeError::InvalidField("economics.quote_version")
}
- RadrootsOrderPayloadError::MissingInventoryCommitments => {
+ OrderPayloadError::MissingInventoryCommitments => {
EventEncodeError::EmptyRequiredField("inventory_commitments")
}
- RadrootsOrderPayloadError::InvalidInventoryCommitmentCount { .. } => {
+ OrderPayloadError::InvalidInventoryCommitmentCount { .. } => {
EventEncodeError::InvalidField("inventory_commitments.bin_count")
}
}
@@ -78,19 +73,19 @@ fn map_order_payload_error(error: RadrootsOrderPayloadError) -> EventEncodeError
#[cfg(feature = "serde_json")]
struct OrderEnvelopeEventBuildParts<'a, T> {
recipient_pubkey: &'a PublicKey,
- message_type: RadrootsOrderEventType,
+ message_type: OrderEventType,
listing_addr: &'a str,
order_id: &'a str,
- listing_event: Option<&'a RadrootsEventPtr>,
- root_event_id: Option<&'a RadrootsEventId>,
- prev_event_id: Option<&'a RadrootsEventId>,
+ listing_event: Option<&'a EventPtr>,
+ root_event_id: Option<&'a EventId>,
+ prev_event_id: Option<&'a EventId>,
payload: &'a T,
}
#[cfg(feature = "serde_json")]
fn order_envelope_event_build<T: serde::Serialize>(
parts: OrderEnvelopeEventBuildParts<'_, T>,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if parts.message_type.requires_listing_snapshot() && parts.listing_event.is_none() {
return Err(EventEncodeError::EmptyRequiredField("listing_event.id"));
}
@@ -103,7 +98,7 @@ fn order_envelope_event_build<T: serde::Serialize>(
}
}
- let envelope = RadrootsOrderEnvelope::new(
+ let envelope = OrderEnvelope::new(
parts.message_type,
parts.listing_addr,
parts.order_id,
@@ -111,8 +106,8 @@ fn order_envelope_event_build<T: serde::Serialize>(
);
envelope.validate().map_err(map_order_envelope_error)?;
let content = serde_json::to_string(&envelope).map_err(|_| EventEncodeError::Json)?;
- let root_event_id = parts.root_event_id.map(RadrootsEventId::to_hex);
- let prev_event_id = parts.prev_event_id.map(RadrootsEventId::to_hex);
+ let root_event_id = parts.root_event_id.map(EventId::to_hex);
+ let prev_event_id = parts.prev_event_id.map(EventId::to_hex);
let tags = order_envelope_tags(
parts.recipient_pubkey.to_hex(),
parts.listing_addr,
@@ -121,7 +116,7 @@ fn order_envelope_event_build<T: serde::Serialize>(
root_event_id.as_deref(),
prev_event_id.as_deref(),
)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind: parts.message_type.kind(),
content,
tags,
@@ -130,13 +125,13 @@ fn order_envelope_event_build<T: serde::Serialize>(
#[cfg(feature = "serde_json")]
pub fn order_request_event_build(
- listing_event: &RadrootsEventPtr,
- payload: &RadrootsOrderRequest,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ listing_event: &EventPtr,
+ payload: &OrderRequest,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
payload.validate().map_err(map_order_payload_error)?;
order_envelope_event_build(OrderEnvelopeEventBuildParts {
recipient_pubkey: &payload.seller_pubkey,
- message_type: RadrootsOrderEventType::OrderRequested,
+ message_type: OrderEventType::OrderRequested,
listing_addr: payload.listing_addr.as_str(),
order_id: payload.order_id.as_str(),
listing_event: Some(listing_event),
@@ -148,14 +143,14 @@ pub fn order_request_event_build(
#[cfg(feature = "serde_json")]
pub fn order_decision_event_build(
- root_event_id: &RadrootsEventId,
- prev_event_id: &RadrootsEventId,
- payload: &RadrootsOrderDecision,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ root_event_id: &EventId,
+ prev_event_id: &EventId,
+ payload: &OrderDecision,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
payload.validate().map_err(map_order_payload_error)?;
order_envelope_event_build(OrderEnvelopeEventBuildParts {
recipient_pubkey: &payload.buyer_pubkey,
- message_type: RadrootsOrderEventType::OrderDecision,
+ message_type: OrderEventType::OrderDecision,
listing_addr: payload.listing_addr.as_str(),
order_id: payload.order_id.as_str(),
listing_event: None,
@@ -167,14 +162,14 @@ pub fn order_decision_event_build(
#[cfg(feature = "serde_json")]
pub fn order_cancellation_event_build(
- root_event_id: &RadrootsEventId,
- prev_event_id: &RadrootsEventId,
- payload: &RadrootsOrderCancellation,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ root_event_id: &EventId,
+ prev_event_id: &EventId,
+ payload: &OrderCancellation,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
payload.validate().map_err(map_order_payload_error)?;
order_envelope_event_build(OrderEnvelopeEventBuildParts {
recipient_pubkey: &payload.seller_pubkey,
- message_type: RadrootsOrderEventType::OrderCancelled,
+ message_type: OrderEventType::OrderCancelled,
listing_addr: payload.listing_addr.as_str(),
order_id: payload.order_id.as_str(),
listing_event: None,
@@ -192,17 +187,15 @@ mod tests {
};
use crate::error::EventEncodeError;
use radroots_event::{
- id::RadrootsEventId,
- tag::RadrootsEventPtr,
- trade::order::{
- RadrootsOrderEnvelopeError, RadrootsOrderEventType, RadrootsOrderPayloadError,
- },
+ id::EventId,
+ tag::EventPtr,
+ trade::order::{OrderEnvelopeError, OrderEventType, OrderPayloadError},
};
use radroots_identity::PublicKey;
const RECIPIENT: &str = "585591529da0bab31b3b1b1f986611cf5f435dca84f978c89ee8a40cca7103df";
- fn event_id(character: char) -> RadrootsEventId {
+ fn event_id(character: char) -> EventId {
core::iter::repeat_n(character, 64)
.collect::<String>()
.parse()
@@ -216,81 +209,73 @@ mod tests {
#[test]
fn order_encode_error_mappers_cover_envelope_and_payload_variants() {
assert_empty_required(
- map_order_envelope_error(RadrootsOrderEnvelopeError::MissingOrderId),
+ map_order_envelope_error(OrderEnvelopeError::MissingOrderId),
"order_id",
);
assert_empty_required(
- map_order_envelope_error(RadrootsOrderEnvelopeError::MissingListingAddr),
+ map_order_envelope_error(OrderEnvelopeError::MissingListingAddr),
"listing_addr",
);
assert_invalid_field(
- map_order_envelope_error(RadrootsOrderEnvelopeError::InvalidVersion {
+ map_order_envelope_error(OrderEnvelopeError::InvalidVersion {
expected: 1,
got: 2,
}),
"version",
);
assert_empty_required(
- map_order_payload_error(RadrootsOrderPayloadError::EmptyField("buyer_pubkey")),
+ map_order_payload_error(OrderPayloadError::EmptyField("buyer_pubkey")),
"buyer_pubkey",
);
assert_empty_required(
- map_order_payload_error(RadrootsOrderPayloadError::MissingItems),
+ map_order_payload_error(OrderPayloadError::MissingItems),
"items",
);
assert_invalid_field(
- map_order_payload_error(RadrootsOrderPayloadError::InvalidItemBinCount { index: 0 }),
+ map_order_payload_error(OrderPayloadError::InvalidItemBinCount { index: 0 }),
"items.bin_count",
);
assert_empty_required(
- map_order_payload_error(RadrootsOrderPayloadError::MissingEconomicItems),
+ map_order_payload_error(OrderPayloadError::MissingEconomicItems),
"economics.items",
);
assert_invalid_field(
- map_order_payload_error(RadrootsOrderPayloadError::InvalidEconomicItemBinCount {
- index: 0,
- }),
+ map_order_payload_error(OrderPayloadError::InvalidEconomicItemBinCount { index: 0 }),
"economics.items.bin_count",
);
assert_invalid_field(
- map_order_payload_error(RadrootsOrderPayloadError::InvalidEconomicItemQuantity {
- index: 0,
- }),
+ map_order_payload_error(OrderPayloadError::InvalidEconomicItemQuantity { index: 0 }),
"economics.items.quantity_amount",
);
assert_invalid_field(
- map_order_payload_error(RadrootsOrderPayloadError::InvalidEconomicItemPrice {
- index: 0,
- }),
+ map_order_payload_error(OrderPayloadError::InvalidEconomicItemPrice { index: 0 }),
"economics.items.unit_price_amount",
);
assert_invalid_field(
- map_order_payload_error(RadrootsOrderPayloadError::InvalidEconomicItemSubtotal {
- index: 0,
- }),
+ map_order_payload_error(OrderPayloadError::InvalidEconomicItemSubtotal { index: 0 }),
"economics.items.line_subtotal",
);
for error in [
- RadrootsOrderPayloadError::InvalidEconomicLineAmount {
+ OrderPayloadError::InvalidEconomicLineAmount {
field: "adjustments.amount",
index: 0,
},
- RadrootsOrderPayloadError::InvalidEconomicLineKind {
+ OrderPayloadError::InvalidEconomicLineKind {
field: "discounts.kind",
index: 0,
},
- RadrootsOrderPayloadError::InvalidEconomicLineEffect {
+ OrderPayloadError::InvalidEconomicLineEffect {
field: "discounts.effect",
index: 0,
},
- RadrootsOrderPayloadError::InvalidEconomicCurrency {
+ OrderPayloadError::InvalidEconomicCurrency {
field: "subtotal.currency",
},
- RadrootsOrderPayloadError::InvalidEconomicOrdering {
+ OrderPayloadError::InvalidEconomicOrdering {
field: "adjustments",
},
- RadrootsOrderPayloadError::InvalidEconomicTotal { field: "total" },
- RadrootsOrderPayloadError::InvalidOrderEconomicsBinding { field: "items" },
+ OrderPayloadError::InvalidEconomicTotal { field: "total" },
+ OrderPayloadError::InvalidOrderEconomicsBinding { field: "items" },
] {
assert!(matches!(
map_order_payload_error(error),
@@ -298,15 +283,15 @@ mod tests {
));
}
assert_invalid_field(
- map_order_payload_error(RadrootsOrderPayloadError::InvalidQuoteVersion),
+ map_order_payload_error(OrderPayloadError::InvalidQuoteVersion),
"economics.quote_version",
);
assert_empty_required(
- map_order_payload_error(RadrootsOrderPayloadError::MissingInventoryCommitments),
+ map_order_payload_error(OrderPayloadError::MissingInventoryCommitments),
"inventory_commitments",
);
assert_invalid_field(
- map_order_payload_error(RadrootsOrderPayloadError::InvalidInventoryCommitmentCount {
+ map_order_payload_error(OrderPayloadError::InvalidInventoryCommitmentCount {
index: 0,
}),
"inventory_commitments.bin_count",
@@ -322,7 +307,7 @@ mod tests {
let missing_listing_event = order_envelope_event_build(OrderEnvelopeEventBuildParts {
recipient_pubkey: &recipient_pubkey,
- message_type: RadrootsOrderEventType::OrderRequested,
+ message_type: OrderEventType::OrderRequested,
listing_addr: "listing-address",
order_id: "order-1",
listing_event: None,
@@ -335,7 +320,7 @@ mod tests {
let missing_root = order_envelope_event_build(OrderEnvelopeEventBuildParts {
recipient_pubkey: &recipient_pubkey,
- message_type: RadrootsOrderEventType::OrderDecision,
+ message_type: OrderEventType::OrderDecision,
listing_addr: "listing-address",
order_id: "order-1",
listing_event: None,
@@ -348,7 +333,7 @@ mod tests {
let missing_prev = order_envelope_event_build(OrderEnvelopeEventBuildParts {
recipient_pubkey: &recipient_pubkey,
- message_type: RadrootsOrderEventType::OrderDecision,
+ message_type: OrderEventType::OrderDecision,
listing_addr: "listing-address",
order_id: "order-1",
listing_event: None,
@@ -361,10 +346,10 @@ mod tests {
let invalid_listing_event = order_envelope_event_build(OrderEnvelopeEventBuildParts {
recipient_pubkey: &recipient_pubkey,
- message_type: RadrootsOrderEventType::OrderRequested,
+ message_type: OrderEventType::OrderRequested,
listing_addr: "listing-address",
order_id: "order-1",
- listing_event: Some(&RadrootsEventPtr {
+ listing_event: Some(&EventPtr {
id: String::new(),
relays: None,
}),
diff --git a/crates/event_codec/src/order/tags.rs b/crates/event_codec/src/order/tags.rs
@@ -2,8 +2,8 @@
use alloc::{borrow::ToOwned, string::String, vec, vec::Vec};
use radroots_event::{
- id::{RadrootsEventEnvelopePointer, RadrootsEventId},
- tag::RadrootsEventPtr,
+ id::{EventEnvelopePointer, EventId},
+ tag::EventPtr,
tag::name::{TAG_D, TAG_E_PREV, TAG_E_ROOT},
};
@@ -21,13 +21,13 @@ fn push_tag(tags: &mut Vec<Vec<String>>, name: &'static str, value: impl Into<St
fn build_event_ptr_tag(
name: &'static str,
- ptr: &RadrootsEventPtr,
+ ptr: &EventPtr,
field_prefix: &'static str,
) -> Result<Vec<String>, EventEncodeError> {
if ptr.id.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField(field_prefix));
}
- let event_id = RadrootsEventId::parse(ptr.id.as_str())
+ let event_id = EventId::parse(ptr.id.as_str())
.map_err(|_| EventEncodeError::InvalidField(field_prefix))?;
let mut tag = Vec::with_capacity(3);
tag.push(name.to_owned());
@@ -36,7 +36,7 @@ fn build_event_ptr_tag(
if relay.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("listing_event.relays"));
}
- RadrootsEventEnvelopePointer::new(event_id, [relay.as_str()])
+ EventEnvelopePointer::new(event_id, [relay.as_str()])
.map_err(|_| EventEncodeError::InvalidField("listing_event.relays"))?;
tag.push(relay.clone());
}
@@ -46,7 +46,7 @@ fn build_event_ptr_tag(
fn parse_event_ptr_tag(
tags: &[Vec<String>],
name: &'static str,
-) -> Result<Option<RadrootsEventPtr>, EventParseError> {
+) -> Result<Option<EventPtr>, EventParseError> {
let Some(tag) = tags
.iter()
.find(|tag| tag.first().map(|value| value.as_str()) == Some(name))
@@ -57,18 +57,17 @@ fn parse_event_ptr_tag(
if id.trim().is_empty() {
return Err(EventParseError::InvalidTag(name));
}
- let event_id =
- RadrootsEventId::parse(id.as_str()).map_err(|_| EventParseError::InvalidTag(name))?;
+ let event_id = EventId::parse(id.as_str()).map_err(|_| EventParseError::InvalidTag(name))?;
let relay = match tag.get(2) {
Some(value) if value.trim().is_empty() => return Err(EventParseError::InvalidTag(name)),
Some(value) => Some(value.clone()),
None => None,
};
if let Some(relay) = relay.as_ref() {
- RadrootsEventEnvelopePointer::new(event_id, [relay.as_str()])
+ EventEnvelopePointer::new(event_id, [relay.as_str()])
.map_err(|_| EventParseError::InvalidTag(name))?;
}
- Ok(Some(RadrootsEventPtr {
+ Ok(Some(EventPtr {
id: event_id.to_hex(),
relays: relay,
}))
@@ -79,7 +78,7 @@ pub fn order_envelope_tags<P, A, D>(
recipient_pubkey: P,
listing_addr: A,
order_id: Option<D>,
- listing_event: Option<&RadrootsEventPtr>,
+ listing_event: Option<&EventPtr>,
root_event_id: Option<&str>,
prev_event_id: Option<&str>,
) -> Result<Vec<Vec<String>>, EventEncodeError>
@@ -147,7 +146,7 @@ pub fn parse_order_counterparty_tag(tags: &[Vec<String>]) -> Result<String, Even
#[inline]
pub fn parse_order_listing_event_tag(
tags: &[Vec<String>],
-) -> Result<Option<RadrootsEventPtr>, EventParseError> {
+) -> Result<Option<EventPtr>, EventParseError> {
parse_event_ptr_tag(tags, TAG_LISTING_EVENT)
}
@@ -254,7 +253,7 @@ mod tests {
};
use radroots_event::{
envelope::kind::KIND_CLASSIFIED_LISTING,
- tag::RadrootsEventPtr,
+ tag::EventPtr,
tag::name::{TAG_D, TAG_E_PREV, TAG_E_ROOT},
};
@@ -290,7 +289,7 @@ mod tests {
"buyer",
listing_addr.as_str(),
Some("order-1"),
- Some(&RadrootsEventPtr {
+ Some(&EventPtr {
id: listing_event_id.clone(),
relays: Some("wss://relay.example".into()),
}),
@@ -324,7 +323,7 @@ mod tests {
"buyer",
listing_addr.as_str(),
None::<&str>,
- Some(&RadrootsEventPtr {
+ Some(&EventPtr {
id: listing_event_id.clone(),
relays: None,
}),
@@ -350,7 +349,7 @@ mod tests {
"buyer",
listing_addr.as_str(),
Some("order-1"),
- None::<&RadrootsEventPtr>,
+ None::<&EventPtr>,
Some("root-event"),
Some("prev-event"),
)
@@ -375,7 +374,7 @@ mod tests {
"buyer",
listing_addr.as_str(),
None::<&str>,
- Some(&RadrootsEventPtr {
+ Some(&EventPtr {
id: listing_event_id.clone(),
relays: None,
}),
@@ -422,7 +421,7 @@ mod tests {
"buyer",
listing_addr.as_str(),
None::<&str>,
- Some(&RadrootsEventPtr {
+ Some(&EventPtr {
id: " ".into(),
relays: None,
}),
@@ -439,7 +438,7 @@ mod tests {
"buyer",
listing_addr.as_str(),
None::<&str>,
- Some(&RadrootsEventPtr {
+ Some(&EventPtr {
id: "not-an-event-id".into(),
relays: None,
}),
@@ -456,7 +455,7 @@ mod tests {
"buyer",
listing_addr.as_str(),
None::<&str>,
- Some(&RadrootsEventPtr {
+ Some(&EventPtr {
id: event_id('d'),
relays: Some(" ".into()),
}),
@@ -517,7 +516,7 @@ mod tests {
);
assert_eq!(
parse_order_listing_event_tag(&tags).expect("snapshot"),
- Some(RadrootsEventPtr {
+ Some(EventPtr {
id: listing_event_id,
relays: Some("wss://relay".into()),
})
@@ -591,7 +590,7 @@ mod tests {
assert_eq!(
parse_order_listing_event_tag(&[vec![String::from(TAG_LISTING_EVENT), event_id('a'),]])
.expect("snapshot without relay"),
- Some(RadrootsEventPtr {
+ Some(EventPtr {
id: event_id('a'),
relays: None,
})
diff --git a/crates/event_codec/src/parsed.rs b/crates/event_codec/src/parsed.rs
@@ -2,7 +2,7 @@
use alloc::{string::String, vec::Vec};
use crate::error::EventParseError;
-use radroots_event::{envelope::RadrootsEventEnvelope, envelope::RadrootsEventEnvelopeParts};
+use radroots_event::{envelope::EventEnvelope, envelope::EventEnvelopeParts};
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, Eq)]
@@ -30,13 +30,13 @@ impl<T> RadrootsParsedData<T> {
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug)]
pub struct RadrootsParsedEvent<T> {
- pub event: RadrootsEventEnvelope,
+ pub event: EventEnvelope,
pub data: RadrootsParsedData<T>,
}
impl<T> RadrootsParsedEvent<T> {
#[inline]
- pub fn new(event: RadrootsEventEnvelope, data: RadrootsParsedData<T>) -> Self {
+ pub fn new(event: EventEnvelope, data: RadrootsParsedData<T>) -> Self {
Self { event, data }
}
@@ -76,7 +76,7 @@ impl<T> RadrootsParsedEvent<T> {
sig: String,
data: RadrootsParsedData<T>,
) -> Result<Self, EventParseError> {
- let event = RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ let event = EventEnvelope::new(EventEnvelopeParts {
id,
author,
created_at: published_at,
@@ -92,7 +92,7 @@ impl<T> RadrootsParsedEvent<T> {
#[cfg(test)]
mod tests {
use super::{RadrootsParsedData, RadrootsParsedEvent};
- use radroots_event::{envelope::RadrootsEventEnvelope, envelope::RadrootsEventEnvelopeParts};
+ use radroots_event::{envelope::EventEnvelope, envelope::EventEnvelopeParts};
const EVENT_ID: &str = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
const AUTHOR: &str = crate::test_fixtures::FIXTURE_ALICE_PUBLIC_KEY_HEX;
@@ -119,7 +119,7 @@ mod tests {
#[test]
fn parsed_event_constructor_maps_event_and_data() {
- let event = RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ let event = EventEnvelope::new(EventEnvelopeParts {
id: EVENT_ID.to_string(),
author: AUTHOR.to_string(),
created_at: 22,
diff --git a/crates/event_codec/src/plot/decode.rs b/crates/event_codec/src/plot/decode.rs
@@ -8,8 +8,8 @@ use alloc::{
use radroots_event::{
envelope::kind::{KIND_FARM, KIND_PLOT},
- farm::RadrootsFarmRef,
- farm::plot::RadrootsPlot,
+ farm::FarmRef,
+ farm::plot::Plot,
tag::name::TAG_D,
};
@@ -37,7 +37,7 @@ fn parse_d_tag(tags: &[Vec<String>]) -> Result<String, EventParseError> {
Ok(value)
}
-fn parse_farm_ref(tags: &[Vec<String>]) -> Result<RadrootsFarmRef, EventParseError> {
+fn parse_farm_ref(tags: &[Vec<String>]) -> Result<FarmRef, EventParseError> {
let tag = tags
.iter()
.find(|t| t.first().map(|s| s.as_str()) == Some(TAG_A))
@@ -66,7 +66,7 @@ fn parse_farm_ref(tags: &[Vec<String>]) -> Result<RadrootsFarmRef, EventParseErr
return Err(EventParseError::InvalidTag(TAG_A));
}
validate_d_tag_tag(&d_tag, TAG_A)?;
- Ok(RadrootsFarmRef { pubkey, d_tag })
+ Ok(FarmRef { pubkey, d_tag })
}
fn parse_farm_pubkey(tags: &[Vec<String>]) -> Result<String, EventParseError> {
@@ -88,7 +88,7 @@ pub fn plot_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsPlot, EventParseError> {
+) -> Result<Plot, EventParseError> {
if kind != DEFAULT_KIND {
return Err(EventParseError::InvalidKind {
expected: "30350",
@@ -101,7 +101,7 @@ pub fn plot_from_event(
let d_tag = parse_d_tag(tags)?;
let farm_ref = parse_farm_ref(tags)?;
let farm_pubkey = parse_farm_pubkey(tags)?;
- let mut plot: RadrootsPlot =
+ let mut plot: Plot =
serde_json::from_str(content).map_err(|_| EventParseError::InvalidJson("content"))?;
if plot.d_tag.trim().is_empty() {
@@ -129,7 +129,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsPlot>, EventParseError> {
+) -> Result<RadrootsParsedData<Plot>, EventParseError> {
let plot = plot_from_event(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -148,7 +148,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsPlot>, EventParseError> {
+) -> Result<RadrootsParsedEvent<Plot>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
diff --git a/crates/event_codec/src/plot/encode.rs b/crates/event_codec/src/plot/encode.rs
@@ -7,8 +7,8 @@ use alloc::{
use radroots_event::{
envelope::kind::{KIND_FARM, KIND_PLOT},
- farm::RadrootsFarmRef,
- farm::plot::RadrootsPlot,
+ farm::FarmRef,
+ farm::plot::Plot,
tag::name::TAG_D,
};
@@ -16,7 +16,7 @@ use crate::d_tag::validate_d_tag;
use crate::error::EventEncodeError;
#[cfg(feature = "serde_json")]
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
const TAG_T: &str = "t";
const TAG_G: &str = "g";
@@ -27,7 +27,7 @@ fn push_tag(tags: &mut Vec<Vec<String>>, key: &str, value: &str) {
tags.push(vec![key.to_string(), value.to_string()]);
}
-fn farm_address(farm: &RadrootsFarmRef) -> String {
+fn farm_address(farm: &FarmRef) -> String {
let mut value = String::new();
value.push_str(&KIND_FARM.to_string());
value.push(':');
@@ -56,7 +56,7 @@ pub fn plot_address(author_pubkey: &str, plot_id: &str) -> Result<String, EventE
Ok(value)
}
-pub fn plot_build_tags(plot: &RadrootsPlot) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn plot_build_tags(plot: &Plot) -> Result<Vec<Vec<String>>, EventEncodeError> {
if plot.d_tag.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("d_tag"));
}
@@ -91,21 +91,21 @@ pub fn plot_build_tags(plot: &RadrootsPlot) -> Result<Vec<Vec<String>>, EventEnc
}
#[cfg(feature = "serde_json")]
-pub fn to_wire_parts(plot: &RadrootsPlot) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+pub fn to_wire_parts(plot: &Plot) -> Result<Nip01EventWireParts, EventEncodeError> {
to_wire_parts_with_kind(plot, KIND_PLOT)
}
#[cfg(feature = "serde_json")]
pub fn to_wire_parts_with_kind(
- plot: &RadrootsPlot,
+ plot: &Plot,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != KIND_PLOT {
return Err(EventEncodeError::InvalidKind(kind));
}
let tags = plot_build_tags(plot)?;
let content = serde_json::to_string(plot).map_err(|_| EventEncodeError::Json)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content,
tags,
diff --git a/crates/event_codec/src/plot/mod.rs b/crates/event_codec/src/plot/mod.rs
@@ -6,35 +6,35 @@ mod tests {
use crate::error::EventEncodeError;
use crate::plot::encode::{plot_address, plot_build_tags};
use radroots_event::{
- farm::RadrootsFarmRef,
- farm::change_set::{RadrootsGcsLocation, RadrootsGeoJsonPoint, RadrootsGeoJsonPolygon},
- farm::plot::{RadrootsPlot, RadrootsPlotLocation},
+ farm::FarmRef,
+ farm::change_set::{GcsLocation, GeoJsonPoint, GeoJsonPolygon},
+ farm::plot::{Plot, PlotLocation},
};
#[test]
fn plot_tags_include_farm_address() {
- let plot = RadrootsPlot {
+ let plot = Plot {
d_tag: "AAAAAAAAAAAAAAAAAAAAAQ".to_string(),
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: "farm_pubkey".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
},
name: "Orchard".to_string(),
about: None,
- location: Some(RadrootsPlotLocation {
+ location: Some(PlotLocation {
primary: None,
city: None,
region: None,
country: None,
- gcs: RadrootsGcsLocation {
+ gcs: GcsLocation {
lat: 37.0,
lng: -122.0,
geohash: "9q8yy".to_string(),
- point: RadrootsGeoJsonPoint {
+ point: GeoJsonPoint {
r#type: "Point".to_string(),
coordinates: [-122.0, 37.0],
},
- polygon: RadrootsGeoJsonPolygon {
+ polygon: GeoJsonPolygon {
r#type: "Polygon".to_string(),
coordinates: vec![vec![
[-122.0, 37.0],
@@ -75,9 +75,9 @@ mod tests {
#[test]
fn plot_tags_allow_missing_optional_fields() {
- let plot = RadrootsPlot {
+ let plot = Plot {
d_tag: "AAAAAAAAAAAAAAAAAAAAAQ".to_string(),
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: "farm_pubkey".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
},
@@ -114,9 +114,9 @@ mod tests {
#[test]
fn plot_build_tags_rejects_invalid_plot_and_farm_d_tag() {
- let mut plot = RadrootsPlot {
+ let mut plot = Plot {
d_tag: "AAAAAAAAAAAAAAAAAAAAAQ".to_string(),
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: "farm_pubkey".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
},
@@ -138,28 +138,28 @@ mod tests {
#[test]
fn plot_encode_rejects_empty_required_fields() {
- let mut plot = RadrootsPlot {
+ let mut plot = Plot {
d_tag: "AAAAAAAAAAAAAAAAAAAAAQ".to_string(),
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: "farm_pubkey".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
},
name: "Orchard".to_string(),
about: None,
- location: Some(RadrootsPlotLocation {
+ location: Some(PlotLocation {
primary: None,
city: None,
region: None,
country: None,
- gcs: RadrootsGcsLocation {
+ gcs: GcsLocation {
lat: 37.0,
lng: -122.0,
geohash: "9q8yy".to_string(),
- point: RadrootsGeoJsonPoint {
+ point: GeoJsonPoint {
r#type: "Point".to_string(),
coordinates: [-122.0, 37.0],
},
- polygon: RadrootsGeoJsonPolygon {
+ polygon: GeoJsonPolygon {
r#type: "Polygon".to_string(),
coordinates: vec![vec![
[-122.0, 37.0],
diff --git a/crates/event_codec/src/post/admission.rs b/crates/event_codec/src/post/admission.rs
@@ -1,6 +1,6 @@
use core::fmt;
-use radroots_event::{contract::RadrootsEventContract, envelope::RadrootsEventEnvelope};
+use radroots_event::{contract::EventContract, envelope::EventEnvelope};
use crate::{
post::inbound::{
@@ -23,7 +23,7 @@ impl RadrootsAdmittedRootPostEvent {
&self.verified_event
}
- pub fn event(&self) -> &RadrootsEventEnvelope {
+ pub fn event(&self) -> &EventEnvelope {
self.verified_event.event()
}
@@ -31,7 +31,7 @@ impl RadrootsAdmittedRootPostEvent {
&self.projection
}
- pub fn contract(&self) -> &'static RadrootsEventContract {
+ pub fn contract(&self) -> &'static EventContract {
debug_assert!(self.projection.classification().is_root_card());
radroots_event::contract::event_contract(self.projection.classification().contract_id())
.expect("root post projection contract IDs are registry-owned")
@@ -62,7 +62,7 @@ impl RadrootsThreadExcludedPostCandidate {
&self.verified_event
}
- pub fn event(&self) -> &RadrootsEventEnvelope {
+ pub fn event(&self) -> &EventEnvelope {
self.verified_event.event()
}
@@ -165,7 +165,7 @@ pub fn admit_verified_post_event(
/// A verified thread candidate is returned as thread-excluded compatibility
/// data; this boundary does not claim that it is a valid Radroots reply.
pub fn verify_and_admit_post_event(
- event: RadrootsEventEnvelope,
+ event: EventEnvelope,
) -> Result<RadrootsPostAdmissionOutcome, RadrootsPostAdmissionError> {
admit_verified_post_event(verify_nip01_event(event)?)
}
diff --git a/crates/event_codec/src/post/authored.rs b/crates/event_codec/src/post/authored.rs
@@ -8,17 +8,15 @@ use alloc::{
use radroots_event::{
envelope::kind::KIND_POST,
post::{
- RADROOTS_ASK_MARKER_TAG_KEY, RADROOTS_ASK_MARKER_TAG_VALUE, RadrootsAuthoredAsk,
- RadrootsAuthoredPhotoUpdate, RadrootsAuthoredPostImage, RadrootsAuthoredUpdate,
+ AuthoredAsk, AuthoredPhotoUpdate, AuthoredPostImage, AuthoredUpdate,
+ RADROOTS_ASK_MARKER_TAG_KEY, RADROOTS_ASK_MARKER_TAG_VALUE,
},
- wire::RadrootsNip01EventWireParts,
+ wire::Nip01EventWireParts,
};
/// Builds deterministic unsigned kind-1 wire parts for a strict Update.
-pub fn authored_update_to_wire_parts(
- update: &RadrootsAuthoredUpdate,
-) -> RadrootsNip01EventWireParts {
- RadrootsNip01EventWireParts {
+pub fn authored_update_to_wire_parts(update: &AuthoredUpdate) -> Nip01EventWireParts {
+ Nip01EventWireParts {
kind: KIND_POST,
content: update.content().to_string(),
tags: Vec::new(),
@@ -29,10 +27,8 @@ pub fn authored_update_to_wire_parts(
///
/// The caller must separately establish successful BUD-02 upload completion
/// for every image before passing these parts to a signing boundary.
-pub fn authored_photo_update_to_wire_parts(
- photo: &RadrootsAuthoredPhotoUpdate,
-) -> RadrootsNip01EventWireParts {
- RadrootsNip01EventWireParts {
+pub fn authored_photo_update_to_wire_parts(photo: &AuthoredPhotoUpdate) -> Nip01EventWireParts {
+ Nip01EventWireParts {
kind: KIND_POST,
content: photo.content().to_string(),
tags: image_tags(photo.images()),
@@ -44,21 +40,21 @@ pub fn authored_photo_update_to_wire_parts(
/// The exact Ask marker is emitted first. Optional media uses the same strict
/// NIP-92 profile as PhotoUpdate. Upload completion remains a separate runtime
/// precondition before signing.
-pub fn authored_ask_to_wire_parts(ask: &RadrootsAuthoredAsk) -> RadrootsNip01EventWireParts {
+pub fn authored_ask_to_wire_parts(ask: &AuthoredAsk) -> Nip01EventWireParts {
let mut tags = Vec::with_capacity(1 + ask.images().len());
tags.push(vec![
RADROOTS_ASK_MARKER_TAG_KEY.to_string(),
RADROOTS_ASK_MARKER_TAG_VALUE.to_string(),
]);
tags.extend(image_tags(ask.images()));
- RadrootsNip01EventWireParts {
+ Nip01EventWireParts {
kind: KIND_POST,
content: ask.content().to_string(),
tags,
}
}
-fn image_tags(images: &[RadrootsAuthoredPostImage]) -> Vec<Vec<String>> {
+fn image_tags(images: &[AuthoredPostImage]) -> Vec<Vec<String>> {
images
.iter()
.map(|image| image.imeta_tag().to_vec())
diff --git a/crates/event_codec/src/post/decode.rs b/crates/event_codec/src/post/decode.rs
@@ -7,9 +7,8 @@ use alloc::{
use radroots_event::{
envelope::kind::{KIND_FARM, KIND_POST},
- farm::RadrootsFarmRef,
- post::RadrootsPost,
- social::{RadrootsSocialFarmAnchor, RadrootsSocialMediaMetadata, RadrootsSocialTarget},
+ farm::FarmRef,
+ social::{SocialFarmAnchor, SocialLocation, SocialMediaMetadata, SocialTarget},
tag::name::{TAG_A, TAG_IMETA, TAG_Q, TAG_T},
};
@@ -20,7 +19,47 @@ use crate::social_helpers::{location_from_tags, parse_dimensions_tag};
const DEFAULT_KIND: u32 = KIND_POST;
-pub fn post_from_content(kind: u32, content: &str) -> Result<RadrootsPost, EventParseError> {
+/// Temporary compatibility projection for pre-v1 post consumers.
+///
+/// This type is quarantined in the non-publishable intermediate codec surface
+/// and must be removed with the superseded codec APIs in Step 087.
+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
+#[derive(Clone, Debug)]
+pub struct LegacyPost {
+ pub content: String,
+ #[cfg_attr(
+ feature = "serde",
+ serde(default, skip_serializing_if = "Option::is_none")
+ )]
+ pub farm: Option<SocialFarmAnchor>,
+ #[cfg_attr(
+ feature = "serde",
+ serde(default, skip_serializing_if = "Option::is_none")
+ )]
+ pub address_refs: Option<Vec<SocialTarget>>,
+ #[cfg_attr(
+ feature = "serde",
+ serde(default, skip_serializing_if = "Option::is_none")
+ )]
+ pub location: Option<SocialLocation>,
+ #[cfg_attr(
+ feature = "serde",
+ serde(default, skip_serializing_if = "Option::is_none")
+ )]
+ pub topics: Option<Vec<String>>,
+ #[cfg_attr(
+ feature = "serde",
+ serde(default, skip_serializing_if = "Option::is_none")
+ )]
+ pub quote_refs: Option<Vec<SocialTarget>>,
+ #[cfg_attr(
+ feature = "serde",
+ serde(default, skip_serializing_if = "Option::is_none")
+ )]
+ pub media: Option<Vec<SocialMediaMetadata>>,
+}
+
+pub fn post_from_content(kind: u32, content: &str) -> Result<LegacyPost, EventParseError> {
if kind != DEFAULT_KIND {
return Err(EventParseError::InvalidKind {
expected: "1",
@@ -30,7 +69,7 @@ pub fn post_from_content(kind: u32, content: &str) -> Result<RadrootsPost, Event
if content.trim().is_empty() {
return Err(EventParseError::InvalidTag("content"));
}
- Ok(RadrootsPost {
+ Ok(LegacyPost {
content: content.to_string(),
farm: None,
address_refs: None,
@@ -45,7 +84,7 @@ pub fn post_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsPost, EventParseError> {
+) -> Result<LegacyPost, EventParseError> {
let mut post = post_from_content(kind, content)?;
post.farm = farm_anchor_from_tags(tags)?;
post.address_refs = address_refs_from_tags(tags)?;
@@ -63,7 +102,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsPost>, EventParseError> {
+) -> Result<RadrootsParsedData<LegacyPost>, EventParseError> {
let post = post_from_event(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -82,7 +121,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsPost>, EventParseError> {
+) -> Result<RadrootsParsedEvent<LegacyPost>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
@@ -96,7 +135,7 @@ pub fn parsed_from_event(
fn farm_anchor_from_tags(
tags: &[Vec<String>],
-) -> Result<Option<RadrootsSocialFarmAnchor>, EventParseError> {
+) -> Result<Option<SocialFarmAnchor>, EventParseError> {
for tag in tags
.iter()
.filter(|tag| tag.first().map(|value| value.as_str()) == Some(TAG_A))
@@ -109,8 +148,8 @@ fn farm_anchor_from_tags(
} else {
None
};
- return Ok(Some(RadrootsSocialFarmAnchor {
- farm: RadrootsFarmRef {
+ return Ok(Some(SocialFarmAnchor {
+ farm: FarmRef {
pubkey: address.pubkey,
d_tag: address.d_tag,
},
@@ -123,7 +162,7 @@ fn farm_anchor_from_tags(
fn address_refs_from_tags(
tags: &[Vec<String>],
-) -> Result<Option<Vec<RadrootsSocialTarget>>, EventParseError> {
+) -> Result<Option<Vec<SocialTarget>>, EventParseError> {
let mut refs = Vec::new();
for tag in tags
.iter()
@@ -139,7 +178,7 @@ fn address_refs_from_tags(
} else {
None
};
- refs.push(RadrootsSocialTarget::Address {
+ refs.push(SocialTarget::Address {
address: value.clone(),
author: Some(address.pubkey),
event_kind: Some(address.kind),
@@ -151,7 +190,7 @@ fn address_refs_from_tags(
fn quote_refs_from_tags(
tags: &[Vec<String>],
-) -> Result<Option<Vec<RadrootsSocialTarget>>, EventParseError> {
+) -> Result<Option<Vec<SocialTarget>>, EventParseError> {
let mut refs = Vec::new();
for tag in tags
.iter()
@@ -164,7 +203,7 @@ fn quote_refs_from_tags(
None
};
match parse_address_tag(value, TAG_Q) {
- Ok(address) => refs.push(RadrootsSocialTarget::Address {
+ Ok(address) => refs.push(SocialTarget::Address {
address: value.clone(),
author: Some(address.pubkey),
event_kind: Some(address.kind),
@@ -172,7 +211,7 @@ fn quote_refs_from_tags(
}),
Err(_) => {
validate_lowercase_hex_64_tag(value, TAG_Q)?;
- refs.push(RadrootsSocialTarget::Event {
+ refs.push(SocialTarget::Event {
id: value.clone(),
author: None,
event_kind: None,
@@ -186,7 +225,7 @@ fn quote_refs_from_tags(
fn media_from_tags(
tags: &[Vec<String>],
-) -> Result<Option<Vec<RadrootsSocialMediaMetadata>>, EventParseError> {
+) -> Result<Option<Vec<SocialMediaMetadata>>, EventParseError> {
let mut media = Vec::new();
for tag in tags
.iter()
@@ -199,9 +238,9 @@ fn media_from_tags(
if raw.iter().any(|value| value.trim().is_empty()) {
return Err(EventParseError::InvalidTag(TAG_IMETA));
}
- let mut item = RadrootsSocialMediaMetadata {
+ let mut item = SocialMediaMetadata {
imeta: Some(vec![raw.clone()]),
- ..RadrootsSocialMediaMetadata::default()
+ ..SocialMediaMetadata::default()
};
for entry in raw {
parse_imeta_entry(&mut item, &entry)?;
@@ -211,10 +250,7 @@ fn media_from_tags(
Ok(non_empty_vec(media))
}
-fn parse_imeta_entry(
- item: &mut RadrootsSocialMediaMetadata,
- entry: &str,
-) -> Result<(), EventParseError> {
+fn parse_imeta_entry(item: &mut SocialMediaMetadata, entry: &str) -> Result<(), EventParseError> {
let Some((key, value)) = entry.split_once(' ') else {
return Err(EventParseError::InvalidTag(TAG_IMETA));
};
@@ -264,6 +300,25 @@ fn non_empty_vec<T>(values: Vec<T>) -> Option<Vec<T>> {
mod tests {
use super::*;
+ #[cfg(feature = "serde")]
+ #[test]
+ fn content_only_legacy_post_round_trips_without_null_metadata() {
+ let post: LegacyPost =
+ serde_json::from_str(r#"{"content":"farm update"}"#).expect("legacy post");
+
+ assert_eq!(post.content, "farm update");
+ assert!(post.farm.is_none());
+ assert!(post.address_refs.is_none());
+ assert!(post.location.is_none());
+ assert!(post.topics.is_none());
+ assert!(post.quote_refs.is_none());
+ assert!(post.media.is_none());
+ assert_eq!(
+ serde_json::to_string(&post).expect("legacy post JSON"),
+ r#"{"content":"farm update"}"#
+ );
+ }
+
#[test]
fn post_decode_accepts_address_ref_without_relays_and_unknown_imeta_keys() {
let author = "a".repeat(64);
@@ -287,7 +342,7 @@ mod tests {
let refs = post.address_refs.expect("address refs");
assert!(matches!(
&refs[0],
- RadrootsSocialTarget::Address { relays: None, .. }
+ SocialTarget::Address { relays: None, .. }
));
let media = post.media.expect("media");
assert_eq!(
diff --git a/crates/event_codec/src/post/inbound/registry_v7.rs b/crates/event_codec/src/post/inbound/registry_v7.rs
@@ -14,9 +14,9 @@ use std::collections::{BTreeMap, BTreeSet};
use radroots_event::{
envelope::kind::KIND_POST,
post::{
- RADROOTS_ASK_MARKER_TAG_VALUE, RADROOTS_POST_ALT_MAX_BYTES,
+ PostImageDimensions, RADROOTS_ASK_MARKER_TAG_VALUE, RADROOTS_POST_ALT_MAX_BYTES,
RADROOTS_POST_CONTENT_MAX_BYTES, RADROOTS_POST_IMETA_MAX_COUNT,
- RadrootsPostImageDimensions, post_image_media_type_is_valid, post_media_http_url_is_valid,
+ post_image_media_type_is_valid, post_media_http_url_is_valid,
},
};
@@ -114,7 +114,7 @@ pub struct RadrootsInboundPostImeta {
url: Option<String>,
sha256: Option<String>,
media_type: Option<String>,
- dimensions: Option<RadrootsPostImageDimensions>,
+ dimensions: Option<PostImageDimensions>,
size: Option<u64>,
alt: Option<String>,
fallbacks: Vec<String>,
@@ -139,7 +139,7 @@ impl RadrootsInboundPostImeta {
self.media_type.as_deref()
}
- pub const fn dimensions(&self) -> Option<RadrootsPostImageDimensions> {
+ pub const fn dimensions(&self) -> Option<PostImageDimensions> {
self.dimensions
}
@@ -478,12 +478,12 @@ fn lower_hex_64(value: &str) -> bool {
.all(|byte| byte.is_ascii_digit() || matches!(byte, b'a'..=b'f'))
}
-fn parse_dimensions(value: &str) -> Option<RadrootsPostImageDimensions> {
+fn parse_dimensions(value: &str) -> Option<PostImageDimensions> {
let (width, height) = value.split_once('x')?;
if !canonical_nonzero_decimal(width) || !canonical_nonzero_decimal(height) {
return None;
}
- RadrootsPostImageDimensions::new(width.parse().ok()?, height.parse().ok()?).ok()
+ PostImageDimensions::new(width.parse().ok()?, height.parse().ok()?).ok()
}
fn parse_nonzero_u64(value: &str) -> Option<u64> {
diff --git a/crates/event_codec/src/post/inbound/registry_v7/tests.rs b/crates/event_codec/src/post/inbound/registry_v7/tests.rs
@@ -1,5 +1,5 @@
use super::*;
-use radroots_event::post::RadrootsAuthoredUpdate;
+use radroots_event::post::AuthoredUpdate;
#[test]
fn thread_exclusion_precedes_ask_and_media_projection() {
@@ -268,7 +268,7 @@ fn empty_inbound_root_is_update_without_becoming_valid_authored_content() {
projection.classification(),
RadrootsPostClassification::Update
);
- assert!(RadrootsAuthoredUpdate::new("\t").is_err());
+ assert!(AuthoredUpdate::new("\t").is_err());
}
#[test]
diff --git a/crates/event_codec/src/profile/admission.rs b/crates/event_codec/src/profile/admission.rs
@@ -1,8 +1,8 @@
use core::fmt;
use radroots_event::{
- contract::{RadrootsEventContract, event_contract},
- envelope::RadrootsEventEnvelope,
+ contract::{EventContract, event_contract},
+ envelope::EventEnvelope,
envelope::kind::KIND_PROFILE,
};
@@ -26,7 +26,7 @@ impl RadrootsAdmittedProfileEvent {
&self.verified_event
}
- pub fn event(&self) -> &RadrootsEventEnvelope {
+ pub fn event(&self) -> &EventEnvelope {
self.verified_event.event()
}
@@ -34,7 +34,7 @@ impl RadrootsAdmittedProfileEvent {
&self.metadata
}
- pub fn contract(&self) -> &'static RadrootsEventContract {
+ pub fn contract(&self) -> &'static EventContract {
event_contract("radroots.profile.metadata.v1")
.expect("Profile metadata contract is registry-owned")
}
@@ -125,7 +125,7 @@ pub fn admit_verified_profile_event(
/// Verifies id and signature before parsing and admitting exact kind-0 content.
pub fn verify_and_admit_profile_event(
- event: RadrootsEventEnvelope,
+ event: EventEnvelope,
) -> Result<RadrootsAdmittedProfileEvent, RadrootsProfileAdmissionError> {
admit_verified_profile_event(verify_nip01_event(event)?)
}
diff --git a/crates/event_codec/src/profile/authored.rs b/crates/event_codec/src/profile/authored.rs
@@ -4,8 +4,8 @@ use core::fmt;
use radroots_event::{
envelope::kind::KIND_PROFILE,
- profile::{RADROOTS_PROFILE_METADATA_MAX_CONTENT_BYTES, RadrootsAuthoredProfile},
- wire::RadrootsNip01EventWireParts,
+ profile::{AuthoredProfile, RADROOTS_PROFILE_METADATA_MAX_CONTENT_BYTES},
+ wire::Nip01EventWireParts,
};
use serde::Serialize;
@@ -66,8 +66,8 @@ struct AuthoredProfileMetadata<'a> {
/// The caller must separately prove successful BUD-02 upload completion before
/// passing media-bearing output to a signing boundary.
pub fn authored_profile_to_wire_parts(
- profile: &RadrootsAuthoredProfile,
-) -> Result<RadrootsNip01EventWireParts, RadrootsAuthoredProfileEncodeError> {
+ profile: &AuthoredProfile,
+) -> Result<Nip01EventWireParts, RadrootsAuthoredProfileEncodeError> {
let metadata = AuthoredProfileMetadata {
name: profile.name(),
display_name: profile.display_name(),
@@ -90,7 +90,7 @@ pub fn authored_profile_to_wire_parts(
}
let content = serde_json::to_string(&metadata)
.expect("authored Profile metadata contains only infallible JSON scalar types");
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind: KIND_PROFILE,
content,
tags: Vec::new(),
@@ -150,7 +150,7 @@ fn json_string_encoded_len(value: &str) -> usize {
#[cfg(test)]
mod tests {
use super::*;
- use radroots_event::profile::RadrootsNip05Identifier;
+ use radroots_event::profile::Nip05Identifier;
#[test]
fn preflight_length_matches_compact_json_escaping() {
@@ -160,11 +160,11 @@ mod tests {
serde_json::to_string(escaped).unwrap().len()
);
- let profile = RadrootsAuthoredProfile::new("farm \\\"one\\\"")
+ let profile = AuthoredProfile::new("farm \\\"one\\\"")
.unwrap()
.with_display_name(escaped)
.with_about("Victoria \u{e9}")
- .with_nip05(RadrootsNip05Identifier::parse("farm@example.com").unwrap())
+ .with_nip05(Nip05Identifier::parse("farm@example.com").unwrap())
.with_bot(true);
let wire = authored_profile_to_wire_parts(&profile).unwrap();
let metadata = AuthoredProfileMetadata {
diff --git a/crates/event_codec/src/profile/decode.rs b/crates/event_codec/src/profile/decode.rs
@@ -4,13 +4,10 @@ use alloc::{
vec::Vec,
};
-use super::RadrootsProfileData;
+use super::{LegacyProfile, RadrootsProfileData};
use radroots_event::{
envelope::kind::KIND_PROFILE,
- profile::{
- RADROOTS_PROFILE_TYPE_TAG_KEY, RadrootsProfile, RadrootsProfileType,
- radroots_profile_type_from_tag_value,
- },
+ profile::{ProfileType, RADROOTS_PROFILE_TYPE_TAG_KEY, radroots_profile_type_from_tag_value},
};
use crate::error::EventParseError;
@@ -34,7 +31,7 @@ fn parse_bot(value: &Value) -> Option<String> {
}
}
-fn profile_type_from_tags(tags: &[Vec<String>]) -> Option<RadrootsProfileType> {
+fn profile_type_from_tags(tags: &[Vec<String>]) -> Option<ProfileType> {
tags.iter()
.filter(|tag| tag.first().map(|v| v.as_str()) == Some(RADROOTS_PROFILE_TYPE_TAG_KEY))
.filter_map(|tag| tag.get(1))
@@ -46,7 +43,7 @@ fn profile_type_from_tags(tags: &[Vec<String>]) -> Option<RadrootsProfileType> {
/// This API requires `name`, coerces Boolean `bot` to a string, and discards
/// unprojected fields. Use `profile.parse_inbound_metadata` for the tolerant
/// inbound metadata contract.
-pub fn profile_from_content(content: &str) -> Result<RadrootsProfile, EventParseError> {
+pub fn profile_from_content(content: &str) -> Result<LegacyProfile, EventParseError> {
let value: Value =
serde_json::from_str(content).map_err(|_| EventParseError::InvalidJson("content"))?;
let obj = value
@@ -57,7 +54,7 @@ pub fn profile_from_content(content: &str) -> Result<RadrootsProfile, EventParse
.and_then(|v| v.as_str())
.ok_or(EventParseError::InvalidJson("name"))?;
- Ok(RadrootsProfile {
+ Ok(LegacyProfile {
name: name.to_string(),
display_name: parse_optional_string(&value, "display_name"),
nip05: parse_optional_string(&value, "nip05"),
diff --git a/crates/event_codec/src/profile/inbound/registry_v7.rs b/crates/event_codec/src/profile/inbound/registry_v7.rs
@@ -10,9 +10,7 @@ use std::{collections::BTreeMap, string::String};
use core::fmt;
-use radroots_event::profile::{
- RADROOTS_PROFILE_METADATA_MAX_CONTENT_BYTES, RadrootsNip05Identifier,
-};
+use radroots_event::profile::{Nip05Identifier, RADROOTS_PROFILE_METADATA_MAX_CONTENT_BYTES};
use serde::de::{IgnoredAny, MapAccess, SeqAccess, Visitor};
use serde::{Deserialize, Deserializer};
use serde_json::Value;
@@ -110,7 +108,7 @@ pub struct RadrootsInboundProfileMetadata {
about: Option<String>,
picture: Option<RadrootsUnverifiedProfileMediaReference>,
banner: Option<RadrootsUnverifiedProfileMediaReference>,
- nip05: Option<RadrootsNip05Identifier>,
+ nip05: Option<Nip05Identifier>,
bot: Option<bool>,
}
@@ -148,7 +146,7 @@ impl RadrootsInboundProfileMetadata {
}
/// Returns only a syntax-checked identifier; no NIP-05 resolution occurred.
- pub fn nip05(&self) -> Option<&RadrootsNip05Identifier> {
+ pub fn nip05(&self) -> Option<&Nip05Identifier> {
self.nip05.as_ref()
}
@@ -242,9 +240,9 @@ fn project_bool(
fn project_nip05(
raw_fields: &BTreeMap<String, Value>,
residual_fields: &mut BTreeMap<String, Value>,
-) -> Option<RadrootsNip05Identifier> {
+) -> Option<Nip05Identifier> {
let value = raw_fields.get("nip05")?.as_str()?;
- let identifier = RadrootsNip05Identifier::parse(value).ok()?;
+ let identifier = Nip05Identifier::parse(value).ok()?;
residual_fields.remove("nip05");
Some(identifier)
}
diff --git a/crates/event_codec/src/profile/mod.rs b/crates/event_codec/src/profile/mod.rs
@@ -1,7 +1,12 @@
#[cfg(not(feature = "std"))]
extern crate alloc;
-use radroots_event::profile::{RadrootsProfile, RadrootsProfileType};
+use radroots_event::profile::ProfileType;
+
+#[cfg(feature = "std")]
+type LegacyProfileString = std::string::String;
+#[cfg(not(feature = "std"))]
+type LegacyProfileString = alloc::string::String;
#[cfg(feature = "serde_json")]
pub mod admission;
@@ -15,9 +20,29 @@ pub mod decode;
#[cfg(feature = "serde_json")]
pub mod inbound;
+/// Temporary lossy compatibility projection for pre-v1 profile consumers.
+///
+/// Strict reads use `inbound::RadrootsInboundProfileMetadata`. This type is
+/// quarantined in the non-publishable intermediate codec surface and must be
+/// removed with the superseded codec APIs in Step 087.
+#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
+#[derive(Clone, Debug)]
+pub struct LegacyProfile {
+ pub name: LegacyProfileString,
+ pub display_name: Option<LegacyProfileString>,
+ pub nip05: Option<LegacyProfileString>,
+ pub about: Option<LegacyProfileString>,
+ pub website: Option<LegacyProfileString>,
+ pub picture: Option<LegacyProfileString>,
+ pub banner: Option<LegacyProfileString>,
+ pub lud06: Option<LegacyProfileString>,
+ pub lud16: Option<LegacyProfileString>,
+ pub bot: Option<LegacyProfileString>,
+}
+
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
#[derive(Clone, Debug)]
pub struct RadrootsProfileData {
- pub profile_type: Option<RadrootsProfileType>,
- pub profile: RadrootsProfile,
+ pub profile_type: Option<ProfileType>,
+ pub profile: LegacyProfile,
}
diff --git a/crates/event_codec/src/reaction/decode.rs b/crates/event_codec/src/reaction/decode.rs
@@ -5,7 +5,7 @@ use alloc::{
};
use radroots_event::{
- envelope::kind::KIND_REACTION, post::reaction::RadrootsReaction, social::RadrootsSocialTarget,
+ envelope::kind::KIND_REACTION, post::reaction::Reaction, social::SocialTarget,
tag::name::TAG_E_ROOT,
};
@@ -19,7 +19,7 @@ pub fn reaction_from_tags(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsReaction, EventParseError> {
+) -> Result<Reaction, EventParseError> {
if kind != DEFAULT_KIND {
return Err(EventParseError::InvalidKind {
expected: "7",
@@ -33,7 +33,7 @@ pub fn reaction_from_tags(
return Err(EventParseError::InvalidTag(TAG_E_ROOT));
}
let target = parse_reaction_target(tags)?;
- Ok(RadrootsReaction {
+ Ok(Reaction {
target,
content: content.to_string(),
})
@@ -46,7 +46,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsReaction>, EventParseError> {
+) -> Result<RadrootsParsedData<Reaction>, EventParseError> {
let reaction = reaction_from_tags(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -65,7 +65,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsReaction>, EventParseError> {
+) -> Result<RadrootsParsedEvent<Reaction>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
@@ -77,7 +77,7 @@ pub fn parsed_from_event(
RadrootsParsedEvent::from_event_parts(id, author, published_at, kind, content, tags, sig, data)
}
-fn parse_reaction_target(tags: &[Vec<String>]) -> Result<RadrootsSocialTarget, EventParseError> {
+fn parse_reaction_target(tags: &[Vec<String>]) -> Result<SocialTarget, EventParseError> {
let event_tag = find_tag(tags, "e");
let address_tag = find_tag(tags, "a");
match (event_tag, address_tag) {
@@ -94,7 +94,7 @@ fn parse_reaction_target(tags: &[Vec<String>]) -> Result<RadrootsSocialTarget, E
} else {
None
};
- Ok(RadrootsSocialTarget::Event {
+ Ok(SocialTarget::Event {
id,
author: optional_tag_value(tags, "p")?,
event_kind: optional_numeric_tag(tags, "k")?,
@@ -120,7 +120,7 @@ fn parse_reaction_target(tags: &[Vec<String>]) -> Result<RadrootsSocialTarget, E
} else {
None
};
- Ok(RadrootsSocialTarget::Address {
+ Ok(SocialTarget::Address {
address: value,
author: Some(author),
event_kind: Some(kind),
diff --git a/crates/event_codec/src/reaction/encode.rs b/crates/event_codec/src/reaction/encode.rs
@@ -7,40 +7,36 @@ use alloc::{
};
use radroots_event::{
- envelope::kind::KIND_REACTION, post::reaction::RadrootsReaction, social::RadrootsSocialTarget,
+ envelope::kind::KIND_REACTION, post::reaction::Reaction, social::SocialTarget,
};
use crate::error::EventEncodeError;
use crate::field_helpers::{
parse_address_tag, validate_lowercase_hex_64, validate_non_empty_field,
};
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
const DEFAULT_KIND: u32 = KIND_REACTION;
-pub fn reaction_build_tags(
- reaction: &RadrootsReaction,
-) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn reaction_build_tags(reaction: &Reaction) -> Result<Vec<Vec<String>>, EventEncodeError> {
let mut tags = Vec::with_capacity(4);
push_reaction_target(&mut tags, &reaction.target)?;
Ok(tags)
}
-pub fn to_wire_parts(
- reaction: &RadrootsReaction,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+pub fn to_wire_parts(reaction: &Reaction) -> Result<Nip01EventWireParts, EventEncodeError> {
to_wire_parts_with_kind(reaction, DEFAULT_KIND)
}
pub fn to_wire_parts_with_kind(
- reaction: &RadrootsReaction,
+ reaction: &Reaction,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != DEFAULT_KIND {
return Err(EventEncodeError::InvalidKind(kind));
}
let tags = reaction_build_tags(reaction)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content: reaction.content.clone(),
tags,
@@ -49,10 +45,10 @@ pub fn to_wire_parts_with_kind(
fn push_reaction_target(
tags: &mut Vec<Vec<String>>,
- target: &RadrootsSocialTarget,
+ target: &SocialTarget,
) -> Result<(), EventEncodeError> {
match target {
- RadrootsSocialTarget::Event {
+ SocialTarget::Event {
id,
author,
event_kind,
@@ -74,7 +70,7 @@ fn push_reaction_target(
tags.push(vec!["k".to_string(), kind.to_string()]);
}
}
- RadrootsSocialTarget::Address {
+ SocialTarget::Address {
address,
author,
event_kind,
@@ -105,7 +101,7 @@ fn push_reaction_target(
tags.push(vec!["p".to_string(), parsed.pubkey]);
tags.push(vec!["k".to_string(), parsed.kind.to_string()]);
}
- RadrootsSocialTarget::External { .. } => {
+ SocialTarget::External { .. } => {
return Err(EventEncodeError::InvalidField("target"));
}
}
@@ -118,8 +114,8 @@ mod tests {
#[test]
fn reaction_event_target_encodes_without_relays() {
- let reaction = RadrootsReaction {
- target: RadrootsSocialTarget::Event {
+ let reaction = Reaction {
+ target: SocialTarget::Event {
id: "a".repeat(64),
author: Some("b".repeat(64)),
event_kind: Some(1),
diff --git a/crates/event_codec/src/relay_auth/decode.rs b/crates/event_codec/src/relay_auth/decode.rs
@@ -2,7 +2,7 @@
use alloc::{string::String, vec::Vec};
use radroots_event::{
- social::relay_auth::{KIND_RELAY_AUTH, RadrootsRelayAuth},
+ social::relay_auth::{KIND_RELAY_AUTH, RelayAuth},
tag::name::{TAG_CHALLENGE, TAG_RELAY},
};
@@ -16,7 +16,7 @@ pub fn relay_auth_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsRelayAuth, EventParseError> {
+) -> Result<RelayAuth, EventParseError> {
if kind != KIND_RELAY_AUTH {
return Err(EventParseError::InvalidKind {
expected: EXPECTED_KIND,
@@ -24,7 +24,7 @@ pub fn relay_auth_from_event(
});
}
require_empty_content(content, "content")?;
- Ok(RadrootsRelayAuth {
+ Ok(RelayAuth {
relay: required_tag_value(tags, TAG_RELAY)?,
challenge: required_tag_value(tags, TAG_CHALLENGE)?,
})
@@ -37,7 +37,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsRelayAuth>, EventParseError> {
+) -> Result<RadrootsParsedData<RelayAuth>, EventParseError> {
let auth = relay_auth_from_event(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -56,7 +56,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsRelayAuth>, EventParseError> {
+) -> Result<RadrootsParsedEvent<RelayAuth>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
diff --git a/crates/event_codec/src/relay_auth/encode.rs b/crates/event_codec/src/relay_auth/encode.rs
@@ -2,17 +2,15 @@
use alloc::{string::String, vec::Vec};
use radroots_event::{
- social::relay_auth::{KIND_RELAY_AUTH, RadrootsRelayAuth},
+ social::relay_auth::{KIND_RELAY_AUTH, RelayAuth},
tag::name::{TAG_CHALLENGE, TAG_RELAY},
};
use crate::error::EventEncodeError;
use crate::field_helpers::{push_tag, validate_non_empty_field};
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
-pub fn relay_auth_build_tags(
- auth: &RadrootsRelayAuth,
-) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn relay_auth_build_tags(auth: &RelayAuth) -> Result<Vec<Vec<String>>, EventEncodeError> {
validate_non_empty_field(&auth.relay, "relay")?;
validate_non_empty_field(&auth.challenge, "challenge")?;
let mut tags = Vec::new();
@@ -21,21 +19,19 @@ pub fn relay_auth_build_tags(
Ok(tags)
}
-pub fn to_wire_parts(
- auth: &RadrootsRelayAuth,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+pub fn to_wire_parts(auth: &RelayAuth) -> Result<Nip01EventWireParts, EventEncodeError> {
to_wire_parts_with_kind(auth, KIND_RELAY_AUTH)
}
pub fn to_wire_parts_with_kind(
- auth: &RadrootsRelayAuth,
+ auth: &RelayAuth,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != KIND_RELAY_AUTH {
return Err(EventEncodeError::InvalidKind(kind));
}
let tags = relay_auth_build_tags(auth)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content: String::new(),
tags,
diff --git a/crates/event_codec/src/relay_auth/mod.rs b/crates/event_codec/src/relay_auth/mod.rs
@@ -3,7 +3,7 @@ pub mod encode;
#[cfg(test)]
mod tests {
- use radroots_event::{envelope::kind::KIND_POST, social::relay_auth::RadrootsRelayAuth};
+ use radroots_event::{envelope::kind::KIND_POST, social::relay_auth::RelayAuth};
use crate::error::{EventEncodeError, EventParseError};
use crate::relay_auth::decode::{data_from_event, parsed_from_event, relay_auth_from_event};
@@ -146,8 +146,8 @@ mod tests {
assert_eq!(parsed.data.data, auth);
}
- fn sample_auth() -> RadrootsRelayAuth {
- RadrootsRelayAuth {
+ fn sample_auth() -> RelayAuth {
+ RelayAuth {
relay: "wss://relay.example.invalid/farm/field-group".to_string(),
challenge: "relay-provided-challenge".to_string(),
}
diff --git a/crates/event_codec/src/relay_document/decode.rs b/crates/event_codec/src/relay_document/decode.rs
@@ -1,9 +1,9 @@
#![cfg(feature = "serde_json")]
-use radroots_event::social::relay_document::RadrootsRelayDocument;
+use radroots_event::social::relay_document::RelayDocument;
use crate::error::EventParseError;
-pub fn from_json(content: &str) -> Result<RadrootsRelayDocument, EventParseError> {
+pub fn from_json(content: &str) -> Result<RelayDocument, EventParseError> {
serde_json::from_str(content).map_err(|_| EventParseError::InvalidJson("relay_document"))
}
diff --git a/crates/event_codec/src/relay_document/encode.rs b/crates/event_codec/src/relay_document/encode.rs
@@ -3,10 +3,10 @@
#[cfg(not(feature = "std"))]
use alloc::string::String;
-use radroots_event::social::relay_document::RadrootsRelayDocument;
+use radroots_event::social::relay_document::RelayDocument;
use crate::error::EventEncodeError;
-pub fn to_json(doc: &RadrootsRelayDocument) -> Result<String, EventEncodeError> {
+pub fn to_json(doc: &RelayDocument) -> Result<String, EventEncodeError> {
serde_json::to_string(doc).map_err(|_| EventEncodeError::Json)
}
diff --git a/crates/event_codec/src/reply/admission.rs b/crates/event_codec/src/reply/admission.rs
@@ -1,6 +1,6 @@
use core::fmt;
-use radroots_event::{contract::RadrootsEventContract, envelope::RadrootsEventEnvelope};
+use radroots_event::{contract::EventContract, envelope::EventEnvelope};
use crate::{
post::admission::RadrootsThreadExcludedPostCandidate,
@@ -25,7 +25,7 @@ impl RadrootsAdmittedNip10ReplyEvent {
&self.verified_event
}
- pub fn event(&self) -> &RadrootsEventEnvelope {
+ pub fn event(&self) -> &EventEnvelope {
self.verified_event.event()
}
@@ -33,7 +33,7 @@ impl RadrootsAdmittedNip10ReplyEvent {
&self.projection
}
- pub fn contract(&self) -> &'static RadrootsEventContract {
+ pub fn contract(&self) -> &'static EventContract {
radroots_event::contract::event_contract(self.projection.contract_id())
.expect("NIP-10 Reply contract is registry-owned")
}
@@ -114,7 +114,7 @@ pub fn admit_thread_excluded_post_candidate(
}
pub fn verify_and_admit_nip10_reply_event(
- event: RadrootsEventEnvelope,
+ event: EventEnvelope,
) -> Result<RadrootsAdmittedNip10ReplyEvent, RadrootsNip10ReplyAdmissionError> {
admit_verified_nip10_reply_event(verify_nip01_event(event)?)
}
diff --git a/crates/event_codec/src/reply/authored.rs b/crates/event_codec/src/reply/authored.rs
@@ -7,15 +7,13 @@ use alloc::{
use radroots_event::{
envelope::kind::KIND_POST,
- post::reply::{RadrootsAuthoredNip10Reply, RadrootsNip10ReplyReference},
- wire::RadrootsNip01EventWireParts,
+ post::reply::{AuthoredNip10Reply, Nip10ReplyReference},
+ wire::Nip01EventWireParts,
};
/// Builds deterministic unsigned kind-1 wire parts for a strict marked NIP-10
/// reply.
-pub fn authored_nip10_reply_to_wire_parts(
- reply: &RadrootsAuthoredNip10Reply,
-) -> RadrootsNip01EventWireParts {
+pub fn authored_nip10_reply_to_wire_parts(reply: &AuthoredNip10Reply) -> Nip01EventWireParts {
let mut tags = Vec::with_capacity(if reply.parent().is_some() { 4 } else { 2 });
tags.push(event_tag(reply.root(), "root"));
if let Some(parent) = reply.parent() {
@@ -28,14 +26,14 @@ pub fn authored_nip10_reply_to_wire_parts(
{
tags.push(public_key_tag(parent));
}
- RadrootsNip01EventWireParts {
+ Nip01EventWireParts {
kind: KIND_POST,
content: reply.content().to_string(),
tags,
}
}
-fn event_tag(reference: &RadrootsNip10ReplyReference, marker: &str) -> Vec<String> {
+fn event_tag(reference: &Nip10ReplyReference, marker: &str) -> Vec<String> {
vec![
"e".to_string(),
reference.event_id().to_hex(),
@@ -44,7 +42,7 @@ fn event_tag(reference: &RadrootsNip10ReplyReference, marker: &str) -> Vec<Strin
]
}
-fn public_key_tag(reference: &RadrootsNip10ReplyReference) -> Vec<String> {
+fn public_key_tag(reference: &Nip10ReplyReference) -> Vec<String> {
vec!["p".to_string(), reference.author().to_hex()]
}
@@ -59,12 +57,9 @@ mod tests {
#[test]
fn nested_reply_deduplicates_equal_reference_authors() {
let author = h('b');
- let root =
- RadrootsNip10ReplyReference::parse(h('a'), &author, None).expect("root reference");
- let parent =
- RadrootsNip10ReplyReference::parse(h('c'), &author, None).expect("parent reference");
- let reply =
- RadrootsAuthoredNip10Reply::nested("Reply", root, parent).expect("nested reply");
+ let root = Nip10ReplyReference::parse(h('a'), &author, None).expect("root reference");
+ let parent = Nip10ReplyReference::parse(h('c'), &author, None).expect("parent reference");
+ let reply = AuthoredNip10Reply::nested("Reply", root, parent).expect("nested reply");
assert_eq!(
authored_nip10_reply_to_wire_parts(&reply).tags,
diff --git a/crates/event_codec/src/reply/inbound/registry_v7.rs b/crates/event_codec/src/reply/inbound/registry_v7.rs
@@ -8,12 +8,12 @@ use std::collections::BTreeSet;
use radroots_event::{
envelope::kind::KIND_POST,
- id::{RadrootsEventId, RadrootsIdParseError},
+ id::{EventId, ParseError},
post::{
RADROOTS_POST_CONTENT_MAX_BYTES, RADROOTS_POST_EVENT_WIRE_MAX_BYTES,
RADROOTS_POST_TAG_ELEMENT_MAX_BYTES, RADROOTS_POST_TAG_TOTAL_MAX_BYTES,
},
- tag::relay_hint::RadrootsNostrRelayHint,
+ tag::relay_hint::NostrRelayHint,
};
use radroots_identity::{Error as PublicKeyError, PublicKey};
@@ -50,7 +50,7 @@ pub enum RadrootsNip10ReplyDiagnostic {
ReferenceRelayIgnored {
tag_index: usize,
raw_tag: Vec<String>,
- error: RadrootsIdParseError,
+ error: ParseError,
},
ReferenceAuthorIgnored {
tag_index: usize,
@@ -64,7 +64,7 @@ pub enum RadrootsNip10ReplyDiagnostic {
CitationEventIdIgnored {
tag_index: usize,
raw_tag: Vec<String>,
- error: RadrootsIdParseError,
+ error: ParseError,
},
CitationMarkerIgnored {
tag_index: usize,
@@ -82,7 +82,7 @@ pub enum RadrootsNip10ReplyDiagnostic {
ReplyAuthorRelayIgnored {
tag_index: usize,
raw_tag: Vec<String>,
- error: RadrootsIdParseError,
+ error: ParseError,
},
ReplyAuthorDuplicateIgnored {
tag_index: usize,
@@ -148,8 +148,8 @@ impl RadrootsNip10ReplyDiagnostic {
pub struct RadrootsInboundNip10EventReference {
tag_index: usize,
raw_tag: Vec<String>,
- event_id: RadrootsEventId,
- relay: Option<RadrootsNostrRelayHint>,
+ event_id: EventId,
+ relay: Option<NostrRelayHint>,
author_hint: Option<PublicKey>,
}
@@ -162,11 +162,11 @@ impl RadrootsInboundNip10EventReference {
&self.raw_tag
}
- pub const fn event_id(&self) -> &RadrootsEventId {
+ pub const fn event_id(&self) -> &EventId {
&self.event_id
}
- pub const fn relay(&self) -> Option<&RadrootsNostrRelayHint> {
+ pub const fn relay(&self) -> Option<&NostrRelayHint> {
self.relay.as_ref()
}
@@ -180,7 +180,7 @@ pub struct RadrootsInboundNip10Participant {
tag_index: usize,
raw_tag: Vec<String>,
pubkey: PublicKey,
- relay: Option<RadrootsNostrRelayHint>,
+ relay: Option<NostrRelayHint>,
}
impl RadrootsInboundNip10Participant {
@@ -196,7 +196,7 @@ impl RadrootsInboundNip10Participant {
&self.pubkey
}
- pub const fn relay(&self) -> Option<&RadrootsNostrRelayHint> {
+ pub const fn relay(&self) -> Option<&NostrRelayHint> {
self.relay.as_ref()
}
}
@@ -268,7 +268,7 @@ pub enum RadrootsNip10ReplyProjectionError {
},
EventIdInvalid {
tag_index: usize,
- error: RadrootsIdParseError,
+ error: ParseError,
},
ReplyReferenceAmbiguous,
TagElementTooLarge {
@@ -560,7 +560,7 @@ fn parse_event_reference(
.get(1)
.ok_or(RadrootsNip10ReplyProjectionError::EventReferenceShape { tag_index })
.and_then(|value| {
- RadrootsEventId::parse(value).map_err(|error| {
+ EventId::parse(value).map_err(|error| {
RadrootsNip10ReplyProjectionError::EventIdInvalid { tag_index, error }
})
})?;
@@ -629,7 +629,7 @@ fn project_supplemental_reference(
return None;
}
}
- let event_id = match RadrootsEventId::parse(&tag[1]) {
+ let event_id = match EventId::parse(&tag[1]) {
Ok(event_id) => event_id,
Err(error) => {
diagnostics.push(RadrootsNip10ReplyDiagnostic::CitationEventIdIgnored {
@@ -745,12 +745,10 @@ fn project_participants(
participants
}
-fn parse_relay_hint(
- value: Option<&str>,
-) -> Result<Option<RadrootsNostrRelayHint>, RadrootsIdParseError> {
+fn parse_relay_hint(value: Option<&str>) -> Result<Option<NostrRelayHint>, ParseError> {
match value {
None | Some("") => Ok(None),
- Some(value) => RadrootsNostrRelayHint::parse(value).map(Some),
+ Some(value) => NostrRelayHint::parse(value).map(Some),
}
}
diff --git a/crates/event_codec/src/reply/inbound/registry_v7/tests.rs b/crates/event_codec/src/reply/inbound/registry_v7/tests.rs
@@ -199,7 +199,7 @@ fn inbound_relay_syntax_and_tag_element_budgets_remain_separate() {
"a".repeat(RADROOTS_POST_TAG_ELEMENT_MAX_BYTES + 1 - prefix.len())
);
assert_eq!(relay.len(), RADROOTS_POST_TAG_ELEMENT_MAX_BYTES + 1);
- RadrootsNostrRelayHint::parse(&relay).expect("relay syntax has no Reply wire budget");
+ NostrRelayHint::parse(&relay).expect("relay syntax has no Reply wire budget");
let tags = vec![
vec!["e".to_string(), h('a'), relay, "root".to_string()],
diff --git a/crates/event_codec/src/report/decode.rs b/crates/event_codec/src/report/decode.rs
@@ -6,8 +6,8 @@ use alloc::{
use radroots_event::{
envelope::kind::KIND_REPORT,
- post::report::RadrootsReport,
- social::{RadrootsReportFileTarget, RadrootsReportType, RadrootsSocialTarget},
+ post::report::Report,
+ social::{ReportFileTarget, ReportType, SocialTarget},
tag::name::{TAG_A, TAG_E, TAG_MAGNET, TAG_P, TAG_SERVER, TAG_SHA256},
};
@@ -20,7 +20,7 @@ pub fn report_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsReport, EventParseError> {
+) -> Result<Report, EventParseError> {
if kind != KIND_REPORT {
return Err(EventParseError::InvalidKind {
expected: "1984",
@@ -39,7 +39,7 @@ pub fn report_from_event(
)?;
let event = parse_event_target(tags, &report_type)?;
let file = parse_file_target(tags, &report_type)?;
- Ok(RadrootsReport {
+ Ok(Report {
reported_pubkey,
report_type,
event,
@@ -59,7 +59,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsReport>, EventParseError> {
+) -> Result<RadrootsParsedData<Report>, EventParseError> {
let report = report_from_event(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -78,7 +78,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsReport>, EventParseError> {
+) -> Result<RadrootsParsedEvent<Report>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
@@ -92,8 +92,8 @@ pub fn parsed_from_event(
fn parse_event_target(
tags: &[Vec<String>],
- report_type: &RadrootsReportType,
-) -> Result<Option<RadrootsSocialTarget>, EventParseError> {
+ report_type: &ReportType,
+) -> Result<Option<SocialTarget>, EventParseError> {
if let Some(tag) = find_tag(tags, TAG_A) {
validate_optional_target_report_type(tag, 2, report_type, TAG_A)?;
let value = tag
@@ -101,7 +101,7 @@ fn parse_event_target(
.cloned()
.ok_or(EventParseError::InvalidTag(TAG_A))?;
let address = parse_address_tag(&value, TAG_A)?;
- return Ok(Some(RadrootsSocialTarget::Address {
+ return Ok(Some(SocialTarget::Address {
address: value,
author: Some(address.pubkey),
event_kind: Some(address.kind),
@@ -115,7 +115,7 @@ fn parse_event_target(
.cloned()
.ok_or(EventParseError::InvalidTag(TAG_E))?;
validate_lowercase_hex_64_tag(&id, TAG_E)?;
- return Ok(Some(RadrootsSocialTarget::Event {
+ return Ok(Some(SocialTarget::Event {
id,
author: first_tag_value(tags, TAG_P),
event_kind: None,
@@ -127,8 +127,8 @@ fn parse_event_target(
fn parse_file_target(
tags: &[Vec<String>],
- report_type: &RadrootsReportType,
-) -> Result<Option<RadrootsReportFileTarget>, EventParseError> {
+ report_type: &ReportType,
+) -> Result<Option<ReportFileTarget>, EventParseError> {
let sha256 = if let Some(tag) = find_tag(tags, TAG_SHA256) {
validate_optional_target_report_type(tag, 2, report_type, TAG_SHA256)?;
let value = tag
@@ -145,7 +145,7 @@ fn parse_file_target(
if sha256.is_none() && url.is_none() && magnet.is_none() {
Ok(None)
} else {
- Ok(Some(RadrootsReportFileTarget {
+ Ok(Some(ReportFileTarget {
sha256,
url,
magnet,
@@ -156,7 +156,7 @@ fn parse_file_target(
fn validate_optional_target_report_type(
tag: &[String],
index: usize,
- expected: &RadrootsReportType,
+ expected: &ReportType,
tag_name: &'static str,
) -> Result<(), EventParseError> {
let Some(value) = tag.get(index) else {
@@ -169,18 +169,15 @@ fn validate_optional_target_report_type(
}
}
-fn parse_report_type(
- value: &str,
- tag_name: &'static str,
-) -> Result<RadrootsReportType, EventParseError> {
+fn parse_report_type(value: &str, tag_name: &'static str) -> Result<ReportType, EventParseError> {
match value {
- "nudity" => Ok(RadrootsReportType::Nudity),
- "malware" => Ok(RadrootsReportType::Malware),
- "profanity" => Ok(RadrootsReportType::Profanity),
- "illegal" => Ok(RadrootsReportType::Illegal),
- "spam" => Ok(RadrootsReportType::Spam),
- "impersonation" => Ok(RadrootsReportType::Impersonation),
- "other" => Ok(RadrootsReportType::Other),
+ "nudity" => Ok(ReportType::Nudity),
+ "malware" => Ok(ReportType::Malware),
+ "profanity" => Ok(ReportType::Profanity),
+ "illegal" => Ok(ReportType::Illegal),
+ "spam" => Ok(ReportType::Spam),
+ "impersonation" => Ok(ReportType::Impersonation),
+ "other" => Ok(ReportType::Other),
_ => Err(EventParseError::InvalidTag(tag_name)),
}
}
diff --git a/crates/event_codec/src/report/encode.rs b/crates/event_codec/src/report/encode.rs
@@ -8,8 +8,8 @@ use alloc::{
use radroots_event::{
envelope::kind::KIND_REPORT,
- post::report::RadrootsReport,
- social::{RadrootsReportFileTarget, RadrootsReportType, RadrootsSocialTarget},
+ post::report::Report,
+ social::{ReportFileTarget, ReportType, SocialTarget},
tag::name::{TAG_A, TAG_E, TAG_MAGNET, TAG_P, TAG_SERVER, TAG_SHA256},
};
@@ -18,9 +18,9 @@ use crate::field_helpers::{
parse_address_tag, push_tag, validate_lowercase_hex_64, validate_non_empty_field,
};
use crate::social_helpers::validate_http_url;
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
-pub fn report_build_tags(report: &RadrootsReport) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn report_build_tags(report: &Report) -> Result<Vec<Vec<String>>, EventEncodeError> {
validate_report(report)?;
let report_type = report_type_as_str(&report.report_type);
let mut tags = Vec::new();
@@ -38,27 +38,25 @@ pub fn report_build_tags(report: &RadrootsReport) -> Result<Vec<Vec<String>>, Ev
Ok(tags)
}
-pub fn to_wire_parts(
- report: &RadrootsReport,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+pub fn to_wire_parts(report: &Report) -> Result<Nip01EventWireParts, EventEncodeError> {
to_wire_parts_with_kind(report, KIND_REPORT)
}
pub fn to_wire_parts_with_kind(
- report: &RadrootsReport,
+ report: &Report,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != KIND_REPORT {
return Err(EventEncodeError::InvalidKind(kind));
}
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content: report.content.clone().unwrap_or_default(),
tags: report_build_tags(report)?,
})
}
-fn validate_report(report: &RadrootsReport) -> Result<(), EventEncodeError> {
+fn validate_report(report: &Report) -> Result<(), EventEncodeError> {
validate_non_empty_field(&report.reported_pubkey, "reported_pubkey")?;
validate_lowercase_hex_64(&report.reported_pubkey, "reported_pubkey")?;
if let Some(file) = report.file.as_ref() {
@@ -69,11 +67,11 @@ fn validate_report(report: &RadrootsReport) -> Result<(), EventEncodeError> {
fn push_report_event_target(
tags: &mut Vec<Vec<String>>,
- target: &RadrootsSocialTarget,
+ target: &SocialTarget,
report_type: &'static str,
) -> Result<(), EventEncodeError> {
match target {
- RadrootsSocialTarget::Event { id, relays, .. } => {
+ SocialTarget::Event { id, relays, .. } => {
validate_lowercase_hex_64(id, "event.id")?;
let mut tag = vec![TAG_E.to_string(), id.clone(), report_type.to_string()];
if let Some(relays) = relays.as_ref() {
@@ -87,7 +85,7 @@ fn push_report_event_target(
tags.push(tag);
Ok(())
}
- RadrootsSocialTarget::Address {
+ SocialTarget::Address {
address, relays, ..
} => {
let address = parse_address_tag(address, "event.address")
@@ -108,13 +106,13 @@ fn push_report_event_target(
tags.push(tag);
Ok(())
}
- RadrootsSocialTarget::External { .. } => Err(EventEncodeError::InvalidField("event")),
+ SocialTarget::External { .. } => Err(EventEncodeError::InvalidField("event")),
}
}
fn push_report_file_target(
tags: &mut Vec<Vec<String>>,
- file: &RadrootsReportFileTarget,
+ file: &ReportFileTarget,
report_type: &'static str,
) -> Result<(), EventEncodeError> {
if let Some(hash) = file.sha256.as_deref() {
@@ -133,7 +131,7 @@ fn push_report_file_target(
Ok(())
}
-fn validate_file_target(file: &RadrootsReportFileTarget) -> Result<(), EventEncodeError> {
+fn validate_file_target(file: &ReportFileTarget) -> Result<(), EventEncodeError> {
if file.sha256.is_none() && file.url.is_none() && file.magnet.is_none() {
return Err(EventEncodeError::EmptyRequiredField("file"));
}
@@ -149,14 +147,14 @@ fn validate_file_target(file: &RadrootsReportFileTarget) -> Result<(), EventEnco
Ok(())
}
-fn report_type_as_str(report_type: &RadrootsReportType) -> &'static str {
+fn report_type_as_str(report_type: &ReportType) -> &'static str {
match report_type {
- RadrootsReportType::Nudity => "nudity",
- RadrootsReportType::Malware => "malware",
- RadrootsReportType::Profanity => "profanity",
- RadrootsReportType::Illegal => "illegal",
- RadrootsReportType::Spam => "spam",
- RadrootsReportType::Impersonation => "impersonation",
- RadrootsReportType::Other => "other",
+ ReportType::Nudity => "nudity",
+ ReportType::Malware => "malware",
+ ReportType::Profanity => "profanity",
+ ReportType::Illegal => "illegal",
+ ReportType::Spam => "spam",
+ ReportType::Impersonation => "impersonation",
+ ReportType::Other => "other",
}
}
diff --git a/crates/event_codec/src/repost/decode.rs b/crates/event_codec/src/repost/decode.rs
@@ -6,8 +6,8 @@ use alloc::{
use radroots_event::{
envelope::kind::{KIND_GENERIC_REPOST, KIND_POST, KIND_REPOST},
- post::repost::{RadrootsGenericRepost, RadrootsRepost},
- social::RadrootsSocialTarget,
+ post::repost::{GenericRepost, Repost},
+ social::SocialTarget,
tag::name::{TAG_A, TAG_E, TAG_K, TAG_P},
};
@@ -20,7 +20,7 @@ pub fn repost_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsRepost, EventParseError> {
+) -> Result<Repost, EventParseError> {
if kind != KIND_REPOST {
return Err(EventParseError::InvalidKind {
expected: "6",
@@ -33,8 +33,8 @@ pub fn repost_from_event(
.cloned()
.ok_or(EventParseError::InvalidTag(TAG_E))?;
validate_lowercase_hex_64_tag(&id, TAG_E)?;
- Ok(RadrootsRepost {
- target: RadrootsSocialTarget::Event {
+ Ok(Repost {
+ target: SocialTarget::Event {
id,
author: first_tag_value(tags, TAG_P),
event_kind: Some(KIND_POST),
@@ -48,7 +48,7 @@ pub fn generic_repost_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsGenericRepost, EventParseError> {
+) -> Result<GenericRepost, EventParseError> {
if kind != KIND_GENERIC_REPOST {
return Err(EventParseError::InvalidKind {
expected: "16",
@@ -70,7 +70,7 @@ pub fn generic_repost_from_event(
if address.kind != target_kind {
return Err(EventParseError::InvalidTag(TAG_A));
}
- RadrootsSocialTarget::Address {
+ SocialTarget::Address {
address: value,
author: Some(address.pubkey),
event_kind: Some(target_kind),
@@ -82,7 +82,7 @@ pub fn generic_repost_from_event(
.cloned()
.ok_or(EventParseError::InvalidTag(TAG_E))?;
validate_lowercase_hex_64_tag(&id, TAG_E)?;
- RadrootsSocialTarget::Event {
+ SocialTarget::Event {
id,
author: first_tag_value(tags, TAG_P),
event_kind: Some(target_kind),
@@ -91,7 +91,7 @@ pub fn generic_repost_from_event(
} else {
return Err(EventParseError::MissingTag(TAG_E));
};
- Ok(RadrootsGenericRepost {
+ Ok(GenericRepost {
target,
target_kind,
content: optional_content(content),
@@ -105,7 +105,7 @@ pub fn repost_data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsRepost>, EventParseError> {
+) -> Result<RadrootsParsedData<Repost>, EventParseError> {
let repost = repost_from_event(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -123,7 +123,7 @@ pub fn generic_repost_data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsGenericRepost>, EventParseError> {
+) -> Result<RadrootsParsedData<GenericRepost>, EventParseError> {
let repost = generic_repost_from_event(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -142,7 +142,7 @@ pub fn repost_parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsRepost>, EventParseError> {
+) -> Result<RadrootsParsedEvent<Repost>, EventParseError> {
let data = repost_data_from_event(
id.clone(),
author.clone(),
@@ -162,7 +162,7 @@ pub fn generic_repost_parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsGenericRepost>, EventParseError> {
+) -> Result<RadrootsParsedEvent<GenericRepost>, EventParseError> {
let data = generic_repost_data_from_event(
id.clone(),
author.clone(),
diff --git a/crates/event_codec/src/repost/encode.rs b/crates/event_codec/src/repost/encode.rs
@@ -8,8 +8,8 @@ use alloc::{
use radroots_event::{
envelope::kind::{KIND_GENERIC_REPOST, KIND_POST, KIND_REPOST},
- post::repost::{RadrootsGenericRepost, RadrootsRepost},
- social::RadrootsSocialTarget,
+ post::repost::{GenericRepost, Repost},
+ social::SocialTarget,
tag::name::{TAG_A, TAG_E, TAG_K, TAG_P},
};
@@ -17,16 +17,16 @@ use crate::error::EventEncodeError;
use crate::field_helpers::{
parse_address_tag, push_tag, validate_lowercase_hex_64, validate_non_empty_field,
};
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
-pub fn repost_build_tags(repost: &RadrootsRepost) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn repost_build_tags(repost: &Repost) -> Result<Vec<Vec<String>>, EventEncodeError> {
let mut tags = Vec::new();
push_event_target(&mut tags, &repost.target, KIND_POST, "target")?;
Ok(tags)
}
pub fn generic_repost_build_tags(
- repost: &RadrootsGenericRepost,
+ repost: &GenericRepost,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
validate_generic_target_kind(repost.target_kind)?;
let mut tags = Vec::new();
@@ -35,26 +35,24 @@ pub fn generic_repost_build_tags(
Ok(tags)
}
-pub fn repost_to_wire_parts(
- repost: &RadrootsRepost,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+pub fn repost_to_wire_parts(repost: &Repost) -> Result<Nip01EventWireParts, EventEncodeError> {
repost_to_wire_parts_with_kind(repost, KIND_REPOST)
}
pub fn generic_repost_to_wire_parts(
- repost: &RadrootsGenericRepost,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ repost: &GenericRepost,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
generic_repost_to_wire_parts_with_kind(repost, KIND_GENERIC_REPOST)
}
pub fn repost_to_wire_parts_with_kind(
- repost: &RadrootsRepost,
+ repost: &Repost,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != KIND_REPOST {
return Err(EventEncodeError::InvalidKind(kind));
}
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content: repost.content.clone().unwrap_or_default(),
tags: repost_build_tags(repost)?,
@@ -62,13 +60,13 @@ pub fn repost_to_wire_parts_with_kind(
}
pub fn generic_repost_to_wire_parts_with_kind(
- repost: &RadrootsGenericRepost,
+ repost: &GenericRepost,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != KIND_GENERIC_REPOST {
return Err(EventEncodeError::InvalidKind(kind));
}
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content: repost.content.clone().unwrap_or_default(),
tags: generic_repost_build_tags(repost)?,
@@ -77,11 +75,11 @@ pub fn generic_repost_to_wire_parts_with_kind(
fn push_event_target(
tags: &mut Vec<Vec<String>>,
- target: &RadrootsSocialTarget,
+ target: &SocialTarget,
expected_kind: u32,
field: &'static str,
) -> Result<(), EventEncodeError> {
- let RadrootsSocialTarget::Event {
+ let SocialTarget::Event {
id,
author,
event_kind,
@@ -111,11 +109,11 @@ fn push_event_target(
fn push_generic_target(
tags: &mut Vec<Vec<String>>,
- target: &RadrootsSocialTarget,
+ target: &SocialTarget,
expected_kind: u32,
) -> Result<(), EventEncodeError> {
match target {
- RadrootsSocialTarget::Event {
+ SocialTarget::Event {
id,
author,
event_kind,
@@ -139,7 +137,7 @@ fn push_generic_target(
}
Ok(())
}
- RadrootsSocialTarget::Address {
+ SocialTarget::Address {
address,
author,
event_kind,
@@ -169,7 +167,7 @@ fn push_generic_target(
}
Ok(())
}
- RadrootsSocialTarget::External { .. } => Err(EventEncodeError::InvalidField("target")),
+ SocialTarget::External { .. } => Err(EventEncodeError::InvalidField("target")),
}
}
diff --git a/crates/event_codec/src/resource_area/decode.rs b/crates/event_codec/src/resource_area/decode.rs
@@ -7,7 +7,7 @@ use alloc::{
};
use radroots_event::{
- envelope::kind::KIND_RESOURCE_AREA, farm::resource_area::RadrootsResourceArea, tag::name::TAG_D,
+ envelope::kind::KIND_RESOURCE_AREA, farm::resource_area::ResourceArea, tag::name::TAG_D,
};
use crate::d_tag::validate_d_tag_tag;
@@ -36,7 +36,7 @@ pub fn resource_area_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsResourceArea, EventParseError> {
+) -> Result<ResourceArea, EventParseError> {
if kind != DEFAULT_KIND {
return Err(EventParseError::InvalidKind {
expected: "30370",
@@ -47,7 +47,7 @@ pub fn resource_area_from_event(
return Err(EventParseError::InvalidJson("content"));
}
let d_tag = parse_d_tag(tags)?;
- let mut area: RadrootsResourceArea =
+ let mut area: ResourceArea =
serde_json::from_str(content).map_err(|_| EventParseError::InvalidJson("content"))?;
if area.d_tag.trim().is_empty() {
@@ -66,7 +66,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsResourceArea>, EventParseError> {
+) -> Result<RadrootsParsedData<ResourceArea>, EventParseError> {
let area = resource_area_from_event(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -85,7 +85,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsResourceArea>, EventParseError> {
+) -> Result<RadrootsParsedEvent<ResourceArea>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
diff --git a/crates/event_codec/src/resource_area/encode.rs b/crates/event_codec/src/resource_area/encode.rs
@@ -7,7 +7,7 @@ use alloc::{
use radroots_event::{
envelope::kind::KIND_RESOURCE_AREA,
- farm::resource_area::{RadrootsResourceArea, RadrootsResourceAreaRef},
+ farm::resource_area::{ResourceArea, ResourceAreaRef},
tag::name::TAG_D,
};
@@ -15,7 +15,7 @@ use crate::d_tag::validate_d_tag;
use crate::error::EventEncodeError;
#[cfg(feature = "serde_json")]
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
const TAG_T: &str = "t";
const TAG_G: &str = "g";
@@ -26,7 +26,7 @@ fn push_tag(tags: &mut Vec<Vec<String>>, key: &str, value: &str) {
tags.push(vec![key.to_string(), value.to_string()]);
}
-fn resource_area_address(area: &RadrootsResourceAreaRef) -> Result<String, EventEncodeError> {
+fn resource_area_address(area: &ResourceAreaRef) -> Result<String, EventEncodeError> {
if area.pubkey.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("resource_area.pubkey"));
}
@@ -43,9 +43,7 @@ fn resource_area_address(area: &RadrootsResourceAreaRef) -> Result<String, Event
Ok(addr)
}
-pub fn resource_area_build_tags(
- area: &RadrootsResourceArea,
-) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn resource_area_build_tags(area: &ResourceArea) -> Result<Vec<Vec<String>>, EventEncodeError> {
if area.d_tag.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("d_tag"));
}
@@ -69,7 +67,7 @@ pub fn resource_area_build_tags(
}
pub fn resource_area_ref_tags(
- area: &RadrootsResourceAreaRef,
+ area: &ResourceAreaRef,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
let addr = resource_area_address(area)?;
let mut tags = Vec::with_capacity(2);
@@ -79,23 +77,21 @@ pub fn resource_area_ref_tags(
}
#[cfg(feature = "serde_json")]
-pub fn to_wire_parts(
- area: &RadrootsResourceArea,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+pub fn to_wire_parts(area: &ResourceArea) -> Result<Nip01EventWireParts, EventEncodeError> {
to_wire_parts_with_kind(area, KIND_RESOURCE_AREA)
}
#[cfg(feature = "serde_json")]
pub fn to_wire_parts_with_kind(
- area: &RadrootsResourceArea,
+ area: &ResourceArea,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != KIND_RESOURCE_AREA {
return Err(EventEncodeError::InvalidKind(kind));
}
let tags = resource_area_build_tags(area)?;
let content = serde_json::to_string(area).map_err(|_| EventEncodeError::Json)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content,
tags,
diff --git a/crates/event_codec/src/resource_area/list_sets.rs b/crates/event_codec/src/resource_area/list_sets.rs
@@ -9,10 +9,10 @@ use alloc::{
};
use radroots_event::envelope::kind::{KIND_FARM, KIND_PLOT};
-use radroots_event::farm::RadrootsFarmRef;
-use radroots_event::farm::plot::RadrootsPlotRef;
-use radroots_event::social::list::RadrootsListEntry;
-use radroots_event::social::list_set::RadrootsListSet;
+use radroots_event::farm::FarmRef;
+use radroots_event::farm::plot::PlotRef;
+use radroots_event::social::list::ListEntry;
+use radroots_event::social::list_set::ListSet;
use crate::d_tag::validate_d_tag;
use crate::error::EventEncodeError;
@@ -26,7 +26,7 @@ fn resource_list_set_id(area_id: &str, suffix: &str) -> Result<String, EventEnco
Ok(format!("resource:{area_id}:{suffix}"))
}
-fn list_entries<I, S>(tag: &str, values: I) -> Result<Vec<RadrootsListEntry>, EventEncodeError>
+fn list_entries<I, S>(tag: &str, values: I) -> Result<Vec<ListEntry>, EventEncodeError>
where
I: IntoIterator<Item = S>,
S: AsRef<str>,
@@ -37,7 +37,7 @@ where
if value.is_empty() {
return Err(EventEncodeError::EmptyRequiredField("entry.values"));
}
- entries.push(RadrootsListEntry {
+ entries.push(ListEntry {
tag: tag.to_string(),
values: vec![value.to_string()],
});
@@ -45,7 +45,7 @@ where
Ok(entries)
}
-fn farm_address(farm: &RadrootsFarmRef) -> Result<String, EventEncodeError> {
+fn farm_address(farm: &FarmRef) -> Result<String, EventEncodeError> {
if farm.pubkey.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("farm.pubkey"));
}
@@ -62,7 +62,7 @@ fn farm_address(farm: &RadrootsFarmRef) -> Result<String, EventEncodeError> {
Ok(addr)
}
-fn plot_address(plot: &RadrootsPlotRef) -> Result<String, EventEncodeError> {
+fn plot_address(plot: &PlotRef) -> Result<String, EventEncodeError> {
if plot.pubkey.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("plot.pubkey"));
}
@@ -82,23 +82,23 @@ fn plot_address(plot: &RadrootsPlotRef) -> Result<String, EventEncodeError> {
pub fn resource_area_members_farms_list_set<I>(
area_id: &str,
farms: I,
-) -> Result<RadrootsListSet, EventEncodeError>
+) -> Result<ListSet, EventEncodeError>
where
- I: IntoIterator<Item = RadrootsFarmRef>,
+ I: IntoIterator<Item = FarmRef>,
{
let mut entries = Vec::new();
for farm in farms {
let address = farm_address(&farm)?;
- entries.push(RadrootsListEntry {
+ entries.push(ListEntry {
tag: "a".to_string(),
values: vec![address],
});
- entries.push(RadrootsListEntry {
+ entries.push(ListEntry {
tag: "p".to_string(),
values: vec![farm.pubkey],
});
}
- Ok(RadrootsListSet {
+ Ok(ListSet {
d_tag: resource_list_set_id(area_id, "members.farms")?,
content: String::new(),
entries,
@@ -111,23 +111,23 @@ where
pub fn resource_area_members_plots_list_set<I>(
area_id: &str,
plots: I,
-) -> Result<RadrootsListSet, EventEncodeError>
+) -> Result<ListSet, EventEncodeError>
where
- I: IntoIterator<Item = RadrootsPlotRef>,
+ I: IntoIterator<Item = PlotRef>,
{
let mut entries = Vec::new();
for plot in plots {
let address = plot_address(&plot)?;
- entries.push(RadrootsListEntry {
+ entries.push(ListEntry {
tag: "a".to_string(),
values: vec![address],
});
- entries.push(RadrootsListEntry {
+ entries.push(ListEntry {
tag: "p".to_string(),
values: vec![plot.pubkey],
});
}
- Ok(RadrootsListSet {
+ Ok(ListSet {
d_tag: resource_list_set_id(area_id, "members.plots")?,
content: String::new(),
entries,
@@ -140,12 +140,12 @@ where
pub fn resource_area_stewards_list_set<I, S>(
area_id: &str,
stewards: I,
-) -> Result<RadrootsListSet, EventEncodeError>
+) -> Result<ListSet, EventEncodeError>
where
I: IntoIterator<Item = S>,
S: AsRef<str>,
{
- Ok(RadrootsListSet {
+ Ok(ListSet {
d_tag: resource_list_set_id(area_id, "members.stewards")?,
content: String::new(),
entries: list_entries("p", stewards)?,
@@ -201,7 +201,7 @@ mod tests {
#[test]
fn farm_and_plot_address_helpers_reject_empty_d_tags() {
- let err = farm_address(&RadrootsFarmRef {
+ let err = farm_address(&FarmRef {
pubkey: " ".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
})
@@ -211,7 +211,7 @@ mod tests {
EventEncodeError::EmptyRequiredField("farm.pubkey")
));
- let err = farm_address(&RadrootsFarmRef {
+ let err = farm_address(&FarmRef {
pubkey: "farm_pubkey".to_string(),
d_tag: " ".to_string(),
})
@@ -221,7 +221,7 @@ mod tests {
EventEncodeError::EmptyRequiredField("farm.d_tag")
));
- let err = plot_address(&RadrootsPlotRef {
+ let err = plot_address(&PlotRef {
pubkey: " ".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
})
@@ -231,7 +231,7 @@ mod tests {
EventEncodeError::EmptyRequiredField("plot.pubkey")
));
- let err = plot_address(&RadrootsPlotRef {
+ let err = plot_address(&PlotRef {
pubkey: "plot_pubkey".to_string(),
d_tag: " ".to_string(),
})
@@ -250,7 +250,7 @@ mod tests {
let err = resource_area_members_farms_list_set(
"invalid",
- vec![RadrootsFarmRef {
+ vec![FarmRef {
pubkey: farm_pubkey.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
}],
@@ -260,7 +260,7 @@ mod tests {
let farms = resource_area_members_farms_list_set(
area_id,
- vec![RadrootsFarmRef {
+ vec![FarmRef {
pubkey: farm_pubkey.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
}],
@@ -273,7 +273,7 @@ mod tests {
let err = resource_area_members_farms_list_set(
area_id,
- vec![RadrootsFarmRef {
+ vec![FarmRef {
pubkey: farm_pubkey.to_string(),
d_tag: "invalid".to_string(),
}],
@@ -283,7 +283,7 @@ mod tests {
let plots = resource_area_members_plots_list_set(
area_id,
- vec![RadrootsPlotRef {
+ vec![PlotRef {
pubkey: plot_pubkey.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
}],
@@ -296,7 +296,7 @@ mod tests {
let err = resource_area_members_plots_list_set(
"invalid",
- vec![RadrootsPlotRef {
+ vec![PlotRef {
pubkey: plot_pubkey.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
}],
@@ -306,7 +306,7 @@ mod tests {
let err = resource_area_members_plots_list_set(
area_id,
- vec![RadrootsPlotRef {
+ vec![PlotRef {
pubkey: plot_pubkey.to_string(),
d_tag: "invalid".to_string(),
}],
diff --git a/crates/event_codec/src/resource_area/mod.rs b/crates/event_codec/src/resource_area/mod.rs
@@ -12,30 +12,28 @@ mod tests {
resource_area_members_farms_list_set, resource_area_members_plots_list_set,
resource_area_stewards_list_set,
};
- use radroots_event::farm::RadrootsFarmRef;
- use radroots_event::farm::change_set::{
- RadrootsGcsLocation, RadrootsGeoJsonPoint, RadrootsGeoJsonPolygon,
- };
- use radroots_event::farm::plot::RadrootsPlotRef;
+ use radroots_event::farm::FarmRef;
+ use radroots_event::farm::change_set::{GcsLocation, GeoJsonPoint, GeoJsonPolygon};
+ use radroots_event::farm::plot::PlotRef;
use radroots_event::farm::resource_area::{
- RadrootsResourceArea, RadrootsResourceAreaLocation, RadrootsResourceAreaRef,
+ ResourceArea, ResourceAreaLocation, ResourceAreaRef,
};
- fn sample_location() -> RadrootsResourceAreaLocation {
- RadrootsResourceAreaLocation {
+ fn sample_location() -> ResourceAreaLocation {
+ ResourceAreaLocation {
primary: None,
city: None,
region: None,
country: None,
- gcs: RadrootsGcsLocation {
+ gcs: GcsLocation {
lat: -4.527,
lng: 129.898,
geohash: "pmb5v".to_string(),
- point: RadrootsGeoJsonPoint {
+ point: GeoJsonPoint {
r#type: "Point".to_string(),
coordinates: [129.898, -4.527],
},
- polygon: RadrootsGeoJsonPolygon {
+ polygon: GeoJsonPolygon {
r#type: "Polygon".to_string(),
coordinates: vec![vec![
[129.898, -4.527],
@@ -64,7 +62,7 @@ mod tests {
#[test]
fn resource_area_tags_include_required_fields() {
- let area = RadrootsResourceArea {
+ let area = ResourceArea {
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
name: "Banda Grove".to_string(),
about: None,
@@ -89,7 +87,7 @@ mod tests {
#[test]
fn resource_area_tags_allow_missing_optional_fields() {
- let area = RadrootsResourceArea {
+ let area = ResourceArea {
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
name: "Banda Grove".to_string(),
about: None,
@@ -115,7 +113,7 @@ mod tests {
#[test]
fn resource_area_ref_tags_include_p_and_a() {
- let area_ref = RadrootsResourceAreaRef {
+ let area_ref = ResourceAreaRef {
pubkey: "area_pubkey".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
};
@@ -130,7 +128,7 @@ mod tests {
.any(|tag| tag.first().map(|v| v.as_str()) == Some("a"))
);
- let err = resource_area_ref_tags(&RadrootsResourceAreaRef {
+ let err = resource_area_ref_tags(&ResourceAreaRef {
pubkey: "area_pubkey".to_string(),
d_tag: "invalid".to_string(),
})
@@ -143,7 +141,7 @@ mod tests {
#[test]
fn resource_area_build_tags_rejects_invalid_d_tag() {
- let area = RadrootsResourceArea {
+ let area = ResourceArea {
d_tag: "invalid".to_string(),
name: "Banda Grove".to_string(),
about: None,
@@ -157,7 +155,7 @@ mod tests {
#[test]
fn resource_area_encode_rejects_empty_required_fields() {
- let mut area = RadrootsResourceArea {
+ let mut area = ResourceArea {
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
name: "Banda Grove".to_string(),
about: None,
@@ -182,7 +180,7 @@ mod tests {
EventEncodeError::EmptyRequiredField("location.gcs.geohash")
));
- let err = resource_area_ref_tags(&RadrootsResourceAreaRef {
+ let err = resource_area_ref_tags(&ResourceAreaRef {
pubkey: " ".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
})
@@ -192,7 +190,7 @@ mod tests {
EventEncodeError::EmptyRequiredField("resource_area.pubkey")
));
- let err = resource_area_ref_tags(&RadrootsResourceAreaRef {
+ let err = resource_area_ref_tags(&ResourceAreaRef {
pubkey: "area_pubkey".to_string(),
d_tag: " ".to_string(),
})
@@ -207,7 +205,7 @@ mod tests {
fn resource_area_list_sets_include_expected_tags() {
let farms = resource_area_members_farms_list_set(
"AAAAAAAAAAAAAAAAAAAAAw",
- [RadrootsFarmRef {
+ [FarmRef {
pubkey: "farm_pubkey".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
}],
@@ -219,7 +217,7 @@ mod tests {
let plots = resource_area_members_plots_list_set(
"AAAAAAAAAAAAAAAAAAAAAw",
- [RadrootsPlotRef {
+ [PlotRef {
pubkey: "farm_pubkey".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAQ".to_string(),
}],
diff --git a/crates/event_codec/src/resource_cap/decode.rs b/crates/event_codec/src/resource_cap/decode.rs
@@ -7,7 +7,7 @@ use alloc::{
};
use radroots_event::{
- envelope::kind::KIND_RESOURCE_HARVEST_CAP, farm::resource_cap::RadrootsResourceHarvestCap,
+ envelope::kind::KIND_RESOURCE_HARVEST_CAP, farm::resource_cap::ResourceHarvestCap,
tag::name::TAG_D,
};
@@ -37,7 +37,7 @@ pub fn resource_harvest_cap_from_event(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsResourceHarvestCap, EventParseError> {
+) -> Result<ResourceHarvestCap, EventParseError> {
if kind != DEFAULT_KIND {
return Err(EventParseError::InvalidKind {
expected: "30371",
@@ -48,7 +48,7 @@ pub fn resource_harvest_cap_from_event(
return Err(EventParseError::InvalidJson("content"));
}
let d_tag = parse_d_tag(tags)?;
- let mut cap: RadrootsResourceHarvestCap =
+ let mut cap: ResourceHarvestCap =
serde_json::from_str(content).map_err(|_| EventParseError::InvalidJson("content"))?;
if cap.d_tag.trim().is_empty() {
@@ -67,7 +67,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsResourceHarvestCap>, EventParseError> {
+) -> Result<RadrootsParsedData<ResourceHarvestCap>, EventParseError> {
let cap = resource_harvest_cap_from_event(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(id, author, published_at, kind, cap))
}
@@ -80,7 +80,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsResourceHarvestCap>, EventParseError> {
+) -> Result<RadrootsParsedEvent<ResourceHarvestCap>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
diff --git a/crates/event_codec/src/resource_cap/encode.rs b/crates/event_codec/src/resource_cap/encode.rs
@@ -6,8 +6,7 @@ use alloc::{
};
use radroots_event::{
- envelope::kind::KIND_RESOURCE_AREA, farm::resource_cap::RadrootsResourceHarvestCap,
- tag::name::TAG_D,
+ envelope::kind::KIND_RESOURCE_AREA, farm::resource_cap::ResourceHarvestCap, tag::name::TAG_D,
};
use crate::d_tag::validate_d_tag;
@@ -16,7 +15,7 @@ use crate::error::EventEncodeError;
#[cfg(feature = "serde_json")]
use radroots_event::envelope::kind::KIND_RESOURCE_HARVEST_CAP;
#[cfg(feature = "serde_json")]
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
const TAG_A: &str = "a";
const TAG_P: &str = "p";
@@ -30,7 +29,7 @@ fn push_tag(tags: &mut Vec<Vec<String>>, key: &str, value: &str) {
tags.push(vec![key.to_string(), value.to_string()]);
}
-fn resource_area_address(cap: &RadrootsResourceHarvestCap) -> Result<String, EventEncodeError> {
+fn resource_area_address(cap: &ResourceHarvestCap) -> Result<String, EventEncodeError> {
let area = &cap.resource_area;
if area.pubkey.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("resource_area.pubkey"));
@@ -49,7 +48,7 @@ fn resource_area_address(cap: &RadrootsResourceHarvestCap) -> Result<String, Eve
}
pub fn resource_harvest_cap_build_tags(
- cap: &RadrootsResourceHarvestCap,
+ cap: &ResourceHarvestCap,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
if cap.d_tag.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("d_tag"));
@@ -80,23 +79,21 @@ pub fn resource_harvest_cap_build_tags(
}
#[cfg(feature = "serde_json")]
-pub fn to_wire_parts(
- cap: &RadrootsResourceHarvestCap,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+pub fn to_wire_parts(cap: &ResourceHarvestCap) -> Result<Nip01EventWireParts, EventEncodeError> {
to_wire_parts_with_kind(cap, KIND_RESOURCE_HARVEST_CAP)
}
#[cfg(feature = "serde_json")]
pub fn to_wire_parts_with_kind(
- cap: &RadrootsResourceHarvestCap,
+ cap: &ResourceHarvestCap,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != KIND_RESOURCE_HARVEST_CAP {
return Err(EventEncodeError::InvalidKind(kind));
}
let tags = resource_harvest_cap_build_tags(cap)?;
let content = serde_json::to_string(cap).map_err(|_| EventEncodeError::Json)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind,
content,
tags,
@@ -108,17 +105,17 @@ mod tests {
use super::*;
use crate::test_fixtures::FIXTURE_ALICE_PUBLIC_KEY_HEX;
use radroots_core::{Decimal, Quantity, Unit};
- use radroots_event::farm::resource_area::RadrootsResourceAreaRef;
- use radroots_event::farm::resource_cap::RadrootsResourceHarvestProduct;
+ use radroots_event::farm::resource_area::ResourceAreaRef;
+ use radroots_event::farm::resource_cap::ResourceHarvestProduct;
- fn sample_cap_with_category(category: Option<&str>) -> RadrootsResourceHarvestCap {
- RadrootsResourceHarvestCap {
+ fn sample_cap_with_category(category: Option<&str>) -> ResourceHarvestCap {
+ ResourceHarvestCap {
d_tag: "AAAAAAAAAAAAAAAAAAAABA".to_string(),
- resource_area: RadrootsResourceAreaRef {
+ resource_area: ResourceAreaRef {
pubkey: FIXTURE_ALICE_PUBLIC_KEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
},
- product: RadrootsResourceHarvestProduct {
+ product: ResourceHarvestProduct {
key: "nutmeg".to_string(),
category: category.map(|value| value.to_string()),
},
diff --git a/crates/event_codec/src/resource_cap/mod.rs b/crates/event_codec/src/resource_cap/mod.rs
@@ -8,20 +8,18 @@ mod tests {
use crate::error::EventEncodeError;
use crate::resource_cap::encode::resource_harvest_cap_build_tags;
use radroots_core::{Decimal, Quantity, Unit};
- use radroots_event::farm::resource_area::RadrootsResourceAreaRef;
- use radroots_event::farm::resource_cap::{
- RadrootsResourceHarvestCap, RadrootsResourceHarvestProduct,
- };
+ use radroots_event::farm::resource_area::ResourceAreaRef;
+ use radroots_event::farm::resource_cap::{ResourceHarvestCap, ResourceHarvestProduct};
#[test]
fn resource_harvest_cap_tags_include_required_fields() {
- let cap = RadrootsResourceHarvestCap {
+ let cap = ResourceHarvestCap {
d_tag: "DAAAAAAAAAAAAAAAAAAAAA".to_string(),
- resource_area: RadrootsResourceAreaRef {
+ resource_area: ResourceAreaRef {
pubkey: "area_pubkey".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
},
- product: RadrootsResourceHarvestProduct {
+ product: ResourceHarvestProduct {
key: "nutmeg".to_string(),
category: Some("spice".to_string()),
},
@@ -59,13 +57,13 @@ mod tests {
#[test]
fn resource_harvest_cap_build_tags_rejects_invalid_d_tags() {
- let mut cap = RadrootsResourceHarvestCap {
+ let mut cap = ResourceHarvestCap {
d_tag: "DAAAAAAAAAAAAAAAAAAAAA".to_string(),
- resource_area: RadrootsResourceAreaRef {
+ resource_area: ResourceAreaRef {
pubkey: "area_pubkey".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
},
- product: RadrootsResourceHarvestProduct {
+ product: ResourceHarvestProduct {
key: "nutmeg".to_string(),
category: Some("spice".to_string()),
},
diff --git a/crates/event_codec/src/seal/decode.rs b/crates/event_codec/src/seal/decode.rs
@@ -4,7 +4,7 @@ use alloc::{
vec::Vec,
};
-use radroots_event::{envelope::kind::KIND_SEAL, social::seal::RadrootsSeal};
+use radroots_event::{envelope::kind::KIND_SEAL, social::seal::Seal};
use crate::error::EventParseError;
use crate::parsed::{RadrootsParsedData, RadrootsParsedEvent};
@@ -15,7 +15,7 @@ pub fn seal_from_parts(
kind: u32,
tags: &[Vec<String>],
content: &str,
-) -> Result<RadrootsSeal, EventParseError> {
+) -> Result<Seal, EventParseError> {
if kind != DEFAULT_KIND {
return Err(EventParseError::InvalidKind {
expected: "13",
@@ -28,7 +28,7 @@ pub fn seal_from_parts(
if content.trim().is_empty() {
return Err(EventParseError::InvalidTag("content"));
}
- Ok(RadrootsSeal {
+ Ok(Seal {
content: content.to_string(),
})
}
@@ -40,7 +40,7 @@ pub fn data_from_event(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> Result<RadrootsParsedData<RadrootsSeal>, EventParseError> {
+) -> Result<RadrootsParsedData<Seal>, EventParseError> {
let seal = seal_from_parts(kind, &tags, &content)?;
Ok(RadrootsParsedData::new(
id,
@@ -59,7 +59,7 @@ pub fn parsed_from_event(
content: String,
tags: Vec<Vec<String>>,
sig: String,
-) -> Result<RadrootsParsedEvent<RadrootsSeal>, EventParseError> {
+) -> Result<RadrootsParsedEvent<Seal>, EventParseError> {
let data = data_from_event(
id.clone(),
author.clone(),
diff --git a/crates/event_codec/src/seal/encode.rs b/crates/event_codec/src/seal/encode.rs
@@ -2,23 +2,23 @@
use alloc::{string::String, vec::Vec};
use radroots_event::envelope::kind::KIND_SEAL;
-use radroots_event::social::seal::RadrootsSeal;
+use radroots_event::social::seal::Seal;
use crate::error::EventEncodeError;
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
const DEFAULT_KIND: u32 = KIND_SEAL;
-pub fn seal_build_tags(_seal: &RadrootsSeal) -> Result<Vec<Vec<String>>, EventEncodeError> {
+pub fn seal_build_tags(_seal: &Seal) -> Result<Vec<Vec<String>>, EventEncodeError> {
if _seal.content.trim().is_empty() {
return Err(EventEncodeError::EmptyRequiredField("content"));
}
Ok(Vec::new())
}
-pub fn to_wire_parts(seal: &RadrootsSeal) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+pub fn to_wire_parts(seal: &Seal) -> Result<Nip01EventWireParts, EventEncodeError> {
let tags = seal_build_tags(seal)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind: DEFAULT_KIND,
content: seal.content.clone(),
tags,
@@ -26,9 +26,9 @@ pub fn to_wire_parts(seal: &RadrootsSeal) -> Result<RadrootsNip01EventWireParts,
}
pub fn to_wire_parts_with_kind(
- seal: &RadrootsSeal,
+ seal: &Seal,
kind: u32,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+) -> Result<Nip01EventWireParts, EventEncodeError> {
if kind != DEFAULT_KIND {
return Err(EventEncodeError::InvalidKind(kind));
}
diff --git a/crates/event_codec/src/social_helpers.rs b/crates/event_codec/src/social_helpers.rs
@@ -7,11 +7,8 @@ use alloc::{
};
use radroots_event::{
- calendar::RadrootsCalendarParticipant,
- social::{
- RadrootsSocialFarmAnchor, RadrootsSocialLocation, RadrootsSocialMediaDimensions,
- RadrootsSocialMediaThumbnail,
- },
+ calendar::CalendarParticipant,
+ social::{SocialFarmAnchor, SocialLocation, SocialMediaDimensions, SocialMediaThumbnail},
};
use crate::error::{EventEncodeError, EventParseError};
@@ -25,7 +22,7 @@ pub(crate) fn validate_http_url(value: &str, field: &'static str) -> Result<(),
}
}
-pub(crate) fn push_location_tags(tags: &mut Vec<Vec<String>>, location: &RadrootsSocialLocation) {
+pub(crate) fn push_location_tags(tags: &mut Vec<Vec<String>>, location: &SocialLocation) {
if let Some(name) = location
.name
.as_deref()
@@ -42,17 +39,17 @@ pub(crate) fn push_location_tags(tags: &mut Vec<Vec<String>>, location: &Radroot
}
}
-pub(crate) fn location_from_tags(tags: &[Vec<String>]) -> Option<RadrootsSocialLocation> {
+pub(crate) fn location_from_tags(tags: &[Vec<String>]) -> Option<SocialLocation> {
let name = first_tag_value(tags, "location");
let geohash = first_tag_value(tags, "g");
if name.is_none() && geohash.is_none() {
None
} else {
- Some(RadrootsSocialLocation { name, geohash })
+ Some(SocialLocation { name, geohash })
}
}
-pub(crate) fn push_farm_anchor(tags: &mut Vec<Vec<String>>, farm: &RadrootsSocialFarmAnchor) {
+pub(crate) fn push_farm_anchor(tags: &mut Vec<Vec<String>>, farm: &SocialFarmAnchor) {
if farm.farm.pubkey.trim().is_empty() || farm.farm.d_tag.trim().is_empty() {
return;
}
@@ -62,7 +59,7 @@ pub(crate) fn push_farm_anchor(tags: &mut Vec<Vec<String>>, farm: &RadrootsSocia
pub(crate) fn push_participants(
tags: &mut Vec<Vec<String>>,
- participants: Option<&Vec<RadrootsCalendarParticipant>>,
+ participants: Option<&Vec<CalendarParticipant>>,
) {
let Some(participants) = participants else {
return;
@@ -93,14 +90,14 @@ pub(crate) fn first_tag_value(tags: &[Vec<String>], key: &str) -> Option<String>
.cloned()
}
-pub(crate) fn dimensions_tag(dimensions: &RadrootsSocialMediaDimensions) -> String {
+pub(crate) fn dimensions_tag(dimensions: &SocialMediaDimensions) -> String {
format!("{}x{}", dimensions.width, dimensions.height)
}
pub(crate) fn parse_dimensions_tag(
value: &str,
tag: &'static str,
-) -> Result<RadrootsSocialMediaDimensions, EventParseError> {
+) -> Result<SocialMediaDimensions, EventParseError> {
let Some((width, height)) = value.split_once('x') else {
return Err(EventParseError::InvalidTag(tag));
};
@@ -113,13 +110,10 @@ pub(crate) fn parse_dimensions_tag(
if width == 0 || height == 0 {
return Err(EventParseError::InvalidTag(tag));
}
- Ok(RadrootsSocialMediaDimensions { width, height })
+ Ok(SocialMediaDimensions { width, height })
}
-pub(crate) fn push_thumbnail(
- tags: &mut Vec<Vec<String>>,
- thumbnail: &RadrootsSocialMediaThumbnail,
-) {
+pub(crate) fn push_thumbnail(tags: &mut Vec<Vec<String>>, thumbnail: &SocialMediaThumbnail) {
if thumbnail.url.trim().is_empty() {
return;
}
@@ -153,14 +147,14 @@ mod tests {
let mut tags = Vec::new();
push_location_tags(
&mut tags,
- &RadrootsSocialLocation {
+ &SocialLocation {
name: Some("Pack shed".to_string()),
geohash: Some("c23nb62w20st".to_string()),
},
);
push_participants(
&mut tags,
- Some(&vec![RadrootsCalendarParticipant {
+ Some(&vec![CalendarParticipant {
pubkey: "crew_pubkey".to_string(),
relay: None,
role: Some("participant".to_string()),
@@ -183,7 +177,7 @@ mod tests {
let mut empty_tags = Vec::new();
push_location_tags(
&mut empty_tags,
- &RadrootsSocialLocation {
+ &SocialLocation {
name: Some(" ".to_string()),
geohash: Some(" ".to_string()),
},
@@ -202,8 +196,8 @@ mod tests {
let mut anchor_tags = Vec::new();
push_farm_anchor(
&mut anchor_tags,
- &RadrootsSocialFarmAnchor {
- farm: radroots_event::farm::RadrootsFarmRef {
+ &SocialFarmAnchor {
+ farm: radroots_event::farm::FarmRef {
pubkey: " ".to_string(),
d_tag: "farm-d-tag".to_string(),
},
@@ -212,8 +206,8 @@ mod tests {
);
push_farm_anchor(
&mut anchor_tags,
- &RadrootsSocialFarmAnchor {
- farm: radroots_event::farm::RadrootsFarmRef {
+ &SocialFarmAnchor {
+ farm: radroots_event::farm::FarmRef {
pubkey: "farm_pubkey".to_string(),
d_tag: " ".to_string(),
},
@@ -222,8 +216,8 @@ mod tests {
);
push_farm_anchor(
&mut anchor_tags,
- &RadrootsSocialFarmAnchor {
- farm: radroots_event::farm::RadrootsFarmRef {
+ &SocialFarmAnchor {
+ farm: radroots_event::farm::FarmRef {
pubkey: "farm_pubkey".to_string(),
d_tag: "farm-d-tag".to_string(),
},
@@ -243,17 +237,17 @@ mod tests {
push_participants(
&mut participant_tags,
Some(&vec![
- RadrootsCalendarParticipant {
+ CalendarParticipant {
pubkey: " ".to_string(),
relay: None,
role: None,
},
- RadrootsCalendarParticipant {
+ CalendarParticipant {
pubkey: "crew_pubkey".to_string(),
relay: Some("wss://relay.example.test".to_string()),
role: Some("host".to_string()),
},
- RadrootsCalendarParticipant {
+ CalendarParticipant {
pubkey: "relay_only_pubkey".to_string(),
relay: Some("wss://relay.example.test".to_string()),
role: None,
@@ -299,23 +293,23 @@ mod tests {
let mut thumbnail_tags = Vec::new();
push_thumbnail(
&mut thumbnail_tags,
- &RadrootsSocialMediaThumbnail {
+ &SocialMediaThumbnail {
url: " ".to_string(),
dimensions: None,
},
);
push_thumbnail(
&mut thumbnail_tags,
- &RadrootsSocialMediaThumbnail {
+ &SocialMediaThumbnail {
url: "https://media.example.test/thumb.jpg".to_string(),
dimensions: None,
},
);
push_thumbnail(
&mut thumbnail_tags,
- &RadrootsSocialMediaThumbnail {
+ &SocialMediaThumbnail {
url: "https://media.example.test/thumb-large.jpg".to_string(),
- dimensions: Some(RadrootsSocialMediaDimensions {
+ dimensions: Some(SocialMediaDimensions {
width: 320,
height: 240,
}),
diff --git a/crates/event_codec/src/tag_builders.rs b/crates/event_codec/src/tag_builders.rs
@@ -5,22 +5,18 @@ use alloc::{string::String, vec::Vec};
#[cfg(feature = "knowledge")]
use radroots_event::knowledge::{
- RadrootsContributionAttestation, RadrootsEvidenceBounty, RadrootsKnowledgeChangeProposal,
- RadrootsKnowledgeClaim, RadrootsKnowledgeFieldReport, RadrootsKnowledgeRelation,
- RadrootsKnowledgeReview, RadrootsKnowledgeSource, RadrootsWikiArticle,
- RadrootsWikiMergeRequest, RadrootsWikiRedirect,
+ ContributionAttestation, EvidenceBounty, KnowledgeChangeProposal, KnowledgeClaim,
+ KnowledgeFieldReport, KnowledgeRelation, KnowledgeReview, KnowledgeSource, WikiArticle,
+ WikiMergeRequest, WikiRedirect,
};
use radroots_event::{
- farm::RadrootsFarm, farm::coop::RadrootsCoop, farm::plot::RadrootsPlot,
- farm::resource_area::RadrootsResourceArea, farm::resource_cap::RadrootsResourceHarvestCap,
- listing::operational::RadrootsOperationalListing, post::document::RadrootsDocument,
- post::reaction::RadrootsReaction, social::app_data::RadrootsAppData,
- social::follow::RadrootsFollow, social::geochat::RadrootsGeoChat,
- social::gift_wrap::RadrootsGiftWrap, social::job_feedback::RadrootsJobFeedback,
- social::job_request::RadrootsJobRequest, social::job_result::RadrootsJobResult,
- social::list::RadrootsList, social::list_set::RadrootsListSet,
- social::message::RadrootsMessage, social::message_file::RadrootsMessageFile,
- social::seal::RadrootsSeal,
+ farm::Farm, farm::coop::Coop, farm::plot::Plot, farm::resource_area::ResourceArea,
+ farm::resource_cap::ResourceHarvestCap, listing::operational::OperationalListing,
+ post::document::Document, post::reaction::Reaction, social::app_data::AppData,
+ social::follow::Follow, social::geochat::GeoChat, social::gift_wrap::GiftWrap,
+ social::job_feedback::JobFeedback, social::job_request::JobRequest,
+ social::job_result::JobResult, social::list::List, social::list_set::ListSet,
+ social::message::Message, social::message_file::MessageFile, social::seal::Seal,
};
use crate::app_data::encode::app_data_build_tags;
@@ -59,7 +55,7 @@ pub trait RadrootsEventTagBuilder {
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error>;
}
-impl RadrootsEventTagBuilder for RadrootsOperationalListing {
+impl RadrootsEventTagBuilder for OperationalListing {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -67,7 +63,7 @@ impl RadrootsEventTagBuilder for RadrootsOperationalListing {
}
}
-impl RadrootsEventTagBuilder for RadrootsAppData {
+impl RadrootsEventTagBuilder for AppData {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -75,7 +71,7 @@ impl RadrootsEventTagBuilder for RadrootsAppData {
}
}
-impl RadrootsEventTagBuilder for RadrootsReaction {
+impl RadrootsEventTagBuilder for Reaction {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -83,7 +79,7 @@ impl RadrootsEventTagBuilder for RadrootsReaction {
}
}
-impl RadrootsEventTagBuilder for RadrootsMessage {
+impl RadrootsEventTagBuilder for Message {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -91,7 +87,7 @@ impl RadrootsEventTagBuilder for RadrootsMessage {
}
}
-impl RadrootsEventTagBuilder for RadrootsMessageFile {
+impl RadrootsEventTagBuilder for MessageFile {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -99,7 +95,7 @@ impl RadrootsEventTagBuilder for RadrootsMessageFile {
}
}
-impl RadrootsEventTagBuilder for RadrootsGeoChat {
+impl RadrootsEventTagBuilder for GeoChat {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -107,7 +103,7 @@ impl RadrootsEventTagBuilder for RadrootsGeoChat {
}
}
-impl RadrootsEventTagBuilder for RadrootsFollow {
+impl RadrootsEventTagBuilder for Follow {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -115,7 +111,7 @@ impl RadrootsEventTagBuilder for RadrootsFollow {
}
}
-impl RadrootsEventTagBuilder for RadrootsFarm {
+impl RadrootsEventTagBuilder for Farm {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -123,7 +119,7 @@ impl RadrootsEventTagBuilder for RadrootsFarm {
}
}
-impl RadrootsEventTagBuilder for RadrootsResourceArea {
+impl RadrootsEventTagBuilder for ResourceArea {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -131,7 +127,7 @@ impl RadrootsEventTagBuilder for RadrootsResourceArea {
}
}
-impl RadrootsEventTagBuilder for RadrootsResourceHarvestCap {
+impl RadrootsEventTagBuilder for ResourceHarvestCap {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -139,7 +135,7 @@ impl RadrootsEventTagBuilder for RadrootsResourceHarvestCap {
}
}
-impl RadrootsEventTagBuilder for RadrootsCoop {
+impl RadrootsEventTagBuilder for Coop {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -147,7 +143,7 @@ impl RadrootsEventTagBuilder for RadrootsCoop {
}
}
-impl RadrootsEventTagBuilder for RadrootsDocument {
+impl RadrootsEventTagBuilder for Document {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -155,7 +151,7 @@ impl RadrootsEventTagBuilder for RadrootsDocument {
}
}
-impl RadrootsEventTagBuilder for RadrootsList {
+impl RadrootsEventTagBuilder for List {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -163,7 +159,7 @@ impl RadrootsEventTagBuilder for RadrootsList {
}
}
-impl RadrootsEventTagBuilder for RadrootsListSet {
+impl RadrootsEventTagBuilder for ListSet {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -171,7 +167,7 @@ impl RadrootsEventTagBuilder for RadrootsListSet {
}
}
-impl RadrootsEventTagBuilder for RadrootsPlot {
+impl RadrootsEventTagBuilder for Plot {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -179,7 +175,7 @@ impl RadrootsEventTagBuilder for RadrootsPlot {
}
}
-impl RadrootsEventTagBuilder for RadrootsJobRequest {
+impl RadrootsEventTagBuilder for JobRequest {
type Error = JobEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -190,7 +186,7 @@ impl RadrootsEventTagBuilder for RadrootsJobRequest {
}
}
-impl RadrootsEventTagBuilder for RadrootsJobResult {
+impl RadrootsEventTagBuilder for JobResult {
type Error = JobEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -198,7 +194,7 @@ impl RadrootsEventTagBuilder for RadrootsJobResult {
}
}
-impl RadrootsEventTagBuilder for RadrootsJobFeedback {
+impl RadrootsEventTagBuilder for JobFeedback {
type Error = JobEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -206,7 +202,7 @@ impl RadrootsEventTagBuilder for RadrootsJobFeedback {
}
}
-impl RadrootsEventTagBuilder for RadrootsSeal {
+impl RadrootsEventTagBuilder for Seal {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -214,7 +210,7 @@ impl RadrootsEventTagBuilder for RadrootsSeal {
}
}
-impl RadrootsEventTagBuilder for RadrootsGiftWrap {
+impl RadrootsEventTagBuilder for GiftWrap {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -223,7 +219,7 @@ impl RadrootsEventTagBuilder for RadrootsGiftWrap {
}
#[cfg(feature = "knowledge")]
-impl RadrootsEventTagBuilder for RadrootsWikiArticle {
+impl RadrootsEventTagBuilder for WikiArticle {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -232,7 +228,7 @@ impl RadrootsEventTagBuilder for RadrootsWikiArticle {
}
#[cfg(feature = "knowledge")]
-impl RadrootsEventTagBuilder for RadrootsWikiRedirect {
+impl RadrootsEventTagBuilder for WikiRedirect {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -241,7 +237,7 @@ impl RadrootsEventTagBuilder for RadrootsWikiRedirect {
}
#[cfg(feature = "knowledge")]
-impl RadrootsEventTagBuilder for RadrootsWikiMergeRequest {
+impl RadrootsEventTagBuilder for WikiMergeRequest {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -250,7 +246,7 @@ impl RadrootsEventTagBuilder for RadrootsWikiMergeRequest {
}
#[cfg(feature = "knowledge")]
-impl RadrootsEventTagBuilder for RadrootsKnowledgeSource {
+impl RadrootsEventTagBuilder for KnowledgeSource {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -259,7 +255,7 @@ impl RadrootsEventTagBuilder for RadrootsKnowledgeSource {
}
#[cfg(feature = "knowledge")]
-impl RadrootsEventTagBuilder for RadrootsKnowledgeClaim {
+impl RadrootsEventTagBuilder for KnowledgeClaim {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -268,7 +264,7 @@ impl RadrootsEventTagBuilder for RadrootsKnowledgeClaim {
}
#[cfg(feature = "knowledge")]
-impl RadrootsEventTagBuilder for RadrootsKnowledgeRelation {
+impl RadrootsEventTagBuilder for KnowledgeRelation {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -277,7 +273,7 @@ impl RadrootsEventTagBuilder for RadrootsKnowledgeRelation {
}
#[cfg(feature = "knowledge")]
-impl RadrootsEventTagBuilder for RadrootsKnowledgeReview {
+impl RadrootsEventTagBuilder for KnowledgeReview {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -286,7 +282,7 @@ impl RadrootsEventTagBuilder for RadrootsKnowledgeReview {
}
#[cfg(feature = "knowledge")]
-impl RadrootsEventTagBuilder for RadrootsKnowledgeFieldReport {
+impl RadrootsEventTagBuilder for KnowledgeFieldReport {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -295,7 +291,7 @@ impl RadrootsEventTagBuilder for RadrootsKnowledgeFieldReport {
}
#[cfg(feature = "knowledge")]
-impl RadrootsEventTagBuilder for RadrootsEvidenceBounty {
+impl RadrootsEventTagBuilder for EvidenceBounty {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -304,7 +300,7 @@ impl RadrootsEventTagBuilder for RadrootsEvidenceBounty {
}
#[cfg(feature = "knowledge")]
-impl RadrootsEventTagBuilder for RadrootsKnowledgeChangeProposal {
+impl RadrootsEventTagBuilder for KnowledgeChangeProposal {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
@@ -313,7 +309,7 @@ impl RadrootsEventTagBuilder for RadrootsKnowledgeChangeProposal {
}
#[cfg(feature = "knowledge")]
-impl RadrootsEventTagBuilder for RadrootsContributionAttestation {
+impl RadrootsEventTagBuilder for ContributionAttestation {
type Error = EventEncodeError;
fn build_tags(&self) -> Result<Vec<Vec<String>>, Self::Error> {
diff --git a/crates/event_codec/src/trade/mod.rs b/crates/event_codec/src/trade/mod.rs
@@ -7,15 +7,15 @@ use alloc::{
#[cfg(feature = "serde_json")]
use radroots_event::{
- envelope::RadrootsEventEnvelope,
+ envelope::EventEnvelope,
envelope::kind::is_trade_mutation_event_kind,
- id::RadrootsTradeMutationId,
+ id::MutationId,
tag::name::{TAG_D, TAG_E},
trade::{
- RadrootsTradeMutationEnvelopeV1, RadrootsTradeProtocolError,
- canonical_trade_mutation_content, trade_mutation_from_canonical_content,
+ TradeMutationEnvelopeV1, TradeProtocolError, canonical_trade_mutation_content,
+ trade_mutation_from_canonical_content,
},
- wire::RadrootsNip01EventWireParts,
+ wire::Nip01EventWireParts,
};
#[cfg(feature = "serde_json")]
@@ -32,7 +32,7 @@ pub enum RadrootsTradeMutationParseError {
CounterpartyTagMismatch,
ParentTagsMismatch,
KindContractMismatch,
- Canonical(RadrootsTradeProtocolError),
+ Canonical(TradeProtocolError),
}
#[cfg(feature = "serde_json")]
@@ -56,20 +56,20 @@ impl core::fmt::Display for RadrootsTradeMutationParseError {
impl std::error::Error for RadrootsTradeMutationParseError {}
#[cfg(feature = "serde_json")]
-impl From<RadrootsTradeProtocolError> for RadrootsTradeMutationParseError {
- fn from(value: RadrootsTradeProtocolError) -> Self {
+impl From<TradeProtocolError> for RadrootsTradeMutationParseError {
+ fn from(value: TradeProtocolError) -> Self {
Self::Canonical(value)
}
}
#[cfg(feature = "serde_json")]
pub fn trade_mutation_event_build(
- envelope: RadrootsTradeMutationEnvelopeV1,
-) -> Result<RadrootsNip01EventWireParts, EventEncodeError> {
+ envelope: TradeMutationEnvelopeV1,
+) -> Result<Nip01EventWireParts, EventEncodeError> {
let canonical = canonical_trade_mutation_content(envelope)
.map_err(map_trade_protocol_error_to_encode_error)?;
let tags = trade_mutation_tags(&canonical.envelope)?;
- Ok(RadrootsNip01EventWireParts {
+ Ok(Nip01EventWireParts {
kind: canonical.envelope.mutation_kind().nostr_kind(),
content: canonical.content,
tags,
@@ -78,8 +78,8 @@ pub fn trade_mutation_event_build(
#[cfg(feature = "serde_json")]
pub fn trade_mutation_from_event(
- event: &RadrootsEventEnvelope,
-) -> Result<RadrootsTradeMutationEnvelopeV1, RadrootsTradeMutationParseError> {
+ event: &EventEnvelope,
+) -> Result<TradeMutationEnvelopeV1, RadrootsTradeMutationParseError> {
if !is_trade_mutation_event_kind(event.kind_u32()) {
return Err(RadrootsTradeMutationParseError::InvalidKind(
event.kind_u32(),
@@ -95,7 +95,7 @@ pub fn trade_mutation_from_event(
#[cfg(feature = "serde_json")]
pub fn trade_mutation_tags(
- envelope: &RadrootsTradeMutationEnvelopeV1,
+ envelope: &TradeMutationEnvelopeV1,
) -> Result<Vec<Vec<String>>, EventEncodeError> {
let mut tags = Vec::with_capacity(3 + envelope.parent_mutation_ids.len());
push_tag(&mut tags, "contract", envelope.contract_id.clone())?;
@@ -109,7 +109,7 @@ pub fn trade_mutation_tags(
#[cfg(feature = "serde_json")]
fn validate_trade_mutation_tags(
- envelope: &RadrootsTradeMutationEnvelopeV1,
+ envelope: &TradeMutationEnvelopeV1,
tags: &[Vec<String>],
) -> Result<(), RadrootsTradeMutationParseError> {
let contract = required_tag_value(tags, "contract")?;
@@ -133,7 +133,7 @@ fn validate_trade_mutation_tags(
.get(1)
.map(String::as_str)
.ok_or(RadrootsTradeMutationParseError::InvalidTag(TAG_E))?;
- let parent = RadrootsTradeMutationId::parse(value)
+ let parent = MutationId::parse(value)
.map_err(|_| RadrootsTradeMutationParseError::InvalidTag(TAG_E))?;
parents.push(parent);
}
@@ -176,36 +176,34 @@ fn push_tag(
}
#[cfg(feature = "serde_json")]
-fn map_trade_protocol_error_to_encode_error(error: RadrootsTradeProtocolError) -> EventEncodeError {
+fn map_trade_protocol_error_to_encode_error(error: TradeProtocolError) -> EventEncodeError {
match error {
- RadrootsTradeProtocolError::EmptyField(field) => {
- EventEncodeError::EmptyRequiredField(field)
- }
- RadrootsTradeProtocolError::ContractMismatch { .. }
- | RadrootsTradeProtocolError::InvalidField(_)
- | RadrootsTradeProtocolError::InvalidIdentifier { .. }
- | RadrootsTradeProtocolError::InvalidInitialParents
- | RadrootsTradeProtocolError::MissingParentMutation
- | RadrootsTradeProtocolError::TooManyParents { .. }
- | RadrootsTradeProtocolError::UnsortedParents
- | RadrootsTradeProtocolError::DuplicateParent
- | RadrootsTradeProtocolError::SelfParent
- | RadrootsTradeProtocolError::MissingLines
- | RadrootsTradeProtocolError::TooManyLines { .. }
- | RadrootsTradeProtocolError::TooManyAdjustments { .. }
- | RadrootsTradeProtocolError::UnsupportedNumber
- | RadrootsTradeProtocolError::ContentTooLarge { .. }
- | RadrootsTradeProtocolError::InvalidTimeRange
- | RadrootsTradeProtocolError::MissingReservationCommitments
- | RadrootsTradeProtocolError::MissingCancellationTarget
- | RadrootsTradeProtocolError::CandidateIdMismatch { .. }
- | RadrootsTradeProtocolError::MutationIdMismatch { .. }
- | RadrootsTradeProtocolError::InvalidSchemaVersion { .. } => {
+ TradeProtocolError::EmptyField(field) => EventEncodeError::EmptyRequiredField(field),
+ TradeProtocolError::ContractMismatch { .. }
+ | TradeProtocolError::InvalidField(_)
+ | TradeProtocolError::InvalidIdentifier { .. }
+ | TradeProtocolError::InvalidInitialParents
+ | TradeProtocolError::MissingParentMutation
+ | TradeProtocolError::TooManyParents { .. }
+ | TradeProtocolError::UnsortedParents
+ | TradeProtocolError::DuplicateParent
+ | TradeProtocolError::SelfParent
+ | TradeProtocolError::MissingLines
+ | TradeProtocolError::TooManyLines { .. }
+ | TradeProtocolError::TooManyAdjustments { .. }
+ | TradeProtocolError::UnsupportedNumber
+ | TradeProtocolError::ContentTooLarge { .. }
+ | TradeProtocolError::InvalidTimeRange
+ | TradeProtocolError::MissingReservationCommitments
+ | TradeProtocolError::MissingCancellationTarget
+ | TradeProtocolError::CandidateIdMismatch { .. }
+ | TradeProtocolError::MutationIdMismatch { .. }
+ | TradeProtocolError::InvalidSchemaVersion { .. } => {
EventEncodeError::InvalidField("trade_mutation")
}
- RadrootsTradeProtocolError::DuplicateKey(_)
- | RadrootsTradeProtocolError::InvalidJson(_)
- | RadrootsTradeProtocolError::NonCanonicalJson => EventEncodeError::Json,
+ TradeProtocolError::DuplicateKey(_)
+ | TradeProtocolError::InvalidJson(_)
+ | TradeProtocolError::NonCanonicalJson => EventEncodeError::Json,
}
}
@@ -213,18 +211,14 @@ fn map_trade_protocol_error_to_encode_error(error: RadrootsTradeProtocolError) -
mod tests {
use super::*;
use radroots_event::{
- envelope::RadrootsEventEnvelope,
- envelope::RadrootsEventEnvelopeParts,
- id::{
- RadrootsClassifiedListingAddress, RadrootsDTag, RadrootsEventId,
- RadrootsInventoryBinId, RadrootsTradeId,
- },
+ envelope::EventEnvelope,
+ envelope::EventEnvelopeParts,
+ id::{ClassifiedListingAddress, DTag, EventId, InventoryBinId, TradeId},
trade::{
- RADROOTS_TRADE_PROPOSAL_CONTRACT_ID, RADROOTS_TRADE_SCHEMA_VERSION,
- RadrootsFulfillmentProfileV1, RadrootsTradeCancellationProfileV1,
- RadrootsTradeCandidateLineV1, RadrootsTradeCandidateTermsV1,
- RadrootsTradeEconomicAdjustmentV1, RadrootsTradeEconomicsProfileV1,
- RadrootsTradeMutationBodyV1, RadrootsTradeMutationEnvelopeV1,
+ FulfillmentProfileV1, RADROOTS_TRADE_PROPOSAL_CONTRACT_ID,
+ RADROOTS_TRADE_SCHEMA_VERSION, TradeCancellationProfileV1, TradeCandidateLineV1,
+ TradeCandidateTermsV1, TradeEconomicAdjustmentV1, TradeEconomicsProfileV1,
+ TradeMutationBodyV1, TradeMutationEnvelopeV1,
},
};
use radroots_identity::PublicKey;
@@ -241,42 +235,42 @@ mod tests {
PublicKey::from_hex(&crate::test_fixtures::fixture_public_key_hex(character)).unwrap()
}
- fn event_id(character: char) -> RadrootsEventId {
- RadrootsEventId::parse(hex_64(character)).unwrap()
+ fn event_id(character: char) -> EventId {
+ EventId::parse(hex_64(character)).unwrap()
}
- fn proposal() -> RadrootsTradeMutationEnvelopeV1 {
- RadrootsTradeMutationEnvelopeV1 {
+ fn proposal() -> TradeMutationEnvelopeV1 {
+ TradeMutationEnvelopeV1 {
mutation_id: None,
contract_id: RADROOTS_TRADE_PROPOSAL_CONTRACT_ID.to_string(),
schema_version: RADROOTS_TRADE_SCHEMA_VERSION,
- trade_id: RadrootsTradeId::parse(hex_32('1')).unwrap(),
+ trade_id: TradeId::parse(hex_32('1')).unwrap(),
root_mutation_id: None,
buyer_pubkey: pubkey('a'),
seller_pubkey: pubkey('b'),
- farm_id: RadrootsDTag::parse("farm-1").unwrap(),
+ farm_id: DTag::parse("farm-1").unwrap(),
parent_mutation_ids: Vec::new(),
author_pubkey: pubkey('a'),
counterparty_pubkey: pubkey('b'),
authored_at_unix_s: 1_799_000_000,
- body: RadrootsTradeMutationBodyV1::Proposal {
+ body: TradeMutationBodyV1::Proposal {
candidate: candidate(),
},
}
}
- fn candidate() -> RadrootsTradeCandidateTermsV1 {
- RadrootsTradeCandidateTermsV1 {
+ fn candidate() -> TradeCandidateTermsV1 {
+ TradeCandidateTermsV1 {
candidate_id: None,
schema_version: RADROOTS_TRADE_SCHEMA_VERSION,
base_candidate_id: None,
supersession_intent: None,
buyer_pubkey: pubkey('a'),
seller_pubkey: pubkey('b'),
- farm_id: RadrootsDTag::parse("farm-1").unwrap(),
- lines: vec![RadrootsTradeCandidateLineV1 {
- line_id: RadrootsDTag::parse("line-1").unwrap(),
- listing_addr: RadrootsClassifiedListingAddress::parse(format!(
+ farm_id: DTag::parse("farm-1").unwrap(),
+ lines: vec![TradeCandidateLineV1 {
+ line_id: DTag::parse("line-1").unwrap(),
+ listing_addr: ClassifiedListingAddress::parse(format!(
"30402:{}:listing-1",
pubkey('b').to_hex()
))
@@ -285,7 +279,7 @@ mod tests {
listing_snapshot_sha256: hex_64('d'),
product_id: "carrots".to_string(),
option_id: None,
- bin_id: RadrootsInventoryBinId::parse("bin-1").unwrap(),
+ bin_id: InventoryBinId::parse("bin-1").unwrap(),
quantity_mantissa: "2".to_string(),
quantity_scale: 0,
unit_code: "count".to_string(),
@@ -296,7 +290,7 @@ mod tests {
replaces_line_id: None,
}],
line_tombstones: Vec::new(),
- economics: RadrootsTradeEconomicsProfileV1 {
+ economics: TradeEconomicsProfileV1 {
profile_id: "mvp-fixed".to_string(),
currency_code: "USD".to_string(),
currency_exponent: 2,
@@ -305,9 +299,9 @@ mod tests {
discount_total_mantissa: "0".to_string(),
adjustment_total_mantissa: "0".to_string(),
total_mantissa: "1000".to_string(),
- adjustments: Vec::<RadrootsTradeEconomicAdjustmentV1>::new(),
+ adjustments: Vec::<TradeEconomicAdjustmentV1>::new(),
},
- fulfillment: RadrootsFulfillmentProfileV1 {
+ fulfillment: FulfillmentProfileV1 {
profile_id: "market-pickup".to_string(),
method: "pickup".to_string(),
starts_at_unix_s: 1_800_000_000,
@@ -318,7 +312,7 @@ mod tests {
location_class: "farmstand".to_string(),
requires_private_terms: false,
},
- cancellation: RadrootsTradeCancellationProfileV1 {
+ cancellation: TradeCancellationProfileV1 {
profile_id: "buyer-pre-agreement".to_string(),
buyer_pre_agreement: true,
post_agreement_cutoff_unix_s: None,
@@ -343,7 +337,7 @@ mod tests {
]
);
let envelope = trade_mutation_from_event(
- &RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ &EventEnvelope::new(EventEnvelopeParts {
id: hex_64('e'),
author: pubkey('a').to_hex(),
created_at: 1_799_000_000,
@@ -370,13 +364,13 @@ mod tests {
RadrootsTradeMutationParseError::CounterpartyTagMismatch,
RadrootsTradeMutationParseError::ParentTagsMismatch,
RadrootsTradeMutationParseError::KindContractMismatch,
- RadrootsTradeMutationParseError::Canonical(RadrootsTradeProtocolError::MissingLines),
+ RadrootsTradeMutationParseError::Canonical(TradeProtocolError::MissingLines),
];
for error in parse_errors {
assert!(!error.to_string().is_empty());
}
let canonical_error =
- RadrootsTradeMutationParseError::from(RadrootsTradeProtocolError::MissingLines);
+ RadrootsTradeMutationParseError::from(TradeProtocolError::MissingLines);
assert!(matches!(
canonical_error,
RadrootsTradeMutationParseError::Canonical(_)
@@ -426,7 +420,7 @@ mod tests {
RadrootsTradeMutationParseError::InvalidTag(TAG_E)
);
- let parent = RadrootsTradeMutationId::parse(hex_64('9')).unwrap();
+ let parent = MutationId::parse(hex_64('9')).unwrap();
let mut parent_envelope = proposal();
parent_envelope.parent_mutation_ids.push(parent);
let parent_tags = trade_mutation_tags(&parent_envelope).unwrap();
@@ -457,7 +451,7 @@ mod tests {
));
let built = trade_mutation_event_build(proposal()).unwrap();
- let invalid_kind = RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ let invalid_kind = EventEnvelope::new(EventEnvelopeParts {
id: hex_64('e'),
author: pubkey('a').to_hex(),
created_at: 1_799_000_000,
@@ -472,7 +466,7 @@ mod tests {
RadrootsTradeMutationParseError::InvalidKind(1)
);
- let kind_contract_mismatch = RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ let kind_contract_mismatch = EventEnvelope::new(EventEnvelopeParts {
id: hex_64('e'),
author: pubkey('a').to_hex(),
created_at: 1_799_000_000,
@@ -491,40 +485,40 @@ mod tests {
#[test]
#[cfg_attr(coverage_nightly, coverage(off))]
fn trade_protocol_errors_map_to_stable_encode_categories() {
- let id_error = RadrootsTradeMutationId::parse("invalid").unwrap_err();
+ let id_error = MutationId::parse("invalid").unwrap_err();
let invalid_field_errors = [
- RadrootsTradeProtocolError::ContractMismatch {
+ TradeProtocolError::ContractMismatch {
expected: "expected",
actual: "actual".into(),
},
- RadrootsTradeProtocolError::InvalidField("field"),
- RadrootsTradeProtocolError::InvalidIdentifier {
+ TradeProtocolError::InvalidField("field"),
+ TradeProtocolError::InvalidIdentifier {
field: "id",
error: id_error,
},
- RadrootsTradeProtocolError::InvalidInitialParents,
- RadrootsTradeProtocolError::MissingParentMutation,
- RadrootsTradeProtocolError::TooManyParents { max: 1, actual: 2 },
- RadrootsTradeProtocolError::UnsortedParents,
- RadrootsTradeProtocolError::DuplicateParent,
- RadrootsTradeProtocolError::SelfParent,
- RadrootsTradeProtocolError::MissingLines,
- RadrootsTradeProtocolError::TooManyLines { max: 1, actual: 2 },
- RadrootsTradeProtocolError::TooManyAdjustments { max: 1, actual: 2 },
- RadrootsTradeProtocolError::UnsupportedNumber,
- RadrootsTradeProtocolError::ContentTooLarge { max: 1, actual: 2 },
- RadrootsTradeProtocolError::InvalidTimeRange,
- RadrootsTradeProtocolError::MissingReservationCommitments,
- RadrootsTradeProtocolError::MissingCancellationTarget,
- RadrootsTradeProtocolError::CandidateIdMismatch {
+ TradeProtocolError::InvalidInitialParents,
+ TradeProtocolError::MissingParentMutation,
+ TradeProtocolError::TooManyParents { max: 1, actual: 2 },
+ TradeProtocolError::UnsortedParents,
+ TradeProtocolError::DuplicateParent,
+ TradeProtocolError::SelfParent,
+ TradeProtocolError::MissingLines,
+ TradeProtocolError::TooManyLines { max: 1, actual: 2 },
+ TradeProtocolError::TooManyAdjustments { max: 1, actual: 2 },
+ TradeProtocolError::UnsupportedNumber,
+ TradeProtocolError::ContentTooLarge { max: 1, actual: 2 },
+ TradeProtocolError::InvalidTimeRange,
+ TradeProtocolError::MissingReservationCommitments,
+ TradeProtocolError::MissingCancellationTarget,
+ TradeProtocolError::CandidateIdMismatch {
declared: "declared".into(),
computed: "computed".into(),
},
- RadrootsTradeProtocolError::MutationIdMismatch {
+ TradeProtocolError::MutationIdMismatch {
declared: "declared".into(),
computed: "computed".into(),
},
- RadrootsTradeProtocolError::InvalidSchemaVersion {
+ TradeProtocolError::InvalidSchemaVersion {
expected: 1,
actual: 2,
},
@@ -537,15 +531,13 @@ mod tests {
}
assert!(matches!(
- map_trade_protocol_error_to_encode_error(RadrootsTradeProtocolError::EmptyField(
- "field"
- )),
+ map_trade_protocol_error_to_encode_error(TradeProtocolError::EmptyField("field")),
EventEncodeError::EmptyRequiredField("field")
));
for error in [
- RadrootsTradeProtocolError::DuplicateKey("key".into()),
- RadrootsTradeProtocolError::InvalidJson("json".into()),
- RadrootsTradeProtocolError::NonCanonicalJson,
+ TradeProtocolError::DuplicateKey("key".into()),
+ TradeProtocolError::InvalidJson("json".into()),
+ TradeProtocolError::NonCanonicalJson,
] {
assert!(matches!(
map_trade_protocol_error_to_encode_error(error),
diff --git a/crates/event_codec/src/verification/v1.rs b/crates/event_codec/src/verification/v1.rs
@@ -8,38 +8,38 @@ use core::fmt;
use core::str::FromStr;
use radroots_event::contract::registry_v7::{
- RadrootsContractValidationError, RadrootsEventContract,
+ ContractValidationError, EventContract,
validate_event_contract_registry_v7 as validate_radroots_event_contract_registry_v7,
};
-use radroots_event::envelope::RadrootsEventEnvelope;
+use radroots_event::envelope::EventEnvelope;
use radroots_event::wire::v1::compute_canonical_nip01_event_id_v1;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsIdVerifiedEvent {
- event: RadrootsEventEnvelope,
+ event: EventEnvelope,
}
impl RadrootsIdVerifiedEvent {
- pub fn event(&self) -> &RadrootsEventEnvelope {
+ pub fn event(&self) -> &EventEnvelope {
&self.event
}
- pub fn into_event(self) -> RadrootsEventEnvelope {
+ pub fn into_event(self) -> EventEnvelope {
self.event
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsSignatureVerifiedEvent {
- event: RadrootsEventEnvelope,
+ event: EventEnvelope,
}
impl RadrootsSignatureVerifiedEvent {
- pub fn event(&self) -> &RadrootsEventEnvelope {
+ pub fn event(&self) -> &EventEnvelope {
&self.event
}
- pub fn into_event(self) -> RadrootsEventEnvelope {
+ pub fn into_event(self) -> EventEnvelope {
self.event
}
}
@@ -48,7 +48,7 @@ impl RadrootsSignatureVerifiedEvent {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsContractValidatedEvent {
verified_event: RadrootsSignatureVerifiedEvent,
- contract: &'static RadrootsEventContract,
+ contract: &'static EventContract,
}
impl RadrootsContractValidatedEvent {
@@ -56,11 +56,11 @@ impl RadrootsContractValidatedEvent {
&self.verified_event
}
- pub fn event(&self) -> &RadrootsEventEnvelope {
+ pub fn event(&self) -> &EventEnvelope {
self.verified_event.event()
}
- pub fn contract(&self) -> &'static RadrootsEventContract {
+ pub fn contract(&self) -> &'static EventContract {
self.contract
}
@@ -72,7 +72,7 @@ impl RadrootsContractValidatedEvent {
self.verified_event
}
- pub fn into_event(self) -> RadrootsEventEnvelope {
+ pub fn into_event(self) -> EventEnvelope {
self.verified_event.into_event()
}
}
@@ -124,14 +124,14 @@ impl fmt::Display for RadrootsNip01VerificationError {
impl std::error::Error for RadrootsNip01VerificationError {}
pub fn verify_event_id(
- event: RadrootsEventEnvelope,
+ event: EventEnvelope,
) -> Result<RadrootsIdVerifiedEvent, RadrootsNip01VerificationError> {
verify_event_id_v1(event)
}
/// Verifies the canonical identifier with reconciliation-v1 semantics.
pub fn verify_event_id_v1(
- event: RadrootsEventEnvelope,
+ event: EventEnvelope,
) -> Result<RadrootsIdVerifiedEvent, RadrootsNip01VerificationError> {
u16::try_from(event.kind_u32()).map_err(|_| {
RadrootsNip01VerificationError::KindOutOfRange {
@@ -192,14 +192,14 @@ pub fn verify_event_signature_v1(
/// Verifies the canonical NIP-01 identifier and Schnorr signature in order.
pub fn verify_nip01_event(
- event: RadrootsEventEnvelope,
+ event: EventEnvelope,
) -> Result<RadrootsSignatureVerifiedEvent, RadrootsNip01VerificationError> {
verify_nip01_event_v1(event)
}
/// Verifies a NIP-01 event with the behavior frozen for reconciliation v1.
pub fn verify_nip01_event_v1(
- event: RadrootsEventEnvelope,
+ event: EventEnvelope,
) -> Result<RadrootsSignatureVerifiedEvent, RadrootsNip01VerificationError> {
verify_event_signature_v1(verify_event_id_v1(event)?)
}
@@ -207,14 +207,14 @@ pub fn verify_nip01_event_v1(
/// Applies full registry contract-shape validation to an already verified event.
pub fn validate_event_contract(
event: RadrootsSignatureVerifiedEvent,
-) -> Result<RadrootsContractValidatedEvent, RadrootsContractValidationError> {
+) -> Result<RadrootsContractValidatedEvent, ContractValidationError> {
validate_event_contract_registry_v7(event)
}
/// Applies the immutable registry-v7 contract-shape validation boundary.
pub fn validate_event_contract_registry_v7(
event: RadrootsSignatureVerifiedEvent,
-) -> Result<RadrootsContractValidatedEvent, RadrootsContractValidationError> {
+) -> Result<RadrootsContractValidatedEvent, ContractValidationError> {
let contract = validate_radroots_event_contract_registry_v7(event.event())?;
Ok(RadrootsContractValidatedEvent {
verified_event: event,
@@ -224,7 +224,7 @@ pub fn validate_event_contract_registry_v7(
#[cfg(feature = "nostr")]
fn raw_event_from_radroots(
- event: &RadrootsEventEnvelope,
+ event: &EventEnvelope,
) -> Result<nostr::Event, RadrootsNip01VerificationError> {
let event_id = event.id_hex();
let id = nostr::EventId::from_hex(event_id.as_str())
diff --git a/crates/event_codec/src/verification/v1/tests.rs b/crates/event_codec/src/verification/v1/tests.rs
@@ -1,5 +1,5 @@
use super::*;
-use radroots_event::envelope::RadrootsEventEnvelopeParts;
+use radroots_event::envelope::EventEnvelopeParts;
#[test]
fn id_verification_returns_the_exact_envelope() {
@@ -78,7 +78,7 @@ fn id_verification_rejects_an_out_of_range_kind_before_hashing() {
)
.expect("canonical hash remains mechanically computable")
.into_string();
- let event = RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ let event = EventEnvelope::new(EventEnvelopeParts {
id,
author: original.author().to_hex().to_owned(),
created_at: original.created_at_u64(),
@@ -95,8 +95,8 @@ fn id_verification_rejects_an_out_of_range_kind_before_hashing() {
);
}
-fn signed_max_kind_event() -> RadrootsEventEnvelope {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+fn signed_max_kind_event() -> EventEnvelope {
+ EventEnvelope::new(EventEnvelopeParts {
id: "a07878757d705d3cd848b9264791d699069068a5f0a575112f351367b0987958"
.to_string(),
author: "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f"
diff --git a/crates/event_codec/tests/app_data.rs b/crates/event_codec/tests/app_data.rs
@@ -3,7 +3,7 @@ mod common;
use common::{AUTHOR, EVENT_ID, EVENT_SIG};
use radroots_event::{
envelope::kind::KIND_POST,
- social::app_data::{KIND_APP_DATA, RadrootsAppData},
+ social::app_data::{AppData, KIND_APP_DATA},
};
use radroots_event_codec::app_data::decode::{
app_data_from_tags, data_from_event, parsed_from_event,
@@ -15,7 +15,7 @@ use radroots_event_codec::error::{EventEncodeError, EventParseError};
#[test]
fn app_data_build_tags_requires_d_tag() {
- let app_data = RadrootsAppData {
+ let app_data = AppData {
d_tag: " ".to_string(),
content: "payload".to_string(),
};
@@ -26,7 +26,7 @@ fn app_data_build_tags_requires_d_tag() {
#[test]
fn app_data_to_wire_parts_sets_kind_tags_content() {
- let app_data = RadrootsAppData {
+ let app_data = AppData {
d_tag: "radroots.app".to_string(),
content: "payload".to_string(),
};
@@ -42,7 +42,7 @@ fn app_data_to_wire_parts_sets_kind_tags_content() {
#[test]
fn app_data_to_wire_parts_propagates_tag_build_errors() {
- let app_data = RadrootsAppData {
+ let app_data = AppData {
d_tag: " ".to_string(),
content: "payload".to_string(),
};
@@ -52,7 +52,7 @@ fn app_data_to_wire_parts_propagates_tag_build_errors() {
#[test]
fn app_data_to_wire_parts_with_kind_rejects_wrong_kind() {
- let app_data = RadrootsAppData {
+ let app_data = AppData {
d_tag: "radroots.app".to_string(),
content: "payload".to_string(),
};
diff --git a/crates/event_codec/tests/article.rs b/crates/event_codec/tests/article.rs
@@ -5,9 +5,9 @@ mod common;
use common::{AUTHOR, EVENT_ID, EVENT_SIG};
use radroots_event::{
envelope::kind::{KIND_ARTICLE, KIND_POST},
- farm::RadrootsFarmRef,
- post::article::RadrootsArticle,
- social::{RadrootsSocialFarmAnchor, RadrootsSocialLocation},
+ farm::FarmRef,
+ post::article::Article,
+ social::{SocialFarmAnchor, SocialLocation},
tag::name::{TAG_A, TAG_D, TAG_G, TAG_IMAGE, TAG_LOCATION, TAG_PUBLISHED_AT, TAG_T, TAG_TITLE},
};
use radroots_event_codec::{
@@ -22,22 +22,22 @@ const VALID_D_TAG: &str = "AAAAAAAAAAAAAAAAAAAAAA";
const FARM_D_TAG: &str = "BBBBBBBBBBBBBBBBBBBBBA";
const FARM_PUBKEY: &str = "farm_pubkey";
-fn sample_article() -> RadrootsArticle {
- RadrootsArticle {
+fn sample_article() -> Article {
+ Article {
d_tag: VALID_D_TAG.to_string(),
title: "Spring soil notes".to_string(),
content: "# Spring soil notes".to_string(),
summary: Some("Field update".to_string()),
image: Some("https://media.example.test/soil.jpg".to_string()),
published_at: Some(1_781_895_600),
- farm: Some(RadrootsSocialFarmAnchor {
- farm: RadrootsFarmRef {
+ farm: Some(SocialFarmAnchor {
+ farm: FarmRef {
pubkey: FARM_PUBKEY.to_string(),
d_tag: FARM_D_TAG.to_string(),
},
relays: None,
}),
- location: Some(RadrootsSocialLocation {
+ location: Some(SocialLocation {
name: Some("North field".to_string()),
geohash: Some("c23nb62w20st".to_string()),
}),
@@ -163,7 +163,7 @@ fn article_decode_handles_minimal_and_invalid_optional_tags() {
#[test]
fn article_build_tags_handles_absent_optional_metadata() {
- let article = RadrootsArticle {
+ let article = Article {
d_tag: VALID_D_TAG.to_string(),
title: "Minimal article".to_string(),
content: "Body".to_string(),
diff --git a/crates/event_codec/tests/calendar.rs b/crates/event_codec/tests/calendar.rs
@@ -1,19 +1,18 @@
use radroots_blossom::{BlobDescriptor, BlobUrl, MediaType, Sha256};
use radroots_event::{
calendar::{
- RADROOTS_CALENDAR_MAX_COVERED_UTC_DAYS, RADROOTS_CALENDAR_SECONDS_PER_DAY,
- RadrootsAuthoredCalendar, RadrootsAuthoredCalendarDateEvent,
- RadrootsAuthoredCalendarEventRsvp, RadrootsAuthoredCalendarTimeEvent,
- RadrootsCalendarAdmissionError, RadrootsCalendarDate, RadrootsCalendarEventError,
- RadrootsCalendarEventReference, RadrootsCalendarEventRsvpStatus,
- RadrootsCalendarParticipant, RadrootsCalendarUid, RadrootsIanaTimeZoneId, covered_utc_days,
+ AuthoredCalendar, AuthoredCalendarDateEvent, AuthoredCalendarEventRsvp,
+ AuthoredCalendarTimeEvent, CalendarAdmissionError, CalendarDate, CalendarEventError,
+ CalendarEventReference, CalendarEventRsvpStatus, CalendarParticipant, CalendarUid,
+ IanaTimeZoneId, RADROOTS_CALENDAR_MAX_COVERED_UTC_DAYS, RADROOTS_CALENDAR_SECONDS_PER_DAY,
+ covered_utc_days,
},
- envelope::RadrootsEventTags,
+ envelope::EventTags,
envelope::kind::{
KIND_CALENDAR, KIND_CALENDAR_DATE_EVENT, KIND_CALENDAR_EVENT_RSVP,
KIND_CALENDAR_TIME_EVENT, KIND_POST,
},
- media::RadrootsAuthoredImage,
+ media::AuthoredImage,
tag::name::{
TAG_A, TAG_D, TAG_D_DAY, TAG_END, TAG_END_TZID, TAG_G, TAG_IMAGE, TAG_LOCATION, TAG_P,
TAG_R, TAG_START, TAG_START_TZID, TAG_SUMMARY, TAG_T, TAG_TITLE,
@@ -49,11 +48,11 @@ const EVENT_SIG: &str = concat!(
"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"
);
-fn date(value: &str) -> RadrootsCalendarDate {
- RadrootsCalendarDate::parse(value).unwrap()
+fn date(value: &str) -> CalendarDate {
+ CalendarDate::parse(value).unwrap()
}
-fn authored_image() -> RadrootsAuthoredImage {
+fn authored_image() -> AuthoredImage {
let bytes = b"canonical-calendar-image";
let hash = Sha256::digest(bytes);
let media_type = MediaType::parse("image/webp").unwrap();
@@ -69,11 +68,11 @@ fn authored_image() -> RadrootsAuthoredImage {
.unwrap()
.verify_bytes(bytes, &media_type)
.unwrap();
- RadrootsAuthoredImage::try_from(descriptor).unwrap()
+ AuthoredImage::try_from(descriptor).unwrap()
}
-fn sample_date_event() -> RadrootsAuthoredCalendarDateEvent {
- RadrootsAuthoredCalendarDateEvent::new(DATE_D_TAG, "CSA pickup", date("2026-06-20"))
+fn sample_date_event() -> AuthoredCalendarDateEvent {
+ AuthoredCalendarDateEvent::new(DATE_D_TAG, "CSA pickup", date("2026-06-20"))
.unwrap()
.with_end(date("2026-06-21"))
.unwrap()
@@ -87,7 +86,7 @@ fn sample_date_event() -> RadrootsAuthoredCalendarDateEvent {
.unwrap()
.with_image(authored_image())
.unwrap()
- .with_participants(vec![RadrootsCalendarParticipant {
+ .with_participants(vec![CalendarParticipant {
pubkey: EVENT_AUTHOR.to_string(),
relay: Some("wss://relay.example.test".to_string()),
role: Some("host".to_string()),
@@ -97,8 +96,8 @@ fn sample_date_event() -> RadrootsAuthoredCalendarDateEvent {
.unwrap()
}
-fn sample_time_event() -> RadrootsAuthoredCalendarTimeEvent {
- RadrootsAuthoredCalendarTimeEvent::new(TIME_D_TAG, "Wash pack shift", 86_399)
+fn sample_time_event() -> AuthoredCalendarTimeEvent {
+ AuthoredCalendarTimeEvent::new(TIME_D_TAG, "Wash pack shift", 86_399)
.unwrap()
.with_end(172_801)
.unwrap()
@@ -112,7 +111,7 @@ fn sample_time_event() -> RadrootsAuthoredCalendarTimeEvent {
.unwrap()
.with_summary("Prepare CSA bins")
.unwrap()
- .with_participants(vec![RadrootsCalendarParticipant {
+ .with_participants(vec![CalendarParticipant {
pubkey: EVENT_AUTHOR.to_string(),
relay: None,
role: Some("participant".to_string()),
@@ -208,9 +207,7 @@ fn authored_date_event_emits_canonical_fields_and_no_uppercase_day_tag() {
fn authored_time_event_derives_exact_ordered_days_and_iana_fallback() {
let event = sample_time_event();
assert_eq!(
- event
- .effective_end_tzid()
- .map(RadrootsIanaTimeZoneId::as_str),
+ event.effective_end_tzid().map(IanaTimeZoneId::as_str),
Some("America/Vancouver")
);
assert_eq!(event.end_tzid(), None);
@@ -307,9 +304,7 @@ fn baseline_time_parser_accepts_nip52_should_level_variance() {
vec![("000", 0, false), ("2", 2, true)]
);
assert_eq!(
- parsed
- .effective_end_tzid()
- .map(RadrootsIanaTimeZoneId::as_str),
+ parsed.effective_end_tzid().map(IanaTimeZoneId::as_str),
Some("America/Vancouver")
);
}
@@ -326,7 +321,7 @@ fn strict_admission_rejects_date_extensions_noncanonical_metadata_and_non_blosso
parse_nip52_calendar_date_event(KIND_CALENDAR_DATE_EVENT, &extension_tags, "").unwrap();
assert_eq!(
admit_radroots_calendar_date_event(parsed),
- Err(RadrootsCalendarAdmissionError::ForbiddenDateDayIndex)
+ Err(CalendarAdmissionError::ForbiddenDateDayIndex)
);
extension_tags.retain(|tag| tag[0] != TAG_D_DAY);
@@ -335,9 +330,7 @@ fn strict_admission_rejects_date_extensions_noncanonical_metadata_and_non_blosso
parse_nip52_calendar_date_event(KIND_CALENDAR_DATE_EVENT, &extension_tags, "").unwrap();
assert_eq!(
admit_radroots_calendar_date_event(parsed),
- Err(RadrootsCalendarAdmissionError::NonCanonicalField(
- "metadata"
- ))
+ Err(CalendarAdmissionError::NonCanonicalField("metadata"))
);
replace_tag_value(&mut extension_tags, TAG_TITLE, "CSA pickup");
@@ -349,7 +342,7 @@ fn strict_admission_rejects_date_extensions_noncanonical_metadata_and_non_blosso
parse_nip52_calendar_date_event(KIND_CALENDAR_DATE_EVENT, &extension_tags, "").unwrap();
assert_eq!(
admit_radroots_calendar_date_event(parsed),
- Err(RadrootsCalendarAdmissionError::NonBlossomImage)
+ Err(CalendarAdmissionError::NonBlossomImage)
);
}
@@ -376,7 +369,7 @@ fn strict_time_admission_requires_canonical_exact_coverage() {
let parsed = parse_nip52_calendar_time_event(KIND_CALENDAR_TIME_EVENT, &tags, "").unwrap();
assert_eq!(
admit_radroots_calendar_time_event(parsed),
- Err(RadrootsCalendarAdmissionError::IncompleteDayCoverage)
+ Err(CalendarAdmissionError::IncompleteDayCoverage)
);
}
@@ -389,9 +382,7 @@ fn strict_time_admission_requires_canonical_exact_coverage() {
.unwrap();
assert_eq!(
admit_radroots_calendar_time_event(parsed),
- Err(RadrootsCalendarAdmissionError::NonCanonicalField(
- "timestamp"
- ))
+ Err(CalendarAdmissionError::NonCanonicalField("timestamp"))
);
}
@@ -409,7 +400,7 @@ fn baseline_can_parse_overlong_ranges_that_strict_admission_rejects() {
assert_eq!(parsed.end(), Some(end));
assert_eq!(
admit_radroots_calendar_time_event(parsed),
- Err(RadrootsCalendarAdmissionError::CoveredDayLimitExceeded {
+ Err(CalendarAdmissionError::CoveredDayLimitExceeded {
max: RADROOTS_CALENDAR_MAX_COVERED_UTC_DAYS,
actual: RADROOTS_CALENDAR_MAX_COVERED_UTC_DAYS + 1,
})
@@ -419,41 +410,41 @@ fn baseline_can_parse_overlong_ranges_that_strict_admission_rejects() {
#[test]
fn authored_construction_rejects_invalid_fields_before_encoding() {
assert_eq!(
- RadrootsAuthoredCalendarDateEvent::new(DATE_D_TAG, " CSA pickup ", date("2026-06-20")),
- Err(RadrootsCalendarEventError::InvalidTitle)
+ AuthoredCalendarDateEvent::new(DATE_D_TAG, " CSA pickup ", date("2026-06-20")),
+ Err(CalendarEventError::InvalidTitle)
);
assert_eq!(
- RadrootsAuthoredCalendarTimeEvent::new(TIME_D_TAG, "Shift", 10)
+ AuthoredCalendarTimeEvent::new(TIME_D_TAG, "Shift", 10)
.unwrap()
.with_start_tzid("america/vancouver"),
- Err(RadrootsCalendarEventError::InvalidTimeZone)
+ Err(CalendarEventError::InvalidTimeZone)
);
assert!(matches!(
- RadrootsAuthoredCalendarDateEvent::new(DATE_D_TAG, "Pickup", date("2026-06-20"))
+ AuthoredCalendarDateEvent::new(DATE_D_TAG, "Pickup", date("2026-06-20"))
.unwrap()
.with_summary("x".repeat(DEFAULT_TAG_ELEMENT_MAX_BYTES + 1)),
- Err(RadrootsCalendarEventError::TagElementTooLarge {
+ Err(CalendarEventError::TagElementTooLarge {
field: "summary",
..
})
));
assert!(matches!(
- RadrootsAuthoredCalendarDateEvent::new(DATE_D_TAG, "Pickup", date("2026-06-20"))
+ AuthoredCalendarDateEvent::new(DATE_D_TAG, "Pickup", date("2026-06-20"))
.unwrap()
.with_description("x".repeat(DEFAULT_CONTENT_MAX_BYTES + 1)),
- Err(RadrootsCalendarEventError::ContentTooLarge { .. })
+ Err(CalendarEventError::ContentTooLarge { .. })
));
- let invalid_participant = RadrootsCalendarParticipant {
+ let invalid_participant = CalendarParticipant {
pubkey: EVENT_AUTHOR.to_ascii_uppercase(),
relay: None,
role: None,
};
assert!(matches!(
- RadrootsAuthoredCalendarDateEvent::new(DATE_D_TAG, "Pickup", date("2026-06-20"))
+ AuthoredCalendarDateEvent::new(DATE_D_TAG, "Pickup", date("2026-06-20"))
.unwrap()
.with_participants(vec![invalid_participant]),
- Err(RadrootsCalendarEventError::InvalidParticipant { index: 0 })
+ Err(CalendarEventError::InvalidParticipant { index: 0 })
));
}
@@ -566,7 +557,7 @@ fn baseline_parser_rejects_malformed_fields_and_bounds_before_projection() {
(too_many_tags.len()..=DEFAULT_TAG_MAX_COUNT)
.map(|_| vec!["x".to_string(), "y".to_string()]),
);
- assert!(RadrootsEventTags::new(too_many_tags.clone()).is_err());
+ assert!(EventTags::new(too_many_tags.clone()).is_err());
assert!(matches!(
parse_nip52_calendar_date_event(KIND_CALENDAR_DATE_EVENT, &too_many_tags, ""),
Err(EventParseError::InvalidEnvelope)
@@ -609,13 +600,13 @@ fn kind_specific_encoders_and_parsed_wrappers_preserve_envelopes() {
assert_eq!(parsed.event.signature_hex(), EVENT_SIG);
assert_eq!(parsed.data.data.common().d_tag(), DATE_D_TAG);
- let event_reference = RadrootsCalendarEventReference::parse(
+ let event_reference = CalendarEventReference::parse(
format!("{KIND_CALENDAR_TIME_EVENT}:{EVENT_AUTHOR}:{TIME_D_TAG}"),
Some("wss://relay.example.test/events"),
)
.unwrap();
- let calendar = RadrootsAuthoredCalendar::new(
- RadrootsCalendarUid::parse("AAAAAAAAAAAAAAAAAAAAAA").unwrap(),
+ let calendar = AuthoredCalendar::new(
+ CalendarUid::parse("AAAAAAAAAAAAAAAAAAAAAA").unwrap(),
"Farm calendar",
"Shared farm schedule.",
vec![event_reference.clone()],
@@ -653,10 +644,10 @@ fn kind_specific_encoders_and_parsed_wrappers_preserve_envelopes() {
assert_eq!(parsed.event.signature_hex(), EVENT_SIG);
assert_eq!(parsed.data.data.title(), "Farm calendar");
- let rsvp = RadrootsAuthoredCalendarEventRsvp::new(
- RadrootsCalendarUid::parse("DDDDDDDDDDDDDDDDDDDDDw").unwrap(),
+ let rsvp = AuthoredCalendarEventRsvp::new(
+ CalendarUid::parse("DDDDDDDDDDDDDDDDDDDDDw").unwrap(),
event_reference,
- RadrootsCalendarEventRsvpStatus::Accepted,
+ CalendarEventRsvpStatus::Accepted,
)
.unwrap();
assert!(matches!(
@@ -674,10 +665,7 @@ fn kind_specific_encoders_and_parsed_wrappers_preserve_envelopes() {
parts.tags.clone(),
)
.unwrap();
- assert_eq!(
- data.data.status(),
- &RadrootsCalendarEventRsvpStatus::Accepted
- );
+ assert_eq!(data.data.status(), &CalendarEventRsvpStatus::Accepted);
let parsed = nip52_calendar_event_rsvp_parsed_from_event(
EVENT_ID.to_string(),
EVENT_AUTHOR.to_string(),
@@ -708,6 +696,6 @@ fn exclusive_end_day_math_is_bounded() {
);
assert_eq!(
covered_utc_days(10, Some(10)),
- Err(RadrootsCalendarEventError::InvalidRange)
+ Err(CalendarEventError::InvalidRange)
);
}
diff --git a/crates/event_codec/tests/calendar_conformance.rs b/crates/event_codec/tests/calendar_conformance.rs
@@ -3,18 +3,16 @@ use std::{borrow::Cow, fs, path::Path};
use radroots_blossom::{BlobDescriptor, ByteVerifiedDescriptor, Error};
use radroots_event::{
calendar::{
- RADROOTS_CALENDAR_MAX_COVERED_UTC_DAYS, RadrootsAuthoredCalendar,
- RadrootsAuthoredCalendarDateEvent, RadrootsAuthoredCalendarEventRsvp,
- RadrootsAuthoredCalendarTimeEvent, RadrootsCalendarAdmissionError, RadrootsCalendarDate,
- RadrootsCalendarEventAuthorReference, RadrootsCalendarEventError,
- RadrootsCalendarEventFreeBusy, RadrootsCalendarEventReference,
- RadrootsCalendarEventRevisionReference, RadrootsCalendarEventRsvpStatus,
- RadrootsCalendarParticipant, RadrootsCalendarRequest, RadrootsCalendarUid,
- RadrootsCalendarUri, RadrootsIanaTimeZoneId, RadrootsParsedNip52Calendar,
- RadrootsParsedNip52CalendarCommon, RadrootsParsedNip52CalendarEventRsvp,
+ AuthoredCalendar, AuthoredCalendarDateEvent, AuthoredCalendarEventRsvp,
+ AuthoredCalendarTimeEvent, CalendarAdmissionError, CalendarDate,
+ CalendarEventAuthorReference, CalendarEventError, CalendarEventFreeBusy,
+ CalendarEventReference, CalendarEventRevisionReference, CalendarEventRsvpStatus,
+ CalendarParticipant, CalendarRequest, CalendarUid, CalendarUri, IanaTimeZoneId,
+ ParsedNip52Calendar, ParsedNip52CalendarCommon, ParsedNip52CalendarEventRsvp,
+ RADROOTS_CALENDAR_MAX_COVERED_UTC_DAYS,
},
contract::validate_event_contract_parts,
- media::RadrootsAuthoredImage,
+ media::AuthoredImage,
};
use radroots_event_codec::{
calendar::{
@@ -194,7 +192,7 @@ fn baseline_date_valid(vector: &Value) {
assert_common(parsed.common(), expected, vector);
assert_eq!(parsed.start().as_str(), value_str(expected, "start"));
assert_optional_str(
- parsed.end().map(RadrootsCalendarDate::as_str),
+ parsed.end().map(CalendarDate::as_str),
expected,
"end",
vector,
@@ -240,21 +238,19 @@ fn baseline_time_valid(vector: &Value) {
vector_id(vector)
);
assert_optional_str(
- parsed.start_tzid().map(RadrootsIanaTimeZoneId::as_str),
+ parsed.start_tzid().map(IanaTimeZoneId::as_str),
expected,
"start_tzid",
vector,
);
assert_optional_str(
- parsed.end_tzid().map(RadrootsIanaTimeZoneId::as_str),
+ parsed.end_tzid().map(IanaTimeZoneId::as_str),
expected,
"end_tzid",
vector,
);
assert_optional_str(
- parsed
- .effective_end_tzid()
- .map(RadrootsIanaTimeZoneId::as_str),
+ parsed.effective_end_tzid().map(IanaTimeZoneId::as_str),
expected,
"effective_end_tzid",
vector,
@@ -303,11 +299,7 @@ fn baseline_rsvp_invalid(vector: &Value) {
assert_parse_error(vector, &error);
}
-fn assert_parsed_collection(
- parsed: &RadrootsParsedNip52Calendar,
- expected: &Value,
- vector: &Value,
-) {
+fn assert_parsed_collection(parsed: &ParsedNip52Calendar, expected: &Value, vector: &Value) {
assert_eq!(
parsed.d_tag(),
value_str(expected, "d"),
@@ -333,7 +325,7 @@ fn assert_parsed_collection(
vector,
);
assert_optional_str(
- parsed.image().map(RadrootsCalendarUri::as_str),
+ parsed.image().map(CalendarUri::as_str),
expected,
"image",
vector,
@@ -346,11 +338,7 @@ fn assert_parsed_collection(
);
}
-fn assert_parsed_rsvp(
- parsed: &RadrootsParsedNip52CalendarEventRsvp,
- expected: &Value,
- vector: &Value,
-) {
+fn assert_parsed_rsvp(parsed: &ParsedNip52CalendarEventRsvp, expected: &Value, vector: &Value) {
assert_eq!(
parsed.d_tag(),
value_str(expected, "d"),
@@ -385,7 +373,7 @@ fn assert_parsed_rsvp(
assert_optional_str(parsed.note(), expected, "note", vector);
}
-fn assert_common(common: &RadrootsParsedNip52CalendarCommon, expected: &Value, vector: &Value) {
+fn assert_common(common: &ParsedNip52CalendarCommon, expected: &Value, vector: &Value) {
assert_eq!(
common.d_tag(),
value_str(expected, "d"),
@@ -408,7 +396,7 @@ fn assert_common(common: &RadrootsParsedNip52CalendarCommon, expected: &Value, v
assert_optional_str(common.geohash(), expected, "geohash", vector);
assert_optional_str(common.summary(), expected, "summary", vector);
assert_optional_str(
- common.image().map(RadrootsCalendarUri::as_str),
+ common.image().map(CalendarUri::as_str),
expected,
"image",
vector,
@@ -424,7 +412,7 @@ fn assert_common(common: &RadrootsParsedNip52CalendarCommon, expected: &Value, v
common
.references()
.iter()
- .map(RadrootsCalendarUri::as_str)
+ .map(CalendarUri::as_str)
.collect::<Vec<_>>(),
expected["references"]
.as_array()
@@ -439,11 +427,7 @@ fn assert_common(common: &RadrootsParsedNip52CalendarCommon, expected: &Value, v
assert_optional_str(common.legacy_name(), expected, "legacy_name", vector);
}
-fn assert_participants(
- common: &RadrootsParsedNip52CalendarCommon,
- expected: &Value,
- vector: &Value,
-) {
+fn assert_participants(common: &ParsedNip52CalendarCommon, expected: &Value, vector: &Value) {
if let Some(count) = expected["participants"].as_u64() {
assert_eq!(
common.participants().len() as u64,
@@ -472,11 +456,7 @@ fn assert_participants(
);
}
-fn assert_calendar_requests(
- common: &RadrootsParsedNip52CalendarCommon,
- expected: &Value,
- vector: &Value,
-) {
+fn assert_calendar_requests(common: &ParsedNip52CalendarCommon, expected: &Value, vector: &Value) {
if let Some(count) = expected["calendar_requests"].as_u64() {
assert_eq!(
common.calendar_requests().len() as u64,
@@ -505,7 +485,7 @@ fn assert_calendar_requests(
}
fn assert_event_references(
- actual: &[RadrootsCalendarEventReference],
+ actual: &[CalendarEventReference],
expected: &Value,
key: &str,
vector: &Value,
@@ -519,11 +499,7 @@ fn assert_event_references(
}
}
-fn assert_event_reference(
- actual: &RadrootsCalendarEventReference,
- expected: &Value,
- vector: &Value,
-) {
+fn assert_event_reference(actual: &CalendarEventReference, expected: &Value, vector: &Value) {
let coordinate = value_str(expected, "coordinate");
let relay = expected.get("relay").and_then(Value::as_str);
assert_eq!(
@@ -534,11 +510,11 @@ fn assert_event_reference(
);
assert_eq!(actual.relay(), relay, "{}", vector_id(vector));
- let parts = radroots_event::id::RadrootsAddressableCoordinateParts::parse(coordinate)
+ let parts = radroots_event::id::AddressableCoordinateParts::parse(coordinate)
.expect("expected event reference coordinate");
let canonical_coordinate = format!("{}:{}:{}", parts.kind, parts.pubkey, parts.d_tag);
let canonical_relay =
- relay.is_none_or(|relay| radroots_event::id::RadrootsRelayUrl::parse(relay).is_ok());
+ relay.is_none_or(|relay| radroots_event::id::RelayUrl::parse(relay).is_ok());
assert_eq!(
actual.is_canonical(),
coordinate == canonical_coordinate && canonical_relay,
@@ -548,7 +524,7 @@ fn assert_event_reference(
}
fn assert_revision_reference(
- actual: Option<&RadrootsCalendarEventRevisionReference>,
+ actual: Option<&CalendarEventRevisionReference>,
expected: &Value,
vector: &Value,
) {
@@ -571,7 +547,7 @@ fn assert_revision_reference(
);
assert_eq!(actual.relay(), relay, "{}", vector_id(vector));
let canonical_relay =
- relay.is_none_or(|relay| radroots_event::id::RadrootsRelayUrl::parse(relay).is_ok());
+ relay.is_none_or(|relay| radroots_event::id::RelayUrl::parse(relay).is_ok());
assert_eq!(
actual.is_canonical(),
event_id == actual.event_id().to_hex() && canonical_relay,
@@ -581,7 +557,7 @@ fn assert_revision_reference(
}
fn assert_author_reference(
- actual: Option<&RadrootsCalendarEventAuthorReference>,
+ actual: Option<&CalendarEventAuthorReference>,
expected: &Value,
vector: &Value,
) {
@@ -601,7 +577,7 @@ fn assert_author_reference(
);
assert_eq!(actual.relay(), relay, "{}", vector_id(vector));
let canonical_relay =
- relay.is_none_or(|relay| radroots_event::id::RadrootsRelayUrl::parse(relay).is_ok());
+ relay.is_none_or(|relay| radroots_event::id::RelayUrl::parse(relay).is_ok());
assert_eq!(
actual.is_canonical(),
pubkey == actual.pubkey().to_hex() && canonical_relay,
@@ -610,29 +586,29 @@ fn assert_author_reference(
);
}
-fn rsvp_status_str(status: &RadrootsCalendarEventRsvpStatus) -> &'static str {
+fn rsvp_status_str(status: &CalendarEventRsvpStatus) -> &'static str {
match status {
- RadrootsCalendarEventRsvpStatus::Accepted => "accepted",
- RadrootsCalendarEventRsvpStatus::Declined => "declined",
- RadrootsCalendarEventRsvpStatus::Tentative => "tentative",
+ CalendarEventRsvpStatus::Accepted => "accepted",
+ CalendarEventRsvpStatus::Declined => "declined",
+ CalendarEventRsvpStatus::Tentative => "tentative",
}
}
-fn free_busy_str(free_busy: &RadrootsCalendarEventFreeBusy) -> &'static str {
+fn free_busy_str(free_busy: &CalendarEventFreeBusy) -> &'static str {
match free_busy {
- RadrootsCalendarEventFreeBusy::Free => "free",
- RadrootsCalendarEventFreeBusy::Busy => "busy",
+ CalendarEventFreeBusy::Free => "free",
+ CalendarEventFreeBusy::Busy => "busy",
}
}
fn profile_date_parse_valid(vector: &Value) {
- let parsed = RadrootsCalendarDate::parse(input_str(vector, "value"))
+ let parsed = CalendarDate::parse(input_str(vector, "value"))
.unwrap_or_else(|error| panic!("{} failed: {error}", vector_id(vector)));
assert_eq!(parsed.as_str(), expected_str(vector, "value"));
}
fn profile_date_parse_invalid(vector: &Value) {
- let error = RadrootsCalendarDate::parse(input_str(vector, "value"))
+ let error = CalendarDate::parse(input_str(vector, "value"))
.expect_err("invalid profile date must fail");
assert_calendar_event_error(vector, &error);
}
@@ -675,9 +651,7 @@ fn profile_authored_time_valid(vector: &Value) {
let event = authored_time_event(input(vector), vector_id(vector))
.unwrap_or_else(|error| panic!("{} failed: {error}", vector_id(vector)));
assert_optional_str(
- event
- .effective_end_tzid()
- .map(RadrootsIanaTimeZoneId::as_str),
+ event.effective_end_tzid().map(IanaTimeZoneId::as_str),
expected(vector),
"effective_end_tzid",
vector,
@@ -788,7 +762,7 @@ fn profile_authored_collection_valid(vector: &Value) {
vector_id(vector)
);
assert_eq!(
- parsed.image().map(RadrootsCalendarUri::as_str),
+ parsed.image().map(CalendarUri::as_str),
calendar
.image()
.map(|image| image.descriptor().url().as_str()),
@@ -799,7 +773,7 @@ fn profile_authored_collection_valid(vector: &Value) {
parsed
.event_references()
.iter()
- .all(RadrootsCalendarEventReference::is_canonical),
+ .all(CalendarEventReference::is_canonical),
"{}",
vector_id(vector)
);
@@ -1048,7 +1022,7 @@ fn profile_admit_collection_valid(vector: &Value) {
.and_then(|tag| tag.get(1))
.map(String::as_str);
assert_eq!(
- admitted.parsed().image().map(RadrootsCalendarUri::as_str),
+ admitted.parsed().image().map(CalendarUri::as_str),
image,
"{}",
vector_id(vector)
@@ -1137,7 +1111,7 @@ fn profile_admit_rsvp_valid(vector: &Value) {
}
fn assert_admitted_rsvp_references_against_tags(
- admitted: &radroots_event::calendar::RadrootsAdmittedCalendarEventRsvp,
+ admitted: &radroots_event::calendar::AdmittedCalendarEventRsvp,
tags: &[Vec<String>],
vector: &Value,
) {
@@ -1203,15 +1177,15 @@ fn profile_admit_rsvp_invalid(vector: &Value) {
fn authored_collection(
input: &Map<String, Value>,
vector_id: &str,
-) -> Result<RadrootsAuthoredCalendar, RadrootsCalendarEventError> {
- let uid = RadrootsCalendarUid::parse(map_str(input, "d"))?;
+) -> Result<AuthoredCalendar, CalendarEventError> {
+ let uid = CalendarUid::parse(map_str(input, "d"))?;
let event_references = input["event_references"]
.as_array()
.expect("input.event_references")
.iter()
.map(calendar_event_reference)
.collect::<Result<Vec<_>, _>>()?;
- let mut calendar = RadrootsAuthoredCalendar::new(
+ let mut calendar = AuthoredCalendar::new(
uid,
map_str(input, "title"),
map_optional_str(input, "content").unwrap_or_default(),
@@ -1228,10 +1202,10 @@ fn authored_collection(
fn authored_rsvp(
input: &Map<String, Value>,
-) -> Result<RadrootsAuthoredCalendarEventRsvp, RadrootsCalendarEventError> {
- let uid = RadrootsCalendarUid::parse(map_str(input, "d"))?;
+) -> Result<AuthoredCalendarEventRsvp, CalendarEventError> {
+ let uid = CalendarUid::parse(map_str(input, "d"))?;
let event_reference = calendar_event_reference(&input["event_reference"])?;
- let mut rsvp = RadrootsAuthoredCalendarEventRsvp::new(
+ let mut rsvp = AuthoredCalendarEventRsvp::new(
uid,
event_reference,
parse_authored_rsvp_status(map_str(input, "status")),
@@ -1251,10 +1225,8 @@ fn authored_rsvp(
Ok(rsvp)
}
-fn calendar_event_reference(
- value: &Value,
-) -> Result<RadrootsCalendarEventReference, RadrootsCalendarEventError> {
- RadrootsCalendarEventReference::parse(
+fn calendar_event_reference(value: &Value) -> Result<CalendarEventReference, CalendarEventError> {
+ CalendarEventReference::parse(
value["coordinate"]
.as_str()
.expect("event_reference.coordinate"),
@@ -1264,8 +1236,8 @@ fn calendar_event_reference(
fn calendar_revision_reference(
value: &Value,
-) -> Result<RadrootsCalendarEventRevisionReference, RadrootsCalendarEventError> {
- RadrootsCalendarEventRevisionReference::parse(
+) -> Result<CalendarEventRevisionReference, CalendarEventError> {
+ CalendarEventRevisionReference::parse(
value["id"].as_str().expect("revision_reference.id"),
value.get("relay").and_then(Value::as_str),
)
@@ -1273,26 +1245,26 @@ fn calendar_revision_reference(
fn calendar_author_reference(
value: &Value,
-) -> Result<RadrootsCalendarEventAuthorReference, RadrootsCalendarEventError> {
- RadrootsCalendarEventAuthorReference::parse(
+) -> Result<CalendarEventAuthorReference, CalendarEventError> {
+ CalendarEventAuthorReference::parse(
value["pubkey"].as_str().expect("author_hint.pubkey"),
value.get("relay").and_then(Value::as_str),
)
}
-fn parse_authored_rsvp_status(value: &str) -> RadrootsCalendarEventRsvpStatus {
+fn parse_authored_rsvp_status(value: &str) -> CalendarEventRsvpStatus {
match value {
- "accepted" => RadrootsCalendarEventRsvpStatus::Accepted,
- "declined" => RadrootsCalendarEventRsvpStatus::Declined,
- "tentative" => RadrootsCalendarEventRsvpStatus::Tentative,
+ "accepted" => CalendarEventRsvpStatus::Accepted,
+ "declined" => CalendarEventRsvpStatus::Declined,
+ "tentative" => CalendarEventRsvpStatus::Tentative,
value => panic!("unsupported authored RSVP status {value}"),
}
}
-fn parse_authored_free_busy(value: &str) -> RadrootsCalendarEventFreeBusy {
+fn parse_authored_free_busy(value: &str) -> CalendarEventFreeBusy {
match value {
- "free" => RadrootsCalendarEventFreeBusy::Free,
- "busy" => RadrootsCalendarEventFreeBusy::Busy,
+ "free" => CalendarEventFreeBusy::Free,
+ "busy" => CalendarEventFreeBusy::Busy,
value => panic!("unsupported authored RSVP free/busy value {value}"),
}
}
@@ -1300,25 +1272,22 @@ fn parse_authored_free_busy(value: &str) -> RadrootsCalendarEventFreeBusy {
fn authored_date_event(
input: &Map<String, Value>,
vector_id: &str,
-) -> Result<RadrootsAuthoredCalendarDateEvent, RadrootsCalendarEventError> {
- let start = RadrootsCalendarDate::parse(map_str(input, "start"))?;
- let mut event = RadrootsAuthoredCalendarDateEvent::new(
- map_str(input, "d"),
- map_str(input, "title"),
- start,
- )?;
+) -> Result<AuthoredCalendarDateEvent, CalendarEventError> {
+ let start = CalendarDate::parse(map_str(input, "start"))?;
+ let mut event =
+ AuthoredCalendarDateEvent::new(map_str(input, "d"), map_str(input, "title"), start)?;
if let Some(value) = map_optional_str(input, "end") {
- event = event.with_end(RadrootsCalendarDate::parse(value)?)?;
+ event = event.with_end(CalendarDate::parse(value)?)?;
}
event = apply_authored_date_common(event, input, vector_id)?;
Ok(event)
}
fn apply_authored_date_common(
- mut event: RadrootsAuthoredCalendarDateEvent,
+ mut event: AuthoredCalendarDateEvent,
input: &Map<String, Value>,
vector_id: &str,
-) -> Result<RadrootsAuthoredCalendarDateEvent, RadrootsCalendarEventError> {
+) -> Result<AuthoredCalendarDateEvent, CalendarEventError> {
if let Some(value) = map_optional_str(input, "description") {
event = event.with_description(value)?;
}
@@ -1344,7 +1313,7 @@ fn apply_authored_date_common(
event = event.with_references(
value
.into_iter()
- .map(RadrootsCalendarUri::parse)
+ .map(CalendarUri::parse)
.collect::<Result<Vec<_>, _>>()?,
)?;
}
@@ -1357,8 +1326,8 @@ fn apply_authored_date_common(
fn authored_time_event(
input: &Map<String, Value>,
vector_id: &str,
-) -> Result<RadrootsAuthoredCalendarTimeEvent, RadrootsCalendarEventError> {
- let mut event = RadrootsAuthoredCalendarTimeEvent::new(
+) -> Result<AuthoredCalendarTimeEvent, CalendarEventError> {
+ let mut event = AuthoredCalendarTimeEvent::new(
map_str(input, "d"),
map_str(input, "title"),
map_u64(input, "start"),
@@ -1397,7 +1366,7 @@ fn authored_time_event(
event = event.with_references(
value
.into_iter()
- .map(RadrootsCalendarUri::parse)
+ .map(CalendarUri::parse)
.collect::<Result<Vec<_>, _>>()?,
)?;
}
@@ -1407,8 +1376,8 @@ fn authored_time_event(
Ok(event)
}
-fn authored_image(input: &Value, vector_id: &str) -> RadrootsAuthoredImage {
- RadrootsAuthoredImage::try_from(verified_descriptor(input, vector_id))
+fn authored_image(input: &Value, vector_id: &str) -> AuthoredImage {
+ AuthoredImage::try_from(verified_descriptor(input, vector_id))
.unwrap_or_else(|error| panic!("{vector_id} image failed: {error}"))
}
@@ -1430,12 +1399,12 @@ fn verified_descriptor_result(input: &Value) -> Result<ByteVerifiedDescriptor, E
)
}
-fn participants(input: &Value, vector_id: &str) -> Vec<RadrootsCalendarParticipant> {
+fn participants(input: &Value, vector_id: &str) -> Vec<CalendarParticipant> {
input
.as_array()
.unwrap_or_else(|| panic!("{vector_id} participants must be an array"))
.iter()
- .map(|value| RadrootsCalendarParticipant {
+ .map(|value| CalendarParticipant {
pubkey: value["pubkey"]
.as_str()
.expect("participant.pubkey")
@@ -1452,13 +1421,13 @@ fn participants(input: &Value, vector_id: &str) -> Vec<RadrootsCalendarParticipa
.collect()
}
-fn calendar_requests(input: &Value, vector_id: &str) -> Vec<RadrootsCalendarRequest> {
+fn calendar_requests(input: &Value, vector_id: &str) -> Vec<CalendarRequest> {
input
.as_array()
.unwrap_or_else(|| panic!("{vector_id} calendar_requests must be an array"))
.iter()
.map(|value| {
- RadrootsCalendarRequest::new(
+ CalendarRequest::new(
value["calendar"].as_str().expect("request.calendar"),
value.get("relay").and_then(Value::as_str),
)
@@ -1487,7 +1456,7 @@ fn assert_authored_media_claims(vector: &Value, image_expected: bool) {
);
}
-fn assert_calendar_event_error(vector: &Value, error: &RadrootsCalendarEventError) {
+fn assert_calendar_event_error(vector: &Value, error: &CalendarEventError) {
assert_eq!(
error.code(),
expected_str(vector, "error"),
@@ -1495,13 +1464,13 @@ fn assert_calendar_event_error(vector: &Value, error: &RadrootsCalendarEventErro
vector_id(vector)
);
assert!(!error.to_string().is_empty());
- if let RadrootsCalendarEventError::CoveredDayLimitExceeded { max, actual } = error {
+ if let CalendarEventError::CoveredDayLimitExceeded { max, actual } = error {
assert_eq!(*max, expected_u64(vector, "max"));
assert_eq!(*actual, expected_u64(vector, "actual"));
}
}
-fn assert_admission_error(vector: &Value, error: &RadrootsCalendarAdmissionError) {
+fn assert_admission_error(vector: &Value, error: &CalendarAdmissionError) {
assert_eq!(
error.code(),
expected_str(vector, "error"),
@@ -1510,7 +1479,7 @@ fn assert_admission_error(vector: &Value, error: &RadrootsCalendarAdmissionError
);
assert!(!error.to_string().is_empty());
if let Some(expected_field) = expected(vector).get("field").and_then(Value::as_str) {
- let RadrootsCalendarAdmissionError::NonCanonicalField(actual_field) = error else {
+ let CalendarAdmissionError::NonCanonicalField(actual_field) = error else {
panic!(
"{} expected a field-bearing admission error",
vector_id(vector)
@@ -1518,7 +1487,7 @@ fn assert_admission_error(vector: &Value, error: &RadrootsCalendarAdmissionError
};
assert_eq!(*actual_field, expected_field, "{}", vector_id(vector));
}
- if let RadrootsCalendarAdmissionError::CoveredDayLimitExceeded { max, actual } = error {
+ if let CalendarAdmissionError::CoveredDayLimitExceeded { max, actual } = error {
assert_eq!(*max, expected_u64(vector, "max"));
assert_eq!(*actual, expected_u64(vector, "actual"));
}
@@ -1554,7 +1523,7 @@ fn parse_error_tag(error: &EventParseError) -> Option<&'static str> {
}
fn assert_wire_parts(
- wire: &radroots_event::wire::RadrootsNip01EventWireParts,
+ wire: &radroots_event::wire::Nip01EventWireParts,
expected: &Value,
vector_id: &str,
) {
diff --git a/crates/event_codec/tests/common/mod.rs b/crates/event_codec/tests/common/mod.rs
@@ -1,8 +1,7 @@
#![allow(dead_code)]
use radroots_event::{
- envelope::RadrootsEventEnvelope, envelope::RadrootsEventEnvelopeParts, tag::RadrootsEventPtr,
- tag::RadrootsEventRef,
+ envelope::EventEnvelope, envelope::EventEnvelopeParts, tag::EventPtr, tag::EventRef,
};
use radroots_identity::PublicKey;
@@ -13,8 +12,8 @@ pub const EVENT_SIG: &str = concat!(
"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
);
-pub fn event_ref(id: &str, author: &str, kind: u32) -> RadrootsEventRef {
- RadrootsEventRef {
+pub fn event_ref(id: &str, author: &str, kind: u32) -> EventRef {
+ EventRef {
id: id.to_string(),
author: PublicKey::from_hex(author).expect("valid fixture public key"),
kind,
@@ -29,8 +28,8 @@ pub fn event_ref_with_d(
kind: u32,
d_tag: &str,
relays: Option<Vec<String>>,
-) -> RadrootsEventRef {
- RadrootsEventRef {
+) -> EventRef {
+ EventRef {
id: id.to_string(),
author: PublicKey::from_hex(author).expect("valid fixture public key"),
kind,
@@ -39,15 +38,15 @@ pub fn event_ref_with_d(
}
}
-pub fn event_ptr(id: &str, relays: Option<&str>) -> RadrootsEventPtr {
- RadrootsEventPtr {
+pub fn event_ptr(id: &str, relays: Option<&str>) -> EventPtr {
+ EventPtr {
id: id.to_string(),
relays: relays.map(|s| s.to_string()),
}
}
-pub fn nostr_event(kind: u32, content: &str, tags: Vec<Vec<String>>) -> RadrootsEventEnvelope {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+pub fn nostr_event(kind: u32, content: &str, tags: Vec<Vec<String>>) -> EventEnvelope {
+ EventEnvelope::new(EventEnvelopeParts {
id: EVENT_ID.to_string(),
author: AUTHOR.to_string(),
created_at: 123,
diff --git a/crates/event_codec/tests/domain_encode_non_serde.rs b/crates/event_codec/tests/domain_encode_non_serde.rs
@@ -5,21 +5,19 @@ use std::str::FromStr;
use radroots_core::{Currency, Decimal, Money, Quantity, QuantityPrice, Unit};
use radroots_event::{
- farm::change_set::{RadrootsGcsLocation, RadrootsGeoJsonPoint, RadrootsGeoJsonPolygon},
- farm::coop::{RadrootsCoop, RadrootsCoopLocation, RadrootsCoopRef},
- farm::plot::{RadrootsPlot, RadrootsPlotLocation, RadrootsPlotRef},
- farm::resource_area::{
- RadrootsResourceArea, RadrootsResourceAreaLocation, RadrootsResourceAreaRef,
- },
- farm::resource_cap::{RadrootsResourceHarvestCap, RadrootsResourceHarvestProduct},
- farm::{RadrootsFarm, RadrootsFarmPublicLocation, RadrootsFarmRef},
- id::{RadrootsDTag, RadrootsInventoryBinId},
+ farm::change_set::{GcsLocation, GeoJsonPoint, GeoJsonPolygon},
+ farm::coop::{Coop, CoopLocation, CoopRef},
+ farm::plot::{Plot, PlotLocation, PlotRef},
+ farm::resource_area::{ResourceArea, ResourceAreaLocation, ResourceAreaRef},
+ farm::resource_cap::{ResourceHarvestCap, ResourceHarvestProduct},
+ farm::{Farm, FarmPublicLocation, FarmRef},
+ id::{DTag, InventoryBinId},
listing::operational::{
- RadrootsOperationalListing, RadrootsOperationalListingAvailability,
- RadrootsOperationalListingBin, RadrootsOperationalListingDeliveryMethod,
- RadrootsOperationalListingProduct, RadrootsOperationalListingPublicLocation,
+ OperationalListing, OperationalListingAvailability, OperationalListingBin,
+ OperationalListingDeliveryMethod, OperationalListingProduct,
+ OperationalListingPublicLocation,
},
- post::document::{RadrootsDocument, RadrootsDocumentSubject},
+ post::document::{Document, DocumentSubject},
};
use radroots_event_codec::coop::encode::{coop_build_tags, coop_ref_tags};
use radroots_event_codec::coop::list_sets::{coop_members_farms_list_set, coop_members_list_set};
@@ -69,24 +67,24 @@ fn quantity_price(amount: Money, quantity: Quantity) -> QuantityPrice {
QuantityPrice::try_new(amount, quantity).unwrap()
}
-fn listing_d_tag(raw: &str) -> RadrootsDTag {
+fn listing_d_tag(raw: &str) -> DTag {
raw.parse().unwrap()
}
-fn bin_id(raw: &str) -> RadrootsInventoryBinId {
+fn bin_id(raw: &str) -> InventoryBinId {
raw.parse().unwrap()
}
-fn sample_gcs(geohash: &str) -> RadrootsGcsLocation {
- RadrootsGcsLocation {
+fn sample_gcs(geohash: &str) -> GcsLocation {
+ GcsLocation {
lat: 37.0,
lng: -122.0,
geohash: geohash.to_string(),
- point: RadrootsGeoJsonPoint {
+ point: GeoJsonPoint {
r#type: "Point".to_string(),
coordinates: [-122.0, 37.0],
},
- polygon: RadrootsGeoJsonPolygon {
+ polygon: GeoJsonPolygon {
r#type: "Polygon".to_string(),
coordinates: vec![vec![
[-122.0, 37.0],
@@ -112,15 +110,15 @@ fn sample_gcs(geohash: &str) -> RadrootsGcsLocation {
}
}
-fn sample_coop() -> RadrootsCoop {
- RadrootsCoop {
+fn sample_coop() -> Coop {
+ Coop {
d_tag: VALID_COOP_D_TAG.to_string(),
name: "Test Coop".to_string(),
about: None,
website: None,
picture: None,
banner: None,
- location: Some(RadrootsCoopLocation {
+ location: Some(CoopLocation {
primary: None,
city: None,
region: None,
@@ -131,15 +129,15 @@ fn sample_coop() -> RadrootsCoop {
}
}
-fn sample_farm() -> RadrootsFarm {
- RadrootsFarm {
+fn sample_farm() -> Farm {
+ Farm {
d_tag: VALID_FARM_D_TAG.to_string(),
name: "Test Farm".to_string(),
about: None,
website: None,
picture: None,
banner: None,
- location: Some(RadrootsFarmPublicLocation {
+ location: Some(FarmPublicLocation {
primary: "Test Farm".to_string(),
city: Some("Santa Cruz".to_string()),
region: Some("California".to_string()),
@@ -150,16 +148,16 @@ fn sample_farm() -> RadrootsFarm {
}
}
-fn sample_plot() -> RadrootsPlot {
- RadrootsPlot {
+fn sample_plot() -> Plot {
+ Plot {
d_tag: VALID_PLOT_D_TAG.to_string(),
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: VALID_PUBKEY.to_string(),
d_tag: VALID_FARM_D_TAG.to_string(),
},
name: "Plot 1".to_string(),
about: None,
- location: Some(RadrootsPlotLocation {
+ location: Some(PlotLocation {
primary: None,
city: None,
region: None,
@@ -170,19 +168,19 @@ fn sample_plot() -> RadrootsPlot {
}
}
-fn sample_listing() -> RadrootsOperationalListing {
+fn sample_listing() -> OperationalListing {
let quantity = quantity(Decimal::from(1u32), Unit::Each);
let price_per_canonical_unit =
quantity_price(money(Decimal::from(10u32), Currency::USD), quantity.clone());
- RadrootsOperationalListing {
+ OperationalListing {
d_tag: listing_d_tag(VALID_DOC_D_TAG),
published_at: None,
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: VALID_PUBKEY.to_string(),
d_tag: VALID_FARM_D_TAG.to_string(),
},
- product: RadrootsOperationalListingProduct {
+ product: OperationalListingProduct {
key: "nutmeg".to_string(),
title: "Nutmeg".to_string(),
category: "spice".to_string(),
@@ -194,7 +192,7 @@ fn sample_listing() -> RadrootsOperationalListing {
year: None,
},
primary_bin_id: bin_id("bin-1"),
- bins: vec![RadrootsOperationalListingBin {
+ bins: vec![OperationalListingBin {
bin_id: bin_id("bin-1"),
quantity,
price_per_canonical_unit,
@@ -208,22 +206,22 @@ fn sample_listing() -> RadrootsOperationalListing {
plot: None,
discounts: None,
inventory_available: Some(decimal("12")),
- availability: Some(RadrootsOperationalListingAvailability::Window {
+ availability: Some(OperationalListingAvailability::Window {
start: Some(1),
end: Some(2),
}),
- delivery_method: Some(RadrootsOperationalListingDeliveryMethod::Shipping),
+ delivery_method: Some(OperationalListingDeliveryMethod::Shipping),
location: None,
images: None,
}
}
-fn sample_resource_area() -> RadrootsResourceArea {
- RadrootsResourceArea {
+fn sample_resource_area() -> ResourceArea {
+ ResourceArea {
d_tag: VALID_AREA_D_TAG.to_string(),
name: "Banda Grove".to_string(),
about: None,
- location: RadrootsResourceAreaLocation {
+ location: ResourceAreaLocation {
primary: None,
city: None,
region: None,
@@ -234,14 +232,14 @@ fn sample_resource_area() -> RadrootsResourceArea {
}
}
-fn sample_resource_cap() -> RadrootsResourceHarvestCap {
- RadrootsResourceHarvestCap {
+fn sample_resource_cap() -> ResourceHarvestCap {
+ ResourceHarvestCap {
d_tag: VALID_CAP_D_TAG.to_string(),
- resource_area: RadrootsResourceAreaRef {
+ resource_area: ResourceAreaRef {
pubkey: VALID_PUBKEY.to_string(),
d_tag: VALID_AREA_D_TAG.to_string(),
},
- product: RadrootsResourceHarvestProduct {
+ product: ResourceHarvestProduct {
key: "nutmeg".to_string(),
category: Some("spice".to_string()),
},
@@ -255,8 +253,8 @@ fn sample_resource_cap() -> RadrootsResourceHarvestCap {
}
}
-fn sample_document() -> RadrootsDocument {
- RadrootsDocument {
+fn sample_document() -> Document {
+ Document {
d_tag: VALID_DOC_D_TAG.to_string(),
doc_type: "charter".to_string(),
title: "Charter".to_string(),
@@ -264,7 +262,7 @@ fn sample_document() -> RadrootsDocument {
summary: None,
effective_at: None,
body_markdown: None,
- subject: RadrootsDocumentSubject {
+ subject: DocumentSubject {
pubkey: VALID_PUBKEY.to_string(),
address: Some(format!("30340:{VALID_PUBKEY}:{VALID_FARM_D_TAG}")),
},
@@ -326,14 +324,14 @@ fn coop_encode_and_list_set_paths() {
let err = coop_build_tags(&coop).expect_err("invalid d_tag");
assert!(matches!(err, EventEncodeError::InvalidField("d_tag")));
- let tags = coop_ref_tags(&RadrootsCoopRef {
+ let tags = coop_ref_tags(&CoopRef {
pubkey: VALID_PUBKEY.to_string(),
d_tag: VALID_COOP_D_TAG.to_string(),
})
.expect("coop ref tags");
assert_eq!(tags.len(), 2);
- let err = coop_ref_tags(&RadrootsCoopRef {
+ let err = coop_ref_tags(&CoopRef {
pubkey: " ".to_string(),
d_tag: VALID_COOP_D_TAG.to_string(),
})
@@ -343,7 +341,7 @@ fn coop_encode_and_list_set_paths() {
EventEncodeError::EmptyRequiredField("coop.pubkey")
));
- let err = coop_ref_tags(&RadrootsCoopRef {
+ let err = coop_ref_tags(&CoopRef {
pubkey: VALID_PUBKEY.to_string(),
d_tag: " ".to_string(),
})
@@ -353,7 +351,7 @@ fn coop_encode_and_list_set_paths() {
EventEncodeError::EmptyRequiredField("coop.d_tag")
));
- let err = coop_ref_tags(&RadrootsCoopRef {
+ let err = coop_ref_tags(&CoopRef {
pubkey: VALID_PUBKEY.to_string(),
d_tag: "invalid".to_string(),
})
@@ -381,7 +379,7 @@ fn coop_encode_and_list_set_paths() {
let member_farms = coop_members_farms_list_set(
VALID_COOP_D_TAG,
- vec![RadrootsFarmRef {
+ vec![FarmRef {
pubkey: VALID_PUBKEY.to_string(),
d_tag: VALID_FARM_D_TAG.to_string(),
}],
@@ -393,7 +391,7 @@ fn coop_encode_and_list_set_paths() {
let member_farms_from_array = coop_members_farms_list_set(
VALID_COOP_D_TAG,
- [RadrootsFarmRef {
+ [FarmRef {
pubkey: VALID_PUBKEY.to_string(),
d_tag: VALID_FARM_D_TAG.to_string(),
}],
@@ -405,7 +403,7 @@ fn coop_encode_and_list_set_paths() {
let err = coop_members_farms_list_set(
VALID_COOP_D_TAG,
- vec![RadrootsFarmRef {
+ vec![FarmRef {
pubkey: " ".to_string(),
d_tag: VALID_FARM_D_TAG.to_string(),
}],
@@ -418,7 +416,7 @@ fn coop_encode_and_list_set_paths() {
let err = coop_members_farms_list_set(
VALID_COOP_D_TAG,
- vec![RadrootsFarmRef {
+ vec![FarmRef {
pubkey: VALID_PUBKEY.to_string(),
d_tag: " ".to_string(),
}],
@@ -431,7 +429,7 @@ fn coop_encode_and_list_set_paths() {
let err = coop_members_farms_list_set(
VALID_COOP_D_TAG,
- vec![RadrootsFarmRef {
+ vec![FarmRef {
pubkey: VALID_PUBKEY.to_string(),
d_tag: "invalid".to_string(),
}],
@@ -497,14 +495,14 @@ fn farm_encode_and_list_set_paths() {
EventEncodeError::InvalidField("location.geohash")
));
- let tags = farm_ref_tags(&RadrootsFarmRef {
+ let tags = farm_ref_tags(&FarmRef {
pubkey: VALID_PUBKEY.to_string(),
d_tag: VALID_FARM_D_TAG.to_string(),
})
.expect("farm ref tags");
assert_eq!(tags.len(), 2);
- let err = farm_ref_tags(&RadrootsFarmRef {
+ let err = farm_ref_tags(&FarmRef {
pubkey: " ".to_string(),
d_tag: VALID_FARM_D_TAG.to_string(),
})
@@ -514,7 +512,7 @@ fn farm_encode_and_list_set_paths() {
EventEncodeError::EmptyRequiredField("farm.pubkey")
));
- let err = farm_ref_tags(&RadrootsFarmRef {
+ let err = farm_ref_tags(&FarmRef {
pubkey: VALID_PUBKEY.to_string(),
d_tag: " ".to_string(),
})
@@ -524,7 +522,7 @@ fn farm_encode_and_list_set_paths() {
EventEncodeError::EmptyRequiredField("farm.d_tag")
));
- let err = farm_ref_tags(&RadrootsFarmRef {
+ let err = farm_ref_tags(&FarmRef {
pubkey: VALID_PUBKEY.to_string(),
d_tag: "invalid".to_string(),
})
@@ -697,7 +695,7 @@ fn listing_encode_paths() {
}));
let mut listing_with_geohash = sample_listing();
- listing_with_geohash.location = Some(RadrootsOperationalListingPublicLocation {
+ listing_with_geohash.location = Some(OperationalListingPublicLocation {
primary: "Origin".to_string(),
city: Some("Town".to_string()),
region: Some("Region".to_string()),
@@ -719,7 +717,7 @@ fn listing_encode_paths() {
);
let mut listing_with_shared_geohash = sample_listing();
- listing_with_shared_geohash.location = Some(RadrootsOperationalListingPublicLocation {
+ listing_with_shared_geohash.location = Some(OperationalListingPublicLocation {
primary: "Origin".to_string(),
city: Some("Town".to_string()),
region: Some("Region".to_string()),
@@ -737,7 +735,7 @@ fn listing_encode_paths() {
}));
let mut listing_without_coordinates = sample_listing();
- listing_without_coordinates.location = Some(RadrootsOperationalListingPublicLocation {
+ listing_without_coordinates.location = Some(OperationalListingPublicLocation {
primary: "Origin".to_string(),
city: Some("Town".to_string()),
region: Some("Region".to_string()),
@@ -765,7 +763,7 @@ fn listing_encode_paths() {
listing_with_blank_optionals.product.location = Some(" ".to_string());
listing_with_blank_optionals.product.profile = Some("null".to_string());
listing_with_blank_optionals.product.year = Some(" ".to_string());
- listing_with_blank_optionals.location = Some(RadrootsOperationalListingPublicLocation {
+ listing_with_blank_optionals.location = Some(OperationalListingPublicLocation {
primary: " ".to_string(),
city: Some(" ".to_string()),
region: Some("null".to_string()),
@@ -804,7 +802,7 @@ fn listing_encode_paths() {
);
let mut listing_without_geohash = sample_listing();
- listing_without_geohash.location = Some(RadrootsOperationalListingPublicLocation {
+ listing_without_geohash.location = Some(OperationalListingPublicLocation {
primary: "Origin".to_string(),
city: Some("Town".to_string()),
region: Some("Region".to_string()),
@@ -837,7 +835,7 @@ fn listing_encode_paths() {
);
let mut listing_pickup = sample_listing();
- listing_pickup.delivery_method = Some(RadrootsOperationalListingDeliveryMethod::Pickup);
+ listing_pickup.delivery_method = Some(OperationalListingDeliveryMethod::Pickup);
let pickup_tags = operational_listing_tags_with_options(&listing_pickup, with_trade_fields())
.expect("listing tags with pickup delivery");
assert!(pickup_tags.iter().any(|tag| {
@@ -846,7 +844,7 @@ fn listing_encode_paths() {
}));
let mut listing_local = sample_listing();
- listing_local.delivery_method = Some(RadrootsOperationalListingDeliveryMethod::LocalDelivery);
+ listing_local.delivery_method = Some(OperationalListingDeliveryMethod::LocalDelivery);
let local_tags = operational_listing_tags_with_options(&listing_local, with_trade_fields())
.expect("listing tags with local delivery");
assert!(local_tags.iter().any(|tag| {
@@ -855,10 +853,9 @@ fn listing_encode_paths() {
}));
let mut listing_other_delivery = sample_listing();
- listing_other_delivery.delivery_method =
- Some(RadrootsOperationalListingDeliveryMethod::Other {
- method: "courier".to_string(),
- });
+ listing_other_delivery.delivery_method = Some(OperationalListingDeliveryMethod::Other {
+ method: "courier".to_string(),
+ });
let other_delivery_tags =
operational_listing_tags_with_options(&listing_other_delivery, with_trade_fields())
.expect("listing tags with other delivery");
@@ -1024,14 +1021,14 @@ fn resource_area_encode_and_list_set_paths() {
EventEncodeError::EmptyRequiredField("location.gcs.geohash")
));
- let tags = resource_area_ref_tags(&RadrootsResourceAreaRef {
+ let tags = resource_area_ref_tags(&ResourceAreaRef {
pubkey: VALID_PUBKEY.to_string(),
d_tag: VALID_AREA_D_TAG.to_string(),
})
.expect("resource area ref tags");
assert_eq!(tags.len(), 2);
- let err = resource_area_ref_tags(&RadrootsResourceAreaRef {
+ let err = resource_area_ref_tags(&ResourceAreaRef {
pubkey: " ".to_string(),
d_tag: VALID_AREA_D_TAG.to_string(),
})
@@ -1041,7 +1038,7 @@ fn resource_area_encode_and_list_set_paths() {
EventEncodeError::EmptyRequiredField("resource_area.pubkey")
));
- let err = resource_area_ref_tags(&RadrootsResourceAreaRef {
+ let err = resource_area_ref_tags(&ResourceAreaRef {
pubkey: VALID_PUBKEY.to_string(),
d_tag: " ".to_string(),
})
@@ -1051,7 +1048,7 @@ fn resource_area_encode_and_list_set_paths() {
EventEncodeError::EmptyRequiredField("resource_area.d_tag")
));
- let err = resource_area_ref_tags(&RadrootsResourceAreaRef {
+ let err = resource_area_ref_tags(&ResourceAreaRef {
pubkey: VALID_PUBKEY.to_string(),
d_tag: "invalid".to_string(),
})
@@ -1063,7 +1060,7 @@ fn resource_area_encode_and_list_set_paths() {
let err = resource_area_members_farms_list_set(
"invalid",
- vec![RadrootsFarmRef {
+ vec![FarmRef {
pubkey: VALID_PUBKEY.to_string(),
d_tag: VALID_FARM_D_TAG.to_string(),
}],
@@ -1085,7 +1082,7 @@ fn resource_area_encode_and_list_set_paths() {
let err = resource_area_members_farms_list_set(
VALID_AREA_D_TAG,
- vec![RadrootsFarmRef {
+ vec![FarmRef {
pubkey: " ".to_string(),
d_tag: VALID_FARM_D_TAG.to_string(),
}],
@@ -1098,7 +1095,7 @@ fn resource_area_encode_and_list_set_paths() {
let err = resource_area_members_farms_list_set(
VALID_AREA_D_TAG,
- vec![RadrootsFarmRef {
+ vec![FarmRef {
pubkey: VALID_PUBKEY.to_string(),
d_tag: " ".to_string(),
}],
@@ -1111,7 +1108,7 @@ fn resource_area_encode_and_list_set_paths() {
let err = resource_area_members_farms_list_set(
VALID_AREA_D_TAG,
- vec![RadrootsFarmRef {
+ vec![FarmRef {
pubkey: VALID_PUBKEY.to_string(),
d_tag: "invalid".to_string(),
}],
@@ -1121,7 +1118,7 @@ fn resource_area_encode_and_list_set_paths() {
let err = resource_area_members_plots_list_set(
VALID_AREA_D_TAG,
- vec![RadrootsPlotRef {
+ vec![PlotRef {
pubkey: " ".to_string(),
d_tag: VALID_PLOT_D_TAG.to_string(),
}],
@@ -1134,7 +1131,7 @@ fn resource_area_encode_and_list_set_paths() {
let err = resource_area_members_plots_list_set(
VALID_AREA_D_TAG,
- vec![RadrootsPlotRef {
+ vec![PlotRef {
pubkey: VALID_PUBKEY.to_string(),
d_tag: " ".to_string(),
}],
@@ -1147,7 +1144,7 @@ fn resource_area_encode_and_list_set_paths() {
let err = resource_area_members_plots_list_set(
VALID_AREA_D_TAG,
- vec![RadrootsPlotRef {
+ vec![PlotRef {
pubkey: VALID_PUBKEY.to_string(),
d_tag: "invalid".to_string(),
}],
diff --git a/crates/event_codec/tests/farm_crdt.rs b/crates/event_codec/tests/farm_crdt.rs
@@ -2,10 +2,10 @@
use radroots_event::{
farm::crdt::{
- RADROOTS_FARM_CRDT_CHANGE_SCHEMA, RadrootsCrdtBackend, RadrootsFarmCrdtChange,
- RadrootsFarmCrdtDocumentKind, RadrootsFarmSemanticKind,
+ CrdtBackend, FarmCrdtChange, FarmCrdtDocumentKind, FarmSemanticKind,
+ RADROOTS_FARM_CRDT_CHANGE_SCHEMA,
},
- farm::workspace::RadrootsFarmWorkspaceRef,
+ farm::workspace::FarmWorkspaceRef,
};
use radroots_event_codec::farm_crdt::encode::to_wire_parts;
@@ -14,22 +14,22 @@ const DOCUMENT_ID: &str = "AAAAAAAAAAAAAAAAAAAAAg";
#[test]
fn farm_crdt_change_encodes_without_optional_metadata() {
- let change = RadrootsFarmCrdtChange {
+ let change = FarmCrdtChange {
schema: RADROOTS_FARM_CRDT_CHANGE_SCHEMA.to_string(),
- workspace: RadrootsFarmWorkspaceRef {
+ workspace: FarmWorkspaceRef {
pubkey: "workspace_pubkey".to_string(),
d_tag: WORKSPACE_D_TAG.to_string(),
},
farm_group_id: "field-group".to_string(),
document_id: DOCUMENT_ID.to_string(),
- document_kind: RadrootsFarmCrdtDocumentKind::FarmTask,
- crdt_backend: RadrootsCrdtBackend::Automerge,
+ document_kind: FarmCrdtDocumentKind::FarmTask,
+ crdt_backend: CrdtBackend::Automerge,
crdt_backend_version: None,
actor_id: "actor_abc".to_string(),
change_hash: "crdt_hash_abc".to_string(),
dependencies: Vec::new(),
encoded_change: "abc-DEF_012".to_string(),
- semantic_kind: RadrootsFarmSemanticKind::FarmTaskCreate,
+ semantic_kind: FarmSemanticKind::FarmTaskCreate,
business_time_ms: 1_780_000_000_000,
author_member_id: None,
app_version: None,
diff --git a/crates/event_codec/tests/farm_workspace.rs b/crates/event_codec/tests/farm_workspace.rs
@@ -2,13 +2,12 @@
use radroots_event::{
envelope::kind::{KIND_FARM, KIND_FARM_FILE_METADATA},
- farm::RadrootsFarmRef,
+ farm::FarmRef,
farm::crdt::KIND_FARM_CRDT_CHANGE,
farm::workspace::{
- KIND_FARM_WORKSPACE_MANIFEST, RADROOTS_FARM_WORKSPACE_PROTOCOL_VERSION,
- RADROOTS_FARM_WORKSPACE_SCHEMA, RadrootsFarmWorkspaceManifest,
- RadrootsFarmWorkspaceMediaServer, RadrootsFarmWorkspaceRelay,
- RadrootsFarmWorkspaceRelayMode,
+ FarmWorkspaceManifest, FarmWorkspaceMediaServer, FarmWorkspaceRelay,
+ FarmWorkspaceRelayMode, KIND_FARM_WORKSPACE_MANIFEST,
+ RADROOTS_FARM_WORKSPACE_PROTOCOL_VERSION, RADROOTS_FARM_WORKSPACE_SCHEMA,
},
tag::name::{TAG_A, TAG_H, TAG_P},
};
@@ -114,22 +113,22 @@ fn farm_workspace_encode_rejects_schema_and_supported_kind_edges() {
}
}
-fn sample_manifest() -> RadrootsFarmWorkspaceManifest {
- RadrootsFarmWorkspaceManifest {
+fn sample_manifest() -> FarmWorkspaceManifest {
+ FarmWorkspaceManifest {
d_tag: D_TAG.to_string(),
schema: RADROOTS_FARM_WORKSPACE_SCHEMA.to_string(),
farm_group_id: GROUP_ID.to_string(),
name: "Small Regen Farm".to_string(),
owner_pubkey: "workspace_owner_pubkey".to_string(),
- farm: Some(RadrootsFarmRef {
+ farm: Some(FarmRef {
pubkey: "farm_pubkey".to_string(),
d_tag: FARM_D_TAG.to_string(),
}),
- relays: vec![RadrootsFarmWorkspaceRelay {
+ relays: vec![FarmWorkspaceRelay {
url: "wss://relay.example.invalid/farm/field-group".to_string(),
- mode: RadrootsFarmWorkspaceRelayMode::ReadWrite,
+ mode: FarmWorkspaceRelayMode::ReadWrite,
}],
- media_servers: vec![RadrootsFarmWorkspaceMediaServer {
+ media_servers: vec![FarmWorkspaceMediaServer {
url: "https://media.example.invalid/farm/field-group".to_string(),
service: "RadrootsPrivateMedia".to_string(),
}],
diff --git a/crates/event_codec/tests/field_events.rs b/crates/event_codec/tests/field_events.rs
@@ -2,24 +2,23 @@
use radroots_event::{
envelope::kind::{KIND_FARM_FILE_METADATA, KIND_POST},
- farm::RadrootsFarmRef,
+ farm::FarmRef,
farm::crdt::{
- RADROOTS_FARM_CRDT_CHANGE_SCHEMA, RadrootsCrdtBackend, RadrootsFarmCrdtChange,
- RadrootsFarmCrdtDocumentKind, RadrootsFarmSemanticKind,
+ CrdtBackend, FarmCrdtChange, FarmCrdtDocumentKind, FarmSemanticKind,
+ RADROOTS_FARM_CRDT_CHANGE_SCHEMA,
},
- farm::file::{RadrootsFarmFileDimensions, RadrootsFarmFileMetadata, RadrootsFarmFileSource},
+ farm::file::{FarmFileDimensions, FarmFileMetadata, FarmFileSource},
farm::workspace::{
- RADROOTS_FARM_WORKSPACE_PROTOCOL_VERSION, RADROOTS_FARM_WORKSPACE_SCHEMA,
- RadrootsFarmWorkspaceManifest, RadrootsFarmWorkspaceMediaServer, RadrootsFarmWorkspaceRef,
- RadrootsFarmWorkspaceRelay, RadrootsFarmWorkspaceRelayMode,
+ FarmWorkspaceManifest, FarmWorkspaceMediaServer, FarmWorkspaceRef, FarmWorkspaceRelay,
+ FarmWorkspaceRelayMode, RADROOTS_FARM_WORKSPACE_PROTOCOL_VERSION,
+ RADROOTS_FARM_WORKSPACE_SCHEMA,
},
social::group::{
- KIND_GROUP_CREATE_INVITE, KIND_GROUP_METADATA, RadrootsGroupAdmins,
- RadrootsGroupCreateInvite, RadrootsGroupEditableMetadata, RadrootsGroupMetadata,
- RadrootsGroupPutUser, RadrootsGroupUserRef,
+ GroupAdmins, GroupCreateInvite, GroupEditableMetadata, GroupMetadata, GroupPutUser,
+ GroupUserRef, KIND_GROUP_CREATE_INVITE, KIND_GROUP_METADATA,
},
- social::http_auth::RadrootsHttpAuth,
- social::relay_auth::RadrootsRelayAuth,
+ social::http_auth::HttpAuth,
+ social::relay_auth::RelayAuth,
};
use radroots_event_codec::{
error::EventParseError,
@@ -93,7 +92,7 @@ fn field_codec_matrix_roundtrips_all_new_event_families() {
file
);
- let relay_auth = RadrootsRelayAuth {
+ let relay_auth = RelayAuth {
relay: "wss://relay.example.invalid/farm/field-group".to_string(),
challenge: "relay-provided-challenge".to_string(),
};
@@ -104,7 +103,7 @@ fn field_codec_matrix_roundtrips_all_new_event_families() {
relay_auth
);
- let http_auth = RadrootsHttpAuth {
+ let http_auth = HttpAuth {
url: "https://media.example.invalid/upload".to_string(),
method: "POST".to_string(),
payload_sha256: Some(SHA256.to_string()),
@@ -116,7 +115,7 @@ fn field_codec_matrix_roundtrips_all_new_event_families() {
http_auth
);
- let metadata = RadrootsGroupMetadata {
+ let metadata = GroupMetadata {
d_tag: GROUP_ID.to_string(),
metadata: sample_group_metadata(),
};
@@ -131,10 +130,10 @@ fn field_codec_matrix_roundtrips_all_new_event_families() {
metadata
);
- let admins = RadrootsGroupAdmins {
+ let admins = GroupAdmins {
d_tag: GROUP_ID.to_string(),
description: Some("field group admins".to_string()),
- admins: vec![RadrootsGroupUserRef {
+ admins: vec![GroupUserRef {
pubkey: "admin_pubkey".to_string(),
roles: vec!["admin".to_string()],
}],
@@ -146,7 +145,7 @@ fn field_codec_matrix_roundtrips_all_new_event_families() {
admins
);
- let put = RadrootsGroupPutUser {
+ let put = GroupPutUser {
group_id: GROUP_ID.to_string(),
message: Some("add field member".to_string()),
pubkey: "member_pubkey".to_string(),
@@ -159,7 +158,7 @@ fn field_codec_matrix_roundtrips_all_new_event_families() {
put
);
- let invite = RadrootsGroupCreateInvite {
+ let invite = GroupCreateInvite {
group_id: GROUP_ID.to_string(),
message: Some("join the field group".to_string()),
code: "invite-code".to_string(),
@@ -203,7 +202,7 @@ fn field_codec_matrix_rejects_missing_required_tags_and_mismatches() {
Err(EventParseError::InvalidTag("d"))
));
- let put_parts = group_put_user_to_wire_parts(&RadrootsGroupPutUser {
+ let put_parts = group_put_user_to_wire_parts(&GroupPutUser {
group_id: GROUP_ID.to_string(),
message: None,
pubkey: "member_pubkey".to_string(),
@@ -267,7 +266,7 @@ fn field_codec_matrix_rejects_bad_hash_base64_kind_and_content() {
})
));
- let relay_parts = relay_auth_to_wire_parts(&RadrootsRelayAuth {
+ let relay_parts = relay_auth_to_wire_parts(&RelayAuth {
relay: "wss://relay.example.invalid/farm/field-group".to_string(),
challenge: "relay-provided-challenge".to_string(),
})
@@ -277,7 +276,7 @@ fn field_codec_matrix_rejects_bad_hash_base64_kind_and_content() {
Err(EventParseError::InvalidJson("content"))
));
- let mut http_parts = http_auth_to_wire_parts(&RadrootsHttpAuth {
+ let mut http_parts = http_auth_to_wire_parts(&HttpAuth {
url: "https://media.example.invalid/upload".to_string(),
method: "POST".to_string(),
payload_sha256: Some(SHA256.to_string()),
@@ -290,22 +289,22 @@ fn field_codec_matrix_rejects_bad_hash_base64_kind_and_content() {
));
}
-fn sample_workspace() -> RadrootsFarmWorkspaceManifest {
- RadrootsFarmWorkspaceManifest {
+fn sample_workspace() -> FarmWorkspaceManifest {
+ FarmWorkspaceManifest {
d_tag: WORKSPACE_D_TAG.to_string(),
schema: RADROOTS_FARM_WORKSPACE_SCHEMA.to_string(),
farm_group_id: GROUP_ID.to_string(),
name: "Small Regen Farm".to_string(),
owner_pubkey: "workspace_owner_pubkey".to_string(),
- farm: Some(RadrootsFarmRef {
+ farm: Some(FarmRef {
pubkey: "farm_pubkey".to_string(),
d_tag: FILE_D_TAG.to_string(),
}),
- relays: vec![RadrootsFarmWorkspaceRelay {
+ relays: vec![FarmWorkspaceRelay {
url: "wss://relay.example.invalid/farm/field-group".to_string(),
- mode: RadrootsFarmWorkspaceRelayMode::ReadWrite,
+ mode: FarmWorkspaceRelayMode::ReadWrite,
}],
- media_servers: vec![RadrootsFarmWorkspaceMediaServer {
+ media_servers: vec![FarmWorkspaceMediaServer {
url: "https://media.example.invalid/farm/field-group".to_string(),
service: "RadrootsPrivateMedia".to_string(),
}],
@@ -316,51 +315,51 @@ fn sample_workspace() -> RadrootsFarmWorkspaceManifest {
}
}
-fn sample_crdt_change() -> RadrootsFarmCrdtChange {
- RadrootsFarmCrdtChange {
+fn sample_crdt_change() -> FarmCrdtChange {
+ FarmCrdtChange {
schema: RADROOTS_FARM_CRDT_CHANGE_SCHEMA.to_string(),
- workspace: RadrootsFarmWorkspaceRef {
+ workspace: FarmWorkspaceRef {
pubkey: "workspace_pubkey".to_string(),
d_tag: WORKSPACE_D_TAG.to_string(),
},
farm_group_id: GROUP_ID.to_string(),
document_id: DOCUMENT_ID.to_string(),
- document_kind: RadrootsFarmCrdtDocumentKind::FarmTask,
- crdt_backend: RadrootsCrdtBackend::Automerge,
+ document_kind: FarmCrdtDocumentKind::FarmTask,
+ crdt_backend: CrdtBackend::Automerge,
crdt_backend_version: Some("0.x".to_string()),
actor_id: "actor_abc".to_string(),
change_hash: "crdt_hash_abc".to_string(),
dependencies: Vec::new(),
encoded_change: "abc-DEF_012".to_string(),
- semantic_kind: RadrootsFarmSemanticKind::FarmTaskCreate,
+ semantic_kind: FarmSemanticKind::FarmTaskCreate,
business_time_ms: 1_780_000_000_000,
author_member_id: Some("member_abc".to_string()),
app_version: Some("0.1.0".to_string()),
}
}
-fn sample_file_metadata() -> RadrootsFarmFileMetadata {
- RadrootsFarmFileMetadata {
+fn sample_file_metadata() -> FarmFileMetadata {
+ FarmFileMetadata {
d_tag: FILE_D_TAG.to_string(),
- workspace: RadrootsFarmWorkspaceRef {
+ workspace: FarmWorkspaceRef {
pubkey: "workspace_pubkey".to_string(),
d_tag: WORKSPACE_D_TAG.to_string(),
},
farm_group_id: GROUP_ID.to_string(),
owner_document_id: DOCUMENT_ID.to_string(),
- owner_document_kind: RadrootsFarmCrdtDocumentKind::FarmTask,
+ owner_document_kind: FarmCrdtDocumentKind::FarmTask,
caption: Some("Tomatoes harvested from Patch Y.".to_string()),
url: "https://media.example.invalid/blob/sha256".to_string(),
mime_type: "image/jpeg".to_string(),
sha256: SHA256.to_string(),
original_sha256: None,
size_bytes: Some(123_456),
- dimensions: Some(RadrootsFarmFileDimensions { w: 1600, h: 1200 }),
+ dimensions: Some(FarmFileDimensions { w: 1600, h: 1200 }),
blurhash: None,
- thumb: Some(RadrootsFarmFileSource {
+ thumb: Some(FarmFileSource {
url: "https://media.example.invalid/thumb/sha256".to_string(),
mime_type: Some("image/jpeg".to_string()),
- dimensions: Some(RadrootsFarmFileDimensions { w: 320, h: 240 }),
+ dimensions: Some(FarmFileDimensions { w: 320, h: 240 }),
}),
image: None,
alt: Some("Harvested tomatoes in a crate".to_string()),
@@ -368,8 +367,8 @@ fn sample_file_metadata() -> RadrootsFarmFileMetadata {
}
}
-fn sample_group_metadata() -> RadrootsGroupEditableMetadata {
- RadrootsGroupEditableMetadata {
+fn sample_group_metadata() -> GroupEditableMetadata {
+ GroupEditableMetadata {
name: Some("Small Regen Farm".to_string()),
about: Some("Field app group".to_string()),
picture: Some("https://media.example.invalid/group.png".to_string()),
diff --git a/crates/event_codec/tests/file_metadata.rs b/crates/event_codec/tests/file_metadata.rs
@@ -5,11 +5,11 @@ mod common;
use common::{AUTHOR, EVENT_ID, EVENT_SIG};
use radroots_event::{
envelope::kind::{KIND_POST, KIND_PUBLIC_FILE_METADATA},
- farm::crdt::RadrootsFarmCrdtDocumentKind,
- farm::file::{RadrootsFarmFileDimensions, RadrootsFarmFileMetadata, RadrootsFarmFileSource},
- farm::workspace::RadrootsFarmWorkspaceRef,
- media::file_metadata::RadrootsFileMetadata,
- social::{RadrootsSocialMediaDimensions, RadrootsSocialMediaThumbnail},
+ farm::crdt::FarmCrdtDocumentKind,
+ farm::file::{FarmFileDimensions, FarmFileMetadata, FarmFileSource},
+ farm::workspace::FarmWorkspaceRef,
+ media::file_metadata::FileMetadata,
+ social::{SocialMediaDimensions, SocialMediaThumbnail},
tag::name::{
TAG_ALT, TAG_DIMENSIONS, TAG_FALLBACK, TAG_MAGNET, TAG_MIME, TAG_ORIGINAL_SHA256,
TAG_SERVICE, TAG_SHA256, TAG_SIZE, TAG_SUMMARY, TAG_THUMB, TAG_URL,
@@ -29,21 +29,21 @@ use radroots_event_codec::{
const VALID_HASH: &str = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
const OTHER_HASH: &str = "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789";
-fn sample_metadata() -> RadrootsFileMetadata {
- RadrootsFileMetadata {
+fn sample_metadata() -> FileMetadata {
+ FileMetadata {
url: "https://media.example.test/field.jpg".to_string(),
mime_type: "image/jpeg".to_string(),
sha256: VALID_HASH.to_string(),
original_sha256: Some(OTHER_HASH.to_string()),
size: Some(4096),
- dimensions: Some(RadrootsSocialMediaDimensions {
+ dimensions: Some(SocialMediaDimensions {
width: 1200,
height: 800,
}),
blurhash: Some("L6PZfSi_.AyE_3t7t7R**0o#DgR4".to_string()),
- thumbnails: Some(vec![RadrootsSocialMediaThumbnail {
+ thumbnails: Some(vec![SocialMediaThumbnail {
url: "https://media.example.test/field-thumb.jpg".to_string(),
- dimensions: Some(RadrootsSocialMediaDimensions {
+ dimensions: Some(SocialMediaDimensions {
width: 320,
height: 200,
}),
@@ -58,23 +58,23 @@ fn sample_metadata() -> RadrootsFileMetadata {
}
}
-fn sample_farm_file_metadata() -> RadrootsFarmFileMetadata {
- RadrootsFarmFileMetadata {
+fn sample_farm_file_metadata() -> FarmFileMetadata {
+ FarmFileMetadata {
d_tag: "BBBBBBBBBBBBBBBBBBBBBA".to_string(),
- workspace: RadrootsFarmWorkspaceRef {
+ workspace: FarmWorkspaceRef {
pubkey: "workspace_pubkey".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
},
farm_group_id: "field-group".to_string(),
owner_document_id: "CCCCCCCCCCCCCCCCCCCCCA".to_string(),
- owner_document_kind: RadrootsFarmCrdtDocumentKind::FarmTask,
+ owner_document_kind: FarmCrdtDocumentKind::FarmTask,
caption: Some("Private crop photo".to_string()),
url: "https://media.example.test/private.jpg".to_string(),
mime_type: "image/jpeg".to_string(),
sha256: VALID_HASH.to_string(),
original_sha256: None,
size_bytes: Some(2048),
- dimensions: Some(RadrootsFarmFileDimensions { w: 800, h: 600 }),
+ dimensions: Some(FarmFileDimensions { w: 800, h: 600 }),
blurhash: None,
thumb: None,
image: None,
@@ -193,7 +193,7 @@ fn file_metadata_encode_handles_minimal_optional_shape_and_invalid_dimensions()
);
let mut metadata = sample_metadata();
- metadata.dimensions = Some(RadrootsSocialMediaDimensions {
+ metadata.dimensions = Some(SocialMediaDimensions {
width: 0,
height: 800,
});
@@ -203,7 +203,7 @@ fn file_metadata_encode_handles_minimal_optional_shape_and_invalid_dimensions()
));
let mut metadata = sample_metadata();
- metadata.dimensions = Some(RadrootsSocialMediaDimensions {
+ metadata.dimensions = Some(SocialMediaDimensions {
width: 1200,
height: 0,
});
@@ -225,12 +225,12 @@ fn file_metadata_public_and_private_kind1063_contracts_do_not_cross_decode() {
));
let mut private_metadata = sample_farm_file_metadata();
- private_metadata.thumb = Some(RadrootsFarmFileSource {
+ private_metadata.thumb = Some(FarmFileSource {
url: "https://media.example.test/private-thumb.jpg".to_string(),
mime_type: Some("image/jpeg".to_string()),
- dimensions: Some(RadrootsFarmFileDimensions { w: 320, h: 240 }),
+ dimensions: Some(FarmFileDimensions { w: 320, h: 240 }),
});
- private_metadata.image = Some(RadrootsFarmFileSource {
+ private_metadata.image = Some(FarmFileSource {
url: "https://media.example.test/private-image.jpg".to_string(),
mime_type: Some("image/jpeg".to_string()),
dimensions: None,
@@ -241,7 +241,7 @@ fn file_metadata_public_and_private_kind1063_contracts_do_not_cross_decode() {
assert_eq!(decoded_private.owner_document_id, "CCCCCCCCCCCCCCCCCCCCCA");
assert_eq!(
decoded_private.thumb.and_then(|source| source.dimensions),
- Some(RadrootsFarmFileDimensions { w: 320, h: 240 })
+ Some(FarmFileDimensions { w: 320, h: 240 })
);
assert_eq!(
decoded_private
diff --git a/crates/event_codec/tests/follow.rs b/crates/event_codec/tests/follow.rs
@@ -5,7 +5,7 @@ mod test_fixtures;
use common::{AUTHOR, EVENT_ID, EVENT_SIG};
use radroots_event::{
envelope::kind::{KIND_FOLLOW, KIND_POST},
- social::follow::{RadrootsFollow, RadrootsFollowProfile},
+ social::follow::{Follow, FollowProfile},
};
use radroots_event_codec::error::{EventEncodeError, EventParseError};
@@ -18,8 +18,8 @@ use test_fixtures::{RELAY_PRIMARY_WSS, RELAY_SECONDARY_WSS};
#[test]
fn follow_to_wire_parts_builds_p_tags() {
- let follow = RadrootsFollow {
- list: vec![RadrootsFollowProfile {
+ let follow = Follow {
+ list: vec![FollowProfile {
published_at: 42,
public_key: "pubkey".to_string(),
relay_url: Some("wss://relay".to_string()),
@@ -41,8 +41,8 @@ fn follow_to_wire_parts_builds_p_tags() {
#[test]
fn follow_to_wire_parts_requires_public_key() {
- let follow = RadrootsFollow {
- list: vec![RadrootsFollowProfile {
+ let follow = Follow {
+ list: vec![FollowProfile {
published_at: 1,
public_key: " ".to_string(),
relay_url: None,
@@ -217,15 +217,15 @@ fn follow_index_from_event_propagates_parse_errors() {
#[test]
fn follow_apply_adds_and_updates_entries() {
- let follow = RadrootsFollow {
+ let follow = Follow {
list: vec![
- RadrootsFollowProfile {
+ FollowProfile {
published_at: 1,
public_key: "pubkey-a".to_string(),
relay_url: None,
contact_name: Some("alice".to_string()),
},
- RadrootsFollowProfile {
+ FollowProfile {
published_at: 1,
public_key: "pubkey-b".to_string(),
relay_url: None,
@@ -266,15 +266,15 @@ fn follow_apply_adds_and_updates_entries() {
#[test]
fn follow_apply_unfollow_removes_entries() {
- let follow = RadrootsFollow {
+ let follow = Follow {
list: vec![
- RadrootsFollowProfile {
+ FollowProfile {
published_at: 1,
public_key: "pubkey-a".to_string(),
relay_url: None,
contact_name: None,
},
- RadrootsFollowProfile {
+ FollowProfile {
published_at: 1,
public_key: "pubkey-b".to_string(),
relay_url: None,
@@ -296,8 +296,8 @@ fn follow_apply_unfollow_removes_entries() {
#[test]
fn follow_apply_toggle_adds_or_removes() {
- let follow = RadrootsFollow {
- list: vec![RadrootsFollowProfile {
+ let follow = Follow {
+ list: vec![FollowProfile {
published_at: 1,
public_key: "pubkey-a".to_string(),
relay_url: None,
@@ -331,7 +331,7 @@ fn follow_apply_toggle_adds_or_removes() {
#[test]
fn follow_apply_rejects_empty_pubkey() {
- let follow = RadrootsFollow { list: Vec::new() };
+ let follow = Follow { list: Vec::new() };
let err = follow_apply(
&follow,
FollowMutation::Follow {
@@ -349,7 +349,7 @@ fn follow_apply_rejects_empty_pubkey() {
#[test]
fn follow_apply_rejects_empty_pubkey_for_unfollow_and_toggle() {
- let follow = RadrootsFollow { list: Vec::new() };
+ let follow = Follow { list: Vec::new() };
let err = follow_apply(
&follow,
FollowMutation::Unfollow {
@@ -379,8 +379,8 @@ fn follow_apply_rejects_empty_pubkey_for_unfollow_and_toggle() {
#[test]
fn follow_apply_rejects_invalid_existing_entries_and_after_mutation_propagates_error() {
- let follow = RadrootsFollow {
- list: vec![RadrootsFollowProfile {
+ let follow = Follow {
+ list: vec![FollowProfile {
published_at: 1,
public_key: " ".to_string(),
relay_url: None,
@@ -401,7 +401,7 @@ fn follow_apply_rejects_invalid_existing_entries_and_after_mutation_propagates_e
));
let err = follow_to_wire_parts_after(
- &RadrootsFollow { list: Vec::new() },
+ &Follow { list: Vec::new() },
FollowMutation::Follow {
public_key: " ".to_string(),
relay_url: None,
@@ -417,8 +417,8 @@ fn follow_apply_rejects_invalid_existing_entries_and_after_mutation_propagates_e
#[test]
fn follow_build_tags_normalizes_empty_optional_values() {
- let follow = RadrootsFollow {
- list: vec![RadrootsFollowProfile {
+ let follow = Follow {
+ list: vec![FollowProfile {
published_at: 1,
public_key: "pubkey".to_string(),
relay_url: Some("".to_string()),
@@ -434,8 +434,8 @@ fn follow_build_tags_normalizes_empty_optional_values() {
#[test]
fn follow_to_wire_parts_with_kind_and_after_mutation_work() {
- let follow = RadrootsFollow {
- list: vec![RadrootsFollowProfile {
+ let follow = Follow {
+ list: vec![FollowProfile {
published_at: 1,
public_key: "pubkey-a".to_string(),
relay_url: None,
@@ -460,15 +460,15 @@ fn follow_to_wire_parts_with_kind_and_after_mutation_work() {
#[test]
fn follow_apply_normalizes_optional_fields_and_deduplicates_existing_list() {
- let follow = RadrootsFollow {
+ let follow = Follow {
list: vec![
- RadrootsFollowProfile {
+ FollowProfile {
published_at: 1,
public_key: " pubkey-a ".to_string(),
relay_url: Some(" ".to_string()),
contact_name: Some(" ".to_string()),
},
- RadrootsFollowProfile {
+ FollowProfile {
published_at: 2,
public_key: "pubkey-a".to_string(),
relay_url: Some(RELAY_SECONDARY_WSS.to_string()),
@@ -495,8 +495,8 @@ fn follow_apply_normalizes_optional_fields_and_deduplicates_existing_list() {
#[test]
fn follow_apply_follow_with_none_preserves_existing_values() {
- let follow = RadrootsFollow {
- list: vec![RadrootsFollowProfile {
+ let follow = Follow {
+ list: vec![FollowProfile {
published_at: 1,
public_key: "pubkey-a".to_string(),
relay_url: Some(RELAY_PRIMARY_WSS.to_string()),
diff --git a/crates/event_codec/tests/food_availability_conformance.rs b/crates/event_codec/tests/food_availability_conformance.rs
@@ -6,17 +6,15 @@ use nostr::secp256k1::Message;
use nostr::{Event as NostrEvent, JsonUtil, Keys, SECP256K1};
use radroots_blossom::{BlobDescriptor, BlobUrl, MediaType, Sha256};
use radroots_event::food::availability::{
- RadrootsFoodAvailabilityDetails, RadrootsFoodAvailabilityDetailsParts,
- RadrootsFoodAvailabilityError, RadrootsFoodAvailabilityImage, RadrootsFoodAvailabilityStatus,
- RadrootsFoodContent, RadrootsFoodCurrency, RadrootsFoodIdentifier, RadrootsFoodImageDimensions,
- RadrootsFoodPrice, RadrootsFoodPublishedAt, RadrootsFoodQuantity, RadrootsFoodText,
- RadrootsFoodUnit,
+ FoodAvailabilityDetails, FoodAvailabilityDetailsParts, FoodAvailabilityError,
+ FoodAvailabilityImage, FoodAvailabilityStatus, FoodContent, FoodCurrency, FoodIdentifier,
+ FoodImageDimensions, FoodPrice, FoodPublishedAt, FoodQuantity, FoodText, FoodUnit,
};
-use radroots_event::media::RadrootsAuthoredImage;
-use radroots_event::wire::{RadrootsNip01EventWire, compute_canonical_nip01_event_id};
+use radroots_event::media::AuthoredImage;
+use radroots_event::wire::{Nip01EventWire, compute_canonical_nip01_event_id};
use radroots_event::{
- envelope::RadrootsEventEnvelope, envelope::RadrootsEventEnvelopeParts,
- listing::classified::RadrootsClassifiedListingPartition,
+ envelope::EventEnvelope, envelope::EventEnvelopeParts,
+ listing::classified::ClassifiedListingPartition,
};
use radroots_event_codec::food_availability::admission::{
RadrootsFoodAvailabilityAdmissionError, RadrootsFoodAvailabilityAdmissionOutcome,
@@ -339,24 +337,21 @@ fn authored_input(vector: &Vector) -> AuthoredInput {
.unwrap_or_else(|error| panic!("{} authored input is invalid: {error}", vector.id))
}
-fn strict_details(
- input: &DetailsInput,
- vector_id: &str,
-) -> (RadrootsFoodAvailabilityDetails, String) {
+fn strict_details(input: &DetailsInput, vector_id: &str) -> (FoodAvailabilityDetails, String) {
let content = input.content.materialize(vector_id);
- let price_unit = RadrootsFoodUnit::parse(&input.price.unit)
+ let price_unit = FoodUnit::parse(&input.price.unit)
.unwrap_or_else(|error| panic!("{vector_id} price unit failed: {error}"));
- let price = RadrootsFoodPrice::new(
+ let price = FoodPrice::new(
input.price.amount.clone(),
- RadrootsFoodCurrency::parse(&input.price.currency)
+ FoodCurrency::parse(&input.price.currency)
.unwrap_or_else(|error| panic!("{vector_id} currency failed: {error}")),
price_unit,
)
.unwrap_or_else(|error| panic!("{vector_id} price failed: {error}"));
let quantity = input.quantity.as_ref().map(|quantity| {
- let unit = RadrootsFoodUnit::parse(&quantity.unit)
+ let unit = FoodUnit::parse(&quantity.unit)
.unwrap_or_else(|error| panic!("{vector_id} quantity unit failed: {error}"));
- RadrootsFoodQuantity::new(quantity.amount.clone(), unit)
+ FoodQuantity::new(quantity.amount.clone(), unit)
.unwrap_or_else(|error| panic!("{vector_id} quantity failed: {error}"))
});
let images = input
@@ -364,22 +359,22 @@ fn strict_details(
.iter()
.map(|image| strict_image(image, vector_id))
.collect();
- let details = RadrootsFoodAvailabilityDetails::new(RadrootsFoodAvailabilityDetailsParts {
- content: RadrootsFoodContent::new(content.clone())
+ let details = FoodAvailabilityDetails::new(FoodAvailabilityDetailsParts {
+ content: FoodContent::new(content.clone())
.unwrap_or_else(|error| panic!("{vector_id} content failed: {error}")),
- identifier: RadrootsFoodIdentifier::parse(&input.identifier)
+ identifier: FoodIdentifier::parse(&input.identifier)
.unwrap_or_else(|error| panic!("{vector_id} identifier failed: {error}")),
- title: RadrootsFoodText::new(input.title.clone())
+ title: FoodText::new(input.title.clone())
.unwrap_or_else(|error| panic!("{vector_id} title failed: {error}")),
- summary: RadrootsFoodText::new(input.summary.clone())
+ summary: FoodText::new(input.summary.clone())
.unwrap_or_else(|error| panic!("{vector_id} summary failed: {error}")),
- published_at: RadrootsFoodPublishedAt::new(input.published_at)
+ published_at: FoodPublishedAt::new(input.published_at)
.unwrap_or_else(|error| panic!("{vector_id} published_at failed: {error}")),
- location: RadrootsFoodText::new(input.location.clone())
+ location: FoodText::new(input.location.clone())
.unwrap_or_else(|error| panic!("{vector_id} location failed: {error}")),
price,
quantity,
- status: RadrootsFoodAvailabilityStatus::parse(&input.status)
+ status: FoodAvailabilityStatus::parse(&input.status)
.unwrap_or_else(|error| panic!("{vector_id} status failed: {error}")),
images,
})
@@ -387,7 +382,7 @@ fn strict_details(
(details, content)
}
-fn strict_image(input: &ImageInput, vector_id: &str) -> RadrootsFoodAvailabilityImage {
+fn strict_image(input: &ImageInput, vector_id: &str) -> FoodAvailabilityImage {
let bytes = input.bytes_utf8.as_bytes();
let hash = Sha256::digest(bytes);
let media_type = MediaType::parse(&input.media_type)
@@ -405,11 +400,11 @@ fn strict_image(input: &ImageInput, vector_id: &str) -> RadrootsFoodAvailability
.unwrap_or_else(|error| panic!("{vector_id} image reference failed: {error}"))
.verify_bytes(bytes, &media_type)
.unwrap_or_else(|error| panic!("{vector_id} image bytes failed: {error}"));
- let image = RadrootsAuthoredImage::try_from_verified_descriptor(verified)
+ let image = AuthoredImage::try_from_verified_descriptor(verified)
.unwrap_or_else(|error| panic!("{vector_id} authored image failed: {error}"));
- let dimensions = RadrootsFoodImageDimensions::parse(&input.dimensions)
+ let dimensions = FoodImageDimensions::parse(&input.dimensions)
.unwrap_or_else(|error| panic!("{vector_id} image dimensions failed: {error}"));
- RadrootsFoodAvailabilityImage::new(image, dimensions)
+ FoodAvailabilityImage::new(image, dimensions)
}
impl TextRecipe {
@@ -430,12 +425,10 @@ impl TextRecipe {
fn authored_error_value(error: &RadrootsFoodAvailabilityEncodeError) -> Value {
match error {
- RadrootsFoodAvailabilityEncodeError::Domain(
- RadrootsFoodAvailabilityError::PublishedAtFuture {
- published_at,
- created_at,
- },
- ) => json!({
+ RadrootsFoodAvailabilityEncodeError::Domain(FoodAvailabilityError::PublishedAtFuture {
+ published_at,
+ created_at,
+ }) => json!({
"code": error.code(),
"message": error.to_string(),
"published_at": published_at,
@@ -609,12 +602,12 @@ fn diagnostic_codes(diagnostics: &[RadrootsFoodAvailabilityImageDiagnostic]) ->
.collect()
}
-fn partition_name(partition: RadrootsClassifiedListingPartition) -> &'static str {
+fn partition_name(partition: ClassifiedListingPartition) -> &'static str {
match partition {
- RadrootsClassifiedListingPartition::FocusedFoodAvailability => "focused_food_availability",
- RadrootsClassifiedListingPartition::OperationalListing => "operational_listing",
- RadrootsClassifiedListingPartition::GenericNip99 => "generic_nip99",
- RadrootsClassifiedListingPartition::Ambiguous => "ambiguous",
+ ClassifiedListingPartition::FocusedFoodAvailability => "focused_food_availability",
+ ClassifiedListingPartition::OperationalListing => "operational_listing",
+ ClassifiedListingPartition::GenericNip99 => "generic_nip99",
+ ClassifiedListingPartition::Ambiguous => "ambiguous",
}
}
@@ -693,9 +686,9 @@ fn verified_event(value: &Value, vector_id: &str) -> RadrootsSignatureVerifiedEv
.unwrap_or_else(|error| panic!("{vector_id} Radroots verification failed: {error}"))
}
-fn canonical_envelope(value: &Value, vector_id: &str) -> RadrootsEventEnvelope {
+fn canonical_envelope(value: &Value, vector_id: &str) -> EventEnvelope {
let raw_json = serde_json::to_string(value).expect("raw event must serialize");
- let wire = RadrootsNip01EventWire::parse_json(&raw_json)
+ let wire = Nip01EventWire::parse_json(&raw_json)
.unwrap_or_else(|error| panic!("{vector_id} wire parsing failed: {error}"));
wire.verify_id()
.unwrap_or_else(|error| panic!("{vector_id} event id failed: {error}"));
@@ -728,7 +721,7 @@ fn directly_signed_verified_event(
raw.id = id.into_string();
raw.sig = signature.to_string();
- let event = RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ let event = EventEnvelope::new(EventEnvelopeParts {
id: raw.id,
author: raw.pubkey,
created_at: raw.created_at,
diff --git a/crates/event_codec/tests/geochat.rs b/crates/event_codec/tests/geochat.rs
@@ -3,7 +3,7 @@ mod common;
use common::{AUTHOR, EVENT_ID, EVENT_SIG};
use radroots_event::{
envelope::kind::{KIND_GEOCHAT, KIND_POST},
- social::geochat::RadrootsGeoChat,
+ social::geochat::GeoChat,
};
use radroots_event_codec::error::{EventEncodeError, EventParseError};
use radroots_event_codec::geochat::decode::{
@@ -13,7 +13,7 @@ use radroots_event_codec::geochat::encode::{geochat_build_tags, to_wire_parts};
#[test]
fn geochat_build_tags_requires_geohash() {
- let geochat = RadrootsGeoChat {
+ let geochat = GeoChat {
geohash: " ".to_string(),
content: "hello".to_string(),
nickname: None,
@@ -29,7 +29,7 @@ fn geochat_build_tags_requires_geohash() {
#[test]
fn geochat_build_tags_requires_nickname_if_present() {
- let geochat = RadrootsGeoChat {
+ let geochat = GeoChat {
geohash: "dr5rsj7".to_string(),
content: "hello".to_string(),
nickname: Some(" ".to_string()),
@@ -45,7 +45,7 @@ fn geochat_build_tags_requires_nickname_if_present() {
#[test]
fn geochat_build_tags_omits_optional_nickname_and_teleport_when_disabled() {
- let geochat = RadrootsGeoChat {
+ let geochat = GeoChat {
geohash: "dr5rsj7".to_string(),
content: "hello".to_string(),
nickname: None,
@@ -58,7 +58,7 @@ fn geochat_build_tags_omits_optional_nickname_and_teleport_when_disabled() {
#[test]
fn geochat_to_wire_parts_requires_content() {
- let geochat = RadrootsGeoChat {
+ let geochat = GeoChat {
geohash: "dr5rsj7".to_string(),
content: " ".to_string(),
nickname: None,
@@ -71,7 +71,7 @@ fn geochat_to_wire_parts_requires_content() {
EventEncodeError::EmptyRequiredField("content")
));
- let geochat = RadrootsGeoChat {
+ let geochat = GeoChat {
geohash: " ".to_string(),
content: "hello".to_string(),
nickname: None,
@@ -86,7 +86,7 @@ fn geochat_to_wire_parts_requires_content() {
#[test]
fn geochat_to_wire_parts_sets_tags() {
- let geochat = RadrootsGeoChat {
+ let geochat = GeoChat {
geohash: "dr5rsj7".to_string(),
content: "hello".to_string(),
nickname: Some("alex".to_string()),
diff --git a/crates/event_codec/tests/gift_wrap.rs b/crates/event_codec/tests/gift_wrap.rs
@@ -4,7 +4,7 @@ mod test_fixtures;
use common::{AUTHOR, EVENT_ID, EVENT_SIG};
use radroots_event::envelope::kind::{KIND_GIFT_WRAP, KIND_MESSAGE};
-use radroots_event::social::gift_wrap::{RadrootsGiftWrap, RadrootsGiftWrapRecipient};
+use radroots_event::social::gift_wrap::{GiftWrap, GiftWrapRecipient};
use radroots_event_codec::error::{EventEncodeError, EventParseError};
use radroots_event_codec::gift_wrap::decode::{
@@ -15,9 +15,9 @@ use radroots_event_codec::gift_wrap::encode::{
};
use test_fixtures::RELAY_PRIMARY_WSS;
-fn sample_gift_wrap() -> RadrootsGiftWrap {
- RadrootsGiftWrap {
- recipient: RadrootsGiftWrapRecipient {
+fn sample_gift_wrap() -> GiftWrap {
+ GiftWrap {
+ recipient: GiftWrapRecipient {
public_key: "pubkey".to_string(),
relay_url: Some(RELAY_PRIMARY_WSS.to_string()),
},
diff --git a/crates/event_codec/tests/group.rs b/crates/event_codec/tests/group.rs
@@ -1,12 +1,11 @@
use radroots_event::social::group::{
+ GroupAdmins, GroupCreateGroup, GroupCreateInvite, GroupDeleteEvent, GroupDeleteGroup,
+ GroupEditMetadata, GroupEditableMetadata, GroupJoinRequest, GroupLeaveRequest, GroupMembers,
+ GroupMetadata, GroupPutUser, GroupRemoveUser, GroupRole, GroupRoles, GroupUserRef,
KIND_GROUP_ADMINS, KIND_GROUP_CREATE_GROUP, KIND_GROUP_CREATE_INVITE, KIND_GROUP_DELETE_EVENT,
KIND_GROUP_DELETE_GROUP, KIND_GROUP_EDIT_METADATA, KIND_GROUP_JOIN_REQUEST,
KIND_GROUP_LEAVE_REQUEST, KIND_GROUP_MEMBERS, KIND_GROUP_METADATA, KIND_GROUP_PUT_USER,
- KIND_GROUP_REMOVE_USER, KIND_GROUP_ROLES, RadrootsGroupAdmins, RadrootsGroupCreateGroup,
- RadrootsGroupCreateInvite, RadrootsGroupDeleteEvent, RadrootsGroupDeleteGroup,
- RadrootsGroupEditMetadata, RadrootsGroupEditableMetadata, RadrootsGroupJoinRequest,
- RadrootsGroupLeaveRequest, RadrootsGroupMembers, RadrootsGroupMetadata, RadrootsGroupPutUser,
- RadrootsGroupRemoveUser, RadrootsGroupRole, RadrootsGroupRoles, RadrootsGroupUserRef,
+ KIND_GROUP_REMOVE_USER, KIND_GROUP_ROLES,
};
use radroots_event_codec::error::{EventEncodeError, EventParseError};
use radroots_event_codec::group::decode::{
@@ -30,86 +29,86 @@ const PUBKEY: &str = "member_pubkey";
#[test]
fn group_public_codecs_roundtrip_all_group_wire_shapes() {
- let put = RadrootsGroupPutUser {
+ let put = GroupPutUser {
group_id: GROUP_ID.to_string(),
message: None,
pubkey: PUBKEY.to_string(),
roles: Vec::new(),
};
- let remove = RadrootsGroupRemoveUser {
+ let remove = GroupRemoveUser {
group_id: GROUP_ID.to_string(),
message: Some("remove member".to_string()),
pubkey: PUBKEY.to_string(),
};
- let create = RadrootsGroupCreateGroup {
+ let create = GroupCreateGroup {
group_id: GROUP_ID.to_string(),
message: Some("create group".to_string()),
metadata: full_metadata(),
};
- let edit = RadrootsGroupEditMetadata {
+ let edit = GroupEditMetadata {
group_id: GROUP_ID.to_string(),
message: None,
metadata: minimal_metadata(),
};
- let delete_group = RadrootsGroupDeleteGroup {
+ let delete_group = GroupDeleteGroup {
group_id: GROUP_ID.to_string(),
message: None,
};
- let delete_event = RadrootsGroupDeleteEvent {
+ let delete_event = GroupDeleteEvent {
group_id: GROUP_ID.to_string(),
message: Some("delete event".to_string()),
event_id: "event_id".to_string(),
};
- let invite = RadrootsGroupCreateInvite {
+ let invite = GroupCreateInvite {
group_id: GROUP_ID.to_string(),
message: None,
code: "invite-code".to_string(),
};
- let join = RadrootsGroupJoinRequest {
+ let join = GroupJoinRequest {
group_id: GROUP_ID.to_string(),
message: None,
code: None,
};
- let leave = RadrootsGroupLeaveRequest {
+ let leave = GroupLeaveRequest {
group_id: GROUP_ID.to_string(),
message: None,
};
- let metadata = RadrootsGroupMetadata {
+ let metadata = GroupMetadata {
d_tag: GROUP_ID.to_string(),
metadata: minimal_metadata(),
};
- let admins = RadrootsGroupAdmins {
+ let admins = GroupAdmins {
d_tag: GROUP_ID.to_string(),
description: None,
admins: vec![
- RadrootsGroupUserRef {
+ GroupUserRef {
pubkey: "admin_pubkey".to_string(),
roles: vec!["admin".to_string()],
},
- RadrootsGroupUserRef {
+ GroupUserRef {
pubkey: "observer_pubkey".to_string(),
roles: Vec::new(),
},
],
};
- let members = RadrootsGroupMembers {
+ let members = GroupMembers {
d_tag: GROUP_ID.to_string(),
description: Some("group members".to_string()),
- members: vec![RadrootsGroupUserRef {
+ members: vec![GroupUserRef {
pubkey: PUBKEY.to_string(),
roles: vec!["member".to_string()],
}],
};
- let roles = RadrootsGroupRoles {
+ let roles = GroupRoles {
d_tag: GROUP_ID.to_string(),
description: None,
roles: vec![
- RadrootsGroupRole {
+ GroupRole {
name: "admin".to_string(),
description: Some("full access".to_string()),
permissions: vec!["read".to_string(), "write".to_string()],
},
- RadrootsGroupRole {
+ GroupRole {
name: "viewer".to_string(),
description: None,
permissions: Vec::new(),
@@ -272,7 +271,7 @@ fn group_public_codecs_reject_invalid_decode_shapes() {
));
assert!(matches!(
group_metadata_from_event(KIND_GROUP_METADATA, &[tag("d", GROUP_ID)], "").unwrap(),
- RadrootsGroupMetadata { .. }
+ GroupMetadata { .. }
));
assert!(matches!(
group_metadata_from_event(
@@ -329,7 +328,7 @@ fn group_public_codecs_reject_invalid_decode_shapes() {
#[test]
fn group_public_encoders_reject_empty_required_fields() {
assert_empty_required(
- group_create_group_to_wire_parts(&RadrootsGroupCreateGroup {
+ group_create_group_to_wire_parts(&GroupCreateGroup {
group_id: GROUP_ID.to_string(),
message: Some(String::new()),
metadata: minimal_metadata(),
@@ -337,10 +336,10 @@ fn group_public_encoders_reject_empty_required_fields() {
"message",
);
assert_empty_required(
- group_edit_metadata_to_wire_parts(&RadrootsGroupEditMetadata {
+ group_edit_metadata_to_wire_parts(&GroupEditMetadata {
group_id: GROUP_ID.to_string(),
message: None,
- metadata: RadrootsGroupEditableMetadata {
+ metadata: GroupEditableMetadata {
about: Some(String::new()),
..minimal_metadata()
},
@@ -348,7 +347,7 @@ fn group_public_encoders_reject_empty_required_fields() {
"about",
);
assert_empty_required(
- group_join_request_to_wire_parts(&RadrootsGroupJoinRequest {
+ group_join_request_to_wire_parts(&GroupJoinRequest {
group_id: GROUP_ID.to_string(),
message: None,
code: Some(String::new()),
@@ -356,10 +355,10 @@ fn group_public_encoders_reject_empty_required_fields() {
"code",
);
assert_empty_required(
- group_roles_to_wire_parts(&RadrootsGroupRoles {
+ group_roles_to_wire_parts(&GroupRoles {
d_tag: GROUP_ID.to_string(),
description: None,
- roles: vec![RadrootsGroupRole {
+ roles: vec![GroupRole {
name: "member".to_string(),
description: Some(String::new()),
permissions: Vec::new(),
@@ -368,10 +367,10 @@ fn group_public_encoders_reject_empty_required_fields() {
"role.description",
);
assert_empty_required(
- group_roles_to_wire_parts(&RadrootsGroupRoles {
+ group_roles_to_wire_parts(&GroupRoles {
d_tag: GROUP_ID.to_string(),
description: None,
- roles: vec![RadrootsGroupRole {
+ roles: vec![GroupRole {
name: "member".to_string(),
description: None,
permissions: vec![String::new()],
@@ -381,8 +380,8 @@ fn group_public_encoders_reject_empty_required_fields() {
);
}
-fn full_metadata() -> RadrootsGroupEditableMetadata {
- RadrootsGroupEditableMetadata {
+fn full_metadata() -> GroupEditableMetadata {
+ GroupEditableMetadata {
name: Some("Small Regen Farm".to_string()),
about: Some("Field app group".to_string()),
picture: Some("https://media.example.invalid/group.png".to_string()),
@@ -394,8 +393,8 @@ fn full_metadata() -> RadrootsGroupEditableMetadata {
}
}
-fn minimal_metadata() -> RadrootsGroupEditableMetadata {
- RadrootsGroupEditableMetadata {
+fn minimal_metadata() -> GroupEditableMetadata {
+ GroupEditableMetadata {
name: None,
about: None,
picture: None,
diff --git a/crates/event_codec/tests/job_feedback.rs b/crates/event_codec/tests/job_feedback.rs
@@ -4,14 +4,14 @@ use radroots_event::envelope::kind::{
KIND_JOB_FEEDBACK, KIND_JOB_REQUEST_MIN, KIND_JOB_RESULT_MIN,
};
use radroots_event::social::job::{JobFeedbackStatus, JobPaymentRequest};
-use radroots_event::social::job_feedback::RadrootsJobFeedback;
+use radroots_event::social::job_feedback::JobFeedback;
use radroots_event_codec::job::encode::JobEncodeError;
use radroots_event_codec::job::error::JobParseError;
use radroots_event_codec::job::feedback::decode::{job_feedback_from_tags, parsed_from_event};
use radroots_event_codec::job::feedback::encode::to_wire_parts;
-fn sample_feedback() -> RadrootsJobFeedback {
- RadrootsJobFeedback {
+fn sample_feedback() -> JobFeedback {
+ JobFeedback {
kind: u16::try_from(KIND_JOB_FEEDBACK).expect("feedback kind must fit NIP-01"),
status: JobFeedbackStatus::Processing,
extra_info: Some("queued".to_string()),
diff --git a/crates/event_codec/tests/job_request.rs b/crates/event_codec/tests/job_request.rs
@@ -5,24 +5,24 @@ use radroots_event::envelope::kind::{
KIND_JOB_FEEDBACK, KIND_JOB_REQUEST_MIN, KIND_JOB_RESULT_MIN,
};
use radroots_event::social::job::JobInputType;
-use radroots_event::social::job_request::{RadrootsJobInput, RadrootsJobParam, RadrootsJobRequest};
+use radroots_event::social::job_request::{JobInput, JobParam, JobRequest};
use radroots_event_codec::job::encode::JobEncodeError;
use radroots_event_codec::job::error::JobParseError;
use radroots_event_codec::job::request::decode::{job_request_from_tags, parsed_from_event};
use radroots_event_codec::job::request::encode::to_wire_parts;
use test_fixtures::{APP_PRIMARY_HTTPS, RELAY_PRIMARY_WSS};
-fn sample_request() -> RadrootsJobRequest {
- RadrootsJobRequest {
+fn sample_request() -> JobRequest {
+ JobRequest {
kind: u16::try_from(KIND_JOB_REQUEST_MIN + 1).expect("request kind must fit NIP-01"),
- inputs: vec![RadrootsJobInput {
+ inputs: vec![JobInput {
data: APP_PRIMARY_HTTPS.to_string(),
input_type: JobInputType::Url,
relay: Some(RELAY_PRIMARY_WSS.to_string()),
marker: Some("source".to_string()),
}],
output: Some("json".to_string()),
- params: vec![RadrootsJobParam {
+ params: vec![JobParam {
key: "foo".to_string(),
value: "bar".to_string(),
}],
diff --git a/crates/event_codec/tests/job_result.rs b/crates/event_codec/tests/job_result.rs
@@ -4,20 +4,20 @@ mod test_fixtures;
use radroots_event::envelope::kind::{KIND_JOB_REQUEST_MIN, KIND_JOB_RESULT_MIN};
use radroots_event::social::job::{JobInputType, JobPaymentRequest};
-use radroots_event::social::job_request::RadrootsJobInput;
-use radroots_event::social::job_result::RadrootsJobResult;
+use radroots_event::social::job_request::JobInput;
+use radroots_event::social::job_result::JobResult;
use radroots_event_codec::job::encode::JobEncodeError;
use radroots_event_codec::job::error::JobParseError;
use radroots_event_codec::job::result::decode::{job_result_from_tags, parsed_from_event};
use radroots_event_codec::job::result::encode::to_wire_parts;
use test_fixtures::{APP_PRIMARY_HTTPS, RELAY_PRIMARY_WSS, RELAY_SECONDARY_WSS};
-fn sample_result() -> RadrootsJobResult {
- RadrootsJobResult {
+fn sample_result() -> JobResult {
+ JobResult {
kind: u16::try_from(KIND_JOB_RESULT_MIN + 1).expect("result kind must fit NIP-01"),
request_event: common::event_ptr("req", Some(RELAY_PRIMARY_WSS)),
request_json: Some("{\"foo\":\"bar\"}".to_string()),
- inputs: vec![RadrootsJobInput {
+ inputs: vec![JobInput {
data: APP_PRIMARY_HTTPS.to_string(),
input_type: JobInputType::Url,
relay: None,
@@ -63,7 +63,7 @@ fn job_result_roundtrip_with_empty_content_sets_none() {
#[test]
fn job_result_roundtrip_preserves_input_relay_and_marker() {
let mut res = sample_result();
- res.inputs = vec![RadrootsJobInput {
+ res.inputs = vec![JobInput {
data: "note1payload".to_string(),
input_type: JobInputType::Event,
relay: Some(RELAY_SECONDARY_WSS.to_string()),
diff --git a/crates/event_codec/tests/job_traits.rs b/crates/event_codec/tests/job_traits.rs
@@ -5,10 +5,10 @@ use radroots_event::envelope::kind::{
KIND_JOB_FEEDBACK, KIND_JOB_REQUEST_MIN, KIND_JOB_RESULT_MIN,
};
use radroots_event::social::job::{JobFeedbackStatus, JobInputType, JobPaymentRequest};
-use radroots_event::social::job_feedback::RadrootsJobFeedback;
-use radroots_event::social::job_request::{RadrootsJobInput, RadrootsJobParam, RadrootsJobRequest};
-use radroots_event::social::job_result::RadrootsJobResult;
-use radroots_event::{envelope::RadrootsEventEnvelope, envelope::RadrootsEventEnvelopeParts};
+use radroots_event::social::job_feedback::JobFeedback;
+use radroots_event::social::job_request::{JobInput, JobParam, JobRequest};
+use radroots_event::social::job_result::JobResult;
+use radroots_event::{envelope::EventEnvelope, envelope::EventEnvelopeParts};
use radroots_event_codec::job::feedback::encode::to_wire_parts as to_feedback_wire_parts;
use radroots_event_codec::job::request::encode::to_wire_parts as to_request_wire_parts;
use radroots_event_codec::job::result::encode::to_wire_parts as to_result_wire_parts;
@@ -22,8 +22,8 @@ const EVENT_SIG: &str = concat!(
"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
);
-fn event_envelope(kind: u32, tags: Vec<Vec<String>>, content: &str) -> RadrootsEventEnvelope {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+fn event_envelope(kind: u32, tags: Vec<Vec<String>>, content: &str) -> EventEnvelope {
+ EventEnvelope::new(EventEnvelopeParts {
id: EVENT_ID.to_string(),
author: AUTHOR.to_string(),
created_at: 42,
@@ -35,17 +35,17 @@ fn event_envelope(kind: u32, tags: Vec<Vec<String>>, content: &str) -> RadrootsE
.unwrap()
}
-fn sample_request() -> RadrootsJobRequest {
- RadrootsJobRequest {
+fn sample_request() -> JobRequest {
+ JobRequest {
kind: u16::try_from(KIND_JOB_REQUEST_MIN + 1).expect("request kind must fit NIP-01"),
- inputs: vec![RadrootsJobInput {
+ inputs: vec![JobInput {
data: "hello".to_string(),
input_type: JobInputType::Text,
relay: None,
marker: None,
}],
output: None,
- params: vec![RadrootsJobParam {
+ params: vec![JobParam {
key: "foo".to_string(),
value: "bar".to_string(),
}],
@@ -76,15 +76,15 @@ fn borrowed_event_adapter_builds_request_metadata() {
assert_eq!(metadata.data, req);
}
-fn sample_result() -> RadrootsJobResult {
- RadrootsJobResult {
+fn sample_result() -> JobResult {
+ JobResult {
kind: u16::try_from(KIND_JOB_RESULT_MIN + 1).expect("result kind must fit NIP-01"),
- request_event: radroots_event::tag::RadrootsEventPtr {
+ request_event: radroots_event::tag::EventPtr {
id: "req".to_string(),
relays: Some(RELAY_PRIMARY_WSS.to_string()),
},
request_json: Some("{\"foo\":\"bar\"}".to_string()),
- inputs: vec![RadrootsJobInput {
+ inputs: vec![JobInput {
data: "hello".to_string(),
input_type: JobInputType::Text,
relay: None,
@@ -100,12 +100,12 @@ fn sample_result() -> RadrootsJobResult {
}
}
-fn sample_feedback() -> RadrootsJobFeedback {
- RadrootsJobFeedback {
+fn sample_feedback() -> JobFeedback {
+ JobFeedback {
kind: u16::try_from(KIND_JOB_FEEDBACK).expect("feedback kind must fit NIP-01"),
status: JobFeedbackStatus::Processing,
extra_info: Some("processing".to_string()),
- request_event: radroots_event::tag::RadrootsEventPtr {
+ request_event: radroots_event::tag::EventPtr {
id: "req".to_string(),
relays: Some(RELAY_PRIMARY_WSS.to_string()),
},
diff --git a/crates/event_codec/tests/knowledge.rs b/crates/event_codec/tests/knowledge.rs
@@ -5,21 +5,20 @@ use radroots_event::envelope::kind::{
KIND_KNOWLEDGE_CLAIM, KIND_KNOWLEDGE_REVIEW, KIND_KNOWLEDGE_SOURCE, KIND_WIKI_ARTICLE,
};
use radroots_event::knowledge::{
+ AddressableRef, ContributionAttestation, EvidenceBounty, KnowledgeChangeProposal,
+ KnowledgeCitationSpan, KnowledgeClaim, KnowledgeFieldContext, KnowledgeFieldReport,
+ KnowledgeLocation, KnowledgeLocationPrecision, KnowledgeNodeRef, KnowledgeObservation,
+ KnowledgeObservationValue, KnowledgeRelation, KnowledgeReview, KnowledgeReviewScope,
+ KnowledgeReviewScore, KnowledgeReviewTarget, KnowledgeSource,
RADROOTS_CONTRIBUTION_ATTESTATION_SCHEMA, RADROOTS_EVIDENCE_BOUNTY_SCHEMA,
RADROOTS_KNOWLEDGE_CHANGE_PROPOSAL_SCHEMA, RADROOTS_KNOWLEDGE_CLAIM_SCHEMA,
RADROOTS_KNOWLEDGE_FIELD_REPORT_SCHEMA, RADROOTS_KNOWLEDGE_RELATION_SCHEMA,
RADROOTS_KNOWLEDGE_REVIEW_SCHEMA, RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
- RADROOTS_KNOWLEDGE_SOURCE_SCHEMA, RadrootsAddressableRef, RadrootsContributionAttestation,
- RadrootsEvidenceBounty, RadrootsKnowledgeChangeProposal, RadrootsKnowledgeCitationSpan,
- RadrootsKnowledgeClaim, RadrootsKnowledgeFieldContext, RadrootsKnowledgeFieldReport,
- RadrootsKnowledgeLocation, RadrootsKnowledgeLocationPrecision, RadrootsKnowledgeNodeRef,
- RadrootsKnowledgeObservation, RadrootsKnowledgeObservationValue, RadrootsKnowledgeRelation,
- RadrootsKnowledgeReview, RadrootsKnowledgeReviewScope, RadrootsKnowledgeReviewScore,
- RadrootsKnowledgeReviewTarget, RadrootsKnowledgeSource, RadrootsWikiArticle,
- RadrootsWikiArticleVersionRef, RadrootsWikiMergeRequest, RadrootsWikiRedirect,
+ RADROOTS_KNOWLEDGE_SOURCE_SCHEMA, WikiArticle, WikiArticleVersionRef, WikiMergeRequest,
+ WikiRedirect,
};
-use radroots_event::wire::RadrootsNip01EventWireParts;
-use radroots_event::{envelope::RadrootsEventEnvelope, envelope::RadrootsEventEnvelopeParts};
+use radroots_event::wire::Nip01EventWireParts;
+use radroots_event::{envelope::EventEnvelope, envelope::EventEnvelopeParts};
use radroots_event_codec::error::{EventEncodeError, EventParseError};
use radroots_event_codec::knowledge::{
contribution_attestation_from_event, contribution_attestation_to_wire_parts,
@@ -41,8 +40,8 @@ fn hex_64(character: char) -> String {
core::iter::repeat_n(character, 64).collect()
}
-fn event_ref(character: char, kind: u32) -> radroots_event::tag::RadrootsEventRef {
- radroots_event::tag::RadrootsEventRef {
+fn event_ref(character: char, kind: u32) -> radroots_event::tag::EventRef {
+ radroots_event::tag::EventRef {
id: hex_64(character),
author: radroots_identity::PublicKey::from_hex(
"585591529da0bab31b3b1b1f986611cf5f435dca84f978c89ee8a40cca7103df",
@@ -54,8 +53,8 @@ fn event_ref(character: char, kind: u32) -> radroots_event::tag::RadrootsEventRe
}
}
-fn address_ref() -> RadrootsAddressableRef {
- RadrootsAddressableRef {
+fn address_ref() -> AddressableRef {
+ AddressableRef {
kind: KIND_WIKI_ARTICLE,
pubkey: hex_64('a'),
d_tag: "soil-health".to_string(),
@@ -63,21 +62,21 @@ fn address_ref() -> RadrootsAddressableRef {
}
}
-fn article_version_ref() -> RadrootsWikiArticleVersionRef {
+fn article_version_ref() -> WikiArticleVersionRef {
article_version_ref_for('b', "soil-health")
}
-fn article_version_ref_for(event_id_character: char, d_tag: &str) -> RadrootsWikiArticleVersionRef {
+fn article_version_ref_for(event_id_character: char, d_tag: &str) -> WikiArticleVersionRef {
let mut address_ref = address_ref();
address_ref.d_tag = d_tag.to_string();
- RadrootsWikiArticleVersionRef {
+ WikiArticleVersionRef {
event_id: hex_64(event_id_character),
address_ref,
}
}
-fn event_from_parts(parts: RadrootsNip01EventWireParts) -> RadrootsEventEnvelope {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+fn event_from_parts(parts: Nip01EventWireParts) -> EventEnvelope {
+ EventEnvelope::new(EventEnvelopeParts {
id: hex_64('0'),
author: hex_64('a'),
created_at: 1_800_000_000,
@@ -90,11 +89,11 @@ fn event_from_parts(parts: RadrootsNip01EventWireParts) -> RadrootsEventEnvelope
}
fn event_with_parts(
- event: &RadrootsEventEnvelope,
+ event: &EventEnvelope,
tags: Vec<Vec<String>>,
content: String,
-) -> RadrootsEventEnvelope {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+) -> EventEnvelope {
+ EventEnvelope::new(EventEnvelopeParts {
id: event.id_hex().to_string(),
author: event.author().to_hex().to_string(),
created_at: event.created_at_u64(),
@@ -106,17 +105,17 @@ fn event_with_parts(
.unwrap()
}
-fn mutate_tags(event: &mut RadrootsEventEnvelope, update: impl FnOnce(&mut Vec<Vec<String>>)) {
+fn mutate_tags(event: &mut EventEnvelope, update: impl FnOnce(&mut Vec<Vec<String>>)) {
let mut tags = event.tags_as_vec();
update(&mut tags);
*event = event_with_parts(event, tags, event.content().to_string());
}
-fn replace_content(event: &mut RadrootsEventEnvelope, content: String) {
+fn replace_content(event: &mut EventEnvelope, content: String) {
*event = event_with_parts(event, event.tags_as_vec(), content);
}
-fn replace_first_tag_value(event: &mut RadrootsEventEnvelope, name: &str, value: String) {
+fn replace_first_tag_value(event: &mut EventEnvelope, name: &str, value: String) {
mutate_tags(event, |tags| {
let tag = tags
.iter_mut()
@@ -131,7 +130,7 @@ fn marked_tag(tag: &[String], name: &str, marker: &str) -> bool {
tag.first().map(String::as_str) == Some(name) && tag.last().map(String::as_str) == Some(marker)
}
-fn marked_tag_index(event: &RadrootsEventEnvelope, name: &str, marker: &str) -> usize {
+fn marked_tag_index(event: &EventEnvelope, name: &str, marker: &str) -> usize {
event
.tags_as_vec()
.iter()
@@ -177,7 +176,7 @@ fn invalid_relay() -> String {
"http://relay.radroots.example".to_string()
}
-fn sign_parts(parts: RadrootsNip01EventWireParts) -> RadrootsEventEnvelope {
+fn sign_parts(parts: Nip01EventWireParts) -> EventEnvelope {
let tags = parts
.tags
.into_iter()
@@ -193,7 +192,7 @@ fn sign_parts(parts: RadrootsNip01EventWireParts) -> RadrootsEventEnvelope {
.custom_created_at(nostr::Timestamp::from_secs(1_800_000_000))
.sign_with_keys(&keys)
.expect("signed event");
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ EventEnvelope::new(EventEnvelopeParts {
id: event.id.to_hex(),
author: event.pubkey.to_hex(),
created_at: event.created_at.as_secs(),
@@ -210,8 +209,8 @@ fn sign_parts(parts: RadrootsNip01EventWireParts) -> RadrootsEventEnvelope {
.unwrap()
}
-fn wiki_article() -> RadrootsWikiArticle {
- RadrootsWikiArticle {
+fn wiki_article() -> WikiArticle {
+ WikiArticle {
d_tag: "soil-health".to_string(),
title: Some("Soil health".to_string()),
content_djot: "# Soil health".to_string(),
@@ -223,8 +222,8 @@ fn wiki_article() -> RadrootsWikiArticle {
}
}
-fn source() -> RadrootsKnowledgeSource {
- RadrootsKnowledgeSource {
+fn source() -> KnowledgeSource {
+ KnowledgeSource {
schema: RADROOTS_KNOWLEDGE_SOURCE_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
d_tag: "soil-source".to_string(),
@@ -242,13 +241,13 @@ fn source() -> RadrootsKnowledgeSource {
}
}
-fn claim() -> RadrootsKnowledgeClaim {
- RadrootsKnowledgeClaim {
+fn claim() -> KnowledgeClaim {
+ KnowledgeClaim {
schema: RADROOTS_KNOWLEDGE_CLAIM_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
claim_type: "practice_effect".to_string(),
text: "Cover crops improve soil structure.".to_string(),
- citation_spans: vec![RadrootsKnowledgeCitationSpan {
+ citation_spans: vec![KnowledgeCitationSpan {
source_ref: event_ref('4', KIND_KNOWLEDGE_SOURCE),
artifact_ref: None,
page_start: Some(12),
@@ -264,8 +263,8 @@ fn claim() -> RadrootsKnowledgeClaim {
}
}
-fn node_ref(label: &str) -> RadrootsKnowledgeNodeRef {
- RadrootsKnowledgeNodeRef {
+fn node_ref(label: &str) -> KnowledgeNodeRef {
+ KnowledgeNodeRef {
node_type: "event".to_string(),
event_ref: Some(event_ref('6', KIND_KNOWLEDGE_CLAIM)),
address_ref: None,
@@ -274,8 +273,8 @@ fn node_ref(label: &str) -> RadrootsKnowledgeNodeRef {
}
}
-fn relation() -> RadrootsKnowledgeRelation {
- RadrootsKnowledgeRelation {
+fn relation() -> KnowledgeRelation {
+ KnowledgeRelation {
schema: RADROOTS_KNOWLEDGE_RELATION_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
subject: node_ref("cover crops"),
@@ -287,21 +286,21 @@ fn relation() -> RadrootsKnowledgeRelation {
}
}
-fn review() -> RadrootsKnowledgeReview {
- RadrootsKnowledgeReview {
+fn review() -> KnowledgeReview {
+ KnowledgeReview {
schema: RADROOTS_KNOWLEDGE_REVIEW_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
- target: RadrootsKnowledgeReviewTarget {
+ target: KnowledgeReviewTarget {
event_id: hex_64('8'),
author_pubkey: hex_64('a'),
kind: KIND_KNOWLEDGE_CLAIM,
address: None,
relays: vec!["wss://relay.radroots.example".to_string()],
- review_scope: RadrootsKnowledgeReviewScope::SpecificVersion,
+ review_scope: KnowledgeReviewScope::SpecificVersion,
},
reviewer_role: "peer".to_string(),
verdict: "needs_more_evidence".to_string(),
- scores: vec![RadrootsKnowledgeReviewScore {
+ scores: vec![KnowledgeReviewScore {
dimension: "evidence".to_string(),
value: "partial".to_string(),
note: None,
@@ -311,16 +310,16 @@ fn review() -> RadrootsKnowledgeReview {
}
}
-fn field_report() -> RadrootsKnowledgeFieldReport {
- RadrootsKnowledgeFieldReport {
+fn field_report() -> KnowledgeFieldReport {
+ KnowledgeFieldReport {
schema: RADROOTS_KNOWLEDGE_FIELD_REPORT_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
report_type: "observation".to_string(),
title: "Field observation".to_string(),
summary: Some("Observed cover crop residue.".to_string()),
- context: RadrootsKnowledgeFieldContext {
- location_precision: RadrootsKnowledgeLocationPrecision::CoarseGeohash,
- public_location: Some(RadrootsKnowledgeLocation {
+ context: KnowledgeFieldContext {
+ location_precision: KnowledgeLocationPrecision::CoarseGeohash,
+ public_location: Some(KnowledgeLocation {
label: Some("watershed".to_string()),
region: Some("synthetic-region".to_string()),
locality: None,
@@ -330,11 +329,11 @@ fn field_report() -> RadrootsKnowledgeFieldReport {
topics: vec!["field".to_string()],
context_tags: vec!["observation".to_string()],
},
- observations: vec![RadrootsKnowledgeObservation {
+ observations: vec![KnowledgeObservation {
observation_type: "residue".to_string(),
text: "Residue was visible across beds.".to_string(),
observed_at: Some("2026-07-05".to_string()),
- values: vec![RadrootsKnowledgeObservationValue {
+ values: vec![KnowledgeObservationValue {
key: "coverage".to_string(),
value: "medium".to_string(),
unit: None,
@@ -346,8 +345,8 @@ fn field_report() -> RadrootsKnowledgeFieldReport {
}
}
-fn bounty() -> RadrootsEvidenceBounty {
- RadrootsEvidenceBounty {
+fn bounty() -> EvidenceBounty {
+ EvidenceBounty {
schema: RADROOTS_EVIDENCE_BOUNTY_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
d_tag: "soil-bounty".to_string(),
@@ -360,8 +359,8 @@ fn bounty() -> RadrootsEvidenceBounty {
}
}
-fn proposal() -> RadrootsKnowledgeChangeProposal {
- RadrootsKnowledgeChangeProposal {
+fn proposal() -> KnowledgeChangeProposal {
+ KnowledgeChangeProposal {
schema: RADROOTS_KNOWLEDGE_CHANGE_PROPOSAL_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
target: event_ref('b', KIND_KNOWLEDGE_CLAIM),
@@ -373,8 +372,8 @@ fn proposal() -> RadrootsKnowledgeChangeProposal {
}
}
-fn attestation() -> RadrootsContributionAttestation {
- RadrootsContributionAttestation {
+fn attestation() -> ContributionAttestation {
+ ContributionAttestation {
schema: RADROOTS_CONTRIBUTION_ATTESTATION_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
contributor_pubkey: hex_64('a'),
@@ -426,7 +425,7 @@ fn knowledge_codecs_roundtrip_all_contracts() {
Some("Soil health".to_string())
);
- let redirect = RadrootsWikiRedirect {
+ let redirect = WikiRedirect {
d_tag: "soil".to_string(),
target: address_ref(),
};
@@ -448,7 +447,7 @@ fn knowledge_codecs_roundtrip_all_contracts() {
"soil-health"
);
- let merge = RadrootsWikiMergeRequest {
+ let merge = WikiMergeRequest {
target_article: address_ref(),
destination_pubkey: hex_64('a'),
base_version_event_id: Some(hex_64('e')),
@@ -536,7 +535,7 @@ fn knowledge_codecs_roundtrip_all_contracts() {
"observation"
);
- let bounty = RadrootsEvidenceBounty {
+ let bounty = EvidenceBounty {
schema: RADROOTS_EVIDENCE_BOUNTY_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
d_tag: "soil-bounty".to_string(),
@@ -558,7 +557,7 @@ fn knowledge_codecs_roundtrip_all_contracts() {
"Soil bounty"
);
- let proposal = RadrootsKnowledgeChangeProposal {
+ let proposal = KnowledgeChangeProposal {
schema: RADROOTS_KNOWLEDGE_CHANGE_PROPOSAL_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
target: event_ref('b', KIND_KNOWLEDGE_CLAIM),
@@ -581,7 +580,7 @@ fn knowledge_codecs_roundtrip_all_contracts() {
"amend"
);
- let attestation = RadrootsContributionAttestation {
+ let attestation = ContributionAttestation {
schema: RADROOTS_CONTRIBUTION_ATTESTATION_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
contributor_pubkey: hex_64('a'),
@@ -715,7 +714,7 @@ fn malformed_knowledge_events_return_stable_decode_codes() {
mutate_tags(&mut missing_contract, |tags| {
tags.retain(|tag| tag.first().map(|value| value.as_str()) != Some("contract"));
});
- let signed = sign_parts(RadrootsNip01EventWireParts {
+ let signed = sign_parts(Nip01EventWireParts {
kind: missing_contract.kind_u32(),
content: missing_contract.content().to_string(),
tags: missing_contract.tags_as_vec(),
@@ -735,7 +734,7 @@ fn malformed_knowledge_events_return_stable_decode_codes() {
#[test]
fn malformed_nip54_wiki_shapes_are_rejected() {
let mut redirect = event_from_parts(
- wiki_redirect_to_wire_parts(&RadrootsWikiRedirect {
+ wiki_redirect_to_wire_parts(&WikiRedirect {
d_tag: "soil".to_string(),
target: address_ref(),
})
@@ -753,7 +752,7 @@ fn malformed_nip54_wiki_shapes_are_rejected() {
EventParseError::InvalidTag("a"),
);
- let merge = RadrootsWikiMergeRequest {
+ let merge = WikiMergeRequest {
target_article: address_ref(),
destination_pubkey: hex_64('a'),
base_version_event_id: Some(hex_64('e')),
@@ -987,7 +986,7 @@ fn semantic_validation_rejects_invalid_encode_models() {
EventEncodeError::EmptyRequiredField("content_djot"),
);
- let mut redirect = RadrootsWikiRedirect {
+ let mut redirect = WikiRedirect {
d_tag: "soil".to_string(),
target: address_ref(),
};
@@ -997,7 +996,7 @@ fn semantic_validation_rejects_invalid_encode_models() {
EventEncodeError::InvalidField("wiki_redirect.target"),
);
- let mut merge = RadrootsWikiMergeRequest {
+ let mut merge = WikiMergeRequest {
target_article: address_ref(),
destination_pubkey: "bad".to_string(),
base_version_event_id: Some(hex_64('e')),
@@ -1050,7 +1049,7 @@ fn semantic_validation_rejects_invalid_encode_models() {
EventEncodeError::EmptyRequiredField("observations"),
);
- let bounty = RadrootsEvidenceBounty {
+ let bounty = EvidenceBounty {
schema: RADROOTS_EVIDENCE_BOUNTY_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
d_tag: "soil-bounty".to_string(),
@@ -1066,7 +1065,7 @@ fn semantic_validation_rejects_invalid_encode_models() {
EventEncodeError::EmptyRequiredField("target_refs"),
);
- let proposal = RadrootsKnowledgeChangeProposal {
+ let proposal = KnowledgeChangeProposal {
schema: RADROOTS_KNOWLEDGE_CHANGE_PROPOSAL_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
target: event_ref('b', KIND_KNOWLEDGE_CLAIM),
@@ -1081,7 +1080,7 @@ fn semantic_validation_rejects_invalid_encode_models() {
EventEncodeError::EmptyRequiredField("summary"),
);
- let attestation = RadrootsContributionAttestation {
+ let attestation = ContributionAttestation {
schema: RADROOTS_CONTRIBUTION_ATTESTATION_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
contributor_pubkey: hex_64('a'),
@@ -1105,7 +1104,7 @@ fn semantic_validation_rejects_invalid_relay_models() {
EventEncodeError::InvalidField("artifact_refs"),
);
- let mut redirect = RadrootsWikiRedirect {
+ let mut redirect = WikiRedirect {
d_tag: "soil".to_string(),
target: address_ref(),
};
@@ -1123,7 +1122,7 @@ fn semantic_validation_rejects_invalid_relay_models() {
);
let mut report = field_report();
- report.context.location_precision = RadrootsKnowledgeLocationPrecision::ExactPrivateReference;
+ report.context.location_precision = KnowledgeLocationPrecision::ExactPrivateReference;
let mut private_location_ref = event_ref('f', KIND_KNOWLEDGE_SOURCE);
private_location_ref.relays = Some(vec![invalid_relay()]);
report.context.private_location_ref = Some(private_location_ref);
@@ -1216,7 +1215,7 @@ fn semantic_validation_rejects_invalid_decoded_content() {
EventParseError::InvalidJson("observations"),
);
- let bounty = RadrootsEvidenceBounty {
+ let bounty = EvidenceBounty {
schema: RADROOTS_EVIDENCE_BOUNTY_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
d_tag: "soil-bounty".to_string(),
@@ -1236,7 +1235,7 @@ fn semantic_validation_rejects_invalid_decoded_content() {
EventParseError::InvalidJson("target_refs"),
);
- let proposal = RadrootsKnowledgeChangeProposal {
+ let proposal = KnowledgeChangeProposal {
schema: RADROOTS_KNOWLEDGE_CHANGE_PROPOSAL_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
target: event_ref('b', KIND_KNOWLEDGE_CLAIM),
@@ -1256,7 +1255,7 @@ fn semantic_validation_rejects_invalid_decoded_content() {
EventParseError::InvalidJson("summary"),
);
- let attestation = RadrootsContributionAttestation {
+ let attestation = ContributionAttestation {
schema: RADROOTS_CONTRIBUTION_ATTESTATION_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
contributor_pubkey: hex_64('a'),
@@ -1295,7 +1294,7 @@ fn knowledge_decode_rejects_invalid_relay_values() {
);
let mut redirect_event = event_from_parts(
- wiki_redirect_to_wire_parts(&RadrootsWikiRedirect {
+ wiki_redirect_to_wire_parts(&WikiRedirect {
d_tag: "soil".to_string(),
target: address_ref(),
})
@@ -1334,7 +1333,7 @@ fn knowledge_decode_rejects_invalid_relay_values() {
);
let mut report = field_report();
- report.context.location_precision = RadrootsKnowledgeLocationPrecision::ExactPrivateReference;
+ report.context.location_precision = KnowledgeLocationPrecision::ExactPrivateReference;
report.context.private_location_ref = Some(event_ref('f', KIND_KNOWLEDGE_SOURCE));
let mut report_event = event_from_parts(knowledge_field_report_to_wire_parts(&report).unwrap());
let mut value: serde_json::Value = serde_json::from_str(report_event.content()).unwrap();
diff --git a/crates/event_codec/tests/knowledge_fixtures.rs b/crates/event_codec/tests/knowledge_fixtures.rs
@@ -3,18 +3,17 @@
use std::collections::BTreeSet;
use radroots_event::contract::{
- RadrootsContractValidationError, RadrootsEventClass, all_event_contracts,
- validate_event_contract_shape,
+ ContractValidationError, EventClass, all_event_contracts, validate_event_contract_shape,
};
use radroots_event::envelope::kind::{
KIND_CONTRIBUTION_ATTESTATION, KIND_KNOWLEDGE_CHANGE_PROPOSAL, KIND_KNOWLEDGE_CLAIM,
KIND_KNOWLEDGE_FIELD_REPORT, KIND_KNOWLEDGE_RELATION, KIND_KNOWLEDGE_REVIEW, KIND_WIKI_ARTICLE,
};
use radroots_event::knowledge::{
- RADROOTS_KNOWLEDGE_CLAIM_SCHEMA, RADROOTS_KNOWLEDGE_FIELD_REPORT_SCHEMA, RadrootsWikiArticle,
+ RADROOTS_KNOWLEDGE_CLAIM_SCHEMA, RADROOTS_KNOWLEDGE_FIELD_REPORT_SCHEMA, WikiArticle,
};
-use radroots_event::wire::RadrootsNip01EventWireParts;
-use radroots_event::{envelope::RadrootsEventEnvelope, envelope::RadrootsEventEnvelopeParts};
+use radroots_event::wire::Nip01EventWireParts;
+use radroots_event::{envelope::EventEnvelope, envelope::EventEnvelopeParts};
use radroots_event_codec::error::{EventEncodeError, EventParseError};
use radroots_event_codec::knowledge::{
contribution_attestation_to_wire_parts, evidence_bounty_to_wire_parts,
@@ -36,8 +35,8 @@ use radroots_test_fixtures::knowledge::{
wiki_redirect,
};
-fn event_from_parts(parts: RadrootsNip01EventWireParts) -> RadrootsEventEnvelope {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+fn event_from_parts(parts: Nip01EventWireParts) -> EventEnvelope {
+ EventEnvelope::new(EventEnvelopeParts {
id: hex_64('0'),
author: hex_64('a'),
created_at: 1_800_000_000,
@@ -49,7 +48,7 @@ fn event_from_parts(parts: RadrootsNip01EventWireParts) -> RadrootsEventEnvelope
.unwrap()
}
-fn sign_parts(parts: RadrootsNip01EventWireParts) -> RadrootsEventEnvelope {
+fn sign_parts(parts: Nip01EventWireParts) -> EventEnvelope {
let tags = parts
.tags
.into_iter()
@@ -65,7 +64,7 @@ fn sign_parts(parts: RadrootsNip01EventWireParts) -> RadrootsEventEnvelope {
.custom_created_at(nostr::Timestamp::from_secs(1_800_000_000))
.sign_with_keys(&keys)
.expect("signed event");
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ EventEnvelope::new(EventEnvelopeParts {
id: event.id.to_hex(),
author: event.pubkey.to_hex(),
created_at: event.created_at.as_secs(),
@@ -83,12 +82,12 @@ fn sign_parts(parts: RadrootsNip01EventWireParts) -> RadrootsEventEnvelope {
}
fn event_with_parts(
- event: &RadrootsEventEnvelope,
+ event: &EventEnvelope,
tags: Vec<Vec<String>>,
content: String,
sig: String,
-) -> RadrootsEventEnvelope {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+) -> EventEnvelope {
+ EventEnvelope::new(EventEnvelopeParts {
id: event.id_hex().to_string(),
author: event.author().to_hex().to_string(),
created_at: event.created_at_u64(),
@@ -100,7 +99,7 @@ fn event_with_parts(
.unwrap()
}
-fn mutate_tags(event: &mut RadrootsEventEnvelope, update: impl FnOnce(&mut Vec<Vec<String>>)) {
+fn mutate_tags(event: &mut EventEnvelope, update: impl FnOnce(&mut Vec<Vec<String>>)) {
let mut tags = event.tags_as_vec();
update(&mut tags);
*event = event_with_parts(
@@ -111,7 +110,7 @@ fn mutate_tags(event: &mut RadrootsEventEnvelope, update: impl FnOnce(&mut Vec<V
);
}
-fn replace_content(event: &mut RadrootsEventEnvelope, content: String) {
+fn replace_content(event: &mut EventEnvelope, content: String) {
*event = event_with_parts(
event,
event.tags_as_vec(),
@@ -120,11 +119,11 @@ fn replace_content(event: &mut RadrootsEventEnvelope, content: String) {
);
}
-fn replace_sig(event: &mut RadrootsEventEnvelope, sig: String) {
+fn replace_sig(event: &mut EventEnvelope, sig: String) {
*event = event_with_parts(event, event.tags_as_vec(), event.content().to_string(), sig);
}
-fn parts_for_fixture(fixture: &RadrootsKnowledgeFixture) -> RadrootsNip01EventWireParts {
+fn parts_for_fixture(fixture: &RadrootsKnowledgeFixture) -> Nip01EventWireParts {
match fixture {
RadrootsKnowledgeFixture::WikiArticle(value) => wiki_article_to_wire_parts(value).unwrap(),
RadrootsKnowledgeFixture::WikiRedirect(value) => {
@@ -279,7 +278,7 @@ fn adversarial_knowledge_fixtures_reject_at_expected_stages() {
mutate_tags(&mut missing_contract_event, |tags| {
tags.retain(|tag| tag.first().map(|value| value.as_str()) != Some("contract"));
});
- let signed = sign_parts(RadrootsNip01EventWireParts {
+ let signed = sign_parts(Nip01EventWireParts {
kind: missing_contract_event.kind_u32(),
content: missing_contract_event.content().to_string(),
tags: missing_contract_event.tags_as_vec(),
@@ -301,7 +300,7 @@ fn adversarial_knowledge_fixtures_reject_at_expected_stages() {
&mut private_event,
serde_json::to_string(&private_value).unwrap(),
);
- let signed = sign_parts(RadrootsNip01EventWireParts {
+ let signed = sign_parts(Nip01EventWireParts {
kind: private_event.kind_u32(),
content: private_event.content().to_string(),
tags: private_event.tags_as_vec(),
@@ -328,7 +327,7 @@ fn adversarial_knowledge_fixtures_reject_at_expected_stages() {
}
}
});
- let signed = sign_parts(RadrootsNip01EventWireParts {
+ let signed = sign_parts(Nip01EventWireParts {
kind: unsupported_event.kind_u32(),
content: unsupported_event.content().to_string(),
tags: unsupported_event.tags_as_vec(),
@@ -344,7 +343,7 @@ fn nip54_and_signature_adversarial_fixtures_are_rejected() {
.iter()
.find(|fixture| fixture.id == "invalid_nip54_d_tag")
.unwrap();
- let mut article: RadrootsWikiArticle = wiki_article();
+ let mut article: WikiArticle = wiki_article();
article.d_tag = "Soil Health".to_string();
let error = wiki_article_to_wire_parts(&article).unwrap_err();
assert_eq!(invalid_d_tag.pipeline_stage, "encode");
@@ -495,7 +494,7 @@ fn authoritative_knowledge_status_fields_are_rejected() {
validate_event_contract_shape(&event, RADROOTS_KNOWLEDGE_CLAIM_SCHEMA).unwrap_err();
assert_eq!(
error,
- RadrootsContractValidationError::ForbiddenContentField {
+ ContractValidationError::ForbiddenContentField {
contract_id: RADROOTS_KNOWLEDGE_CLAIM_SCHEMA,
field,
}
@@ -528,7 +527,7 @@ fn immutable_knowledge_contracts_are_regular_events() {
.find(|contract| contract.id == contract_id)
.unwrap();
assert_eq!(contract.kind, kind);
- assert_eq!(contract.class, RadrootsEventClass::Regular);
+ assert_eq!(contract.class, EventClass::Regular);
}
}
diff --git a/crates/event_codec/tests/knowledge_manifest.rs b/crates/event_codec/tests/knowledge_manifest.rs
@@ -4,7 +4,7 @@ use std::collections::BTreeSet;
use radroots_event::contract::VERSION;
use radroots_event::contract::{
- RADROOTS_EVENT_CONTRACT_REGISTRY_VERSION, RadrootsEventClass, all_event_contracts,
+ EventClass, RADROOTS_EVENT_CONTRACT_REGISTRY_VERSION, all_event_contracts,
};
use radroots_event::envelope::kind::{
KIND_CONTRIBUTION_ATTESTATION, KIND_KNOWLEDGE_CHANGE_PROPOSAL, KIND_KNOWLEDGE_CLAIM,
@@ -224,7 +224,7 @@ fn knowledge_manifest_preserves_regular_immutable_classification() {
.unwrap();
assert_eq!(manifest_entry.kind, kind);
assert_eq!(manifest_entry.class, "regular");
- assert_eq!(registry_entry.class, RadrootsEventClass::Regular);
+ assert_eq!(registry_entry.class, EventClass::Regular);
}
}
diff --git a/crates/event_codec/tests/list.rs b/crates/event_codec/tests/list.rs
@@ -5,7 +5,7 @@ use radroots_event::{
envelope::kind::{
KIND_CALENDAR, KIND_LIST_MUTE, KIND_LIST_READ_WRITE_RELAYS, KIND_LIST_SET_FOLLOW, KIND_POST,
},
- social::list::{RadrootsList, RadrootsListEntry},
+ social::list::{List, ListEntry},
tag::name::TAG_R,
};
use radroots_event_codec::error::{EventEncodeError, EventParseError};
@@ -14,15 +14,15 @@ use radroots_event_codec::list::decode::{
};
use radroots_event_codec::list::encode::{list_build_tags, to_wire_parts_with_kind};
-fn sample_list() -> RadrootsList {
- RadrootsList {
+fn sample_list() -> List {
+ List {
content: "private".to_string(),
entries: vec![
- RadrootsListEntry {
+ ListEntry {
tag: "p".to_string(),
values: vec!["pubkey".to_string()],
},
- RadrootsListEntry {
+ ListEntry {
tag: "t".to_string(),
values: vec!["orchard".to_string()],
},
@@ -45,9 +45,9 @@ fn list_build_tags_and_decode_roundtrip() {
#[test]
fn list_encode_and_decode_reject_invalid_inputs() {
- let invalid = RadrootsList {
+ let invalid = List {
content: "".to_string(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: " ".to_string(),
values: vec!["pubkey".to_string()],
}],
@@ -58,9 +58,9 @@ fn list_encode_and_decode_reject_invalid_inputs() {
EventEncodeError::EmptyRequiredField("entry.tag")
));
- let invalid = RadrootsList {
+ let invalid = List {
content: "".to_string(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "p".to_string(),
values: vec![" ".to_string()],
}],
@@ -71,9 +71,9 @@ fn list_encode_and_decode_reject_invalid_inputs() {
EventEncodeError::EmptyRequiredField("entry.values")
));
- let invalid = RadrootsList {
+ let invalid = List {
content: "".to_string(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "p".to_string(),
values: Vec::new(),
}],
@@ -212,22 +212,22 @@ fn list_index_from_event_propagates_parse_errors() {
#[test]
fn relay_list_kind_roundtrips_nip65_r_tags() {
- let list = RadrootsList {
+ let list = List {
content: String::new(),
entries: vec![
- RadrootsListEntry {
+ ListEntry {
tag: TAG_R.to_string(),
values: vec!["wss://read.example.test".to_string(), "read".to_string()],
},
- RadrootsListEntry {
+ ListEntry {
tag: TAG_R.to_string(),
values: vec!["wss://write.example.test".to_string(), "write".to_string()],
},
- RadrootsListEntry {
+ ListEntry {
tag: TAG_R.to_string(),
values: vec!["wss://both.example.test".to_string()],
},
- RadrootsListEntry {
+ ListEntry {
tag: TAG_R.to_string(),
values: vec!["ws://local-relay.example.test".to_string()],
},
@@ -252,9 +252,9 @@ fn relay_list_kind_roundtrips_nip65_r_tags() {
#[test]
fn relay_list_kind_validates_url_shape_and_markers() {
- let invalid_tag = RadrootsList {
+ let invalid_tag = List {
content: String::new(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "p".to_string(),
values: vec!["wss://relay.example.test".to_string()],
}],
@@ -275,9 +275,9 @@ fn relay_list_kind_validates_url_shape_and_markers() {
Err(EventParseError::InvalidTag(TAG_R))
));
- let missing_url = RadrootsList {
+ let missing_url = List {
content: String::new(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: TAG_R.to_string(),
values: Vec::new(),
}],
@@ -295,9 +295,9 @@ fn relay_list_kind_validates_url_shape_and_markers() {
Err(EventParseError::InvalidTag(TAG_R))
));
- let invalid_url = RadrootsList {
+ let invalid_url = List {
content: String::new(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: TAG_R.to_string(),
values: vec!["https://relay.example.test".to_string()],
}],
@@ -319,9 +319,9 @@ fn relay_list_kind_validates_url_shape_and_markers() {
));
for invalid_empty_relay in ["wss://", "ws://"] {
- let invalid_empty_url = RadrootsList {
+ let invalid_empty_url = List {
content: String::new(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: TAG_R.to_string(),
values: vec![invalid_empty_relay.to_string()],
}],
@@ -340,9 +340,9 @@ fn relay_list_kind_validates_url_shape_and_markers() {
));
}
- let invalid_marker = RadrootsList {
+ let invalid_marker = List {
content: String::new(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: TAG_R.to_string(),
values: vec!["wss://relay.example.test".to_string(), "both".to_string()],
}],
@@ -364,9 +364,9 @@ fn relay_list_kind_validates_url_shape_and_markers() {
Err(EventParseError::InvalidTag(TAG_R))
));
- let extra_marker = RadrootsList {
+ let extra_marker = List {
content: String::new(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: TAG_R.to_string(),
values: vec![
"wss://relay.example.test".to_string(),
@@ -393,7 +393,7 @@ fn relay_list_kind_validates_url_shape_and_markers() {
Err(EventParseError::InvalidTag(TAG_R))
));
- let empty = RadrootsList {
+ let empty = List {
content: String::new(),
entries: Vec::new(),
};
diff --git a/crates/event_codec/tests/list_private.rs b/crates/event_codec/tests/list_private.rs
@@ -1,6 +1,6 @@
#![cfg(feature = "serde_json")]
-use radroots_event::social::list::RadrootsListEntry;
+use radroots_event::social::list::ListEntry;
use radroots_event_codec::list::decode::list_private_entries_from_json;
use radroots_event_codec::list::encode::list_private_entries_json;
use radroots_event_codec::list_set::decode::list_set_private_entries_from_json;
@@ -9,11 +9,11 @@ use radroots_event_codec::list_set::encode::list_set_private_entries_json;
#[test]
fn list_private_entries_roundtrip() {
let entries = vec![
- RadrootsListEntry {
+ ListEntry {
tag: "p".to_string(),
values: vec!["pubkey".to_string()],
},
- RadrootsListEntry {
+ ListEntry {
tag: "a".to_string(),
values: vec!["30340:pubkey:AAAAAAAAAAAAAAAAAAAAAA".to_string()],
},
@@ -29,11 +29,11 @@ fn list_private_entries_roundtrip() {
#[test]
fn list_set_private_entries_roundtrip() {
let entries = vec![
- RadrootsListEntry {
+ ListEntry {
tag: "p".to_string(),
values: vec!["member".to_string()],
},
- RadrootsListEntry {
+ ListEntry {
tag: "t".to_string(),
values: vec!["orchard".to_string()],
},
diff --git a/crates/event_codec/tests/list_set.rs b/crates/event_codec/tests/list_set.rs
@@ -5,8 +5,8 @@ mod test_fixtures;
use common::{AUTHOR, EVENT_ID, EVENT_SIG};
use radroots_event::{
envelope::kind::{KIND_CALENDAR, KIND_LIST_SET_FOLLOW, KIND_POST, is_nip51_list_set_kind},
- social::list::RadrootsListEntry,
- social::list_set::RadrootsListSet,
+ social::list::ListEntry,
+ social::list_set::ListSet,
};
use radroots_event_codec::error::{EventEncodeError, EventParseError};
use radroots_event_codec::list_set::decode::{
@@ -19,16 +19,16 @@ fn app_url(path: &str) -> String {
format!("{APP_PRIMARY_HTTPS}/{path}")
}
-fn sample_list_set() -> RadrootsListSet {
- RadrootsListSet {
+fn sample_list_set() -> ListSet {
+ ListSet {
d_tag: "members.owners".to_string(),
content: "private".to_string(),
entries: vec![
- RadrootsListEntry {
+ ListEntry {
tag: "p".to_string(),
values: vec!["owner".to_string()],
},
- RadrootsListEntry {
+ ListEntry {
tag: "t".to_string(),
values: vec!["orchard".to_string()],
},
@@ -83,7 +83,7 @@ fn generic_list_set_encode_rejects_calendar_kind() {
#[test]
fn list_set_encode_and_decode_reject_invalid_inputs() {
- let invalid = RadrootsListSet {
+ let invalid = ListSet {
d_tag: " ".to_string(),
content: "".to_string(),
entries: Vec::new(),
@@ -96,7 +96,7 @@ fn list_set_encode_and_decode_reject_invalid_inputs() {
let err = to_wire_parts_with_kind(&invalid, KIND_LIST_SET_FOLLOW).unwrap_err();
assert!(matches!(err, EventEncodeError::EmptyRequiredField("d_tag")));
- let invalid = RadrootsListSet {
+ let invalid = ListSet {
d_tag: "farm:invalid:owners".to_string(),
content: "".to_string(),
entries: Vec::new(),
diff --git a/crates/event_codec/tests/message.rs b/crates/event_codec/tests/message.rs
@@ -3,8 +3,8 @@ mod test_fixtures;
use radroots_event::{
envelope::kind::{KIND_MESSAGE, KIND_POST},
- social::message::{RadrootsMessage, RadrootsMessageRecipient},
- tag::RadrootsEventPtr,
+ social::message::{Message, MessageRecipient},
+ tag::EventPtr,
};
use radroots_event_codec::error::{EventEncodeError, EventParseError};
use radroots_event_codec::message::decode::{
@@ -15,7 +15,7 @@ use test_fixtures::{RELAY_PRIMARY_WSS, RELAY_SECONDARY_WSS};
#[test]
fn message_build_tags_requires_recipients() {
- let message = RadrootsMessage {
+ let message = Message {
recipients: Vec::new(),
content: "hello".to_string(),
reply_to: None,
@@ -31,8 +31,8 @@ fn message_build_tags_requires_recipients() {
#[test]
fn message_build_tags_requires_recipient_pubkey() {
- let message = RadrootsMessage {
- recipients: vec![RadrootsMessageRecipient {
+ let message = Message {
+ recipients: vec![MessageRecipient {
public_key: " ".to_string(),
relay_url: None,
}],
@@ -50,8 +50,8 @@ fn message_build_tags_requires_recipient_pubkey() {
#[test]
fn message_to_wire_parts_requires_content() {
- let message = RadrootsMessage {
- recipients: vec![RadrootsMessageRecipient {
+ let message = Message {
+ recipients: vec![MessageRecipient {
public_key: "pub".to_string(),
relay_url: None,
}],
@@ -66,8 +66,8 @@ fn message_to_wire_parts_requires_content() {
EventEncodeError::EmptyRequiredField("content")
));
- let message = RadrootsMessage {
- recipients: vec![RadrootsMessageRecipient {
+ let message = Message {
+ recipients: vec![MessageRecipient {
public_key: " ".to_string(),
relay_url: None,
}],
@@ -84,19 +84,19 @@ fn message_to_wire_parts_requires_content() {
#[test]
fn message_to_wire_parts_sets_tags() {
- let message = RadrootsMessage {
+ let message = Message {
recipients: vec![
- RadrootsMessageRecipient {
+ MessageRecipient {
public_key: "pub1".to_string(),
relay_url: None,
},
- RadrootsMessageRecipient {
+ MessageRecipient {
public_key: "pub2".to_string(),
relay_url: Some(RELAY_PRIMARY_WSS.to_string()),
},
],
content: "hello".to_string(),
- reply_to: Some(RadrootsEventPtr {
+ reply_to: Some(EventPtr {
id: "reply".to_string(),
relays: Some(RELAY_SECONDARY_WSS.to_string()),
}),
@@ -127,8 +127,8 @@ fn message_to_wire_parts_sets_tags() {
#[test]
fn message_to_wire_parts_handles_absent_optional_fields() {
- let message = RadrootsMessage {
- recipients: vec![RadrootsMessageRecipient {
+ let message = Message {
+ recipients: vec![MessageRecipient {
public_key: "pub1".to_string(),
relay_url: None,
}],
@@ -143,13 +143,13 @@ fn message_to_wire_parts_handles_absent_optional_fields() {
#[test]
fn message_to_wire_parts_supports_reply_without_relay() {
- let message = RadrootsMessage {
- recipients: vec![RadrootsMessageRecipient {
+ let message = Message {
+ recipients: vec![MessageRecipient {
public_key: "pub1".to_string(),
relay_url: None,
}],
content: "hello".to_string(),
- reply_to: Some(RadrootsEventPtr {
+ reply_to: Some(EventPtr {
id: "reply".to_string(),
relays: None,
}),
@@ -319,8 +319,8 @@ fn message_index_from_event_propagates_parse_errors() {
#[test]
fn message_build_tags_rejects_invalid_optional_fields() {
- let message = RadrootsMessage {
- recipients: vec![RadrootsMessageRecipient {
+ let message = Message {
+ recipients: vec![MessageRecipient {
public_key: "pub".to_string(),
relay_url: Some(" ".to_string()),
}],
@@ -334,13 +334,13 @@ fn message_build_tags_rejects_invalid_optional_fields() {
EventEncodeError::EmptyRequiredField("recipients.relay_url")
));
- let message = RadrootsMessage {
- recipients: vec![RadrootsMessageRecipient {
+ let message = Message {
+ recipients: vec![MessageRecipient {
public_key: "pub".to_string(),
relay_url: None,
}],
content: "hello".to_string(),
- reply_to: Some(RadrootsEventPtr {
+ reply_to: Some(EventPtr {
id: " ".to_string(),
relays: None,
}),
@@ -352,13 +352,13 @@ fn message_build_tags_rejects_invalid_optional_fields() {
EventEncodeError::EmptyRequiredField("reply_to.id")
));
- let message = RadrootsMessage {
- recipients: vec![RadrootsMessageRecipient {
+ let message = Message {
+ recipients: vec![MessageRecipient {
public_key: "pub".to_string(),
relay_url: None,
}],
content: "hello".to_string(),
- reply_to: Some(RadrootsEventPtr {
+ reply_to: Some(EventPtr {
id: "reply".to_string(),
relays: Some(" ".to_string()),
}),
@@ -370,8 +370,8 @@ fn message_build_tags_rejects_invalid_optional_fields() {
EventEncodeError::EmptyRequiredField("reply_to.relays")
));
- let message = RadrootsMessage {
- recipients: vec![RadrootsMessageRecipient {
+ let message = Message {
+ recipients: vec![MessageRecipient {
public_key: "pub".to_string(),
relay_url: None,
}],
diff --git a/crates/event_codec/tests/message_file.rs b/crates/event_codec/tests/message_file.rs
@@ -4,9 +4,9 @@ mod test_fixtures;
use common::{AUTHOR, EVENT_ID, EVENT_SIG};
use radroots_event::envelope::kind::{KIND_MESSAGE, KIND_MESSAGE_FILE};
-use radroots_event::social::message::RadrootsMessageRecipient;
-use radroots_event::social::message_file::{RadrootsMessageFile, RadrootsMessageFileDimensions};
-use radroots_event::tag::RadrootsEventPtr;
+use radroots_event::social::message::MessageRecipient;
+use radroots_event::social::message_file::{MessageFile, MessageFileDimensions};
+use radroots_event::tag::EventPtr;
use radroots_event_codec::error::{EventEncodeError, EventParseError};
use radroots_event_codec::message_file::decode::{
@@ -21,20 +21,20 @@ fn file_url(path: &str) -> String {
format!("{CDN_PRIMARY_HTTPS}/{path}")
}
-fn sample_message_file() -> RadrootsMessageFile {
- RadrootsMessageFile {
+fn sample_message_file() -> MessageFile {
+ MessageFile {
recipients: vec![
- RadrootsMessageRecipient {
+ MessageRecipient {
public_key: "pub1".to_string(),
relay_url: None,
},
- RadrootsMessageRecipient {
+ MessageRecipient {
public_key: "pub2".to_string(),
relay_url: Some(RELAY_PRIMARY_WSS.to_string()),
},
],
file_url: file_url("encrypted.bin"),
- reply_to: Some(RadrootsEventPtr {
+ reply_to: Some(EventPtr {
id: "reply".to_string(),
relays: Some(RELAY_SECONDARY_WSS.to_string()),
}),
@@ -46,7 +46,7 @@ fn sample_message_file() -> RadrootsMessageFile {
encrypted_hash: "hash".to_string(),
original_hash: Some("orig-hash".to_string()),
size: Some(1200),
- dimensions: Some(RadrootsMessageFileDimensions { w: 1200, h: 800 }),
+ dimensions: Some(MessageFileDimensions { w: 1200, h: 800 }),
blurhash: Some("blurhash".to_string()),
thumb: Some(file_url("thumb.bin")),
fallbacks: vec![file_url("fallback-1.bin"), file_url("fallback-2.bin")],
@@ -149,7 +149,7 @@ fn message_file_build_tags_requires_crypto_fields() {
#[test]
fn message_file_build_tags_rejects_invalid_reply_subject_and_fallbacks() {
let mut message = sample_message_file();
- message.reply_to = Some(RadrootsEventPtr {
+ message.reply_to = Some(EventPtr {
id: " ".to_string(),
relays: None,
});
diff --git a/crates/event_codec/tests/nip09_suppression_conformance.rs b/crates/event_codec/tests/nip09_suppression_conformance.rs
@@ -7,7 +7,7 @@ use std::{
path::Path,
};
-use radroots_event::{envelope::RadrootsEventEnvelope, envelope::RadrootsEventEnvelopeParts};
+use radroots_event::{envelope::EventEnvelope, envelope::EventEnvelopeParts};
use radroots_event_codec::{
deletion::{
admission::{
@@ -396,7 +396,7 @@ fn verified_event(event_json: &str, vector_id: &str) -> RadrootsSignatureVerifie
.unwrap_or_else(|error| panic!("{vector_id} signature verification failed: {error}"))
}
-fn event_envelope(event_json: &str, vector_id: &str) -> RadrootsEventEnvelope {
+fn event_envelope(event_json: &str, vector_id: &str) -> EventEnvelope {
let raw: RawEvent = serde_json::from_str(event_json)
.unwrap_or_else(|error| panic!("{vector_id} signed event JSON is invalid: {error}"));
assert_eq!(
@@ -404,7 +404,7 @@ fn event_envelope(event_json: &str, vector_id: &str) -> RadrootsEventEnvelope {
event_json,
"{vector_id} signed event JSON must be canonical and compact"
);
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ EventEnvelope::new(EventEnvelopeParts {
id: raw.id,
author: raw.pubkey,
created_at: raw.created_at,
diff --git a/crates/event_codec/tests/operational_listing.rs b/crates/event_codec/tests/operational_listing.rs
@@ -3,22 +3,20 @@
use radroots_core::pricing::{Discount, DiscountScope, DiscountThreshold, DiscountValue};
use radroots_core::{Currency, Decimal, Money, Quantity, QuantityPrice, Unit};
use radroots_event::{
- envelope::RadrootsEventEnvelope,
- envelope::RadrootsEventEnvelopeParts,
+ envelope::EventEnvelope,
+ envelope::EventEnvelopeParts,
envelope::kind::{
KIND_CLASSIFIED_LISTING, KIND_FARM, KIND_PLOT, KIND_POST, KIND_RESOURCE_AREA,
},
- farm::RadrootsFarmRef,
- farm::plot::RadrootsPlotRef,
- farm::resource_area::RadrootsResourceAreaRef,
- id::{RadrootsDTag, RadrootsInventoryBinId},
- listing::operational::RadrootsOperationalListingParseError,
+ farm::FarmRef,
+ farm::plot::PlotRef,
+ farm::resource_area::ResourceAreaRef,
+ id::{DTag, InventoryBinId},
+ listing::operational::OperationalListingParseError,
listing::operational::{
- RadrootsOperationalListing, RadrootsOperationalListingAvailability,
- RadrootsOperationalListingBin, RadrootsOperationalListingDeliveryMethod,
- RadrootsOperationalListingImage, RadrootsOperationalListingImageSize,
- RadrootsOperationalListingProduct, RadrootsOperationalListingPublicLocation,
- RadrootsOperationalListingStatus,
+ OperationalListing, OperationalListingAvailability, OperationalListingBin,
+ OperationalListingDeliveryMethod, OperationalListingImage, OperationalListingImageSize,
+ OperationalListingProduct, OperationalListingPublicLocation, OperationalListingStatus,
},
tag::name::{TAG_D, TAG_PUBLISHED_AT},
};
@@ -51,11 +49,11 @@ const WORKSPACE_PARSE_VECTOR_PATH: &str =
"../../contracts/conformance/vectors/operational_listing/parse_event.v1.json";
const WORKSPACE_CONTRACT_MARKER_PATH: &str = "../../contracts/manifest.toml";
-fn listing_d_tag(raw: &str) -> RadrootsDTag {
+fn listing_d_tag(raw: &str) -> DTag {
raw.parse().unwrap()
}
-fn bin_id(raw: &str) -> RadrootsInventoryBinId {
+fn bin_id(raw: &str) -> InventoryBinId {
raw.parse().unwrap()
}
@@ -87,8 +85,8 @@ fn replace_first_tag(tags: &mut [Vec<String>], name: &str, replacement: Vec<&str
*tag = replacement.into_iter().map(str::to_string).collect();
}
-fn event_envelope(kind: u32, tags: Vec<Vec<String>>, content: String) -> RadrootsEventEnvelope {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+fn event_envelope(kind: u32, tags: Vec<Vec<String>>, content: String) -> EventEnvelope {
+ EventEnvelope::new(EventEnvelopeParts {
id: EVENT_ID.to_string(),
author: AUTHOR.to_string(),
created_at: 7,
@@ -114,18 +112,18 @@ fn assert_invalid_tag(tags: Vec<Vec<String>>, expected: &'static str) {
}
}
-fn sample_listing(d_tag: &str) -> RadrootsOperationalListing {
+fn sample_listing(d_tag: &str) -> OperationalListing {
let quantity = quantity(Decimal::from(1u32), Unit::Each);
let price = quantity_price(money(Decimal::from(10u32), Currency::USD), quantity.clone());
- RadrootsOperationalListing {
+ OperationalListing {
d_tag: listing_d_tag(d_tag),
published_at: None,
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: "farm_pubkey".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
},
- product: RadrootsOperationalListingProduct {
+ product: OperationalListingProduct {
key: "sku".to_string(),
title: "Widget".to_string(),
category: "Tools".to_string(),
@@ -137,7 +135,7 @@ fn sample_listing(d_tag: &str) -> RadrootsOperationalListing {
year: None,
},
primary_bin_id: bin_id("bin-1"),
- bins: vec![RadrootsOperationalListingBin {
+ bins: vec![OperationalListingBin {
bin_id: bin_id("bin-1"),
quantity,
price_per_canonical_unit: price,
@@ -164,14 +162,14 @@ fn operational_listing_from_event_parts_preserves_listing_error_taxonomy() {
remove_tags(&mut tags, TAG_D);
assert_eq!(
operational_listing_from_event_parts(&tags, "").unwrap_err(),
- RadrootsOperationalListingParseError::MissingTag(TAG_D.to_string())
+ OperationalListingParseError::MissingTag(TAG_D.to_string())
);
let mut tags = sample_operational_listing_tags();
replace_first_tag(&mut tags, TAG_D, vec![TAG_D, "bad d"]);
assert_eq!(
operational_listing_from_event_parts(&tags, "").unwrap_err(),
- RadrootsOperationalListingParseError::InvalidTag(TAG_D.to_string())
+ OperationalListingParseError::InvalidTag(TAG_D.to_string())
);
let mut tags = sample_operational_listing_tags();
@@ -182,7 +180,7 @@ fn operational_listing_from_event_parts_preserves_listing_error_taxonomy() {
);
assert_eq!(
operational_listing_from_event_parts(&tags, "").unwrap_err(),
- RadrootsOperationalListingParseError::InvalidNumber("radroots:bin".to_string())
+ OperationalListingParseError::InvalidNumber("radroots:bin".to_string())
);
let mut tags = sample_operational_listing_tags();
@@ -193,7 +191,7 @@ fn operational_listing_from_event_parts_preserves_listing_error_taxonomy() {
);
assert_eq!(
operational_listing_from_event_parts(&tags, "").unwrap_err(),
- RadrootsOperationalListingParseError::InvalidUnit
+ OperationalListingParseError::InvalidUnit
);
let mut tags = sample_operational_listing_tags();
@@ -204,14 +202,14 @@ fn operational_listing_from_event_parts_preserves_listing_error_taxonomy() {
);
assert_eq!(
operational_listing_from_event_parts(&tags, "").unwrap_err(),
- RadrootsOperationalListingParseError::InvalidCurrency
+ OperationalListingParseError::InvalidCurrency
);
let mut tags = sample_operational_listing_tags();
tags.push(vec!["radroots:discount".to_string(), "{".to_string()]);
assert_eq!(
operational_listing_from_event_parts(&tags, "").unwrap_err(),
- RadrootsOperationalListingParseError::InvalidDiscount("radroots:discount".to_string())
+ OperationalListingParseError::InvalidDiscount("radroots:discount".to_string())
);
assert_eq!(
@@ -220,7 +218,7 @@ fn operational_listing_from_event_parts_preserves_listing_error_taxonomy() {
r#"{"location":{"coordinates":[1,2]}}"#,
)
.unwrap_err(),
- RadrootsOperationalListingParseError::InvalidJson("location".to_string())
+ OperationalListingParseError::InvalidJson("location".to_string())
);
}
@@ -363,20 +361,20 @@ fn execute_listing_parse_vector(vector: &Value, id: &str) {
}
}
-fn sample_listing_full(d_tag: &str) -> RadrootsOperationalListing {
+fn sample_listing_full(d_tag: &str) -> OperationalListing {
let qty_amount = Decimal::from_str("1000").unwrap();
let price_amount = Decimal::from_str("0.01").unwrap();
let display_qty = Decimal::from_str("1").unwrap();
let display_price = Decimal::from_str("10").unwrap();
- RadrootsOperationalListing {
+ OperationalListing {
d_tag: listing_d_tag(d_tag),
published_at: None,
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: "farm_pubkey".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
},
- product: RadrootsOperationalListingProduct {
+ product: OperationalListingProduct {
key: "sku".to_string(),
title: "Widget".to_string(),
category: "Tools".to_string(),
@@ -388,7 +386,7 @@ fn sample_listing_full(d_tag: &str) -> RadrootsOperationalListing {
year: Some("2024".to_string()),
},
primary_bin_id: bin_id("bin-1"),
- bins: vec![RadrootsOperationalListingBin {
+ bins: vec![OperationalListingBin {
bin_id: bin_id("bin-1"),
quantity: quantity(qty_amount, Unit::MassG),
price_per_canonical_unit: quantity_price(
@@ -417,23 +415,23 @@ fn sample_listing_full(d_tag: &str) -> RadrootsOperationalListing {
inventory_available: None,
availability: None,
delivery_method: None,
- location: Some(RadrootsOperationalListingPublicLocation {
+ location: Some(OperationalListingPublicLocation {
primary: "Moyobamba".to_string(),
city: Some("Moyobamba".to_string()),
region: Some("San Martin".to_string()),
country: Some("PE".to_string()),
geohash: "9q8yy".to_string(),
}),
- images: Some(vec![RadrootsOperationalListingImage {
+ images: Some(vec![OperationalListingImage {
url: "http://example.com/widget.jpg".to_string(),
- size: Some(RadrootsOperationalListingImageSize { w: 1200, h: 800 }),
+ size: Some(OperationalListingImageSize { w: 1200, h: 800 }),
}]),
}
}
#[test]
fn operational_listing_build_tags_requires_d_tag() {
- assert!(RadrootsDTag::parse("").is_err());
+ assert!(DTag::parse("").is_err());
}
#[test]
@@ -573,11 +571,11 @@ fn operational_listing_from_event_covers_reference_tag_error_paths() {
#[test]
fn operational_listing_from_event_covers_resource_and_plot_reference_paths() {
let mut listing = sample_listing("AAAAAAAAAAAAAAAAAAAAAw");
- listing.resource_area = Some(RadrootsResourceAreaRef {
+ listing.resource_area = Some(ResourceAreaRef {
pubkey: "resource_pubkey".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAABQ".to_string(),
});
- listing.plot = Some(RadrootsPlotRef {
+ listing.plot = Some(PlotRef {
pubkey: "plot_pubkey".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
});
@@ -932,15 +930,14 @@ fn operational_listing_from_event_covers_trade_location_delivery_and_image_paths
]);
let decoded =
operational_listing_from_event(KIND_CLASSIFIED_LISTING, &tags, "# Widget").unwrap();
- let Some(RadrootsOperationalListingAvailability::Window { start, end }) = decoded.availability
- else {
+ let Some(OperationalListingAvailability::Window { start, end }) = decoded.availability else {
panic!("expected availability window");
};
assert_eq!(start, Some(1730));
assert_eq!(end, Some(1740));
assert!(matches!(
decoded.delivery_method,
- Some(RadrootsOperationalListingDeliveryMethod::Pickup)
+ Some(OperationalListingDeliveryMethod::Pickup)
));
assert_eq!(decoded.images.as_ref().map(Vec::len), Some(2));
assert!(decoded.images.as_ref().unwrap()[1].size.is_none());
@@ -951,7 +948,7 @@ fn operational_listing_from_event_covers_trade_location_delivery_and_image_paths
operational_listing_from_event(KIND_CLASSIFIED_LISTING, &tags, "# Widget").unwrap();
assert!(matches!(
decoded.delivery_method,
- Some(RadrootsOperationalListingDeliveryMethod::LocalDelivery)
+ Some(OperationalListingDeliveryMethod::LocalDelivery)
));
let mut tags = sample_operational_listing_tags();
@@ -960,7 +957,7 @@ fn operational_listing_from_event_covers_trade_location_delivery_and_image_paths
operational_listing_from_event(KIND_CLASSIFIED_LISTING, &tags, "# Widget").unwrap();
assert!(matches!(
decoded.delivery_method,
- Some(RadrootsOperationalListingDeliveryMethod::Shipping)
+ Some(OperationalListingDeliveryMethod::Shipping)
));
let mut tags = sample_operational_listing_tags();
@@ -971,8 +968,7 @@ fn operational_listing_from_event_covers_trade_location_delivery_and_image_paths
]);
let decoded =
operational_listing_from_event(KIND_CLASSIFIED_LISTING, &tags, "# Widget").unwrap();
- let Some(RadrootsOperationalListingDeliveryMethod::Other { method }) = decoded.delivery_method
- else {
+ let Some(OperationalListingDeliveryMethod::Other { method }) = decoded.delivery_method else {
panic!("expected other delivery method");
};
assert_eq!(method, "bike courier");
@@ -981,8 +977,7 @@ fn operational_listing_from_event_covers_trade_location_delivery_and_image_paths
tags.push(vec!["delivery".to_string(), "drone".to_string()]);
let decoded =
operational_listing_from_event(KIND_CLASSIFIED_LISTING, &tags, "# Widget").unwrap();
- let Some(RadrootsOperationalListingDeliveryMethod::Other { method }) = decoded.delivery_method
- else {
+ let Some(OperationalListingDeliveryMethod::Other { method }) = decoded.delivery_method else {
panic!("expected fallback delivery method");
};
assert_eq!(method, "drone");
@@ -993,8 +988,8 @@ fn operational_listing_from_event_covers_trade_location_delivery_and_image_paths
operational_listing_from_event(KIND_CLASSIFIED_LISTING, &tags, "# Widget").unwrap();
assert!(matches!(
decoded.availability,
- Some(RadrootsOperationalListingAvailability::Status {
- status: RadrootsOperationalListingStatus::Active
+ Some(OperationalListingAvailability::Status {
+ status: OperationalListingStatus::Active
})
));
@@ -1004,8 +999,8 @@ fn operational_listing_from_event_covers_trade_location_delivery_and_image_paths
operational_listing_from_event(KIND_CLASSIFIED_LISTING, &tags, "# Widget").unwrap();
assert!(matches!(
decoded.availability,
- Some(RadrootsOperationalListingAvailability::Status {
- status: RadrootsOperationalListingStatus::Sold
+ Some(OperationalListingAvailability::Status {
+ status: OperationalListingStatus::Sold
})
));
@@ -1013,8 +1008,8 @@ fn operational_listing_from_event_covers_trade_location_delivery_and_image_paths
tags.push(vec!["status".to_string(), "paused".to_string()]);
let decoded =
operational_listing_from_event(KIND_CLASSIFIED_LISTING, &tags, "# Widget").unwrap();
- let Some(RadrootsOperationalListingAvailability::Status {
- status: RadrootsOperationalListingStatus::Other { value },
+ let Some(OperationalListingAvailability::Status {
+ status: OperationalListingStatus::Other { value },
}) = decoded.availability
else {
panic!("expected other availability status");
@@ -1330,7 +1325,7 @@ fn operational_listing_build_tags_includes_listing_fields() {
#[test]
fn operational_listing_tags_full_uses_single_generic_price_for_primary_bin() {
let mut listing = sample_listing_full("AAAAAAAAAAAAAAAAAAAAAw");
- listing.bins.push(RadrootsOperationalListingBin {
+ listing.bins.push(OperationalListingBin {
bin_id: bin_id("bin-2"),
quantity: quantity(Decimal::from_str("500").unwrap(), Unit::MassG),
price_per_canonical_unit: quantity_price(
@@ -1366,11 +1361,11 @@ fn operational_listing_tags_full_includes_trade_fields() {
let inventory = Decimal::from_str("12.5").unwrap();
let inventory_value = inventory.to_string();
listing.inventory_available = Some(inventory);
- listing.availability = Some(RadrootsOperationalListingAvailability::Window {
+ listing.availability = Some(OperationalListingAvailability::Window {
start: Some(1730000000),
end: Some(1731000000),
});
- listing.delivery_method = Some(RadrootsOperationalListingDeliveryMethod::Shipping);
+ listing.delivery_method = Some(OperationalListingDeliveryMethod::Shipping);
let tags = operational_listing_tags_full(&listing).unwrap();
@@ -1395,8 +1390,8 @@ fn operational_listing_tags_full_includes_trade_fields() {
#[test]
fn operational_listing_tags_full_includes_status_tag() {
let mut listing = sample_listing("AAAAAAAAAAAAAAAAAAAAAg");
- listing.availability = Some(RadrootsOperationalListingAvailability::Status {
- status: RadrootsOperationalListingStatus::Active,
+ listing.availability = Some(OperationalListingAvailability::Status {
+ status: OperationalListingStatus::Active,
});
let tags = operational_listing_tags_full(&listing).unwrap();
@@ -1416,14 +1411,14 @@ fn operational_listing_build_tags_ignores_null_strings() {
listing.product.location = Some("null".to_string());
listing.product.profile = Some("null".to_string());
listing.product.year = Some("null".to_string());
- listing.location = Some(RadrootsOperationalListingPublicLocation {
+ listing.location = Some(OperationalListingPublicLocation {
primary: "Moyobamba".to_string(),
city: Some("null".to_string()),
region: Some("San Martin".to_string()),
country: Some("null".to_string()),
geohash: "9q8yy".to_string(),
});
- listing.images = Some(vec![RadrootsOperationalListingImage {
+ listing.images = Some(vec![OperationalListingImage {
url: "null".to_string(),
size: None,
}]);
@@ -1439,7 +1434,7 @@ fn operational_listing_build_tags_ignores_null_strings() {
#[test]
fn operational_listing_build_tags_rejects_location_without_public_locality() {
let mut listing = sample_listing("AAAAAAAAAAAAAAAAAAAAAg");
- listing.location = Some(RadrootsOperationalListingPublicLocation {
+ listing.location = Some(OperationalListingPublicLocation {
primary: "Farm stand".to_string(),
city: Some("null".to_string()),
region: None,
@@ -1456,7 +1451,7 @@ fn operational_listing_build_tags_rejects_location_without_public_locality() {
#[test]
fn operational_listing_tags_with_options_cover_location_fallback_paths() {
let mut geohash_only = sample_listing("AAAAAAAAAAAAAAAAAAAAAg");
- geohash_only.location = Some(RadrootsOperationalListingPublicLocation {
+ geohash_only.location = Some(OperationalListingPublicLocation {
primary: "Moyobamba".to_string(),
city: Some("Moyobamba".to_string()),
region: None,
@@ -1479,7 +1474,7 @@ fn operational_listing_tags_with_options_cover_location_fallback_paths() {
);
let mut no_coordinates = sample_listing("AAAAAAAAAAAAAAAAAAAAAQ");
- no_coordinates.location = Some(RadrootsOperationalListingPublicLocation {
+ no_coordinates.location = Some(OperationalListingPublicLocation {
primary: "Moyobamba".to_string(),
city: Some("Moyobamba".to_string()),
region: None,
@@ -1502,7 +1497,7 @@ fn operational_listing_tags_with_options_cover_location_fallback_paths() {
);
let mut without_geohash = sample_listing("AAAAAAAAAAAAAAAAAAAAAw");
- without_geohash.location = Some(RadrootsOperationalListingPublicLocation {
+ without_geohash.location = Some(OperationalListingPublicLocation {
primary: "Moyobamba".to_string(),
city: Some("Moyobamba".to_string()),
region: None,
diff --git a/crates/event_codec/tests/operational_listing_conformance.rs b/crates/event_codec/tests/operational_listing_conformance.rs
@@ -3,8 +3,8 @@
use std::{borrow::Cow, collections::BTreeSet, fs, path::Path};
use radroots_event::{
- contract::validate_event_contract_shape, envelope::RadrootsEventEnvelope,
- envelope::RadrootsEventEnvelopeParts, listing::operational::RadrootsOperationalListing,
+ contract::validate_event_contract_shape, envelope::EventEnvelope, envelope::EventEnvelopeParts,
+ listing::operational::OperationalListing,
};
use radroots_event_codec::{
error::EventEncodeError,
@@ -203,7 +203,7 @@ fn checked_in_operational_listing_full_event_tag_vectors_execute() {
let wire = to_wire_parts(&listing)
.unwrap_or_else(|error| panic!("{} draft failed: {error}", vector.id));
assert_eq!(wire.tags, actual, "{}", vector.id);
- let event = RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ let event = EventEnvelope::new(EventEnvelopeParts {
id: "b".repeat(64),
author: listing.farm.pubkey.clone(),
created_at: listing.published_at.unwrap_or_default(),
@@ -289,7 +289,7 @@ fn assert_encode_error(id: &str, actual: &EventEncodeError, expected: &EncodeErr
}
}
-fn typed_listing(raw: &Value, id: &str) -> RadrootsOperationalListing {
+fn typed_listing(raw: &Value, id: &str) -> OperationalListing {
validate_listing_fixture_keys(raw)
.unwrap_or_else(|error| panic!("{id} fixture schema failed: {error}"));
serde_json::from_value(raw.clone())
diff --git a/crates/event_codec/tests/post.rs b/crates/event_codec/tests/post.rs
@@ -1,13 +1,12 @@
use radroots_blossom::{BlobDescriptor, BlobUrl, ByteVerifiedDescriptor, MediaType, Sha256};
use radroots_event::{
- media::RadrootsAuthoredImage,
+ media::AuthoredImage,
post::{
- RADROOTS_ASK_MARKER_TAG_VALUE, RADROOTS_POST_ALT_MAX_BYTES,
+ AuthoredAsk, AuthoredPhotoUpdate, AuthoredPostError, AuthoredPostImage, AuthoredUpdate,
+ PostImageDimensions, RADROOTS_ASK_MARKER_TAG_VALUE, RADROOTS_POST_ALT_MAX_BYTES,
RADROOTS_POST_CONTENT_MAX_BYTES, RADROOTS_POST_EVENT_WIRE_MAX_BYTES,
RADROOTS_POST_IMETA_MAX_COUNT, RADROOTS_POST_TAG_ELEMENT_MAX_BYTES,
- RADROOTS_POST_TAG_TOTAL_MAX_BYTES, RadrootsAuthoredAsk, RadrootsAuthoredPhotoUpdate,
- RadrootsAuthoredPostError, RadrootsAuthoredPostImage, RadrootsAuthoredUpdate,
- RadrootsPostImageDimensions, post_image_media_type_is_valid,
+ RADROOTS_POST_TAG_TOTAL_MAX_BYTES, post_image_media_type_is_valid,
},
};
use radroots_event_codec::post::authored::{
@@ -16,14 +15,14 @@ use radroots_event_codec::post::authored::{
#[test]
fn authored_update_emits_only_bounded_nonblank_content() {
- let update = RadrootsAuthoredUpdate::new("The first strawberries are ready.").unwrap();
+ let update = AuthoredUpdate::new("The first strawberries are ready.").unwrap();
let wire = authored_update_to_wire_parts(&update);
assert_eq!(wire.kind, 1);
assert_eq!(wire.content, update.content());
assert!(wire.tags.is_empty());
assert_eq!(
- RadrootsAuthoredUpdate::new(" \t").unwrap_err().code(),
+ AuthoredUpdate::new(" \t").unwrap_err().code(),
"post_content_missing"
);
}
@@ -31,12 +30,12 @@ fn authored_update_emits_only_bounded_nonblank_content() {
#[test]
fn authored_update_enforces_the_utf8_byte_limit() {
let maximum = "x".repeat(RADROOTS_POST_CONTENT_MAX_BYTES);
- assert!(RadrootsAuthoredUpdate::new(maximum).is_ok());
+ assert!(AuthoredUpdate::new(maximum).is_ok());
let over = "x".repeat(RADROOTS_POST_CONTENT_MAX_BYTES + 1);
assert_eq!(
- RadrootsAuthoredUpdate::new(over).unwrap_err(),
- RadrootsAuthoredPostError::ContentTooLarge {
+ AuthoredUpdate::new(over).unwrap_err(),
+ AuthoredPostError::ContentTooLarge {
max: RADROOTS_POST_CONTENT_MAX_BYTES,
actual: RADROOTS_POST_CONTENT_MAX_BYTES + 1,
}
@@ -51,7 +50,7 @@ fn authored_photo_emits_exact_nip92_order_and_repeatable_fallbacks() {
.try_with_fallback(fallback_url(b"strawberries", "cache-two.example", "webp"))
.unwrap();
let content = format!("Today's harvest {}", image.url());
- let photo = RadrootsAuthoredPhotoUpdate::new(content.clone(), vec![image]).unwrap();
+ let photo = AuthoredPhotoUpdate::new(content.clone(), vec![image]).unwrap();
let wire = authored_photo_update_to_wire_parts(&photo);
assert_eq!(wire.kind, 1);
@@ -72,7 +71,7 @@ fn authored_photo_emits_exact_nip92_order_and_repeatable_fallbacks() {
#[test]
fn authored_ask_precedes_optional_media_with_one_exact_marker() {
let image = authored_image(b"leaf", "image/jpeg", "jpg");
- let ask = RadrootsAuthoredAsk::new(
+ let ask = AuthoredAsk::new(
format!("Is this leaf healthy? {}", image.url()),
vec![image],
)
@@ -90,19 +89,19 @@ fn authored_ask_precedes_optional_media_with_one_exact_marker() {
fn authored_photo_rejects_missing_and_duplicate_content_urls() {
let image = authored_image(b"leaf", "image/jpeg", "jpg");
assert_eq!(
- RadrootsAuthoredPhotoUpdate::new("photo", Vec::new()).unwrap_err(),
- RadrootsAuthoredPostError::ImageMissing
+ AuthoredPhotoUpdate::new("photo", Vec::new()).unwrap_err(),
+ AuthoredPostError::ImageMissing
);
assert_eq!(
- RadrootsAuthoredPhotoUpdate::new("photo", vec![image.clone()])
+ AuthoredPhotoUpdate::new("photo", vec![image.clone()])
.unwrap_err()
.code(),
"imeta_url_missing_from_content"
);
let content = image.url().to_string();
assert_eq!(
- RadrootsAuthoredPhotoUpdate::new(content, vec![image.clone(), image]).unwrap_err(),
- RadrootsAuthoredPostError::DuplicateImageUrl
+ AuthoredPhotoUpdate::new(content, vec![image.clone(), image]).unwrap_err(),
+ AuthoredPostError::DuplicateImageUrl
);
}
@@ -110,33 +109,30 @@ fn authored_photo_rejects_missing_and_duplicate_content_urls() {
fn authored_photo_and_ask_enforce_the_imeta_count_limit() {
let image = authored_image(b"leaf", "image/jpeg", "jpg");
let images = vec![image.clone(); RADROOTS_POST_IMETA_MAX_COUNT + 1];
- let expected = RadrootsAuthoredPostError::ImageCountExceeded {
+ let expected = AuthoredPostError::ImageCountExceeded {
max: RADROOTS_POST_IMETA_MAX_COUNT,
actual: RADROOTS_POST_IMETA_MAX_COUNT + 1,
};
assert_eq!(
- RadrootsAuthoredPhotoUpdate::new(image.url(), images.clone()).unwrap_err(),
- expected
- );
- assert_eq!(
- RadrootsAuthoredAsk::new("Question", images).unwrap_err(),
+ AuthoredPhotoUpdate::new(image.url(), images.clone()).unwrap_err(),
expected
);
+ assert_eq!(AuthoredAsk::new("Question", images).unwrap_err(), expected);
}
#[test]
fn authored_image_rejects_parameterized_mime_zero_dimensions_and_wrong_fallback_hash() {
- let parameterized = RadrootsAuthoredImage::try_from(verified_descriptor(
+ let parameterized = AuthoredImage::try_from(verified_descriptor(
b"leaf",
"image/webp; charset=binary",
"webp",
))
.unwrap();
assert_eq!(
- RadrootsAuthoredPostImage::new(
+ AuthoredPostImage::new(
parameterized,
- RadrootsPostImageDimensions::new(1, 1).unwrap(),
+ PostImageDimensions::new(1, 1).unwrap(),
"Leaf",
)
.unwrap_err()
@@ -144,7 +140,7 @@ fn authored_image_rejects_parameterized_mime_zero_dimensions_and_wrong_fallback_
"imeta_mime_invalid"
);
assert_eq!(
- RadrootsPostImageDimensions::new(0, 1).unwrap_err().code(),
+ PostImageDimensions::new(0, 1).unwrap_err().code(),
"imeta_dimensions_invalid"
);
@@ -170,39 +166,32 @@ fn post_image_mime_profile_uses_canonical_parameter_free_media_types() {
#[test]
fn authored_image_rejects_zero_size_and_invalid_alt_text() {
- let empty =
- RadrootsAuthoredImage::try_from(verified_descriptor(b"", "image/webp", "webp")).unwrap();
+ let empty = AuthoredImage::try_from(verified_descriptor(b"", "image/webp", "webp")).unwrap();
assert_eq!(
- RadrootsAuthoredPostImage::new(
+ AuthoredPostImage::new(
empty,
- RadrootsPostImageDimensions::new(1, 1).unwrap(),
+ PostImageDimensions::new(1, 1).unwrap(),
"Empty image",
)
.unwrap_err(),
- RadrootsAuthoredPostError::ImageSizeInvalid
+ AuthoredPostError::ImageSizeInvalid
);
let blank_alt =
- RadrootsAuthoredImage::try_from(verified_descriptor(b"leaf", "image/webp", "webp"))
- .unwrap();
+ AuthoredImage::try_from(verified_descriptor(b"leaf", "image/webp", "webp")).unwrap();
assert_eq!(
- RadrootsAuthoredPostImage::new(
- blank_alt,
- RadrootsPostImageDimensions::new(1, 1).unwrap(),
- " \t",
- )
- .unwrap_err(),
- RadrootsAuthoredPostError::ImageAltInvalid
+ AuthoredPostImage::new(blank_alt, PostImageDimensions::new(1, 1).unwrap(), " \t",)
+ .unwrap_err(),
+ AuthoredPostError::ImageAltInvalid
);
let maximum_alt = "a".repeat(RADROOTS_POST_ALT_MAX_BYTES);
let maximum =
- RadrootsAuthoredImage::try_from(verified_descriptor(b"maximum", "image/webp", "webp"))
- .unwrap();
+ AuthoredImage::try_from(verified_descriptor(b"maximum", "image/webp", "webp")).unwrap();
assert!(
- RadrootsAuthoredPostImage::new(
+ AuthoredPostImage::new(
maximum,
- RadrootsPostImageDimensions::new(1, 1).unwrap(),
+ PostImageDimensions::new(1, 1).unwrap(),
maximum_alt,
)
.is_ok()
@@ -210,16 +199,15 @@ fn authored_image_rejects_zero_size_and_invalid_alt_text() {
let oversized_alt = "a".repeat(RADROOTS_POST_ALT_MAX_BYTES + 1);
let oversized =
- RadrootsAuthoredImage::try_from(verified_descriptor(b"oversized", "image/webp", "webp"))
- .unwrap();
+ AuthoredImage::try_from(verified_descriptor(b"oversized", "image/webp", "webp")).unwrap();
assert_eq!(
- RadrootsAuthoredPostImage::new(
+ AuthoredPostImage::new(
oversized,
- RadrootsPostImageDimensions::new(1, 1).unwrap(),
+ PostImageDimensions::new(1, 1).unwrap(),
oversized_alt,
)
.unwrap_err(),
- RadrootsAuthoredPostError::ImageAltTooLarge {
+ AuthoredPostError::ImageAltTooLarge {
max: RADROOTS_POST_ALT_MAX_BYTES,
actual: RADROOTS_POST_ALT_MAX_BYTES + 1,
}
@@ -228,14 +216,14 @@ fn authored_image_rejects_zero_size_and_invalid_alt_text() {
#[test]
fn authored_image_enforces_the_exact_tag_element_limit() {
- let maximum = RadrootsAuthoredImage::try_from(verified_descriptor_with_url_element_bytes(
+ let maximum = AuthoredImage::try_from(verified_descriptor_with_url_element_bytes(
b"maximum-url",
RADROOTS_POST_TAG_ELEMENT_MAX_BYTES,
))
.unwrap();
- let maximum = RadrootsAuthoredPostImage::new(
+ let maximum = AuthoredPostImage::new(
maximum,
- RadrootsPostImageDimensions::new(1, 1).unwrap(),
+ PostImageDimensions::new(1, 1).unwrap(),
"Maximum URL",
)
.unwrap();
@@ -244,19 +232,19 @@ fn authored_image_enforces_the_exact_tag_element_limit() {
RADROOTS_POST_TAG_ELEMENT_MAX_BYTES
);
- let oversized = RadrootsAuthoredImage::try_from(verified_descriptor_with_url_element_bytes(
+ let oversized = AuthoredImage::try_from(verified_descriptor_with_url_element_bytes(
b"oversized-url",
RADROOTS_POST_TAG_ELEMENT_MAX_BYTES + 1,
))
.unwrap();
assert_eq!(
- RadrootsAuthoredPostImage::new(
+ AuthoredPostImage::new(
oversized,
- RadrootsPostImageDimensions::new(1, 1).unwrap(),
+ PostImageDimensions::new(1, 1).unwrap(),
"Oversized URL",
)
.unwrap_err(),
- RadrootsAuthoredPostError::TagElementTooLarge {
+ AuthoredPostError::TagElementTooLarge {
max: RADROOTS_POST_TAG_ELEMENT_MAX_BYTES,
actual: RADROOTS_POST_TAG_ELEMENT_MAX_BYTES + 1,
}
@@ -279,7 +267,7 @@ fn authored_image_enforces_the_exact_tag_element_limit() {
RADROOTS_POST_TAG_ELEMENT_MAX_BYTES + 1,
))
.unwrap_err(),
- RadrootsAuthoredPostError::TagElementTooLarge {
+ AuthoredPostError::TagElementTooLarge {
max: RADROOTS_POST_TAG_ELEMENT_MAX_BYTES,
actual: RADROOTS_POST_TAG_ELEMENT_MAX_BYTES + 1,
}
@@ -298,8 +286,7 @@ fn authored_posts_enforce_the_exact_aggregate_tag_byte_limit() {
);
let content = format!("{} {}", first.url(), second.url());
let photo =
- RadrootsAuthoredPhotoUpdate::new(content.clone(), vec![first.clone(), second.clone()])
- .unwrap();
+ AuthoredPhotoUpdate::new(content.clone(), vec![first.clone(), second.clone()]).unwrap();
let wire = authored_photo_update_to_wire_parts(&photo);
assert_eq!(
wire.tags.iter().map(|tag| tag_bytes(tag)).sum::<usize>(),
@@ -313,8 +300,8 @@ fn authored_posts_enforce_the_exact_aggregate_tag_byte_limit() {
);
let over_content = format!("{} {}", first_over.url(), second.url());
assert_eq!(
- RadrootsAuthoredPhotoUpdate::new(over_content, vec![first_over, second]).unwrap_err(),
- RadrootsAuthoredPostError::TagBytesExceeded {
+ AuthoredPhotoUpdate::new(over_content, vec![first_over, second]).unwrap_err(),
+ AuthoredPostError::TagBytesExceeded {
max: RADROOTS_POST_TAG_TOTAL_MAX_BYTES,
actual: RADROOTS_POST_TAG_TOTAL_MAX_BYTES + 1,
}
@@ -326,12 +313,12 @@ fn authored_posts_enforce_the_exact_aggregate_tag_byte_limit() {
RADROOTS_POST_TAG_TOTAL_MAX_BYTES,
);
assert!(
- RadrootsAuthoredPhotoUpdate::new(full.url(), vec![full.clone()]).is_ok(),
+ AuthoredPhotoUpdate::new(full.url(), vec![full.clone()]).is_ok(),
"PhotoUpdate must accept the exact aggregate maximum"
);
assert_eq!(
- RadrootsAuthoredAsk::new(full.url(), vec![full.clone()]).unwrap_err(),
- RadrootsAuthoredPostError::TagBytesExceeded {
+ AuthoredAsk::new(full.url(), vec![full.clone()]).unwrap_err(),
+ AuthoredPostError::TagBytesExceeded {
max: RADROOTS_POST_TAG_TOTAL_MAX_BYTES,
actual: RADROOTS_POST_TAG_TOTAL_MAX_BYTES
+ "t".len()
@@ -346,7 +333,7 @@ fn authored_posts_enforce_the_exact_aggregate_tag_byte_limit() {
minimum_fallback_bytes,
))
.unwrap_err(),
- RadrootsAuthoredPostError::TagBytesExceeded {
+ AuthoredPostError::TagBytesExceeded {
max: RADROOTS_POST_TAG_TOTAL_MAX_BYTES,
actual: RADROOTS_POST_TAG_TOTAL_MAX_BYTES + minimum_fallback_bytes,
}
@@ -366,8 +353,7 @@ fn authored_posts_enforce_the_exact_canonical_signed_event_budget() {
let padding_bytes = RADROOTS_POST_EVENT_WIRE_MAX_BYTES - minimum_wire_bytes;
let maximum_content = format!("{minimum_content}{}", "x".repeat(padding_bytes));
- let maximum =
- RadrootsAuthoredPhotoUpdate::new(maximum_content.clone(), vec![image.clone()]).unwrap();
+ let maximum = AuthoredPhotoUpdate::new(maximum_content.clone(), vec![image.clone()]).unwrap();
let maximum_wire = authored_photo_update_to_wire_parts(&maximum);
assert_eq!(
canonical_signed_post_json_bytes(&maximum_wire.content, &maximum_wire.tags),
@@ -376,8 +362,8 @@ fn authored_posts_enforce_the_exact_canonical_signed_event_budget() {
let oversized_content = format!("{maximum_content}x");
assert_eq!(
- RadrootsAuthoredPhotoUpdate::new(oversized_content, vec![image.clone()]).unwrap_err(),
- RadrootsAuthoredPostError::EventWireTooLarge {
+ AuthoredPhotoUpdate::new(oversized_content, vec![image.clone()]).unwrap_err(),
+ AuthoredPostError::EventWireTooLarge {
max: RADROOTS_POST_EVENT_WIRE_MAX_BYTES,
actual: RADROOTS_POST_EVENT_WIRE_MAX_BYTES + 1,
}
@@ -387,8 +373,8 @@ fn authored_posts_enforce_the_exact_canonical_signed_event_budget() {
escaped_content.pop();
escaped_content.push('"');
assert_eq!(
- RadrootsAuthoredPhotoUpdate::new(escaped_content, vec![image]).unwrap_err(),
- RadrootsAuthoredPostError::EventWireTooLarge {
+ AuthoredPhotoUpdate::new(escaped_content, vec![image]).unwrap_err(),
+ AuthoredPostError::EventWireTooLarge {
max: RADROOTS_POST_EVENT_WIRE_MAX_BYTES,
actual: RADROOTS_POST_EVENT_WIRE_MAX_BYTES + 1,
}
@@ -404,8 +390,8 @@ fn authored_update_counts_json_control_character_expansion() {
let actual = canonical_signed_post_json_bytes(&content, &[]);
assert_eq!(
- RadrootsAuthoredUpdate::new(content).unwrap_err(),
- RadrootsAuthoredPostError::EventWireTooLarge {
+ AuthoredUpdate::new(content).unwrap_err(),
+ AuthoredPostError::EventWireTooLarge {
max: RADROOTS_POST_EVENT_WIRE_MAX_BYTES,
actual,
}
@@ -413,10 +399,10 @@ fn authored_update_counts_json_control_character_expansion() {
assert!(actual > RADROOTS_POST_EVENT_WIRE_MAX_BYTES);
}
-fn authored_image(bytes: &[u8], media_type: &str, extension: &str) -> RadrootsAuthoredPostImage {
- RadrootsAuthoredPostImage::new(
- RadrootsAuthoredImage::try_from(verified_descriptor(bytes, media_type, extension)).unwrap(),
- RadrootsPostImageDimensions::new(1200, 900).unwrap(),
+fn authored_image(bytes: &[u8], media_type: &str, extension: &str) -> AuthoredPostImage {
+ AuthoredPostImage::new(
+ AuthoredImage::try_from(verified_descriptor(bytes, media_type, extension)).unwrap(),
+ PostImageDimensions::new(1200, 900).unwrap(),
"Harvest",
)
.unwrap()
@@ -526,10 +512,10 @@ fn canonical_signed_post_json_bytes(content: &str, tags: &[Vec<String>]) -> usiz
}
fn fill_image_tag_bytes(
- mut image: RadrootsAuthoredPostImage,
+ mut image: AuthoredPostImage,
bytes: &[u8],
target: usize,
-) -> RadrootsAuthoredPostImage {
+) -> AuthoredPostImage {
let minimum_fallback_bytes = fallback_element_prefix(bytes).len() + 1;
while tag_bytes(image.imeta_tag()) < target {
let remaining = target - tag_bytes(image.imeta_tag());
diff --git a/crates/event_codec/tests/profile.rs b/crates/event_codec/tests/profile.rs
@@ -3,9 +3,9 @@
use radroots_event::{
envelope::kind::{KIND_POST, KIND_PROFILE},
profile::{
- RADROOTS_PROFILE_TYPE_TAG_ANY, RADROOTS_PROFILE_TYPE_TAG_COOP,
+ ProfileType, RADROOTS_PROFILE_TYPE_TAG_ANY, RADROOTS_PROFILE_TYPE_TAG_COOP,
RADROOTS_PROFILE_TYPE_TAG_FARM, RADROOTS_PROFILE_TYPE_TAG_KEY,
- RADROOTS_PROFILE_TYPE_TAG_RADROOTSD, RadrootsProfileType,
+ RADROOTS_PROFILE_TYPE_TAG_RADROOTSD,
},
};
use radroots_event_codec::error::EventParseError;
@@ -114,7 +114,7 @@ fn profile_metadata_reads_profile_type_tag() {
)
.expect("metadata");
- assert_eq!(metadata.data.profile_type, Some(RadrootsProfileType::Farm));
+ assert_eq!(metadata.data.profile_type, Some(ProfileType::Farm));
}
#[test]
@@ -132,7 +132,7 @@ fn profile_metadata_reads_profile_type_any_tag() {
)
.expect("metadata");
- assert_eq!(metadata.data.profile_type, Some(RadrootsProfileType::Any));
+ assert_eq!(metadata.data.profile_type, Some(ProfileType::Any));
}
#[test]
@@ -150,10 +150,7 @@ fn profile_metadata_reads_profile_type_radrootsd_tag() {
)
.expect("metadata");
- assert_eq!(
- metadata.data.profile_type,
- Some(RadrootsProfileType::Radrootsd)
- );
+ assert_eq!(metadata.data.profile_type, Some(ProfileType::Radrootsd));
}
#[test]
@@ -179,7 +176,7 @@ fn profile_metadata_ignores_short_unknown_and_unrelated_profile_type_tags() {
)
.expect("metadata");
- assert_eq!(metadata.data.profile_type, Some(RadrootsProfileType::Coop));
+ assert_eq!(metadata.data.profile_type, Some(ProfileType::Coop));
}
#[test]
@@ -218,8 +215,5 @@ fn profile_parsed_event_preserves_wire_event_and_decoded_data() {
)
);
assert_eq!(parsed.data.data.profile.name, "alice");
- assert_eq!(
- parsed.data.data.profile_type,
- Some(RadrootsProfileType::Farm)
- );
+ assert_eq!(parsed.data.data.profile_type, Some(ProfileType::Farm));
}
diff --git a/crates/event_codec/tests/profile_conformance.rs b/crates/event_codec/tests/profile_conformance.rs
@@ -4,10 +4,10 @@ use std::{borrow::Cow, fs, path::Path};
use radroots_blossom::{BlobDescriptor, ByteVerifiedDescriptor};
use radroots_event::{
- media::{RadrootsAuthoredImage, RadrootsAuthoredImageError},
+ media::{AuthoredImage, AuthoredImageError},
profile::{
- RADROOTS_PROFILE_METADATA_MAX_CONTENT_BYTES, RadrootsAuthoredProfile,
- RadrootsAuthoredProfileError, RadrootsNip05Identifier,
+ AuthoredProfile, AuthoredProfileError, Nip05Identifier,
+ RADROOTS_PROFILE_METADATA_MAX_CONTENT_BYTES,
},
};
use radroots_event_codec::profile::{
@@ -109,7 +109,7 @@ fn execute(vector: &Vector) {
}
fn nip05_valid(vector: &Vector) {
- let identifier = RadrootsNip05Identifier::parse(input_str(vector, "identifier"))
+ let identifier = Nip05Identifier::parse(input_str(vector, "identifier"))
.unwrap_or_else(|error| panic!("{} failed: {error}", vector.id));
assert_eq!(
identifier.as_str(),
@@ -136,7 +136,7 @@ fn nip05_valid(vector: &Vector) {
}
fn nip05_invalid(vector: &Vector) {
- let error = RadrootsNip05Identifier::parse(input_str(vector, "identifier"))
+ let error = Nip05Identifier::parse(input_str(vector, "identifier"))
.expect_err("invalid NIP-05 vector must fail");
assert_eq!(error.code(), expected_str(vector, "error"), "{}", vector.id);
}
@@ -171,9 +171,9 @@ fn authored_valid(vector: &Vector) {
}
fn authored_name_invalid(vector: &Vector) {
- let error = RadrootsAuthoredProfile::new(input_str(vector, "name"))
+ let error = AuthoredProfile::new(input_str(vector, "name"))
.expect_err("invalid authored Profile name must fail");
- assert_eq!(error, RadrootsAuthoredProfileError::InvalidName);
+ assert_eq!(error, AuthoredProfileError::InvalidName);
assert_eq!(error.code(), expected_str(vector, "error"));
}
@@ -181,7 +181,7 @@ fn authored_limit_valid(vector: &Vector) {
let name_bytes = vector.input["generated_name_bytes"]
.as_u64()
.expect("generated_name_bytes") as usize;
- let profile = RadrootsAuthoredProfile::new("a".repeat(name_bytes)).unwrap();
+ let profile = AuthoredProfile::new("a".repeat(name_bytes)).unwrap();
let wire = authored_profile_to_wire_parts(&profile)
.unwrap_or_else(|error| panic!("{} failed: {error}", vector.id));
assert_eq!(
@@ -207,9 +207,8 @@ fn authored_image_invalid(vector: &Vector) {
let input: AuthoredMediaInput = serde_json::from_value(vector.input["media"].clone())
.unwrap_or_else(|error| panic!("{} media fixture failed: {error}", vector.id));
let descriptor = verified_descriptor(&input, &vector.id);
- let error =
- RadrootsAuthoredImage::try_from(descriptor).expect_err("non-image Profile media must fail");
- assert_eq!(error, RadrootsAuthoredImageError::MediaTypeNotImage);
+ let error = AuthoredImage::try_from(descriptor).expect_err("non-image Profile media must fail");
+ assert_eq!(error, AuthoredImageError::MediaTypeNotImage);
assert_eq!(error.code(), expected_str(vector, "error"));
}
@@ -217,7 +216,7 @@ fn authored_invalid(vector: &Vector) {
let name_bytes = vector.input["generated_name_bytes"]
.as_u64()
.expect("generated_name_bytes") as usize;
- let profile = RadrootsAuthoredProfile::new("a".repeat(name_bytes)).unwrap();
+ let profile = AuthoredProfile::new("a".repeat(name_bytes)).unwrap();
let error = authored_profile_to_wire_parts(&profile)
.expect_err("oversized authored Profile metadata must fail");
assert_eq!(error.code(), expected_str(vector, "error"));
@@ -232,10 +231,10 @@ fn authored_invalid(vector: &Vector) {
}
}
-fn authored_profile(input: &Value, vector_id: &str) -> RadrootsAuthoredProfile {
+fn authored_profile(input: &Value, vector_id: &str) -> AuthoredProfile {
let input: AuthoredProfileInput = serde_json::from_value(input.clone())
.unwrap_or_else(|error| panic!("{vector_id} authored input failed: {error}"));
- let mut profile = RadrootsAuthoredProfile::new(input.name)
+ let mut profile = AuthoredProfile::new(input.name)
.unwrap_or_else(|error| panic!("{vector_id} name failed: {error}"));
if let Some(value) = input.display_name {
profile = profile.with_display_name(value);
@@ -251,7 +250,7 @@ fn authored_profile(input: &Value, vector_id: &str) -> RadrootsAuthoredProfile {
}
if let Some(value) = input.nip05 {
profile = profile.with_nip05(
- RadrootsNip05Identifier::parse(&value)
+ Nip05Identifier::parse(&value)
.unwrap_or_else(|error| panic!("{vector_id} NIP-05 failed: {error}")),
);
}
@@ -261,8 +260,8 @@ fn authored_profile(input: &Value, vector_id: &str) -> RadrootsAuthoredProfile {
profile
}
-fn authored_image(input: &AuthoredMediaInput, vector_id: &str) -> RadrootsAuthoredImage {
- RadrootsAuthoredImage::try_from(verified_descriptor(input, vector_id))
+fn authored_image(input: &AuthoredMediaInput, vector_id: &str) -> AuthoredImage {
+ AuthoredImage::try_from(verified_descriptor(input, vector_id))
.unwrap_or_else(|error| panic!("{vector_id} Profile image failed: {error}"))
}
diff --git a/crates/event_codec/tests/reaction.rs b/crates/event_codec/tests/reaction.rs
@@ -3,8 +3,8 @@ mod common;
use common::{AUTHOR as ENVELOPE_AUTHOR, EVENT_ID as ENVELOPE_ID, EVENT_SIG};
use radroots_event::{
envelope::kind::{KIND_ARTICLE, KIND_COMMENT, KIND_POST, KIND_REACTION},
- post::reaction::RadrootsReaction,
- social::RadrootsSocialTarget,
+ post::reaction::Reaction,
+ social::SocialTarget,
tag::name::TAG_E_ROOT,
};
use radroots_event_codec::error::{EventEncodeError, EventParseError};
@@ -19,8 +19,8 @@ const EVENT_ID: &str = "0123456789abcdef0123456789abcdef0123456789abcdef01234567
const AUTHOR: &str = "author_pubkey";
const D_TAG: &str = "AAAAAAAAAAAAAAAAAAAAAA";
-fn event_target() -> RadrootsSocialTarget {
- RadrootsSocialTarget::Event {
+fn event_target() -> SocialTarget {
+ SocialTarget::Event {
id: EVENT_ID.to_string(),
author: Some(AUTHOR.to_string()),
event_kind: Some(KIND_ARTICLE),
@@ -28,8 +28,8 @@ fn event_target() -> RadrootsSocialTarget {
}
}
-fn address_target() -> RadrootsSocialTarget {
- RadrootsSocialTarget::Address {
+fn address_target() -> SocialTarget {
+ SocialTarget::Address {
address: format!("{}:{AUTHOR}:{D_TAG}", KIND_ARTICLE),
author: Some(AUTHOR.to_string()),
event_kind: Some(KIND_ARTICLE),
@@ -37,9 +37,9 @@ fn address_target() -> RadrootsSocialTarget {
}
}
-fn assert_event_target(target: &RadrootsSocialTarget) {
+fn assert_event_target(target: &SocialTarget) {
match target {
- RadrootsSocialTarget::Event {
+ SocialTarget::Event {
id,
author,
event_kind,
@@ -54,9 +54,9 @@ fn assert_event_target(target: &RadrootsSocialTarget) {
}
}
-fn assert_address_target(target: &RadrootsSocialTarget) {
+fn assert_address_target(target: &SocialTarget) {
match target {
- RadrootsSocialTarget::Address {
+ SocialTarget::Address {
address,
author,
event_kind,
@@ -73,8 +73,8 @@ fn assert_address_target(target: &RadrootsSocialTarget) {
#[test]
fn reaction_build_tags_requires_valid_event_or_address_target() {
- let reaction = RadrootsReaction {
- target: RadrootsSocialTarget::Event {
+ let reaction = Reaction {
+ target: SocialTarget::Event {
id: "not-hex".to_string(),
author: Some(AUTHOR.to_string()),
event_kind: Some(KIND_ARTICLE),
@@ -87,8 +87,8 @@ fn reaction_build_tags_requires_valid_event_or_address_target() {
Err(EventEncodeError::InvalidField("target.id"))
));
- let reaction = RadrootsReaction {
- target: RadrootsSocialTarget::External {
+ let reaction = Reaction {
+ target: SocialTarget::External {
id: "https://example.test".to_string(),
external_kind: "web".to_string(),
hint: None,
@@ -100,8 +100,8 @@ fn reaction_build_tags_requires_valid_event_or_address_target() {
Err(EventEncodeError::InvalidField("target"))
));
- let reaction = RadrootsReaction {
- target: RadrootsSocialTarget::Event {
+ let reaction = Reaction {
+ target: SocialTarget::Event {
id: EVENT_ID.to_string(),
author: Some(" ".to_string()),
event_kind: Some(KIND_ARTICLE),
@@ -114,8 +114,8 @@ fn reaction_build_tags_requires_valid_event_or_address_target() {
Err(EventEncodeError::EmptyRequiredField("target.author"))
));
- let reaction = RadrootsReaction {
- target: RadrootsSocialTarget::Address {
+ let reaction = Reaction {
+ target: SocialTarget::Address {
address: format!("{}:{AUTHOR}:{D_TAG}", KIND_ARTICLE),
author: Some(AUTHOR.to_string()),
event_kind: Some(KIND_COMMENT),
@@ -128,8 +128,8 @@ fn reaction_build_tags_requires_valid_event_or_address_target() {
Err(EventEncodeError::InvalidField("target.kind"))
));
- let reaction = RadrootsReaction {
- target: RadrootsSocialTarget::Address {
+ let reaction = Reaction {
+ target: SocialTarget::Address {
address: format!("{}:{AUTHOR}:{D_TAG}", KIND_ARTICLE),
author: Some("other_author".to_string()),
event_kind: Some(KIND_ARTICLE),
@@ -146,7 +146,7 @@ fn reaction_build_tags_requires_valid_event_or_address_target() {
#[test]
fn reaction_to_wire_parts_accepts_empty_plus_minus_emoji_and_custom_content() {
for content in ["", "+", "-", "🔥", "harvest"] {
- let reaction = RadrootsReaction {
+ let reaction = Reaction {
target: event_target(),
content: content.to_string(),
};
@@ -159,8 +159,8 @@ fn reaction_to_wire_parts_accepts_empty_plus_minus_emoji_and_custom_content() {
#[test]
fn reaction_build_tags_covers_optional_target_branches() {
- let reaction = RadrootsReaction {
- target: RadrootsSocialTarget::Event {
+ let reaction = Reaction {
+ target: SocialTarget::Event {
id: EVENT_ID.to_string(),
author: None,
event_kind: None,
@@ -178,8 +178,8 @@ fn reaction_build_tags_covers_optional_target_branches() {
assert!(!tags.iter().any(|tag| tag[0] == "p"));
assert!(!tags.iter().any(|tag| tag[0] == "k"));
- let reaction = RadrootsReaction {
- target: RadrootsSocialTarget::Address {
+ let reaction = Reaction {
+ target: SocialTarget::Address {
address: format!("{}:{AUTHOR}:{D_TAG}", KIND_ARTICLE),
author: None,
event_kind: None,
@@ -195,8 +195,8 @@ fn reaction_build_tags_covers_optional_target_branches() {
.any(|value| value == "wss://address-relay.example.test")
}));
- let reaction = RadrootsReaction {
- target: RadrootsSocialTarget::Address {
+ let reaction = Reaction {
+ target: SocialTarget::Address {
address: format!("{}:{AUTHOR}:{D_TAG}", KIND_ARTICLE),
author: None,
event_kind: None,
@@ -214,7 +214,7 @@ fn reaction_build_tags_covers_optional_target_branches() {
#[test]
fn reaction_to_wire_parts_with_kind_rejects_non_reaction_kind() {
- let reaction = RadrootsReaction {
+ let reaction = Reaction {
target: event_target(),
content: "+".to_string(),
};
@@ -226,7 +226,7 @@ fn reaction_to_wire_parts_with_kind_rejects_non_reaction_kind() {
#[test]
fn reaction_roundtrips_event_target() {
- let reaction = RadrootsReaction {
+ let reaction = Reaction {
target: event_target(),
content: "+".to_string(),
};
@@ -239,7 +239,7 @@ fn reaction_roundtrips_event_target() {
#[test]
fn reaction_roundtrips_address_target() {
- let reaction = RadrootsReaction {
+ let reaction = Reaction {
target: address_target(),
content: "".to_string(),
};
@@ -311,7 +311,7 @@ fn reaction_from_tags_covers_optional_decode_branches() {
.unwrap();
assert_eq!(event.content, "+");
match event.target {
- RadrootsSocialTarget::Event {
+ SocialTarget::Event {
id,
author,
event_kind,
@@ -334,7 +334,7 @@ fn reaction_from_tags_covers_optional_decode_branches() {
.unwrap();
assert_eq!(reaction.content, "-");
match reaction.target {
- RadrootsSocialTarget::Address {
+ SocialTarget::Address {
address: parsed,
author,
event_kind,
@@ -388,7 +388,7 @@ fn reaction_from_tags_covers_optional_decode_branches() {
#[test]
fn reaction_from_tags_rejects_invalid_kind() {
- let tags = reaction_build_tags(&RadrootsReaction {
+ let tags = reaction_build_tags(&Reaction {
target: event_target(),
content: "+".to_string(),
})
@@ -405,7 +405,7 @@ fn reaction_from_tags_rejects_invalid_kind() {
#[test]
fn reaction_metadata_and_index_from_event_roundtrip() {
- let parts = to_wire_parts(&RadrootsReaction {
+ let parts = to_wire_parts(&Reaction {
target: event_target(),
content: "".to_string(),
})
diff --git a/crates/event_codec/tests/report.rs b/crates/event_codec/tests/report.rs
@@ -5,8 +5,8 @@ mod common;
use common::{AUTHOR as ENVELOPE_AUTHOR, EVENT_ID as ENVELOPE_ID, EVENT_SIG};
use radroots_event::{
envelope::kind::{KIND_ARTICLE, KIND_POST, KIND_REPORT},
- post::report::RadrootsReport,
- social::{RadrootsReportFileTarget, RadrootsReportType, RadrootsSocialTarget},
+ post::report::Report,
+ social::{ReportFileTarget, ReportType, SocialTarget},
tag::name::{TAG_A, TAG_E, TAG_MAGNET, TAG_P, TAG_SERVER, TAG_SHA256},
};
use radroots_event_codec::{
@@ -22,21 +22,21 @@ const REPORTED: &str = "585591529da0bab31b3b1b1f986611cf5f435dca84f978c89ee8a40c
const FILE_HASH: &str = "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc";
const ARTICLE_D_TAG: &str = "DDDDDDDDDDDDDDDDDDDDDA";
-fn profile_report() -> RadrootsReport {
- RadrootsReport {
+fn profile_report() -> Report {
+ Report {
reported_pubkey: REPORTED.to_string(),
- report_type: RadrootsReportType::Spam,
+ report_type: ReportType::Spam,
event: None,
file: None,
content: None,
}
}
-fn event_report() -> RadrootsReport {
- RadrootsReport {
+fn event_report() -> Report {
+ Report {
reported_pubkey: REPORTED.to_string(),
- report_type: RadrootsReportType::Illegal,
- event: Some(RadrootsSocialTarget::Event {
+ report_type: ReportType::Illegal,
+ event: Some(SocialTarget::Event {
id: EVENT_ID.to_string(),
author: Some(REPORTED.to_string()),
event_kind: Some(KIND_POST),
@@ -47,12 +47,12 @@ fn event_report() -> RadrootsReport {
}
}
-fn file_report() -> RadrootsReport {
- RadrootsReport {
+fn file_report() -> Report {
+ Report {
reported_pubkey: REPORTED.to_string(),
- report_type: RadrootsReportType::Malware,
+ report_type: ReportType::Malware,
event: None,
- file: Some(RadrootsReportFileTarget {
+ file: Some(ReportFileTarget {
sha256: Some(FILE_HASH.to_string()),
url: Some("https://media.example.test/blob".to_string()),
magnet: Some("magnet:?xt=urn:btih:example".to_string()),
@@ -61,11 +61,11 @@ fn file_report() -> RadrootsReport {
}
}
-fn address_report() -> RadrootsReport {
- RadrootsReport {
+fn address_report() -> Report {
+ Report {
reported_pubkey: REPORTED.to_string(),
- report_type: RadrootsReportType::Nudity,
- event: Some(RadrootsSocialTarget::Address {
+ report_type: ReportType::Nudity,
+ event: Some(SocialTarget::Address {
address: format!("{KIND_ARTICLE}:{REPORTED}:{ARTICLE_D_TAG}"),
author: Some(REPORTED.to_string()),
event_kind: Some(KIND_ARTICLE),
@@ -103,17 +103,14 @@ fn report_to_wire_parts_roundtrips_pubkey_event_and_file_reports() {
);
let decoded = report_from_event(profile.kind, &profile.tags, &profile.content).unwrap();
assert_eq!(decoded.reported_pubkey, REPORTED);
- assert_eq!(decoded.report_type, RadrootsReportType::Spam);
+ assert_eq!(decoded.report_type, ReportType::Spam);
let event = to_wire_parts(&event_report()).unwrap();
assert_eq!(event.content, "Contains prohibited listing text");
assert!(has_tag(&event.tags, TAG_E, EVENT_ID));
let decoded = report_from_event(event.kind, &event.tags, &event.content).unwrap();
- assert!(matches!(
- decoded.event,
- Some(RadrootsSocialTarget::Event { .. })
- ));
- assert_eq!(decoded.report_type, RadrootsReportType::Illegal);
+ assert!(matches!(decoded.event, Some(SocialTarget::Event { .. })));
+ assert_eq!(decoded.report_type, ReportType::Illegal);
let file = to_wire_parts(&file_report()).unwrap();
assert!(has_tag(&file.tags, TAG_SHA256, FILE_HASH));
@@ -140,10 +137,10 @@ fn report_to_wire_parts_roundtrips_pubkey_event_and_file_reports() {
format!("{KIND_ARTICLE}:{REPORTED}:{ARTICLE_D_TAG}").as_str()
));
let decoded = report_from_event(address.kind, &address.tags, &address.content).unwrap();
- assert_eq!(decoded.report_type, RadrootsReportType::Nudity);
+ assert_eq!(decoded.report_type, ReportType::Nudity);
assert!(matches!(
decoded.event,
- Some(RadrootsSocialTarget::Address { relays: None, .. })
+ Some(SocialTarget::Address { relays: None, .. })
));
}
@@ -176,7 +173,7 @@ fn report_codec_rejects_missing_pubkey_unknown_type_bad_hash_and_wrong_kind() {
));
let mut report = file_report();
- report.file = Some(RadrootsReportFileTarget {
+ report.file = Some(ReportFileTarget {
sha256: None,
url: None,
magnet: None,
@@ -247,7 +244,7 @@ fn report_codec_rejects_missing_pubkey_unknown_type_bad_hash_and_wrong_kind() {
#[test]
fn report_codec_rejects_bad_event_targets_and_report_type_mismatches() {
let mut report = event_report();
- report.event = Some(RadrootsSocialTarget::External {
+ report.event = Some(SocialTarget::External {
id: "https://example.test/report".to_string(),
external_kind: "web".to_string(),
hint: None,
@@ -258,7 +255,7 @@ fn report_codec_rejects_bad_event_targets_and_report_type_mismatches() {
));
let mut report = event_report();
- if let Some(RadrootsSocialTarget::Event { id, .. }) = &mut report.event {
+ if let Some(SocialTarget::Event { id, .. }) = &mut report.event {
*id = "not-a-lowercase-hex-id".to_string();
}
assert!(matches!(
@@ -267,7 +264,7 @@ fn report_codec_rejects_bad_event_targets_and_report_type_mismatches() {
));
let mut report = address_report();
- if let Some(RadrootsSocialTarget::Address {
+ if let Some(SocialTarget::Address {
address, relays, ..
}) = &mut report.event
{
@@ -329,18 +326,15 @@ fn report_codec_rejects_bad_event_targets_and_report_type_mismatches() {
.expect("address tag");
address.truncate(2);
let decoded = report_from_event(KIND_REPORT, &tags, "").expect("address report");
- assert!(matches!(
- decoded.event,
- Some(RadrootsSocialTarget::Address { .. })
- ));
+ assert!(matches!(decoded.event, Some(SocialTarget::Address { .. })));
}
#[test]
fn report_codec_covers_report_type_and_file_variants() {
for (report_type, expected) in [
- (RadrootsReportType::Profanity, "profanity"),
- (RadrootsReportType::Impersonation, "impersonation"),
- (RadrootsReportType::Other, "other"),
+ (ReportType::Profanity, "profanity"),
+ (ReportType::Impersonation, "impersonation"),
+ (ReportType::Other, "other"),
] {
let mut report = profile_report();
report.report_type = report_type;
@@ -351,7 +345,7 @@ fn report_codec_covers_report_type_and_file_variants() {
}
let mut report = file_report();
- report.file = Some(RadrootsReportFileTarget {
+ report.file = Some(ReportFileTarget {
sha256: None,
url: Some("https://media.example.test/blob".to_string()),
magnet: None,
@@ -364,7 +358,7 @@ fn report_codec_covers_report_type_and_file_variants() {
);
let mut report = file_report();
- report.file = Some(RadrootsReportFileTarget {
+ report.file = Some(ReportFileTarget {
sha256: None,
url: None,
magnet: Some("magnet:?xt=urn:btih:example".to_string()),
@@ -377,7 +371,7 @@ fn report_codec_covers_report_type_and_file_variants() {
);
let mut report = event_report();
- if let Some(RadrootsSocialTarget::Event { relays, .. }) = &mut report.event {
+ if let Some(SocialTarget::Event { relays, .. }) = &mut report.event {
*relays = None;
}
let parts = to_wire_parts(&report).unwrap();
@@ -389,7 +383,7 @@ fn report_codec_covers_report_type_and_file_variants() {
assert_eq!(event.len(), 3);
let mut report = address_report();
- if let Some(RadrootsSocialTarget::Address { relays, .. }) = &mut report.event {
+ if let Some(SocialTarget::Address { relays, .. }) = &mut report.event {
*relays = Some(vec![
" ".to_string(),
"wss://relay.example.test".to_string(),
@@ -439,7 +433,7 @@ fn report_wrappers_preserve_event_metadata() {
)
.unwrap();
assert_eq!(data.kind, KIND_REPORT);
- assert_eq!(data.data.report_type, RadrootsReportType::Illegal);
+ assert_eq!(data.data.report_type, ReportType::Illegal);
let parsed = parsed_from_event(
ENVELOPE_ID.to_string(),
diff --git a/crates/event_codec/tests/repost.rs b/crates/event_codec/tests/repost.rs
@@ -2,8 +2,8 @@
use radroots_event::{
envelope::kind::{KIND_ARTICLE, KIND_GENERIC_REPOST, KIND_POST, KIND_REACTION, KIND_REPOST},
- post::repost::{RadrootsGenericRepost, RadrootsRepost},
- social::RadrootsSocialTarget,
+ post::repost::{GenericRepost, Repost},
+ social::SocialTarget,
tag::name::{TAG_A, TAG_E, TAG_K, TAG_P},
};
use radroots_event_codec::{
@@ -30,9 +30,9 @@ const EVENT_SIG: &str = concat!(
);
const ARTICLE_D_TAG: &str = "DDDDDDDDDDDDDDDDDDDDDA";
-fn note_repost() -> RadrootsRepost {
- RadrootsRepost {
- target: RadrootsSocialTarget::Event {
+fn note_repost() -> Repost {
+ Repost {
+ target: SocialTarget::Event {
id: EVENT_ID.to_string(),
author: Some(AUTHOR.to_string()),
event_kind: Some(KIND_POST),
@@ -42,9 +42,9 @@ fn note_repost() -> RadrootsRepost {
}
}
-fn generic_article_repost() -> RadrootsGenericRepost {
- RadrootsGenericRepost {
- target: RadrootsSocialTarget::Address {
+fn generic_article_repost() -> GenericRepost {
+ GenericRepost {
+ target: SocialTarget::Address {
address: format!("{KIND_ARTICLE}:{AUTHOR}:{ARTICLE_D_TAG}"),
author: Some(AUTHOR.to_string()),
event_kind: Some(KIND_ARTICLE),
@@ -83,7 +83,7 @@ fn repost_to_wire_parts_roundtrips_kind_one_target() {
let decoded = repost_from_event(parts.kind, &parts.tags, &parts.content).unwrap();
assert!(matches!(
decoded.target,
- RadrootsSocialTarget::Event {
+ SocialTarget::Event {
event_kind: Some(KIND_POST),
..
}
@@ -113,7 +113,7 @@ fn generic_repost_to_wire_parts_roundtrips_address_target() {
assert_eq!(decoded.target_kind, KIND_ARTICLE);
assert!(matches!(
decoded.target,
- RadrootsSocialTarget::Address {
+ SocialTarget::Address {
event_kind: Some(KIND_ARTICLE),
..
}
@@ -133,7 +133,7 @@ fn repost_codecs_reject_wrong_kind_and_wrong_target_kind() {
));
let mut repost = note_repost();
- if let RadrootsSocialTarget::Event { event_kind, .. } = &mut repost.target {
+ if let SocialTarget::Event { event_kind, .. } = &mut repost.target {
*event_kind = Some(KIND_ARTICLE);
}
assert!(matches!(
@@ -165,7 +165,7 @@ fn repost_codecs_reject_wrong_kind_and_wrong_target_kind() {
fn repost_event_target_codecs_cover_optional_and_error_edges() {
let mut no_relay = note_repost();
no_relay.content = Some("fresh note".to_string());
- if let RadrootsSocialTarget::Event { author, relays, .. } = &mut no_relay.target {
+ if let SocialTarget::Event { author, relays, .. } = &mut no_relay.target {
*author = None;
*relays = None;
}
@@ -182,11 +182,11 @@ fn repost_event_target_codecs_cover_optional_and_error_edges() {
assert_eq!(decoded.content.as_deref(), Some("fresh note"));
assert!(matches!(
decoded.target,
- RadrootsSocialTarget::Event { relays: None, .. }
+ SocialTarget::Event { relays: None, .. }
));
let mut invalid_target = note_repost();
- invalid_target.target = RadrootsSocialTarget::Address {
+ invalid_target.target = SocialTarget::Address {
address: format!("{KIND_ARTICLE}:{AUTHOR}:{ARTICLE_D_TAG}"),
author: Some(AUTHOR.to_string()),
event_kind: Some(KIND_ARTICLE),
@@ -198,7 +198,7 @@ fn repost_event_target_codecs_cover_optional_and_error_edges() {
));
let mut invalid_id = note_repost();
- if let RadrootsSocialTarget::Event { id, .. } = &mut invalid_id.target {
+ if let SocialTarget::Event { id, .. } = &mut invalid_id.target {
*id = "not-a-lowercase-hex-id".to_string();
}
assert!(matches!(
@@ -207,7 +207,7 @@ fn repost_event_target_codecs_cover_optional_and_error_edges() {
));
let mut invalid_author = note_repost();
- if let RadrootsSocialTarget::Event { author, .. } = &mut invalid_author.target {
+ if let SocialTarget::Event { author, .. } = &mut invalid_author.target {
*author = Some(" ".to_string());
}
assert!(matches!(
@@ -236,8 +236,8 @@ fn repost_event_target_codecs_cover_optional_and_error_edges() {
#[test]
fn generic_repost_codecs_cover_event_targets_and_error_edges() {
- let generic = RadrootsGenericRepost {
- target: RadrootsSocialTarget::Event {
+ let generic = GenericRepost {
+ target: SocialTarget::Event {
id: EVENT_ID.to_string(),
author: Some(AUTHOR.to_string()),
event_kind: Some(KIND_REACTION),
@@ -260,14 +260,14 @@ fn generic_repost_codecs_cover_event_targets_and_error_edges() {
assert!(decoded.content.is_none());
assert!(matches!(
decoded.target,
- RadrootsSocialTarget::Event {
+ SocialTarget::Event {
event_kind: Some(KIND_REACTION),
..
}
));
- let no_author_event = RadrootsGenericRepost {
- target: RadrootsSocialTarget::Event {
+ let no_author_event = GenericRepost {
+ target: SocialTarget::Event {
id: EVENT_ID.to_string(),
author: None,
event_kind: Some(KIND_REACTION),
@@ -284,7 +284,7 @@ fn generic_repost_codecs_cover_event_targets_and_error_edges() {
}));
let mut generic = generic_article_repost();
- if let RadrootsSocialTarget::Address { author, relays, .. } = &mut generic.target {
+ if let SocialTarget::Address { author, relays, .. } = &mut generic.target {
*author = None;
*relays = None;
}
@@ -362,7 +362,7 @@ fn generic_repost_codecs_cover_event_targets_and_error_edges() {
));
let mut generic = generic_article_repost();
- if let RadrootsSocialTarget::Address { author, relays, .. } = &mut generic.target {
+ if let SocialTarget::Address { author, relays, .. } = &mut generic.target {
*author = Some(" ".to_string());
*relays = None;
}
@@ -372,7 +372,7 @@ fn generic_repost_codecs_cover_event_targets_and_error_edges() {
));
let mut generic = generic_article_repost();
- generic.target = RadrootsSocialTarget::External {
+ generic.target = SocialTarget::External {
id: "https://example.test/repost-target".to_string(),
external_kind: "web".to_string(),
hint: None,
@@ -382,8 +382,8 @@ fn generic_repost_codecs_cover_event_targets_and_error_edges() {
Err(EventEncodeError::InvalidField("target"))
));
- let mut generic = RadrootsGenericRepost {
- target: RadrootsSocialTarget::Event {
+ let mut generic = GenericRepost {
+ target: SocialTarget::Event {
id: EVENT_ID.to_string(),
author: None,
event_kind: None,
@@ -397,7 +397,7 @@ fn generic_repost_codecs_cover_event_targets_and_error_edges() {
Err(EventEncodeError::InvalidField("target_kind"))
));
- if let RadrootsSocialTarget::Event { event_kind, .. } = &mut generic.target {
+ if let SocialTarget::Event { event_kind, .. } = &mut generic.target {
*event_kind = Some(KIND_REACTION);
}
generic.target_kind = KIND_POST;
diff --git a/crates/event_codec/tests/seal.rs b/crates/event_codec/tests/seal.rs
@@ -1,5 +1,5 @@
use radroots_event::envelope::kind::{KIND_MESSAGE, KIND_SEAL};
-use radroots_event::social::seal::RadrootsSeal;
+use radroots_event::social::seal::Seal;
mod common;
@@ -10,7 +10,7 @@ use radroots_event_codec::seal::encode::{seal_build_tags, to_wire_parts, to_wire
#[test]
fn seal_to_wire_parts_requires_content() {
- let seal = RadrootsSeal {
+ let seal = Seal {
content: " ".to_string(),
};
@@ -23,7 +23,7 @@ fn seal_to_wire_parts_requires_content() {
#[test]
fn seal_to_wire_parts_sets_kind_and_content() {
- let seal = RadrootsSeal {
+ let seal = Seal {
content: "payload".to_string(),
};
@@ -117,7 +117,7 @@ fn seal_index_from_event_propagates_parse_errors() {
#[test]
fn seal_build_tags_and_kind_validation_cover_paths() {
- let seal = RadrootsSeal {
+ let seal = Seal {
content: "payload".to_string(),
};
assert!(seal_build_tags(&seal).unwrap().is_empty());
diff --git a/crates/event_codec/tests/social_events.rs b/crates/event_codec/tests/social_events.rs
@@ -7,12 +7,12 @@ use radroots_event::{
KIND_REPORT, is_home_feed_candidate_kind, is_market_candidate_kind,
is_private_farm_ops_kind, is_public_social_kind,
},
- farm::crdt::RadrootsFarmCrdtDocumentKind,
- farm::file::{RadrootsFarmFileDimensions, RadrootsFarmFileMetadata},
- farm::workspace::RadrootsFarmWorkspaceRef,
- media::file_metadata::RadrootsFileMetadata,
- social::RadrootsSocialMediaDimensions,
- social::group::{RadrootsGroupEditableMetadata, RadrootsGroupMetadata},
+ farm::crdt::FarmCrdtDocumentKind,
+ farm::file::{FarmFileDimensions, FarmFileMetadata},
+ farm::workspace::FarmWorkspaceRef,
+ media::file_metadata::FileMetadata,
+ social::SocialMediaDimensions,
+ social::group::{GroupEditableMetadata, GroupMetadata},
};
use radroots_event_codec::{
article::decode::article_from_event,
@@ -113,9 +113,9 @@ fn social_events_reject_private_farm_ops_semantics_in_public_codecs() {
#[test]
fn social_events_keep_nip29_groups_out_of_public_social_classification() {
- let group = RadrootsGroupMetadata {
+ let group = GroupMetadata {
d_tag: "field-group".to_string(),
- metadata: RadrootsGroupEditableMetadata {
+ metadata: GroupEditableMetadata {
name: Some("Field Group".to_string()),
about: Some("Localhost field coordination".to_string()),
picture: None,
@@ -140,14 +140,14 @@ fn social_events_keep_nip29_groups_out_of_public_social_classification() {
);
}
-fn public_file_metadata() -> RadrootsFileMetadata {
- RadrootsFileMetadata {
+fn public_file_metadata() -> FileMetadata {
+ FileMetadata {
url: "https://media.example.test/public.jpg".to_string(),
mime_type: "image/jpeg".to_string(),
sha256: SHA256.to_string(),
original_sha256: Some(OTHER_SHA256.to_string()),
size: Some(4096),
- dimensions: Some(RadrootsSocialMediaDimensions {
+ dimensions: Some(SocialMediaDimensions {
width: 1200,
height: 800,
}),
@@ -163,23 +163,23 @@ fn public_file_metadata() -> RadrootsFileMetadata {
}
}
-fn private_farm_file_metadata() -> RadrootsFarmFileMetadata {
- RadrootsFarmFileMetadata {
+fn private_farm_file_metadata() -> FarmFileMetadata {
+ FarmFileMetadata {
d_tag: D_TAG.to_string(),
- workspace: RadrootsFarmWorkspaceRef {
+ workspace: FarmWorkspaceRef {
pubkey: "workspace_pubkey".to_string(),
d_tag: D_TAG.to_string(),
},
farm_group_id: "field-group".to_string(),
owner_document_id: D_TAG.to_string(),
- owner_document_kind: RadrootsFarmCrdtDocumentKind::FarmTask,
+ owner_document_kind: FarmCrdtDocumentKind::FarmTask,
caption: Some("private caption".to_string()),
url: "https://media.example.test/private.jpg".to_string(),
mime_type: "image/jpeg".to_string(),
sha256: SHA256.to_string(),
original_sha256: Some(OTHER_SHA256.to_string()),
size_bytes: Some(4096),
- dimensions: Some(RadrootsFarmFileDimensions { w: 1200, h: 800 }),
+ dimensions: Some(FarmFileDimensions { w: 1200, h: 800 }),
blurhash: None,
thumb: None,
image: None,
diff --git a/crates/event_codec/tests/structured_decode.rs b/crates/event_codec/tests/structured_decode.rs
@@ -10,19 +10,13 @@ use radroots_core::{Decimal, Quantity, Unit};
use radroots_event::envelope::kind::{
KIND_COOP, KIND_DOCUMENT, KIND_FARM, KIND_PLOT, KIND_RESOURCE_AREA, KIND_RESOURCE_HARVEST_CAP,
};
-use radroots_event::farm::change_set::{
- RadrootsGcsLocation, RadrootsGeoJsonPoint, RadrootsGeoJsonPolygon,
-};
-use radroots_event::farm::coop::RadrootsCoop;
-use radroots_event::farm::plot::RadrootsPlot;
-use radroots_event::farm::resource_area::{
- RadrootsResourceArea, RadrootsResourceAreaLocation, RadrootsResourceAreaRef,
-};
-use radroots_event::farm::resource_cap::{
- RadrootsResourceHarvestCap, RadrootsResourceHarvestProduct,
-};
-use radroots_event::farm::{RadrootsFarm, RadrootsFarmRef};
-use radroots_event::post::document::{RadrootsDocument, RadrootsDocumentSubject};
+use radroots_event::farm::change_set::{GcsLocation, GeoJsonPoint, GeoJsonPolygon};
+use radroots_event::farm::coop::Coop;
+use radroots_event::farm::plot::Plot;
+use radroots_event::farm::resource_area::{ResourceArea, ResourceAreaLocation, ResourceAreaRef};
+use radroots_event::farm::resource_cap::{ResourceHarvestCap, ResourceHarvestProduct};
+use radroots_event::farm::{Farm, FarmRef};
+use radroots_event::post::document::{Document, DocumentSubject};
use radroots_event::tag::name::TAG_D;
use radroots_event_codec::coop::decode::{
coop_from_event, data_from_event as coop_metadata_from_event,
@@ -55,16 +49,16 @@ use test_fixtures::{FIXTURE_ALICE_NPUB, FIXTURE_ALICE_PUBLIC_KEY_HEX};
const TEST_NPUB: &str = FIXTURE_ALICE_NPUB;
const TEST_PUBKEY_HEX: &str = FIXTURE_ALICE_PUBLIC_KEY_HEX;
-fn sample_gcs() -> RadrootsGcsLocation {
- RadrootsGcsLocation {
+fn sample_gcs() -> GcsLocation {
+ GcsLocation {
lat: 37.0,
lng: -122.0,
geohash: "9q8yy".to_string(),
- point: RadrootsGeoJsonPoint {
+ point: GeoJsonPoint {
r#type: "Point".to_string(),
coordinates: [-122.0, 37.0],
},
- polygon: RadrootsGeoJsonPolygon {
+ polygon: GeoJsonPolygon {
r#type: "Polygon".to_string(),
coordinates: vec![vec![
[-122.0, 37.0],
@@ -90,8 +84,8 @@ fn sample_gcs() -> RadrootsGcsLocation {
}
}
-fn sample_farm(d_tag: &str) -> RadrootsFarm {
- RadrootsFarm {
+fn sample_farm(d_tag: &str) -> Farm {
+ Farm {
d_tag: d_tag.to_string(),
name: "Farm".to_string(),
about: None,
@@ -103,8 +97,8 @@ fn sample_farm(d_tag: &str) -> RadrootsFarm {
}
}
-fn sample_coop(d_tag: &str) -> RadrootsCoop {
- RadrootsCoop {
+fn sample_coop(d_tag: &str) -> Coop {
+ Coop {
d_tag: d_tag.to_string(),
name: "Coop".to_string(),
about: None,
@@ -116,10 +110,10 @@ fn sample_coop(d_tag: &str) -> RadrootsCoop {
}
}
-fn sample_plot(d_tag: &str, farm_pubkey: &str, farm_d_tag: &str) -> RadrootsPlot {
- RadrootsPlot {
+fn sample_plot(d_tag: &str, farm_pubkey: &str, farm_d_tag: &str) -> Plot {
+ Plot {
d_tag: d_tag.to_string(),
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: farm_pubkey.to_string(),
d_tag: farm_d_tag.to_string(),
},
@@ -130,12 +124,8 @@ fn sample_plot(d_tag: &str, farm_pubkey: &str, farm_d_tag: &str) -> RadrootsPlot
}
}
-fn sample_document(
- d_tag: &str,
- subject_pubkey: &str,
- subject_address: Option<&str>,
-) -> RadrootsDocument {
- RadrootsDocument {
+fn sample_document(d_tag: &str, subject_pubkey: &str, subject_address: Option<&str>) -> Document {
+ Document {
d_tag: d_tag.to_string(),
doc_type: "charter".to_string(),
title: "Charter".to_string(),
@@ -143,7 +133,7 @@ fn sample_document(
summary: None,
effective_at: None,
body_markdown: None,
- subject: RadrootsDocumentSubject {
+ subject: DocumentSubject {
pubkey: subject_pubkey.to_string(),
address: subject_address.map(str::to_string),
},
@@ -151,12 +141,12 @@ fn sample_document(
}
}
-fn sample_resource_area(d_tag: &str) -> RadrootsResourceArea {
- RadrootsResourceArea {
+fn sample_resource_area(d_tag: &str) -> ResourceArea {
+ ResourceArea {
d_tag: d_tag.to_string(),
name: "Area".to_string(),
about: None,
- location: RadrootsResourceAreaLocation {
+ location: ResourceAreaLocation {
primary: None,
city: None,
region: None,
@@ -167,14 +157,14 @@ fn sample_resource_area(d_tag: &str) -> RadrootsResourceArea {
}
}
-fn sample_resource_cap(d_tag: &str) -> RadrootsResourceHarvestCap {
- RadrootsResourceHarvestCap {
+fn sample_resource_cap(d_tag: &str) -> ResourceHarvestCap {
+ ResourceHarvestCap {
d_tag: d_tag.to_string(),
- resource_area: RadrootsResourceAreaRef {
+ resource_area: ResourceAreaRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
},
- product: RadrootsResourceHarvestProduct {
+ product: ResourceHarvestProduct {
key: "nutmeg".to_string(),
category: Some("spice".to_string()),
},
@@ -262,7 +252,7 @@ fn farm_metadata_and_index_decode_roundtrip() {
let d_tag = "AAAAAAAAAAAAAAAAAAAAAA";
let content = serde_json::to_string(&sample_farm(d_tag)).expect("farm content");
let tags = d_tag_tags(d_tag);
- let metadata: RadrootsParsedData<RadrootsFarm> = farm_metadata_from_event(
+ let metadata: RadrootsParsedData<Farm> = farm_metadata_from_event(
"id1".to_string(),
TEST_PUBKEY_HEX.to_string(),
55,
@@ -274,7 +264,7 @@ fn farm_metadata_and_index_decode_roundtrip() {
assert_eq!(metadata.id, "id1");
assert_eq!(metadata.data.d_tag, d_tag);
- let index: RadrootsParsedEvent<RadrootsFarm> = farm_index_from_event(
+ let index: RadrootsParsedEvent<Farm> = farm_index_from_event(
EVENT_ID.to_string(),
TEST_PUBKEY_HEX.to_string(),
55,
@@ -324,7 +314,7 @@ fn coop_metadata_and_index_decode_roundtrip() {
let d_tag = "BAAAAAAAAAAAAAAAAAAAAA";
let content = serde_json::to_string(&sample_coop(d_tag)).expect("coop content");
let tags = d_tag_tags(d_tag);
- let metadata: RadrootsParsedData<RadrootsCoop> = coop_metadata_from_event(
+ let metadata: RadrootsParsedData<Coop> = coop_metadata_from_event(
"id2".to_string(),
TEST_PUBKEY_HEX.to_string(),
56,
@@ -336,7 +326,7 @@ fn coop_metadata_and_index_decode_roundtrip() {
assert_eq!(metadata.id, "id2");
assert_eq!(metadata.data.d_tag, d_tag);
- let index: RadrootsParsedEvent<RadrootsCoop> = coop_index_from_event(
+ let index: RadrootsParsedEvent<Coop> = coop_index_from_event(
EVENT_ID.to_string(),
TEST_PUBKEY_HEX.to_string(),
56,
@@ -557,7 +547,7 @@ fn plot_metadata_and_index_decode_roundtrip() {
let content = serde_json::to_string(&sample_plot(d_tag, TEST_PUBKEY_HEX, farm_d_tag))
.expect("plot content");
- let metadata: RadrootsParsedData<RadrootsPlot> = plot_metadata_from_event(
+ let metadata: RadrootsParsedData<Plot> = plot_metadata_from_event(
"id3".to_string(),
TEST_PUBKEY_HEX.to_string(),
57,
@@ -568,7 +558,7 @@ fn plot_metadata_and_index_decode_roundtrip() {
.expect("plot metadata");
assert_eq!(metadata.data.d_tag, d_tag);
- let index: RadrootsParsedEvent<RadrootsPlot> = plot_index_from_event(
+ let index: RadrootsParsedEvent<Plot> = plot_index_from_event(
EVENT_ID.to_string(),
TEST_PUBKEY_HEX.to_string(),
57,
@@ -737,7 +727,7 @@ fn document_metadata_and_index_decode_roundtrip() {
serde_json::to_string(&sample_document(d_tag, TEST_PUBKEY_HEX, Some(&tag_address)))
.expect("document content");
- let metadata: RadrootsParsedData<RadrootsDocument> = document_metadata_from_event(
+ let metadata: RadrootsParsedData<Document> = document_metadata_from_event(
"id4".to_string(),
TEST_PUBKEY_HEX.to_string(),
58,
@@ -748,7 +738,7 @@ fn document_metadata_and_index_decode_roundtrip() {
.expect("document metadata");
assert_eq!(metadata.data.d_tag, d_tag);
- let index: RadrootsParsedEvent<RadrootsDocument> = document_index_from_event(
+ let index: RadrootsParsedEvent<Document> = document_index_from_event(
EVENT_ID.to_string(),
TEST_PUBKEY_HEX.to_string(),
58,
@@ -816,7 +806,7 @@ fn resource_area_metadata_and_index_decode_roundtrip() {
let d_tag = "AAAAAAAAAAAAAAAAAAAAAw";
let content = serde_json::to_string(&sample_resource_area(d_tag)).expect("area content");
let tags = d_tag_tags(d_tag);
- let metadata: RadrootsParsedData<RadrootsResourceArea> = resource_area_metadata_from_event(
+ let metadata: RadrootsParsedData<ResourceArea> = resource_area_metadata_from_event(
"id5".to_string(),
TEST_PUBKEY_HEX.to_string(),
59,
@@ -827,7 +817,7 @@ fn resource_area_metadata_and_index_decode_roundtrip() {
.expect("area metadata");
assert_eq!(metadata.data.d_tag, d_tag);
- let index: RadrootsParsedEvent<RadrootsResourceArea> = resource_area_index_from_event(
+ let index: RadrootsParsedEvent<ResourceArea> = resource_area_index_from_event(
EVENT_ID.to_string(),
TEST_PUBKEY_HEX.to_string(),
59,
@@ -898,19 +888,18 @@ fn resource_cap_metadata_and_index_decode_roundtrip() {
let d_tag = "DAAAAAAAAAAAAAAAAAAAAA";
let content = serde_json::to_string(&sample_resource_cap(d_tag)).expect("cap content");
let tags = d_tag_tags(d_tag);
- let metadata: RadrootsParsedData<RadrootsResourceHarvestCap> =
- resource_cap_metadata_from_event(
- "id6".to_string(),
- TEST_PUBKEY_HEX.to_string(),
- 60,
- KIND_RESOURCE_HARVEST_CAP,
- content.clone(),
- tags.clone(),
- )
- .expect("cap metadata");
+ let metadata: RadrootsParsedData<ResourceHarvestCap> = resource_cap_metadata_from_event(
+ "id6".to_string(),
+ TEST_PUBKEY_HEX.to_string(),
+ 60,
+ KIND_RESOURCE_HARVEST_CAP,
+ content.clone(),
+ tags.clone(),
+ )
+ .expect("cap metadata");
assert_eq!(metadata.data.d_tag, d_tag);
- let index: RadrootsParsedEvent<RadrootsResourceHarvestCap> = resource_cap_index_from_event(
+ let index: RadrootsParsedEvent<ResourceHarvestCap> = resource_cap_index_from_event(
EVENT_ID.to_string(),
TEST_PUBKEY_HEX.to_string(),
60,
diff --git a/crates/event_codec/tests/structured_encode_default.rs b/crates/event_codec/tests/structured_encode_default.rs
@@ -7,24 +7,18 @@ use radroots_core::{Currency, Decimal, Money, Quantity, QuantityPrice, Unit};
use radroots_event::envelope::kind::{
KIND_COOP, KIND_DOCUMENT, KIND_FARM, KIND_PLOT, KIND_RESOURCE_AREA, KIND_RESOURCE_HARVEST_CAP,
};
-use radroots_event::farm::change_set::{
- RadrootsGcsLocation, RadrootsGeoJsonPoint, RadrootsGeoJsonPolygon,
-};
-use radroots_event::farm::coop::{RadrootsCoop, RadrootsCoopLocation, RadrootsCoopRef};
-use radroots_event::farm::plot::{RadrootsPlot, RadrootsPlotLocation, RadrootsPlotRef};
-use radroots_event::farm::resource_area::{
- RadrootsResourceArea, RadrootsResourceAreaLocation, RadrootsResourceAreaRef,
-};
-use radroots_event::farm::resource_cap::{
- RadrootsResourceHarvestCap, RadrootsResourceHarvestProduct,
-};
-use radroots_event::farm::{RadrootsFarm, RadrootsFarmPublicLocation, RadrootsFarmRef};
-use radroots_event::id::{RadrootsDTag, RadrootsInventoryBinId};
+use radroots_event::farm::change_set::{GcsLocation, GeoJsonPoint, GeoJsonPolygon};
+use radroots_event::farm::coop::{Coop, CoopLocation, CoopRef};
+use radroots_event::farm::plot::{Plot, PlotLocation, PlotRef};
+use radroots_event::farm::resource_area::{ResourceArea, ResourceAreaLocation, ResourceAreaRef};
+use radroots_event::farm::resource_cap::{ResourceHarvestCap, ResourceHarvestProduct};
+use radroots_event::farm::{Farm, FarmPublicLocation, FarmRef};
+use radroots_event::id::{DTag, InventoryBinId};
use radroots_event::listing::operational::{
- RadrootsOperationalListing, RadrootsOperationalListingBin, RadrootsOperationalListingProduct,
+ OperationalListing, OperationalListingBin, OperationalListingProduct,
};
-use radroots_event::post::document::{RadrootsDocument, RadrootsDocumentSubject};
-use radroots_event::social::list_set::RadrootsListSet;
+use radroots_event::post::document::{Document, DocumentSubject};
+use radroots_event::social::list_set::ListSet;
use radroots_event_codec::coop::encode::{
coop_build_tags, coop_ref_tags, to_wire_parts as coop_to_wire_parts,
to_wire_parts_with_kind as coop_to_wire_parts_with_kind,
@@ -67,24 +61,24 @@ use test_fixtures::FIXTURE_ALICE_PUBLIC_KEY_HEX;
const TEST_PUBKEY_HEX: &str = FIXTURE_ALICE_PUBLIC_KEY_HEX;
-fn listing_d_tag(raw: &str) -> RadrootsDTag {
+fn listing_d_tag(raw: &str) -> DTag {
raw.parse().unwrap()
}
-fn bin_id(raw: &str) -> RadrootsInventoryBinId {
+fn bin_id(raw: &str) -> InventoryBinId {
raw.parse().unwrap()
}
-fn sample_gcs() -> RadrootsGcsLocation {
- RadrootsGcsLocation {
+fn sample_gcs() -> GcsLocation {
+ GcsLocation {
lat: 37.0,
lng: -122.0,
geohash: "9q8yy".to_string(),
- point: RadrootsGeoJsonPoint {
+ point: GeoJsonPoint {
r#type: "Point".to_string(),
coordinates: [-122.0, 37.0],
},
- polygon: RadrootsGeoJsonPolygon {
+ polygon: GeoJsonPolygon {
r#type: "Polygon".to_string(),
coordinates: vec![vec![
[-122.0, 37.0],
@@ -110,21 +104,21 @@ fn sample_gcs() -> RadrootsGcsLocation {
}
}
-fn sample_listing(d_tag: &str) -> RadrootsOperationalListing {
+fn sample_listing(d_tag: &str) -> OperationalListing {
let quantity = Quantity::try_new(Decimal::from(1u32), Unit::Each).unwrap();
let price = QuantityPrice::try_new(
Money::try_new(Decimal::from(10u32), Currency::USD).unwrap(),
quantity.clone(),
)
.unwrap();
- RadrootsOperationalListing {
+ OperationalListing {
d_tag: listing_d_tag(d_tag),
published_at: None,
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
},
- product: RadrootsOperationalListingProduct {
+ product: OperationalListingProduct {
key: "sku".to_string(),
title: "Widget".to_string(),
category: "Tools".to_string(),
@@ -136,7 +130,7 @@ fn sample_listing(d_tag: &str) -> RadrootsOperationalListing {
year: None,
},
primary_bin_id: bin_id("bin-1"),
- bins: vec![RadrootsOperationalListingBin {
+ bins: vec![OperationalListingBin {
bin_id: bin_id("bin-1"),
quantity,
price_per_canonical_unit: price,
@@ -157,15 +151,15 @@ fn sample_listing(d_tag: &str) -> RadrootsOperationalListing {
}
}
-fn sample_farm() -> RadrootsFarm {
- RadrootsFarm {
+fn sample_farm() -> Farm {
+ Farm {
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
name: "Farm".to_string(),
about: None,
website: None,
picture: None,
banner: None,
- location: Some(RadrootsFarmPublicLocation {
+ location: Some(FarmPublicLocation {
primary: "farm".to_string(),
city: Some("Town".to_string()),
region: Some("Region".to_string()),
@@ -176,15 +170,15 @@ fn sample_farm() -> RadrootsFarm {
}
}
-fn sample_coop() -> RadrootsCoop {
- RadrootsCoop {
+fn sample_coop() -> Coop {
+ Coop {
d_tag: "AAAAAAAAAAAAAAAAAAAAAQ".to_string(),
name: "Coop".to_string(),
about: None,
website: None,
picture: None,
banner: None,
- location: Some(RadrootsCoopLocation {
+ location: Some(CoopLocation {
primary: Some("coop".to_string()),
city: None,
region: None,
@@ -195,8 +189,8 @@ fn sample_coop() -> RadrootsCoop {
}
}
-fn sample_document() -> RadrootsDocument {
- RadrootsDocument {
+fn sample_document() -> Document {
+ Document {
d_tag: "AAAAAAAAAAAAAAAAAAAAAg".to_string(),
doc_type: "charter".to_string(),
title: "Charter".to_string(),
@@ -204,7 +198,7 @@ fn sample_document() -> RadrootsDocument {
summary: None,
effective_at: None,
body_markdown: None,
- subject: RadrootsDocumentSubject {
+ subject: DocumentSubject {
pubkey: TEST_PUBKEY_HEX.to_string(),
address: Some(format!("30340:{TEST_PUBKEY_HEX}:AAAAAAAAAAAAAAAAAAAAAA")),
},
@@ -212,16 +206,16 @@ fn sample_document() -> RadrootsDocument {
}
}
-fn sample_plot() -> RadrootsPlot {
- RadrootsPlot {
+fn sample_plot() -> Plot {
+ Plot {
d_tag: "AAAAAAAAAAAAAAAAAAAABQ".to_string(),
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
},
name: "Plot".to_string(),
about: None,
- location: Some(RadrootsPlotLocation {
+ location: Some(PlotLocation {
primary: Some("plot".to_string()),
city: None,
region: None,
@@ -232,12 +226,12 @@ fn sample_plot() -> RadrootsPlot {
}
}
-fn sample_resource_area() -> RadrootsResourceArea {
- RadrootsResourceArea {
+fn sample_resource_area() -> ResourceArea {
+ ResourceArea {
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
name: "Area".to_string(),
about: None,
- location: RadrootsResourceAreaLocation {
+ location: ResourceAreaLocation {
primary: None,
city: None,
region: None,
@@ -248,14 +242,14 @@ fn sample_resource_area() -> RadrootsResourceArea {
}
}
-fn sample_resource_cap() -> RadrootsResourceHarvestCap {
- RadrootsResourceHarvestCap {
+fn sample_resource_cap() -> ResourceHarvestCap {
+ ResourceHarvestCap {
d_tag: "AAAAAAAAAAAAAAAAAAAABA".to_string(),
- resource_area: RadrootsResourceAreaRef {
+ resource_area: ResourceAreaRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
},
- product: RadrootsResourceHarvestProduct {
+ product: ResourceHarvestProduct {
key: "nutmeg".to_string(),
category: Some("spice".to_string()),
},
@@ -370,14 +364,14 @@ fn structured_wire_parts_cover_default_kind_and_error_paths() {
#[test]
fn structured_build_tags_cover_optional_and_error_paths() {
- let farm = RadrootsFarm {
+ let farm = Farm {
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
name: "Farm".to_string(),
about: None,
website: None,
picture: None,
banner: None,
- location: Some(RadrootsFarmPublicLocation {
+ location: Some(FarmPublicLocation {
primary: "farm".to_string(),
city: Some("Town".to_string()),
region: Some("Region".to_string()),
@@ -412,21 +406,21 @@ fn structured_build_tags_cover_optional_and_error_paths() {
.any(|tag| tag.first().map(|v| v.as_str()) == Some("g"))
);
- let farm_ref_tags = farm_ref_tags(&RadrootsFarmRef {
+ let farm_ref_tags = farm_ref_tags(&FarmRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
})
.unwrap();
assert_eq!(farm_ref_tags.len(), 2);
- let coop = RadrootsCoop {
+ let coop = Coop {
d_tag: "AAAAAAAAAAAAAAAAAAAAAQ".to_string(),
name: "Coop".to_string(),
about: None,
website: None,
picture: None,
banner: None,
- location: Some(RadrootsCoopLocation {
+ location: Some(CoopLocation {
primary: Some("coop".to_string()),
city: None,
region: None,
@@ -442,14 +436,14 @@ fn structured_build_tags_cover_optional_and_error_paths() {
.iter()
.any(|tag| tag[0] == "t" && tag[1] == "co-op")
);
- let coop_ref_tags = coop_ref_tags(&RadrootsCoopRef {
+ let coop_ref_tags = coop_ref_tags(&CoopRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAQ".to_string(),
})
.unwrap();
assert_eq!(coop_ref_tags.len(), 2);
- let document = RadrootsDocument {
+ let document = Document {
d_tag: "AAAAAAAAAAAAAAAAAAAAAg".to_string(),
doc_type: "charter".to_string(),
title: "Charter".to_string(),
@@ -457,7 +451,7 @@ fn structured_build_tags_cover_optional_and_error_paths() {
summary: None,
effective_at: None,
body_markdown: None,
- subject: RadrootsDocumentSubject {
+ subject: DocumentSubject {
pubkey: TEST_PUBKEY_HEX.to_string(),
address: Some(format!("30340:{TEST_PUBKEY_HEX}:AAAAAAAAAAAAAAAAAAAAAA")),
},
@@ -480,15 +474,15 @@ fn structured_build_tags_cover_optional_and_error_paths() {
EventEncodeError::EmptyRequiredField("subject.address")
));
- let plot = RadrootsPlot {
+ let plot = Plot {
d_tag: "AAAAAAAAAAAAAAAAAAAABQ".to_string(),
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
},
name: "Plot".to_string(),
about: None,
- location: Some(RadrootsPlotLocation {
+ location: Some(PlotLocation {
primary: Some("plot".to_string()),
city: None,
region: None,
@@ -521,11 +515,11 @@ fn structured_build_tags_cover_optional_and_error_paths() {
EventEncodeError::EmptyRequiredField("plot.author_pubkey")
));
- let area = RadrootsResourceArea {
+ let area = ResourceArea {
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
name: "Area".to_string(),
about: None,
- location: RadrootsResourceAreaLocation {
+ location: ResourceAreaLocation {
primary: None,
city: None,
region: None,
@@ -542,7 +536,7 @@ fn structured_build_tags_cover_optional_and_error_paths() {
.iter()
.any(|tag| tag[0] == "t" && tag[1] == "orchard")
);
- let area_ref_tags = resource_area_ref_tags(&RadrootsResourceAreaRef {
+ let area_ref_tags = resource_area_ref_tags(&ResourceAreaRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
})
@@ -557,13 +551,13 @@ fn structured_build_tags_cover_optional_and_error_paths() {
EventEncodeError::EmptyRequiredField("location.gcs.geohash")
));
- let cap = RadrootsResourceHarvestCap {
+ let cap = ResourceHarvestCap {
d_tag: "AAAAAAAAAAAAAAAAAAAABA".to_string(),
- resource_area: RadrootsResourceAreaRef {
+ resource_area: ResourceAreaRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
},
- product: RadrootsResourceHarvestProduct {
+ product: ResourceHarvestProduct {
key: "nutmeg".to_string(),
category: Some("spice".to_string()),
},
@@ -598,7 +592,7 @@ fn structured_build_tags_cover_optional_and_error_paths() {
#[test]
fn structured_build_tags_cover_required_field_errors() {
- let document = RadrootsDocument {
+ let document = Document {
d_tag: "AAAAAAAAAAAAAAAAAAAAAg".to_string(),
doc_type: "charter".to_string(),
title: "Charter".to_string(),
@@ -606,7 +600,7 @@ fn structured_build_tags_cover_required_field_errors() {
summary: None,
effective_at: None,
body_markdown: None,
- subject: RadrootsDocumentSubject {
+ subject: DocumentSubject {
pubkey: TEST_PUBKEY_HEX.to_string(),
address: Some(format!("30340:{TEST_PUBKEY_HEX}:AAAAAAAAAAAAAAAAAAAAAA")),
},
@@ -645,7 +639,7 @@ fn structured_build_tags_cover_required_field_errors() {
EventEncodeError::EmptyRequiredField("subject.pubkey")
));
- let farm = RadrootsFarm {
+ let farm = Farm {
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
name: "Farm".to_string(),
about: None,
@@ -663,7 +657,7 @@ fn structured_build_tags_cover_required_field_errors() {
invalid_farm.name = " ".to_string();
let err = farm_build_tags(&invalid_farm).unwrap_err();
assert!(matches!(err, EventEncodeError::EmptyRequiredField("name")));
- let err = farm_ref_tags(&RadrootsFarmRef {
+ let err = farm_ref_tags(&FarmRef {
pubkey: " ".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
})
@@ -672,7 +666,7 @@ fn structured_build_tags_cover_required_field_errors() {
err,
EventEncodeError::EmptyRequiredField("farm.pubkey")
));
- let err = farm_ref_tags(&RadrootsFarmRef {
+ let err = farm_ref_tags(&FarmRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: " ".to_string(),
})
@@ -682,7 +676,7 @@ fn structured_build_tags_cover_required_field_errors() {
EventEncodeError::EmptyRequiredField("farm.d_tag")
));
- let coop = RadrootsCoop {
+ let coop = Coop {
d_tag: "AAAAAAAAAAAAAAAAAAAAAQ".to_string(),
name: "Coop".to_string(),
about: None,
@@ -701,12 +695,12 @@ fn structured_build_tags_cover_required_field_errors() {
let err = coop_build_tags(&invalid_coop).unwrap_err();
assert!(matches!(err, EventEncodeError::EmptyRequiredField("name")));
invalid_coop = coop.clone();
- invalid_coop.location = Some(RadrootsCoopLocation {
+ invalid_coop.location = Some(CoopLocation {
primary: None,
city: None,
region: None,
country: None,
- gcs: RadrootsGcsLocation {
+ gcs: GcsLocation {
geohash: " ".to_string(),
..sample_gcs()
},
@@ -716,7 +710,7 @@ fn structured_build_tags_cover_required_field_errors() {
err,
EventEncodeError::EmptyRequiredField("location.gcs.geohash")
));
- let err = coop_ref_tags(&RadrootsCoopRef {
+ let err = coop_ref_tags(&CoopRef {
pubkey: " ".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAQ".to_string(),
})
@@ -725,7 +719,7 @@ fn structured_build_tags_cover_required_field_errors() {
err,
EventEncodeError::EmptyRequiredField("coop.pubkey")
));
- let err = coop_ref_tags(&RadrootsCoopRef {
+ let err = coop_ref_tags(&CoopRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: " ".to_string(),
})
@@ -735,9 +729,9 @@ fn structured_build_tags_cover_required_field_errors() {
EventEncodeError::EmptyRequiredField("coop.d_tag")
));
- let plot = RadrootsPlot {
+ let plot = Plot {
d_tag: "AAAAAAAAAAAAAAAAAAAABQ".to_string(),
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
},
@@ -774,11 +768,11 @@ fn structured_build_tags_cover_required_field_errors() {
EventEncodeError::EmptyRequiredField("plot.d_tag")
));
- let area = RadrootsResourceArea {
+ let area = ResourceArea {
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
name: "Area".to_string(),
about: None,
- location: RadrootsResourceAreaLocation {
+ location: ResourceAreaLocation {
primary: None,
city: None,
region: None,
@@ -795,7 +789,7 @@ fn structured_build_tags_cover_required_field_errors() {
invalid_area.name = " ".to_string();
let err = resource_area_build_tags(&invalid_area).unwrap_err();
assert!(matches!(err, EventEncodeError::EmptyRequiredField("name")));
- let err = resource_area_ref_tags(&RadrootsResourceAreaRef {
+ let err = resource_area_ref_tags(&ResourceAreaRef {
pubkey: " ".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
})
@@ -804,7 +798,7 @@ fn structured_build_tags_cover_required_field_errors() {
err,
EventEncodeError::EmptyRequiredField("resource_area.pubkey")
));
- let err = resource_area_ref_tags(&RadrootsResourceAreaRef {
+ let err = resource_area_ref_tags(&ResourceAreaRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: " ".to_string(),
})
@@ -814,13 +808,13 @@ fn structured_build_tags_cover_required_field_errors() {
EventEncodeError::EmptyRequiredField("resource_area.d_tag")
));
- let cap = RadrootsResourceHarvestCap {
+ let cap = ResourceHarvestCap {
d_tag: "AAAAAAAAAAAAAAAAAAAABA".to_string(),
- resource_area: RadrootsResourceAreaRef {
+ resource_area: ResourceAreaRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
},
- product: RadrootsResourceHarvestProduct {
+ product: ResourceHarvestProduct {
key: "nutmeg".to_string(),
category: Some("spice".to_string()),
},
@@ -887,9 +881,9 @@ fn structured_list_sets_cover_success_and_error_paths() {
let plots_from = farm_plots_list_set_from_plots(
farm_id,
TEST_PUBKEY_HEX,
- [RadrootsPlot {
+ [Plot {
d_tag: "AAAAAAAAAAAAAAAAAAAABQ".to_string(),
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
},
@@ -936,7 +930,7 @@ fn structured_list_sets_cover_success_and_error_paths() {
let coop_farms = coop_members_farms_list_set(
coop_id,
- [RadrootsFarmRef {
+ [FarmRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
}],
@@ -956,7 +950,7 @@ fn structured_list_sets_cover_success_and_error_paths() {
));
let err = coop_members_farms_list_set(
coop_id,
- [RadrootsFarmRef {
+ [FarmRef {
pubkey: "".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
}],
@@ -968,7 +962,7 @@ fn structured_list_sets_cover_success_and_error_paths() {
));
let err = coop_members_farms_list_set(
"invalid",
- [RadrootsFarmRef {
+ [FarmRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
}],
@@ -979,7 +973,7 @@ fn structured_list_sets_cover_success_and_error_paths() {
let area_id = "AAAAAAAAAAAAAAAAAAAAAw";
let resource_farms = resource_area_members_farms_list_set(
area_id,
- [RadrootsFarmRef {
+ [FarmRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
}],
@@ -989,7 +983,7 @@ fn structured_list_sets_cover_success_and_error_paths() {
let resource_plots = resource_area_members_plots_list_set(
area_id,
- [RadrootsPlotRef {
+ [PlotRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAABQ".to_string(),
}],
@@ -1012,7 +1006,7 @@ fn structured_list_sets_cover_success_and_error_paths() {
));
let err = resource_area_members_plots_list_set(
area_id,
- [RadrootsPlotRef {
+ [PlotRef {
pubkey: "".to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAABQ".to_string(),
}],
@@ -1026,7 +1020,7 @@ fn structured_list_sets_cover_success_and_error_paths() {
#[test]
fn structured_list_set_outputs_remain_deterministic() {
- let list_set: RadrootsListSet =
+ let list_set: ListSet =
farm_members_list_set("AAAAAAAAAAAAAAAAAAAAAA", [TEST_PUBKEY_HEX, TEST_PUBKEY_HEX])
.unwrap();
assert_eq!(list_set.entries.len(), 2);
diff --git a/crates/event_codec/tests/tag_builders.rs b/crates/event_codec/tests/tag_builders.rs
@@ -6,42 +6,35 @@ use radroots_core::{Currency, Decimal, Money, Quantity, QuantityPrice, Unit};
use radroots_event::envelope::kind::{
KIND_ARTICLE, KIND_JOB_FEEDBACK, KIND_JOB_REQUEST_MIN, KIND_JOB_RESULT_MIN,
};
-use radroots_event::farm::change_set::{
- RadrootsGcsLocation, RadrootsGeoJsonPoint, RadrootsGeoJsonPolygon,
-};
-use radroots_event::farm::coop::RadrootsCoop;
-use radroots_event::farm::plot::{RadrootsPlot, RadrootsPlotRef};
-use radroots_event::farm::resource_area::{
- RadrootsResourceArea, RadrootsResourceAreaLocation, RadrootsResourceAreaRef,
-};
-use radroots_event::farm::resource_cap::{
- RadrootsResourceHarvestCap, RadrootsResourceHarvestProduct,
-};
-use radroots_event::farm::{RadrootsFarm, RadrootsFarmRef};
-use radroots_event::id::{RadrootsDTag, RadrootsInventoryBinId};
+use radroots_event::farm::change_set::{GcsLocation, GeoJsonPoint, GeoJsonPolygon};
+use radroots_event::farm::coop::Coop;
+use radroots_event::farm::plot::{Plot, PlotRef};
+use radroots_event::farm::resource_area::{ResourceArea, ResourceAreaLocation, ResourceAreaRef};
+use radroots_event::farm::resource_cap::{ResourceHarvestCap, ResourceHarvestProduct};
+use radroots_event::farm::{Farm, FarmRef};
+use radroots_event::id::{DTag, InventoryBinId};
use radroots_event::listing::operational::{
- RadrootsOperationalListing, RadrootsOperationalListingAvailability,
- RadrootsOperationalListingBin, RadrootsOperationalListingImage,
- RadrootsOperationalListingImageSize, RadrootsOperationalListingProduct,
- RadrootsOperationalListingPublicLocation, RadrootsOperationalListingStatus,
+ OperationalListing, OperationalListingAvailability, OperationalListingBin,
+ OperationalListingImage, OperationalListingImageSize, OperationalListingProduct,
+ OperationalListingPublicLocation, OperationalListingStatus,
};
-use radroots_event::post::document::{RadrootsDocument, RadrootsDocumentSubject};
-use radroots_event::post::reaction::RadrootsReaction;
-use radroots_event::social::RadrootsSocialTarget;
-use radroots_event::social::app_data::RadrootsAppData;
-use radroots_event::social::follow::{RadrootsFollow, RadrootsFollowProfile};
-use radroots_event::social::geochat::RadrootsGeoChat;
-use radroots_event::social::gift_wrap::{RadrootsGiftWrap, RadrootsGiftWrapRecipient};
+use radroots_event::post::document::{Document, DocumentSubject};
+use radroots_event::post::reaction::Reaction;
+use radroots_event::social::SocialTarget;
+use radroots_event::social::app_data::AppData;
+use radroots_event::social::follow::{Follow, FollowProfile};
+use radroots_event::social::geochat::GeoChat;
+use radroots_event::social::gift_wrap::{GiftWrap, GiftWrapRecipient};
use radroots_event::social::job::{JobFeedbackStatus, JobInputType, JobPaymentRequest};
-use radroots_event::social::job_feedback::RadrootsJobFeedback;
-use radroots_event::social::job_request::{RadrootsJobInput, RadrootsJobParam, RadrootsJobRequest};
-use radroots_event::social::job_result::RadrootsJobResult;
-use radroots_event::social::list::{RadrootsList, RadrootsListEntry};
-use radroots_event::social::list_set::RadrootsListSet;
-use radroots_event::social::message::{RadrootsMessage, RadrootsMessageRecipient};
-use radroots_event::social::message_file::RadrootsMessageFile;
-use radroots_event::social::seal::RadrootsSeal;
-use radroots_event::tag::RadrootsEventPtr;
+use radroots_event::social::job_feedback::JobFeedback;
+use radroots_event::social::job_request::{JobInput, JobParam, JobRequest};
+use radroots_event::social::job_result::JobResult;
+use radroots_event::social::list::{List, ListEntry};
+use radroots_event::social::list_set::ListSet;
+use radroots_event::social::message::{Message, MessageRecipient};
+use radroots_event::social::message_file::MessageFile;
+use radroots_event::social::seal::Seal;
+use radroots_event::tag::EventPtr;
use radroots_event_codec::error::EventEncodeError;
use radroots_event_codec::job::encode::JobEncodeError;
use radroots_event_codec::operational_listing::encode::operational_listing_build_tags;
@@ -60,16 +53,16 @@ fn cdn_url(path: &str) -> String {
format!("{CDN_PRIMARY_HTTPS}/{path}")
}
-fn d_tag(raw: &str) -> RadrootsDTag {
+fn d_tag(raw: &str) -> DTag {
raw.parse().unwrap()
}
-fn bin_id(raw: &str) -> RadrootsInventoryBinId {
+fn bin_id(raw: &str) -> InventoryBinId {
raw.parse().unwrap()
}
-fn sample_social_target(id: &str) -> RadrootsSocialTarget {
- RadrootsSocialTarget::Event {
+fn sample_social_target(id: &str) -> SocialTarget {
+ SocialTarget::Event {
id: id.to_string(),
author: Some(TEST_PUBKEY_HEX.to_string()),
event_kind: Some(KIND_ARTICLE),
@@ -77,16 +70,16 @@ fn sample_social_target(id: &str) -> RadrootsSocialTarget {
}
}
-fn sample_gcs() -> RadrootsGcsLocation {
- RadrootsGcsLocation {
+fn sample_gcs() -> GcsLocation {
+ GcsLocation {
lat: 37.0,
lng: -122.0,
geohash: "9q8yy".to_string(),
- point: RadrootsGeoJsonPoint {
+ point: GeoJsonPoint {
r#type: "Point".to_string(),
coordinates: [-122.0, 37.0],
},
- polygon: RadrootsGeoJsonPolygon {
+ polygon: GeoJsonPolygon {
r#type: "Polygon".to_string(),
coordinates: vec![vec![
[-122.0, 37.0],
@@ -112,7 +105,7 @@ fn sample_gcs() -> RadrootsGcsLocation {
}
}
-fn sample_listing() -> RadrootsOperationalListing {
+fn sample_listing() -> OperationalListing {
let quantity = Quantity::try_new(Decimal::from(1u32), Unit::Each).unwrap();
let price = QuantityPrice::try_new(
Money::try_new(Decimal::from(10u32), Currency::USD).unwrap(),
@@ -120,14 +113,14 @@ fn sample_listing() -> RadrootsOperationalListing {
)
.unwrap();
- RadrootsOperationalListing {
+ OperationalListing {
d_tag: d_tag("AAAAAAAAAAAAAAAAAAAAAg"),
published_at: None,
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: TEST_NPUB.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
},
- product: RadrootsOperationalListingProduct {
+ product: OperationalListingProduct {
key: "sku".to_string(),
title: "Widget".to_string(),
category: "Tools".to_string(),
@@ -139,7 +132,7 @@ fn sample_listing() -> RadrootsOperationalListing {
year: None,
},
primary_bin_id: bin_id("bin-1"),
- bins: vec![RadrootsOperationalListingBin {
+ bins: vec![OperationalListingBin {
bin_id: bin_id("bin-1"),
quantity,
price_per_canonical_unit: price,
@@ -166,13 +159,13 @@ fn event_tag_builder_impls_build_tags_for_all_supported_types() {
assert!(!listing.build_tags().unwrap().is_empty());
assert!(!operational_listing_build_tags(&listing).unwrap().is_empty());
- let app_data = RadrootsAppData {
+ let app_data = AppData {
d_tag: "radroots.app".to_string(),
content: "payload".to_string(),
};
assert!(!app_data.build_tags().unwrap().is_empty());
- let reaction = RadrootsReaction {
+ let reaction = Reaction {
target: sample_social_target(
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
),
@@ -180,13 +173,13 @@ fn event_tag_builder_impls_build_tags_for_all_supported_types() {
};
assert!(!reaction.build_tags().unwrap().is_empty());
- let message = RadrootsMessage {
- recipients: vec![RadrootsMessageRecipient {
+ let message = Message {
+ recipients: vec![MessageRecipient {
public_key: TEST_PUBKEY_HEX.to_string(),
relay_url: Some(RELAY_PRIMARY_WSS.to_string()),
}],
content: "hello".to_string(),
- reply_to: Some(RadrootsEventPtr {
+ reply_to: Some(EventPtr {
id: "reply".to_string(),
relays: Some(RELAY_PRIMARY_WSS.to_string()),
}),
@@ -194,8 +187,8 @@ fn event_tag_builder_impls_build_tags_for_all_supported_types() {
};
assert!(!message.build_tags().unwrap().is_empty());
- let message_file = RadrootsMessageFile {
- recipients: vec![RadrootsMessageRecipient {
+ let message_file = MessageFile {
+ recipients: vec![MessageRecipient {
public_key: TEST_PUBKEY_HEX.to_string(),
relay_url: None,
}],
@@ -216,7 +209,7 @@ fn event_tag_builder_impls_build_tags_for_all_supported_types() {
};
assert!(!message_file.build_tags().unwrap().is_empty());
- let geochat = RadrootsGeoChat {
+ let geochat = GeoChat {
geohash: "dr5rsj7".to_string(),
content: "hello".to_string(),
nickname: Some("alex".to_string()),
@@ -224,8 +217,8 @@ fn event_tag_builder_impls_build_tags_for_all_supported_types() {
};
assert!(!geochat.build_tags().unwrap().is_empty());
- let follow = RadrootsFollow {
- list: vec![RadrootsFollowProfile {
+ let follow = Follow {
+ list: vec![FollowProfile {
published_at: 1,
public_key: TEST_PUBKEY_HEX.to_string(),
relay_url: Some(RELAY_PRIMARY_WSS.to_string()),
@@ -234,7 +227,7 @@ fn event_tag_builder_impls_build_tags_for_all_supported_types() {
};
assert!(!follow.build_tags().unwrap().is_empty());
- let farm = RadrootsFarm {
+ let farm = Farm {
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
name: "Farm".to_string(),
about: None,
@@ -246,11 +239,11 @@ fn event_tag_builder_impls_build_tags_for_all_supported_types() {
};
assert!(!farm.build_tags().unwrap().is_empty());
- let resource_area = RadrootsResourceArea {
+ let resource_area = ResourceArea {
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
name: "Area".to_string(),
about: None,
- location: RadrootsResourceAreaLocation {
+ location: ResourceAreaLocation {
primary: None,
city: None,
region: None,
@@ -261,13 +254,13 @@ fn event_tag_builder_impls_build_tags_for_all_supported_types() {
};
assert!(!resource_area.build_tags().unwrap().is_empty());
- let resource_cap = RadrootsResourceHarvestCap {
+ let resource_cap = ResourceHarvestCap {
d_tag: "AAAAAAAAAAAAAAAAAAAABA".to_string(),
- resource_area: RadrootsResourceAreaRef {
+ resource_area: ResourceAreaRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
},
- product: RadrootsResourceHarvestProduct {
+ product: ResourceHarvestProduct {
key: "nutmeg".to_string(),
category: Some("spice".to_string()),
},
@@ -281,7 +274,7 @@ fn event_tag_builder_impls_build_tags_for_all_supported_types() {
};
assert!(!resource_cap.build_tags().unwrap().is_empty());
- let coop = RadrootsCoop {
+ let coop = Coop {
d_tag: "AAAAAAAAAAAAAAAAAAAAAQ".to_string(),
name: "Coop".to_string(),
about: None,
@@ -293,7 +286,7 @@ fn event_tag_builder_impls_build_tags_for_all_supported_types() {
};
assert!(!coop.build_tags().unwrap().is_empty());
- let document = RadrootsDocument {
+ let document = Document {
d_tag: "AAAAAAAAAAAAAAAAAAAAAg".to_string(),
doc_type: "charter".to_string(),
title: "Charter".to_string(),
@@ -301,7 +294,7 @@ fn event_tag_builder_impls_build_tags_for_all_supported_types() {
summary: None,
effective_at: None,
body_markdown: None,
- subject: RadrootsDocumentSubject {
+ subject: DocumentSubject {
pubkey: TEST_PUBKEY_HEX.to_string(),
address: Some(format!("30340:{TEST_PUBKEY_HEX}:AAAAAAAAAAAAAAAAAAAAAA")),
},
@@ -309,19 +302,19 @@ fn event_tag_builder_impls_build_tags_for_all_supported_types() {
};
assert!(!document.build_tags().unwrap().is_empty());
- let list = RadrootsList {
+ let list = List {
content: "private".to_string(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "p".to_string(),
values: vec![TEST_PUBKEY_HEX.to_string()],
}],
};
assert!(!list.build_tags().unwrap().is_empty());
- let list_set = RadrootsListSet {
+ let list_set = ListSet {
d_tag: "members.owners".to_string(),
content: "private".to_string(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "p".to_string(),
values: vec![TEST_PUBKEY_HEX.to_string()],
}],
@@ -331,9 +324,9 @@ fn event_tag_builder_impls_build_tags_for_all_supported_types() {
};
assert!(!list_set.build_tags().unwrap().is_empty());
- let plot = RadrootsPlot {
+ let plot = Plot {
d_tag: "AAAAAAAAAAAAAAAAAAAABQ".to_string(),
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
},
@@ -344,16 +337,16 @@ fn event_tag_builder_impls_build_tags_for_all_supported_types() {
};
assert!(!plot.build_tags().unwrap().is_empty());
- let job_request = RadrootsJobRequest {
+ let job_request = JobRequest {
kind: u16::try_from(KIND_JOB_REQUEST_MIN + 1).expect("request kind must fit NIP-01"),
- inputs: vec![RadrootsJobInput {
+ inputs: vec![JobInput {
data: "hello".to_string(),
input_type: JobInputType::Text,
relay: None,
marker: None,
}],
output: None,
- params: vec![RadrootsJobParam {
+ params: vec![JobParam {
key: "foo".to_string(),
value: "bar".to_string(),
}],
@@ -365,14 +358,14 @@ fn event_tag_builder_impls_build_tags_for_all_supported_types() {
};
assert!(!job_request.build_tags().unwrap().is_empty());
- let job_result = RadrootsJobResult {
+ let job_result = JobResult {
kind: u16::try_from(KIND_JOB_RESULT_MIN + 1).expect("result kind must fit NIP-01"),
- request_event: RadrootsEventPtr {
+ request_event: EventPtr {
id: "req".to_string(),
relays: Some(RELAY_PRIMARY_WSS.to_string()),
},
request_json: None,
- inputs: vec![RadrootsJobInput {
+ inputs: vec![JobInput {
data: "hello".to_string(),
input_type: JobInputType::Text,
relay: None,
@@ -388,11 +381,11 @@ fn event_tag_builder_impls_build_tags_for_all_supported_types() {
};
assert!(!job_result.build_tags().unwrap().is_empty());
- let job_feedback = RadrootsJobFeedback {
+ let job_feedback = JobFeedback {
kind: u16::try_from(KIND_JOB_FEEDBACK).expect("feedback kind must fit NIP-01"),
status: JobFeedbackStatus::Processing,
extra_info: Some("queued".to_string()),
- request_event: RadrootsEventPtr {
+ request_event: EventPtr {
id: "req".to_string(),
relays: Some(RELAY_PRIMARY_WSS.to_string()),
},
@@ -406,13 +399,13 @@ fn event_tag_builder_impls_build_tags_for_all_supported_types() {
};
assert!(!job_feedback.build_tags().unwrap().is_empty());
- let seal = RadrootsSeal {
+ let seal = Seal {
content: "sealed".to_string(),
};
assert!(seal.build_tags().unwrap().is_empty());
- let gift_wrap = RadrootsGiftWrap {
- recipient: RadrootsGiftWrapRecipient {
+ let gift_wrap = GiftWrap {
+ recipient: GiftWrapRecipient {
public_key: TEST_PUBKEY_HEX.to_string(),
relay_url: Some(RELAY_PRIMARY_WSS.to_string()),
},
@@ -425,11 +418,11 @@ fn event_tag_builder_impls_build_tags_for_all_supported_types() {
#[test]
fn listing_and_message_builders_cover_optional_shapes() {
let mut listing = sample_listing();
- listing.resource_area = Some(RadrootsResourceAreaRef {
+ listing.resource_area = Some(ResourceAreaRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
});
- listing.plot = Some(RadrootsPlotRef {
+ listing.plot = Some(PlotRef {
pubkey: TEST_PUBKEY_HEX.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAQ".to_string(),
});
@@ -439,16 +432,16 @@ fn listing_and_message_builders_cover_optional_shapes() {
listing.product.location = Some("Moyobamba".to_string());
listing.product.profile = Some("fruity".to_string());
listing.product.year = Some("2024".to_string());
- listing.location = Some(RadrootsOperationalListingPublicLocation {
+ listing.location = Some(OperationalListingPublicLocation {
primary: "Moyobamba".to_string(),
city: Some("Moyobamba".to_string()),
region: Some("San Martin".to_string()),
country: Some("PE".to_string()),
geohash: "9q8yy".to_string(),
});
- listing.images = Some(vec![RadrootsOperationalListingImage {
+ listing.images = Some(vec![OperationalListingImage {
url: cdn_url("a.jpg"),
- size: Some(RadrootsOperationalListingImageSize { w: 1200, h: 800 }),
+ size: Some(OperationalListingImageSize { w: 1200, h: 800 }),
}]);
assert!(!operational_listing_build_tags(&listing).unwrap().is_empty());
@@ -457,11 +450,11 @@ fn listing_and_message_builders_cover_optional_shapes() {
let with_trade_fields: fn() -> OperationalListingTagOptions =
OperationalListingTagOptions::with_trade_fields;
let trade_options = with_trade_fields();
- listing_with_trade.availability = Some(RadrootsOperationalListingAvailability::Status {
- status: RadrootsOperationalListingStatus::Active,
+ listing_with_trade.availability = Some(OperationalListingAvailability::Status {
+ status: OperationalListingStatus::Active,
});
let operational_listing_tags_full_fn: fn(
- &RadrootsOperationalListing,
+ &OperationalListing,
) -> Result<Vec<Vec<String>>, EventEncodeError> =
radroots_event_codec::operational_listing::tags::operational_listing_tags_full;
let full_tags = operational_listing_tags_full_fn(&listing_with_trade).unwrap();
@@ -482,8 +475,8 @@ fn listing_and_message_builders_cover_optional_shapes() {
}));
let mut listing_status_sold = listing_with_trade.clone();
- listing_status_sold.availability = Some(RadrootsOperationalListingAvailability::Status {
- status: RadrootsOperationalListingStatus::Sold,
+ listing_status_sold.availability = Some(OperationalListingAvailability::Status {
+ status: OperationalListingStatus::Sold,
});
let sold_tags =
operational_listing_tags_with_options(&listing_status_sold, trade_options).unwrap();
@@ -493,8 +486,8 @@ fn listing_and_message_builders_cover_optional_shapes() {
}));
let mut listing_status_other = listing_with_trade.clone();
- listing_status_other.availability = Some(RadrootsOperationalListingAvailability::Status {
- status: RadrootsOperationalListingStatus::Other {
+ listing_status_other.availability = Some(OperationalListingAvailability::Status {
+ status: OperationalListingStatus::Other {
value: "paused".to_string(),
},
});
@@ -506,7 +499,7 @@ fn listing_and_message_builders_cover_optional_shapes() {
}));
let mut listing_geohash_only = listing_with_trade.clone();
- listing_geohash_only.location = Some(RadrootsOperationalListingPublicLocation {
+ listing_geohash_only.location = Some(OperationalListingPublicLocation {
primary: "Moyobamba".to_string(),
city: Some("Moyobamba".to_string()),
region: None,
@@ -524,7 +517,7 @@ fn listing_and_message_builders_cover_optional_shapes() {
}));
let mut listing_no_coordinates = listing_with_trade.clone();
- listing_no_coordinates.location = Some(RadrootsOperationalListingPublicLocation {
+ listing_no_coordinates.location = Some(OperationalListingPublicLocation {
primary: "Moyobamba".to_string(),
city: Some("Moyobamba".to_string()),
region: None,
@@ -556,7 +549,7 @@ fn listing_and_message_builders_cover_optional_shapes() {
);
let mut listing_with_empty_primary_location = listing_with_trade.clone();
- listing_with_empty_primary_location.location = Some(RadrootsOperationalListingPublicLocation {
+ listing_with_empty_primary_location.location = Some(OperationalListingPublicLocation {
primary: " null ".to_string(),
city: Some("Moyobamba".to_string()),
region: None,
@@ -598,13 +591,13 @@ fn listing_and_message_builders_cover_optional_shapes() {
assert!(matches!(err, EventEncodeError::Json));
}
- let message_without_relays = RadrootsMessage {
- recipients: vec![RadrootsMessageRecipient {
+ let message_without_relays = Message {
+ recipients: vec![MessageRecipient {
public_key: TEST_PUBKEY_HEX.to_string(),
relay_url: None,
}],
content: "hello".to_string(),
- reply_to: Some(RadrootsEventPtr {
+ reply_to: Some(EventPtr {
id: "reply".to_string(),
relays: None,
}),
@@ -612,13 +605,13 @@ fn listing_and_message_builders_cover_optional_shapes() {
};
assert!(!message_without_relays.build_tags().unwrap().is_empty());
- let message_invalid_reply = RadrootsMessage {
- recipients: vec![RadrootsMessageRecipient {
+ let message_invalid_reply = Message {
+ recipients: vec![MessageRecipient {
public_key: TEST_PUBKEY_HEX.to_string(),
relay_url: None,
}],
content: "hello".to_string(),
- reply_to: Some(RadrootsEventPtr {
+ reply_to: Some(EventPtr {
id: " ".to_string(),
relays: None,
}),
@@ -664,9 +657,9 @@ fn listing_builder_rejects_required_field_errors() {
#[test]
fn job_request_tag_builder_rejects_encrypted_without_provider() {
- let request = RadrootsJobRequest {
+ let request = JobRequest {
kind: u16::try_from(KIND_JOB_REQUEST_MIN + 1).expect("request kind must fit NIP-01"),
- inputs: vec![RadrootsJobInput {
+ inputs: vec![JobInput {
data: "hello".to_string(),
input_type: JobInputType::Text,
relay: None,
@@ -686,9 +679,9 @@ fn job_request_tag_builder_rejects_encrypted_without_provider() {
#[test]
fn job_request_tag_builder_accepts_encrypted_with_provider() {
- let request = RadrootsJobRequest {
+ let request = JobRequest {
kind: u16::try_from(KIND_JOB_REQUEST_MIN + 1).expect("request kind must fit NIP-01"),
- inputs: vec![RadrootsJobInput {
+ inputs: vec![JobInput {
data: "hello".to_string(),
input_type: JobInputType::Text,
relay: None,
diff --git a/crates/event_codec/tests/verified_admission_conformance.rs b/crates/event_codec/tests/verified_admission_conformance.rs
@@ -2,7 +2,7 @@
use std::{borrow::Cow, fs, path::Path};
-use radroots_event::{envelope::RadrootsEventEnvelope, wire::RadrootsNip01EventWire};
+use radroots_event::{envelope::EventEnvelope, wire::Nip01EventWire};
use radroots_event_codec::{
admission::{RadrootsAdmittedEvent, RadrootsEventAdmissionError, admit_verified_event},
verification::verify_nip01_event,
@@ -150,9 +150,9 @@ fn admission_error_variant(error: &RadrootsEventAdmissionError) -> &'static str
}
}
-fn event_envelope(value: &Value) -> RadrootsEventEnvelope {
+fn event_envelope(value: &Value) -> EventEnvelope {
let raw_json = serde_json::to_string(value).expect("serialize fixed event");
- RadrootsNip01EventWire::parse_json(&raw_json)
+ Nip01EventWire::parse_json(&raw_json)
.expect("fixed signed event wire")
.into_envelope()
.expect("fixed signed event envelope")
diff --git a/crates/event_codec/tests/verified_comment_conformance.rs b/crates/event_codec/tests/verified_comment_conformance.rs
@@ -8,12 +8,12 @@ use std::{
};
use radroots_event::{
- envelope::RadrootsEventEnvelope,
- envelope::RadrootsEventEnvelopeLimits,
- envelope::RadrootsEventEnvelopeParts,
+ envelope::EventEnvelope,
+ envelope::EventEnvelopeLimits,
+ envelope::EventEnvelopeParts,
post::comment::{
- RadrootsAuthoredNip22Comment, RadrootsNip22AddressRootReference, RadrootsNip22CommentError,
- RadrootsNip22CommentParentReference, RadrootsNip22EventRootReference,
+ AuthoredNip22Comment, Nip22AddressRootReference, Nip22CommentError,
+ Nip22CommentParentReference, Nip22EventRootReference,
},
};
use radroots_event_codec::{
@@ -314,9 +314,7 @@ fn execute(vector: &Vector) {
}
}
-fn authored_comment(
- vector: &Vector,
-) -> Result<RadrootsAuthoredNip22Comment, RadrootsNip22CommentError> {
+fn authored_comment(vector: &Vector) -> Result<AuthoredNip22Comment, Nip22CommentError> {
let content = input_str(vector, "content");
let root = input_object(vector, "root");
let position = input_object(vector, "position");
@@ -324,17 +322,15 @@ fn authored_comment(
match object_str(root, "type", &vector.id) {
"event" => {
- let root_reference = RadrootsNip22EventRootReference::parse(
+ let root_reference = Nip22EventRootReference::parse(
object_str(root, "event_id", &vector.id),
object_str(root, "author", &vector.id),
object_u32(root, "kind", &vector.id),
object_optional_str(root, "relay", &vector.id),
)?;
match position_type {
- "top_event" => {
- RadrootsAuthoredNip22Comment::top_level_event(content, root_reference)
- }
- "nested" => RadrootsAuthoredNip22Comment::nested(
+ "top_event" => AuthoredNip22Comment::top_level_event(content, root_reference),
+ "nested" => AuthoredNip22Comment::nested(
content,
root_reference,
nested_parent(position, &vector.id)?,
@@ -343,7 +339,7 @@ fn authored_comment(
}
}
"address" => {
- let root_reference = RadrootsNip22AddressRootReference::parse(
+ let root_reference = Nip22AddressRootReference::parse(
object_str(root, "coordinate", &vector.id),
object_optional_str(root, "relay", &vector.id),
)?;
@@ -360,12 +356,12 @@ fn authored_comment(
vector.id
);
match position_type {
- "top_address" => RadrootsAuthoredNip22Comment::parse_top_level_address(
+ "top_address" => AuthoredNip22Comment::parse_top_level_address(
content,
root_reference,
object_str(position, "current_revision", &vector.id),
),
- "nested" => RadrootsAuthoredNip22Comment::nested(
+ "nested" => AuthoredNip22Comment::nested(
content,
root_reference,
nested_parent(position, &vector.id)?,
@@ -383,18 +379,18 @@ fn authored_comment(
fn nested_parent(
position: &serde_json::Map<String, Value>,
vector_id: &str,
-) -> Result<RadrootsNip22CommentParentReference, RadrootsNip22CommentError> {
+) -> Result<Nip22CommentParentReference, Nip22CommentError> {
let parent = position["parent"]
.as_object()
.unwrap_or_else(|| panic!("{vector_id} position.parent must be an object"));
- RadrootsNip22CommentParentReference::parse(
+ Nip22CommentParentReference::parse(
object_str(parent, "event_id", vector_id),
object_str(parent, "author", vector_id),
object_optional_str(parent, "relay", vector_id),
)
}
-fn fixture_envelope(vector: &Vector) -> RadrootsEventEnvelope {
+fn fixture_envelope(vector: &Vector) -> EventEnvelope {
let event_json = input_str(vector, "event_json");
let raw: RawEvent = serde_json::from_str(event_json)
.unwrap_or_else(|error| panic!("{} event_json failed to parse: {error}", vector.id));
@@ -405,7 +401,7 @@ fn fixture_envelope(vector: &Vector) -> RadrootsEventEnvelope {
vector.id
);
- let mut limits = RadrootsEventEnvelopeLimits::default();
+ let mut limits = EventEnvelopeLimits::default();
limits.max_content_bytes = limits.max_content_bytes.max(raw.content.len());
limits.max_tag_count = limits.max_tag_count.max(raw.tags.len());
limits.max_total_tag_elements = limits
@@ -426,8 +422,8 @@ fn fixture_envelope(vector: &Vector) -> RadrootsEventEnvelope {
.map(String::len)
.sum(),
);
- RadrootsEventEnvelope::new_with_limits(
- RadrootsEventEnvelopeParts {
+ EventEnvelope::new_with_limits(
+ EventEnvelopeParts {
id: raw.id,
author: raw.pubkey,
created_at: raw.created_at,
diff --git a/crates/event_codec/tests/verified_deletion_conformance.rs b/crates/event_codec/tests/verified_deletion_conformance.rs
@@ -8,16 +8,16 @@ use std::{
};
use radroots_event::{
- envelope::RadrootsEventEnvelope,
- envelope::RadrootsEventEnvelopeLimits,
- envelope::RadrootsEventEnvelopeParts,
+ envelope::EventEnvelope,
+ envelope::EventEnvelopeLimits,
+ envelope::EventEnvelopeParts,
post::deletion::{
- RADROOTS_NIP09_DELETION_CONTENT_MAX_BYTES, RADROOTS_NIP09_DELETION_EVENT_WIRE_MAX_BYTES,
+ AuthoredNip09DeletionRequest, Nip09DeletionAddressTarget, Nip09DeletionError,
+ Nip09DeletionEventTarget, RADROOTS_NIP09_DELETION_CONTENT_MAX_BYTES,
+ RADROOTS_NIP09_DELETION_EVENT_WIRE_MAX_BYTES,
RADROOTS_NIP09_DELETION_TAG_ELEMENT_MAX_BYTES, RADROOTS_NIP09_DELETION_TAG_MAX_COUNT,
RADROOTS_NIP09_DELETION_TAG_TOTAL_ELEMENT_MAX_COUNT,
- RADROOTS_NIP09_DELETION_TAG_TOTAL_MAX_BYTES, RadrootsAuthoredNip09DeletionRequest,
- RadrootsNip09DeletionAddressTarget, RadrootsNip09DeletionError,
- RadrootsNip09DeletionEventTarget,
+ RADROOTS_NIP09_DELETION_TAG_TOTAL_MAX_BYTES,
},
};
use radroots_event_codec::{
@@ -678,16 +678,14 @@ fn execute(vector: &Vector) {
}
}
-fn authored_request(
- vector: &Vector,
-) -> Result<RadrootsAuthoredNip09DeletionRequest, RadrootsNip09DeletionError> {
+fn authored_request(vector: &Vector) -> Result<AuthoredNip09DeletionRequest, Nip09DeletionError> {
let event_targets = input_array(vector, "event_targets")
.iter()
.map(|target| {
let target = target
.as_object()
.unwrap_or_else(|| panic!("{} event target must be an object", vector.id));
- RadrootsNip09DeletionEventTarget::parse(
+ Nip09DeletionEventTarget::parse(
object_str(target, "event_id", &vector.id),
object_u32(target, "kind", &vector.id),
)
@@ -696,18 +694,14 @@ fn authored_request(
let address_targets = input_array(vector, "address_targets")
.iter()
.map(|target| {
- RadrootsNip09DeletionAddressTarget::parse(
+ Nip09DeletionAddressTarget::parse(
target
.as_str()
.unwrap_or_else(|| panic!("{} address target must be a string", vector.id)),
)
})
.collect::<Result<Vec<_>, _>>()?;
- RadrootsAuthoredNip09DeletionRequest::new(
- input_str(vector, "content"),
- event_targets,
- address_targets,
- )
+ AuthoredNip09DeletionRequest::new(input_str(vector, "content"), event_targets, address_targets)
}
fn fixture_raw_event(vector: &Vector) -> RawEvent {
@@ -723,9 +717,9 @@ fn fixture_raw_event(vector: &Vector) -> RawEvent {
raw
}
-fn fixture_envelope(vector: &Vector) -> RadrootsEventEnvelope {
+fn fixture_envelope(vector: &Vector) -> EventEnvelope {
let raw = fixture_raw_event(vector);
- let mut limits = RadrootsEventEnvelopeLimits::default();
+ let mut limits = EventEnvelopeLimits::default();
limits.max_content_bytes = limits.max_content_bytes.max(raw.content.len());
limits.max_tag_count = limits.max_tag_count.max(raw.tags.len());
limits.max_total_tag_elements = limits
@@ -740,8 +734,8 @@ fn fixture_envelope(vector: &Vector) -> RadrootsEventEnvelope {
.unwrap_or_default(),
);
limits.max_total_tag_bytes = limits.max_total_tag_bytes.max(tag_bytes(&raw.tags));
- RadrootsEventEnvelope::new_with_limits(
- RadrootsEventEnvelopeParts {
+ EventEnvelope::new_with_limits(
+ EventEnvelopeParts {
id: raw.id,
author: raw.pubkey,
created_at: raw.created_at,
diff --git a/crates/event_codec/tests/verified_post_conformance.rs b/crates/event_codec/tests/verified_post_conformance.rs
@@ -5,17 +5,15 @@ use std::{borrow::Cow, collections::BTreeMap, fs, path::Path};
use radroots_blossom::{BlobDescriptor, BlobUrl, MediaType, Sha256};
use radroots_event::{
contract::identify_event_contract,
- envelope::RadrootsEventEnvelope,
- media::RadrootsAuthoredImage,
- post::reply::{
- RadrootsAuthoredNip10Reply, RadrootsNip10ReplyError, RadrootsNip10ReplyReference,
- },
+ envelope::EventEnvelope,
+ media::AuthoredImage,
+ post::reply::{AuthoredNip10Reply, Nip10ReplyError, Nip10ReplyReference},
post::{
- RadrootsAuthoredAsk, RadrootsAuthoredPhotoUpdate, RadrootsAuthoredPostError,
- RadrootsAuthoredPostImage, RadrootsAuthoredUpdate, RadrootsPostImageDimensions,
+ AuthoredAsk, AuthoredPhotoUpdate, AuthoredPostError, AuthoredPostImage, AuthoredUpdate,
+ PostImageDimensions,
},
- wire::RadrootsNip01EventWire,
- wire::RadrootsNip01EventWireParts,
+ wire::Nip01EventWire,
+ wire::Nip01EventWireParts,
};
use radroots_event_codec::post::{
admission::{RadrootsPostAdmissionOutcome, verify_and_admit_post_event},
@@ -355,7 +353,7 @@ fn conformance_vectors() -> Cow<'static, str> {
fn execute(vector: &Vector) {
match vector.kind.as_str() {
"social.update.build_authored_draft.valid" => {
- let update = RadrootsAuthoredUpdate::new(input_str(vector, "content"))
+ let update = AuthoredUpdate::new(input_str(vector, "content"))
.unwrap_or_else(|error| panic!("{} failed: {error}", vector.id));
let first = authored_update_to_wire_parts(&update);
let second = authored_update_to_wire_parts(&update);
@@ -363,14 +361,14 @@ fn execute(vector: &Vector) {
assert_eq!(wire_parts_value(&first), vector.expected, "{}", vector.id);
}
"social.update.build_authored_draft.invalid" => {
- let error = RadrootsAuthoredUpdate::new(input_str(vector, "content"))
+ let error = AuthoredUpdate::new(input_str(vector, "content"))
.expect_err("invalid authored Update must fail");
assert_eq!(error.code(), expected_str(vector, "error"), "{}", vector.id);
}
"social.photo_update.build_authored_draft.valid" => {
let images = authored_images(vector)
.unwrap_or_else(|error| panic!("{} image construction failed: {error}", vector.id));
- let photo = RadrootsAuthoredPhotoUpdate::new(input_str(vector, "content"), images)
+ let photo = AuthoredPhotoUpdate::new(input_str(vector, "content"), images)
.unwrap_or_else(|error| panic!("{} failed: {error}", vector.id));
let first = authored_photo_update_to_wire_parts(&photo);
let second = authored_photo_update_to_wire_parts(&photo);
@@ -384,7 +382,7 @@ fn execute(vector: &Vector) {
"social.ask.build_authored_draft.valid" => {
let images = authored_images(vector)
.unwrap_or_else(|error| panic!("{} image construction failed: {error}", vector.id));
- let ask = RadrootsAuthoredAsk::new(input_str(vector, "content"), images)
+ let ask = AuthoredAsk::new(input_str(vector, "content"), images)
.unwrap_or_else(|error| panic!("{} failed: {error}", vector.id));
let first = authored_ask_to_wire_parts(&ask);
let second = authored_ask_to_wire_parts(&ask);
@@ -392,7 +390,7 @@ fn execute(vector: &Vector) {
assert_eq!(wire_parts_value(&first), vector.expected, "{}", vector.id);
}
"social.ask.build_authored_draft.invalid" => {
- let error = RadrootsAuthoredAsk::new(input_str(vector, "content"), Vec::new())
+ let error = AuthoredAsk::new(input_str(vector, "content"), Vec::new())
.expect_err("invalid authored Ask must fail");
assert_eq!(error.code(), expected_str(vector, "error"), "{}", vector.id);
}
@@ -605,7 +603,7 @@ fn reply_diagnostic_value(diagnostic: &RadrootsNip10ReplyDiagnostic) -> Value {
})
}
-fn wire_parts_value(parts: &RadrootsNip01EventWireParts) -> Value {
+fn wire_parts_value(parts: &Nip01EventWireParts) -> Value {
json!({
"kind": parts.kind,
"content": parts.content,
@@ -613,13 +611,11 @@ fn wire_parts_value(parts: &RadrootsNip01EventWireParts) -> Value {
})
}
-fn authored_reply(vector: &Vector) -> Result<RadrootsAuthoredNip10Reply, RadrootsNip10ReplyError> {
+fn authored_reply(vector: &Vector) -> Result<AuthoredNip10Reply, Nip10ReplyError> {
let root = authored_reply_reference(vector, &vector.input["root"])?;
match vector.input.get("parent") {
- None | Some(Value::Null) => {
- RadrootsAuthoredNip10Reply::direct(input_str(vector, "content"), root)
- }
- Some(parent) => RadrootsAuthoredNip10Reply::nested(
+ None | Some(Value::Null) => AuthoredNip10Reply::direct(input_str(vector, "content"), root),
+ Some(parent) => AuthoredNip10Reply::nested(
input_str(vector, "content"),
root,
authored_reply_reference(vector, parent)?,
@@ -630,7 +626,7 @@ fn authored_reply(vector: &Vector) -> Result<RadrootsAuthoredNip10Reply, Radroot
fn authored_reply_reference(
vector: &Vector,
input: &Value,
-) -> Result<RadrootsNip10ReplyReference, RadrootsNip10ReplyError> {
+) -> Result<Nip10ReplyReference, Nip10ReplyError> {
let relay = match input.get("relay") {
None | Some(Value::Null) => None,
Some(relay) => Some(
@@ -639,16 +635,14 @@ fn authored_reply_reference(
.unwrap_or_else(|| panic!("{} Reply relay must be a string or null", vector.id)),
),
};
- RadrootsNip10ReplyReference::parse(
+ Nip10ReplyReference::parse(
value_str(vector, input, "event_id"),
value_str(vector, input, "author"),
relay,
)
}
-fn authored_images(
- vector: &Vector,
-) -> Result<Vec<RadrootsAuthoredPostImage>, RadrootsAuthoredPostError> {
+fn authored_images(vector: &Vector) -> Result<Vec<AuthoredPostImage>, AuthoredPostError> {
vector
.input
.get("images")
@@ -664,10 +658,7 @@ fn authored_images(
)
}
-fn authored_image(
- vector: &Vector,
- input: &Value,
-) -> Result<RadrootsAuthoredPostImage, RadrootsAuthoredPostError> {
+fn authored_image(vector: &Vector, input: &Value) -> Result<AuthoredPostImage, AuthoredPostError> {
let bytes = value_str(vector, input, "bytes_utf8").as_bytes();
let media_type = MediaType::parse(value_str(vector, input, "media_type"))
.unwrap_or_else(|error| panic!("{} media type setup failed: {error}", vector.id));
@@ -685,16 +676,15 @@ fn authored_image(
.unwrap_or_else(|error| panic!("{} URL approval failed: {error}", vector.id))
.verify_bytes(bytes, &media_type)
.unwrap_or_else(|error| panic!("{} byte verification failed: {error}", vector.id));
- let image = RadrootsAuthoredImage::try_from(descriptor)
+ let image = AuthoredImage::try_from(descriptor)
.unwrap_or_else(|error| panic!("{} image typestate setup failed: {error}", vector.id));
- let dimensions = RadrootsPostImageDimensions::new(
+ let dimensions = PostImageDimensions::new(
u32::try_from(value_u64(vector, input, "width"))
.unwrap_or_else(|_| panic!("{} image.width must fit u32", vector.id)),
u32::try_from(value_u64(vector, input, "height"))
.unwrap_or_else(|_| panic!("{} image.height must fit u32", vector.id)),
)?;
- let mut image =
- RadrootsAuthoredPostImage::new(image, dimensions, value_str(vector, input, "alt"))?;
+ let mut image = AuthoredPostImage::new(image, dimensions, value_str(vector, input, "alt"))?;
if let Some(fallbacks) = input.get("fallbacks").and_then(Value::as_array) {
for fallback in fallbacks {
image = image.try_with_fallback(
@@ -737,8 +727,8 @@ fn diagnostic_codes(diagnostics: &[RadrootsPostDiagnostic]) -> Vec<&'static str>
.collect()
}
-fn canonical_envelope(raw_json: &str) -> RadrootsEventEnvelope {
- RadrootsNip01EventWire::parse_json(raw_json)
+fn canonical_envelope(raw_json: &str) -> EventEnvelope {
+ Nip01EventWire::parse_json(raw_json)
.expect("canonical raw event")
.into_envelope()
.expect("event envelope")
diff --git a/crates/event_codec/tests/verified_profile_conformance.rs b/crates/event_codec/tests/verified_profile_conformance.rs
@@ -3,14 +3,11 @@
use std::{borrow::Cow, fs, path::Path};
use radroots_event::envelope::event_head::{
- RadrootsCurrentEventHead, RadrootsEventHeadCandidate, RadrootsEventHeadCandidateResult,
- RadrootsEventHeadDecision, event_head_candidate_for_event, select_event_head,
+ CurrentEventHead, EventHeadCandidate, EventHeadCandidateResult, EventHeadDecision,
+ event_head_candidate_for_event, select_event_head,
};
-use radroots_event::{
- envelope::RadrootsEventEnvelope, envelope::RadrootsEventEnvelopeParts,
- wire::RadrootsNip01EventWire,
-};
-use radroots_event::{id::RadrootsIdParseError, wire::RadrootsEventWireError};
+use radroots_event::{envelope::EventEnvelope, envelope::EventEnvelopeParts, wire::Nip01EventWire};
+use radroots_event::{id::ParseError, wire::EventWireError};
use radroots_event_codec::profile::admission::{
RadrootsAdmittedProfileEvent, RadrootsProfileAdmissionError, verify_and_admit_profile_event,
};
@@ -138,14 +135,14 @@ fn verify_invalid_signature(vector: &Vector) {
}
fn reject_invalid_wire_public_key(vector: &Vector) {
- let error = RadrootsNip01EventWire::parse_json(input_str(vector, "event_json"))
+ let error = Nip01EventWire::parse_json(input_str(vector, "event_json"))
.expect_err("invalid secp256k1 public key must fail wire parsing");
assert_eq!(expected_str(vector, "error"), "invalid_public_key");
assert_eq!(
error,
- RadrootsEventWireError::InvalidIdentifier {
+ EventWireError::InvalidIdentifier {
field: "pubkey",
- error: RadrootsIdParseError::InvalidPublicKey,
+ error: ParseError::InvalidPublicKey,
}
);
}
@@ -230,23 +227,21 @@ fn selected_event_id(
current: &RadrootsAdmittedProfileEvent,
candidate: &RadrootsAdmittedProfileEvent,
) -> String {
- let current: RadrootsCurrentEventHead = head_candidate(current).into();
+ let current: CurrentEventHead = head_candidate(current).into();
match select_event_head(head_candidate(candidate), Some(¤t)) {
- RadrootsEventHeadDecision::Applied(head) => head.event_id.into_string(),
- RadrootsEventHeadDecision::SkippedDuplicate
- | RadrootsEventHeadDecision::SkippedOlder
- | RadrootsEventHeadDecision::SkippedSameTimestampHigherEventId => {
- current.event_id.into_string()
- }
- RadrootsEventHeadDecision::CoordinateMismatch => {
+ EventHeadDecision::Applied(head) => head.event_id.into_string(),
+ EventHeadDecision::SkippedDuplicate
+ | EventHeadDecision::SkippedOlder
+ | EventHeadDecision::SkippedSameTimestampHigherEventId => current.event_id.into_string(),
+ EventHeadDecision::CoordinateMismatch => {
panic!("admitted Profile events from one author must share a coordinate")
}
}
}
-fn head_candidate(admitted: &RadrootsAdmittedProfileEvent) -> RadrootsEventHeadCandidate {
+fn head_candidate(admitted: &RadrootsAdmittedProfileEvent) -> EventHeadCandidate {
match event_head_candidate_for_event(admitted.event()).expect("Profile contract") {
- RadrootsEventHeadCandidateResult::Candidate(candidate) => candidate,
+ EventHeadCandidateResult::Candidate(candidate) => candidate,
other => panic!("admitted Profile must be a replaceable head candidate: {other:?}"),
}
}
@@ -256,16 +251,16 @@ fn admitted_event(raw_json: &str, vector_id: &str) -> RadrootsAdmittedProfileEve
.unwrap_or_else(|error| panic!("{vector_id} failed: {error}"))
}
-fn canonical_envelope(raw_json: &str) -> RadrootsEventEnvelope {
- RadrootsNip01EventWire::parse_json(raw_json)
+fn canonical_envelope(raw_json: &str) -> EventEnvelope {
+ Nip01EventWire::parse_json(raw_json)
.expect("canonical raw event")
.into_envelope()
.expect("event envelope")
}
-fn unchecked_id_envelope(raw_json: &str) -> RadrootsEventEnvelope {
+fn unchecked_id_envelope(raw_json: &str) -> EventEnvelope {
let raw: RawEvent = serde_json::from_str(raw_json).expect("raw event");
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ EventEnvelope::new(EventEnvelopeParts {
id: raw.id,
author: raw.pubkey,
created_at: raw.created_at,
diff --git a/crates/event_codec/tests/wire.rs b/crates/event_codec/tests/wire.rs
@@ -1,7 +1,7 @@
-use radroots_event::contract::RadrootsContractValidationError;
-use radroots_event::draft::{RadrootsDraftError, RadrootsEventDraft};
+use radroots_event::contract::ContractValidationError;
+use radroots_event::draft::{DraftError, EventDraft};
use radroots_event::envelope::kind::{KIND_GEOCHAT, KIND_KNOWLEDGE_CLAIM, KIND_KNOWLEDGE_SOURCE};
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
use radroots_event_codec::wire::{canonicalize_tags, empty_content};
#[test]
@@ -27,26 +27,26 @@ fn wire_canonicalize_tags_trims_sorts_and_dedups() {
#[test]
fn wire_parts_are_canonical_event_owned_payload_parts() {
- let parts = RadrootsNip01EventWireParts {
+ let parts = Nip01EventWireParts {
kind: KIND_GEOCHAT,
content: "hello".to_string(),
tags: vec![vec!["t".to_string(), "a".to_string()]],
};
let json = serde_json::to_string(&parts).expect("json");
- let decoded: RadrootsNip01EventWireParts = serde_json::from_str(&json).expect("decoded");
+ let decoded: Nip01EventWireParts = serde_json::from_str(&json).expect("decoded");
assert_eq!(decoded, parts);
}
#[test]
fn draft_validation_accepts_wire_parts_without_signed_envelope() {
- let parts = RadrootsNip01EventWireParts {
+ let parts = Nip01EventWireParts {
kind: KIND_GEOCHAT,
content: "hello".to_string(),
tags: vec![vec!["t".to_string(), "a".to_string()]],
};
- let draft = RadrootsEventDraft::new(
+ let draft = EventDraft::new(
"radroots.social.geochat.v1",
parts.kind,
99,
@@ -66,12 +66,12 @@ fn draft_validation_accepts_wire_parts_without_signed_envelope() {
#[test]
fn draft_validation_rejects_contract_shape_errors() {
- let missing_contract_tag = RadrootsNip01EventWireParts {
+ let missing_contract_tag = Nip01EventWireParts {
kind: KIND_KNOWLEDGE_CLAIM,
content: r#"{"schema":"radroots.knowledge.claim.v1","schema_version":1}"#.to_string(),
tags: Vec::new(),
};
- let error = RadrootsEventDraft::new(
+ let error = EventDraft::new(
"radroots.knowledge.claim.v1",
missing_contract_tag.kind,
99,
@@ -82,8 +82,8 @@ fn draft_validation_rejects_contract_shape_errors() {
.expect_err("missing contract tag");
assert!(matches!(
error,
- RadrootsDraftError::ContractShape {
- error: RadrootsContractValidationError::MissingTag {
+ DraftError::ContractShape {
+ error: ContractValidationError::MissingTag {
name: "contract",
..
},
@@ -91,7 +91,7 @@ fn draft_validation_rejects_contract_shape_errors() {
}
));
- let invalid_relay = RadrootsNip01EventWireParts {
+ let invalid_relay = Nip01EventWireParts {
kind: KIND_KNOWLEDGE_CLAIM,
content: r#"{"schema":"radroots.knowledge.claim.v1","schema_version":1}"#.to_string(),
tags: vec![
@@ -109,7 +109,7 @@ fn draft_validation_rejects_contract_shape_errors() {
],
],
};
- let error = RadrootsEventDraft::new(
+ let error = EventDraft::new(
"radroots.knowledge.claim.v1",
invalid_relay.kind,
99,
@@ -120,8 +120,8 @@ fn draft_validation_rejects_contract_shape_errors() {
.expect_err("invalid relay");
assert!(matches!(
error,
- RadrootsDraftError::ContractShape {
- error: RadrootsContractValidationError::TagValueMismatch { name: "source", .. },
+ DraftError::ContractShape {
+ error: ContractValidationError::TagValueMismatch { name: "source", .. },
..
}
));
diff --git a/crates/event_store/contracts/source_maintenance_v1.manifest.json b/crates/event_store/contracts/source_maintenance_v1.manifest.json
@@ -257,8 +257,8 @@
{
"role": "event_public_surface",
"path": "crates/event/src/lib.rs",
- "byte_length": 1993,
- "sha256": "d7a869dead70892257c0a7a287ddc086c339242f9d8d22c384878315226fe050",
+ "byte_length": 1892,
+ "sha256": "5d609b963a9b8db18ef96a10f394617413734d2631774d3296e6d8fc029cb02c",
"hash_algorithm": "sha256_bytes_v1"
},
{
@@ -271,29 +271,29 @@
{
"role": "event_contract_registry_v7_authority",
"path": "crates/event/src/contract/registry_v7.rs",
- "byte_length": 157252,
- "sha256": "4ae8af380fd99c4b9b011981770bb352e104b7bae1784f45b1979f972a97df35",
+ "byte_length": 145805,
+ "sha256": "0a62603f6fc05dc9f758561cf7da258c676ada810ceaeca7fb151364a5c83d62",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "event_envelope_authority",
"path": "crates/event/src/envelope.rs",
- "byte_length": 31248,
- "sha256": "3105d9cc32779b8c75bfc272f83981cc0036884c78917168389850af7aecc4cd",
+ "byte_length": 29310,
+ "sha256": "29f8d8c4b17c01cb5a8c7f59e4ce52e134180e0e6f37d265063d278b8f2ff26e",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "event_verification_typestate_authority",
"path": "crates/event/src/verification.rs",
- "byte_length": 9645,
- "sha256": "8512710b2730b87c4630f140707d144f3f196685eaa26715f0ee7c99d0d3c6d2",
+ "byte_length": 9400,
+ "sha256": "417acb2ce670d266b1fa4fcafd6b48a910218deab38f57fb8b942056db76f94d",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "event_admission_typestate_authority",
"path": "crates/event/src/admission.rs",
- "byte_length": 7116,
- "sha256": "65034364bca02a26681261ce8dd88ba05857c20048f2f0ddb0dd43d012a6d87a",
+ "byte_length": 7052,
+ "sha256": "62bd2ceb0f434946fdfc2b81f4efb13738676a29a6936c23a427e43aadf2d9cb",
"hash_algorithm": "sha256_bytes_v1"
},
{
@@ -306,22 +306,22 @@
{
"role": "event_head_v1_authority",
"path": "crates/event/src/event_head/v1.rs",
- "byte_length": 7566,
- "sha256": "6ef7537a1188086e4f414b6c5f398a305c2eca5edd0ee188b4f890f07f3322ff",
+ "byte_length": 6849,
+ "sha256": "9f4144d8d240023cf493ce0b538ade4c16dc44204d6b5f2797152caf6f9e7dba",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "event_ids_authority",
"path": "crates/event/src/id.rs",
- "byte_length": 51758,
- "sha256": "8b9a2da028e9621c660dde3c40a34713e7e0e8b3fe66b64aa18de6a6e666db45",
+ "byte_length": 48381,
+ "sha256": "a08fe3873815453a03318a706e2fa98a8a6728ec69d24368a87ec60025566fe0",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "event_trade_authority",
"path": "crates/event/src/trade.rs",
- "byte_length": 68665,
- "sha256": "5e1aa8bd20bc13a08e4ebc7e6306365cb74f55e1cec62af135a36eb41146dd45",
+ "byte_length": 65549,
+ "sha256": "f818a7287ed82de3fb9ef1d973f0fb18d84b30eb4827ddc576ee502dd980145f",
"hash_algorithm": "sha256_bytes_v1"
},
{
@@ -341,78 +341,127 @@
{
"role": "event_draft_authority",
"path": "crates/event/src/draft.rs",
- "byte_length": 53436,
- "sha256": "1eeefbcb9467eb92a9640b3dbd36faa8d98afd20e26d8a3603646a5131be3196",
+ "byte_length": 51154,
+ "sha256": "7fab3174e7fa6c317287ae53f049c9a5f7590c3432b99f1698c415df663265c0",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "event_calendar_authority",
"path": "crates/event/src/calendar.rs",
- "byte_length": 103877,
- "sha256": "1e0bb92b32198cea2f39df57c365d4a8c43dea301f452f1309df4078401df7fc",
+ "byte_length": 97992,
+ "sha256": "73e79d61ee175cb46e6123e1d28239252ddf0ad094dc1113bdb1286b63b88d57",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "event_classified_listing_authority",
"path": "crates/event/src/classified_listing.rs",
- "byte_length": 8236,
- "sha256": "ee022b2aaffd1642c2c1e792c79e8fce353b9edd4d6e49afdebeb74af771187e",
+ "byte_length": 7956,
+ "sha256": "ac58484b87c7712c81f50f884d1c0dd60938571aa5f6f05d555191f529a4c2b0",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "event_profile_authority",
"path": "crates/event/src/profile.rs",
- "byte_length": 18933,
- "sha256": "8f75af27179d62e09da9c4d578e1bbf9e4cda71167888f8ae48ea3d8a9e8fa38",
+ "byte_length": 17011,
+ "sha256": "572bfe3b6f1711d109db445077f0a8453cad3f021cc0638f79201b618e16b978",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "event_post_authority",
"path": "crates/event/src/post.rs",
- "byte_length": 23135,
- "sha256": "8671cb3c4da0e2ea68f95ad99688dba209c6206296300394a7d6e771f7bfc3ed",
+ "byte_length": 19968,
+ "sha256": "a822cd51eff9cbaa39db998cc5c90d117f7a983f0fe2d42d42118cb00e95982c",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "event_comment_authority",
"path": "crates/event/src/comment.rs",
- "byte_length": 36453,
- "sha256": "159eb5487e67e1a834072333a7f08b38ac15756c46eaeafecaa1574aade0a824",
+ "byte_length": 34745,
+ "sha256": "24b7fda13229f21cee5cef2a9941e3aaafdbc486b19ed42731b0b6ee37c28703",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "event_food_availability_authority",
"path": "crates/event/src/food_availability.rs",
- "byte_length": 45430,
- "sha256": "389dda590888278b0bd95b4e19a597f47e0f573a24e0ac3cb92c63098191a290",
+ "byte_length": 42829,
+ "sha256": "52472c07eb0855d884c60755dc3a3e1a963793451d707e51f769f2d78384f318",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "event_deletion_authority",
"path": "crates/event/src/deletion.rs",
- "byte_length": 31181,
- "sha256": "99cf3d8e61f107602df345c6e2ac60223b9d0389537b231dd1a30a2ed0e64990",
+ "byte_length": 30022,
+ "sha256": "8c3f2e32407520a8e8242c1293af32613c648fb76218b8003a18929ac0b3811f",
+ "hash_algorithm": "sha256_bytes_v1"
+ },
+ {
+ "role": "event_dto_authority",
+ "path": "crates/event/src/dto.rs",
+ "byte_length": 5038,
+ "sha256": "9e228c95ff6ff33f99441d8682781fd0a1c4d3f1db24284a43985dcbac3ba136",
+ "hash_algorithm": "sha256_bytes_v1"
+ },
+ {
+ "role": "event_farm_crdt_authority",
+ "path": "crates/event/src/farm_crdt.rs",
+ "byte_length": 21118,
+ "sha256": "cec265ac9c42b59a14be4eb96924d26a83477c27291f667f23e6e47a64b6b2c7",
+ "hash_algorithm": "sha256_bytes_v1"
+ },
+ {
+ "role": "event_knowledge_authority",
+ "path": "crates/event/src/knowledge.rs",
+ "byte_length": 54624,
+ "sha256": "3d55ff88a4e30d5d605f9ae4b2e96b9df6978d6c14e52f9aeb0b8039cfc200d7",
+ "hash_algorithm": "sha256_bytes_v1"
+ },
+ {
+ "role": "event_operational_listing_authority",
+ "path": "crates/event/src/operational_listing.rs",
+ "byte_length": 10307,
+ "sha256": "52e710db816c89c8d4b87c86541987f7447f2f7091c394c68d9cb98a27f90159",
+ "hash_algorithm": "sha256_bytes_v1"
+ },
+ {
+ "role": "event_order_authority",
+ "path": "crates/event/src/order.rs",
+ "byte_length": 60218,
+ "sha256": "4203fcc469612cac5c705884564e140b9fb076cd57079e22ed85275a8b936e50",
+ "hash_algorithm": "sha256_bytes_v1"
+ },
+ {
+ "role": "event_reply_authority",
+ "path": "crates/event/src/reply.rs",
+ "byte_length": 15581,
+ "sha256": "b0b83a1e96125c0892d932e9314519242a715fa8f46334aff765ffd248c91d9a",
+ "hash_algorithm": "sha256_bytes_v1"
+ },
+ {
+ "role": "event_trade_validation_authority",
+ "path": "crates/event/src/trade_validation.rs",
+ "byte_length": 4669,
+ "sha256": "1486f79bd1d0eadea6cc1b7646ce1f7f57ccade18334a3ea37286426676b9b98",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "event_relay_hint_authority",
"path": "crates/event/src/relay_hint.rs",
- "byte_length": 14016,
- "sha256": "095ce5284796eac71b3aa6630718d398a67ff3836a92d80444fc45fb023b4931",
+ "byte_length": 13598,
+ "sha256": "fb8b026eeccf51d78f20771c44223e7b48825aa0e3c760d6b3cb90148021a674",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "event_media_authority",
"path": "crates/event/src/media.rs",
- "byte_length": 3574,
- "sha256": "2e91f3b5624dfab990f18abd4dd6194f1205442c798381af6b648aee88de53ee",
+ "byte_length": 3455,
+ "sha256": "10678af3a202d5367dbcf3bcdc0bf9fdf8d8fb89b045d7d3fb96b3cc195ab6f9",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "event_social_authority",
"path": "crates/event/src/social.rs",
- "byte_length": 6284,
- "sha256": "9db55b9eaa8b712430ecd7b4430e3ed50f3224a4a4c2537f9741e3026f4a1857",
+ "byte_length": 6076,
+ "sha256": "a2dab19caad46eab14fac86e7c878a801a450d8ac374b0e728b71a5a224eef19",
"hash_algorithm": "sha256_bytes_v1"
},
{
@@ -425,8 +474,8 @@
{
"role": "event_wire_v1_authority",
"path": "crates/event/src/wire/v1.rs",
- "byte_length": 22132,
- "sha256": "8b18760d655c01c3cbb1d1818b486c6aeae324d262c864fc1ed1297d2ecf1196",
+ "byte_length": 21218,
+ "sha256": "c3f82fefcf52b3f208f31dedceae64a29ec6ba2804896a0bb957235fd8d9ff6b",
"hash_algorithm": "sha256_bytes_v1"
},
{
@@ -439,15 +488,22 @@
{
"role": "event_codec_verification_v1_authority",
"path": "crates/event_codec/src/verification/v1.rs",
- "byte_length": 8649,
- "sha256": "1ef3d12f90eb7d35f4cafe36c2cc0bbd33731df278b58c9062fb13934e2a98c8",
+ "byte_length": 8489,
+ "sha256": "ca52f783e8b23fa53e91b13bdefff3a9da0adafa2847556ca1a4ffe74538f421",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "event_codec_registry_v7_admission_authority",
"path": "crates/event_codec/src/admission/registry_v7.rs",
- "byte_length": 5360,
- "sha256": "81b26be497e3314564e88b9e6f21aaaf4dee44d6f37b5e127de561553a660c48",
+ "byte_length": 5228,
+ "sha256": "62da30cb6ef7d0ed2d43715a73bd529283e8ae8c12571bc5c68722cb400f17b8",
+ "hash_algorithm": "sha256_bytes_v1"
+ },
+ {
+ "role": "event_codec_admission_facade",
+ "path": "crates/event_codec/src/admission.rs",
+ "byte_length": 20622,
+ "sha256": "72a1bc6abcb32398e33567071af1469cf32ce8498e4a1c7b0ba71e1e066fb14c",
"hash_algorithm": "sha256_bytes_v1"
},
{
@@ -460,8 +516,8 @@
{
"role": "event_codec_profile_registry_v7_authority",
"path": "crates/event_codec/src/profile/inbound/registry_v7.rs",
- "byte_length": 10394,
- "sha256": "c37c225ea8153beb098a39c4a56203aa03382af12646f40cd3f8628663700702",
+ "byte_length": 10347,
+ "sha256": "32111c0e0592229c11a93a3a8054e7b124b039451aa696a9abcb56df2a6608d3",
"hash_algorithm": "sha256_bytes_v1"
},
{
@@ -474,8 +530,8 @@
{
"role": "event_codec_post_registry_v7_authority",
"path": "crates/event_codec/src/post/inbound/registry_v7.rs",
- "byte_length": 16025,
- "sha256": "551380f1b188fbd6ac4cba988426218863ec557eb6022153da89ace2aa40d2c7",
+ "byte_length": 15985,
+ "sha256": "e17083b0596e3a55994c399bc6272c0ebf04cabaa513260b3d45dd546f7f50ef",
"hash_algorithm": "sha256_bytes_v1"
},
{
@@ -488,8 +544,8 @@
{
"role": "event_codec_reply_registry_v7_authority",
"path": "crates/event_codec/src/reply/inbound/registry_v7.rs",
- "byte_length": 26825,
- "sha256": "3abb33e8d20097e41d2c81f10d023c3293390718915eb5087c663676d322bfce",
+ "byte_length": 26662,
+ "sha256": "d1d11116ca27801b7e2f17da60900e6a9ca0b6f27ea9ee0bf19e97dbf24c0c32",
"hash_algorithm": "sha256_bytes_v1"
},
{
@@ -502,8 +558,8 @@
{
"role": "event_codec_comment_registry_v7_authority",
"path": "crates/event_codec/src/comment/inbound/registry_v7.rs",
- "byte_length": 53802,
- "sha256": "32413b80b7472cfb024984ae0e0ea67c7a42ebc98b2257d6c9d16a87f2d84ba0",
+ "byte_length": 53311,
+ "sha256": "c63fe853536b17bded6073f32b53434b60fc5123f911d01c642a6b3982f09c70",
"hash_algorithm": "sha256_bytes_v1"
},
{
@@ -516,22 +572,29 @@
{
"role": "event_codec_deletion_reconciliation_v1_authority",
"path": "crates/event_codec/src/deletion/reconciliation_v1.rs",
- "byte_length": 38345,
- "sha256": "dc6c55e5af2cfab0149dbb763cafa603566772fdae378988a583162c95438496",
+ "byte_length": 38052,
+ "sha256": "06faad60285584a5910ad6b078b0141d461d62511e3ddceb8b021c8457f6a57c",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "event_codec_error_authority",
"path": "crates/event_codec/src/error.rs",
- "byte_length": 3698,
- "sha256": "b20b70056ea2b48a9e3a4f7697a76e87d5f3c445641bfcc7b61d72605b146ce5",
+ "byte_length": 3666,
+ "sha256": "174ce982bca37fac28d016c3ab3236441c9b31b2169ec94db6c9288b36c72849",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "event_codec_food_admission_authority",
"path": "crates/event_codec/src/food_availability/admission.rs",
- "byte_length": 5815,
- "sha256": "96aea4bdd6938d26f03fa9bcb94e3ce8608bf674895961f8bf237554796debba",
+ "byte_length": 5681,
+ "sha256": "99809859090f5295572688d06bbb30dbe50524ba2c996de7ec5b26f6dd390643",
+ "hash_algorithm": "sha256_bytes_v1"
+ },
+ {
+ "role": "event_codec_food_authored_authority",
+ "path": "crates/event_codec/src/food_availability/authored.rs",
+ "byte_length": 9724,
+ "sha256": "8673ec62ed3fc47b691efd9ca828643719803971e72b756c5b4603d409d0fba5",
"hash_algorithm": "sha256_bytes_v1"
},
{
@@ -544,15 +607,36 @@
{
"role": "event_codec_food_registry_v7_authority",
"path": "crates/event_codec/src/food_availability/inbound/registry_v7.rs",
- "byte_length": 26785,
- "sha256": "d06807c62333d0b1b8496b51390210b0738ee92b1748bc7e31bd4b095fb62ed2",
+ "byte_length": 26037,
+ "sha256": "92a7e75da3293967cec17a514479144c3c948a64542577dd58c7f07992968e4f",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "event_codec_job_traits_authority",
"path": "crates/event_codec/src/job/traits.rs",
- "byte_length": 5101,
- "sha256": "bc198764f2825b4b1441781493e13fc7088e7bdd04f70690480f387604b0bd47",
+ "byte_length": 4946,
+ "sha256": "1b3558a3196744005978dceddd33d3a72ad1ab8f50fb1cbfd997dcfe98bb9e39",
+ "hash_algorithm": "sha256_bytes_v1"
+ },
+ {
+ "role": "event_codec_knowledge_verification_authority",
+ "path": "crates/event_codec/src/knowledge/verification.rs",
+ "byte_length": 6986,
+ "sha256": "6f8a10ed262ce37f05acd9c89a1e37ca2fa99ce7da18407891e8abe228ee2349",
+ "hash_algorithm": "sha256_bytes_v1"
+ },
+ {
+ "role": "event_codec_tag_builders_authority",
+ "path": "crates/event_codec/src/tag_builders.rs",
+ "byte_length": 9232,
+ "sha256": "bd81ccf04fd72358331b48eddcde087a95e115c5bd90c05fd9332644979ad5e6",
+ "hash_algorithm": "sha256_bytes_v1"
+ },
+ {
+ "role": "event_codec_trade_facade",
+ "path": "crates/event_codec/src/trade/mod.rs",
+ "byte_length": 21562,
+ "sha256": "97fd292f2ed47719098a55cad20d1f420d4c313a1349cb76a479ac620f809f48",
"hash_algorithm": "sha256_bytes_v1"
},
{
@@ -565,8 +649,8 @@
{
"role": "event_store_error_and_limits",
"path": "crates/event_store/src/error.rs",
- "byte_length": 19516,
- "sha256": "384f81d13dd5a837dd336b1f990fd79718f05ceb9c9272d0e8cd14c9618e4c8b",
+ "byte_length": 19464,
+ "sha256": "47be522eb0541619683f8b30eb6f66da821b65eb310a60815c81c7b7f3349947",
"hash_algorithm": "sha256_bytes_v1"
},
{
@@ -593,57 +677,57 @@
{
"role": "predecessor_model_public_surface",
"path": "crates/event_store/src/model.rs",
- "byte_length": 33624,
- "sha256": "b155993cf03f19f392068188e14adad5b5b139996434d1076a86428e1cce4255",
+ "byte_length": 32314,
+ "sha256": "d7ffa47719783c9f08cb4e00fbe47123cf0310ead06f77d3ad1d81edfda96b2c",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "event_store_reconciliation_v1_model",
"path": "crates/event_store/src/model/reconciliation_v1.rs",
- "byte_length": 11148,
- "sha256": "37f9edd8e1b5ae3f696bc911e8a7eda0a6eac4e05d2d9e6799f041d0abf73b50",
+ "byte_length": 10452,
+ "sha256": "bd3a8f0efe6d4b2959ab8a5b8048cd940fd078dce842083be2386544722017ef",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "event_store_reconciliation_v1_ingest_model",
"path": "crates/event_store/src/model/ingest_reconciliation_v1.rs",
- "byte_length": 1626,
- "sha256": "47bf13b3fc0f8a913a660f7d655413de0f6b90568bc4acc510aa6bd741bab47b",
+ "byte_length": 1594,
+ "sha256": "27b02ef508b4df45a801ef72e9f92b43819ea6372a3936bc2507c67a42acd07a",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "addressable_transition_feed_model",
"path": "crates/event_store/src/model/addressable_transition_feed_v1.rs",
- "byte_length": 22277,
- "sha256": "3fbccc2ab44ceb66ad459ebb56c87aa250732b28248716128e91ca42d7c7656d",
+ "byte_length": 22229,
+ "sha256": "e651952d73ed0a29d2b137076f56f699beada205ac84ed8a96834e86e343fa78",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "current_visibility_model",
"path": "crates/event_store/src/model/current_visibility_v1.rs",
- "byte_length": 5690,
- "sha256": "57a4ccd377fc314193c34125ca2ea0a235637e888c622f60ed27bb5f55805c9d",
+ "byte_length": 5634,
+ "sha256": "7d5b2b35ceb52d7472d68444515fa4a6aab43f6838b557aefff74fcebf487657",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "food_projection_model",
"path": "crates/event_store/src/model/food_availability_projection_v1.rs",
- "byte_length": 17437,
- "sha256": "28c259cdea06dd4b4a3b9103dc85a8049abee5a17f64771fd1083ae945dc009a",
+ "byte_length": 17109,
+ "sha256": "2fd51989da7f07b3e80557fb1a4b89814126eb3ffd80023e42012f0242b0584d",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "source_generation_rebuild_authority",
"path": "crates/event_store/src/nip09/reconciliation_v1.rs",
- "byte_length": 185239,
- "sha256": "fb390d682a84e054d57ec6f845d32b4c28423cb238a246e2008f2e5dd529cdd5",
+ "byte_length": 184853,
+ "sha256": "b6887f9f319809d401ac519137cfa78467ca26594cae53720a58a37ccc72757e",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "nip09_successor_result_vector_executor",
"path": "crates/event_store/tests/support/nip09_reconciliation_v1_result_vector_v2.rs",
- "byte_length": 17992,
- "sha256": "24a004135d4f7f4324f4a61db8384601cbcb85b9376c52e5db8ed6a1463fd045",
+ "byte_length": 17976,
+ "sha256": "f9b17af1b9df22c78b5be76a2a62fb6d55153e0b4173462d6cacc7305aedc967",
"hash_algorithm": "sha256_bytes_v1"
},
{
@@ -656,57 +740,57 @@
{
"role": "public_store_and_transaction_authority",
"path": "crates/event_store/src/store.rs",
- "byte_length": 395033,
- "sha256": "9b990626ac85e70277a869bb31870f9e15e8208e1136a574f99a091632797d99",
+ "byte_length": 393835,
+ "sha256": "d47f5d8d95599783162533dcd26b0114160a098ddef3447fb2ee6648c3949e5f",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "addressable_transition_feed_store",
"path": "crates/event_store/src/store/addressable_transition_feed_v1.rs",
- "byte_length": 40259,
- "sha256": "ebb3b502c55ad218a1551f8ba2b9cc6dca4b34a1010e21002a3165ac8f66edee",
+ "byte_length": 40216,
+ "sha256": "31ed3390d279aee5261848386889cf256667759b9898be5607856a3f80fd7eb7",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "current_visibility_store",
"path": "crates/event_store/src/store/current_visibility_v1.rs",
- "byte_length": 15785,
- "sha256": "165086b7226189ab67600fb4b3c83abfba099e31c1018962d445437a2fe41ce5",
+ "byte_length": 15737,
+ "sha256": "aa5d1bff7a5368cbac2b37906bb40f54bfc8aa6906bab34369569fdd105bf899",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "food_projection_store",
"path": "crates/event_store/src/store/food_availability_projection_v1.rs",
- "byte_length": 48959,
- "sha256": "28197d8d308e14e91391d38d69a45e8286a1513cff4c3e65b40c915e872ad423",
+ "byte_length": 48927,
+ "sha256": "78a96d441e2fbfdfc6f9e2787ae773e8fd6aa5c53ca10d658350b843c0d1537e",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "predecessor_post_core_v1_extension",
"path": "crates/event_store/src/store/post_core_extensions_v1.rs",
- "byte_length": 6922,
- "sha256": "fc18d92f6f4d8cb5b8428c4bd64bcf6d0c9b013e9fbe815830b5a4ab9fe07d45",
+ "byte_length": 6569,
+ "sha256": "f5bd8ddb45e1b2144895bd8da737fc92db051be1844ce7e8047a32b47376ce37",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "predecessor_post_core_v1_storage",
"path": "crates/event_store/src/store/post_core_storage_v1.rs",
- "byte_length": 16896,
- "sha256": "8d0349a0d065708448f8e60387861a39099831142f87dd9a60ee3c6dafae031a",
+ "byte_length": 16558,
+ "sha256": "d88c1f7ff5cc0a19221ad893eb840d55c11535f13adf84ffb3076cbc18d4abf1",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "raw_ingest_capacity_authority",
"path": "crates/event_store/src/store/protocol_reconciliation_v1.rs",
- "byte_length": 30162,
- "sha256": "2934caaf352475a9d50ac79eb9f3e5053075e6a66fb71cfe367a86c212d0159a",
+ "byte_length": 29950,
+ "sha256": "c72aaff06e4f35d0b4523c6625e83345879f9e15b9fe9563dccf589e5d01e277",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "predecessor_protocol_storage",
"path": "crates/event_store/src/store/protocol_storage_v1.rs",
- "byte_length": 10939,
- "sha256": "53593f1c4ea0ff524b31a0e9c027803af051f5bd4fd5d70509508f580ee6dea6",
+ "byte_length": 10835,
+ "sha256": "c82179b9f57968191f3e71dd008cc701787c62715ada74090eeecaa3b213076d",
"hash_algorithm": "sha256_bytes_v1"
},
{
@@ -719,8 +803,8 @@
{
"role": "predecessor_food_result_vector_executor",
"path": "crates/event_store/tests/food_availability_projection_v1_result_vector.rs",
- "byte_length": 34062,
- "sha256": "e3778e4f154845a088d32a83055b678efc1511bc7ae5bb82f4be61df2f6ef88e",
+ "byte_length": 34046,
+ "sha256": "776903c6431ff07f26c6ad6b713db5628efce1a72f34d86de6e47d4404fa3a6d",
"hash_algorithm": "sha256_bytes_v1"
},
{
@@ -740,22 +824,22 @@
{
"role": "transitive_predecessor_membership_governance",
"path": "tools/xtask/src/contract/nip09_reconciliation.rs",
- "byte_length": 838346,
- "sha256": "506005717ab5d5785f5d6fcca54fdb1cddffa7eadebb176bf35cc0d6b3f67003",
+ "byte_length": 838146,
+ "sha256": "3bfaf8b2cef8a93217b65ba86b914ece93b552e463f8f378ac2659ab31c32c00",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "source_maintenance_governance",
"path": "tools/xtask/src/contract/source_maintenance.rs",
- "byte_length": 196407,
- "sha256": "69dc1b2530ab01ef6059e338f2ef80163d409376b0315dbacb23bab34b641074",
+ "byte_length": 198386,
+ "sha256": "0b27791f0f9695fe7dd2e03d5fcb776dd2cc1ee9c68ca62032ea574ef10086b1",
"hash_algorithm": "sha256_bytes_v1"
},
{
"role": "contract_command_authority",
"path": "tools/xtask/src/contract.rs",
- "byte_length": 506342,
- "sha256": "a506f13c9cf95fa60249f7c2aa8947ad5c9c821f82962c549dd324fd69917502",
+ "byte_length": 503671,
+ "sha256": "82a33a2227fe63eed1d8ca5908f51f48c4ac4aa1d4527a7633980673fd9a6a30",
"hash_algorithm": "sha256_bytes_v1"
},
{
diff --git a/crates/event_store/contracts/source_maintenance_v1.manifest.sha256 b/crates/event_store/contracts/source_maintenance_v1.manifest.sha256
@@ -1 +1 @@
-0db33542eef54da6a665c00a9c9ee6cbb2d45f955dba5ecf58967c040d2e8d63
+c86ced595111f009e7888ff77c1a18052cbe5ea5889f409d9d338024c7830e0e
diff --git a/crates/event_store/src/error.rs b/crates/event_store/src/error.rs
@@ -1,6 +1,6 @@
-use radroots_event::draft::RadrootsSignedEventError;
-use radroots_event::id::RadrootsIdParseError;
-use radroots_event::wire::RadrootsEventWireError;
+use radroots_event::draft::SignedEventError;
+use radroots_event::id::ParseError;
+use radroots_event::wire::EventWireError;
use radroots_event_codec::verification::RadrootsNip01VerificationError;
use radroots_transport::RadrootsTransportError;
@@ -54,13 +54,13 @@ pub enum RadrootsEventStoreError {
#[error("json error: {0}")]
Json(#[from] serde_json::Error),
#[error("identifier parse error: {0}")]
- IdParse(#[from] RadrootsIdParseError),
+ IdParse(#[from] ParseError),
#[error("identity value parse error: {0}")]
Identity(#[from] radroots_identity::Error),
#[error("event wire error: {0}")]
- EventWire(#[from] RadrootsEventWireError),
+ EventWire(#[from] EventWireError),
#[error("signed event error: {0}")]
- SignedEvent(#[from] RadrootsSignedEventError),
+ SignedEvent(#[from] SignedEventError),
#[error("NIP-01 verification error: {0}")]
Nip01Verification(#[from] RadrootsNip01VerificationError),
#[error("transport contract error: {0}")]
diff --git a/crates/event_store/src/generated/source_maintenance_manifest.rs b/crates/event_store/src/generated/source_maintenance_manifest.rs
@@ -1,8 +1,8 @@
// @generated by `cargo xtask contract source-maintenance-manifest --write`; do not edit.
-pub(crate) const SOURCE_MAINTENANCE_MANIFEST_JSON: &str = "{\n \"schema_version\": 1,\n \"contract_id\": \"radroots_event_store.source_maintenance_v1\",\n \"hook_id\": \"source_maintenance_v1\",\n \"manifest_schema\": {\n \"path\": \"crates/event_store/contracts/source_maintenance_v1.manifest.schema.json\",\n \"byte_length\": 12315,\n \"sha256\": \"96ea98a5abf3348b61565954cd34f2c622411d8dd34205ef04134bbe0e3d3f2b\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n \"predecessor\": {\n \"hook_id\": \"food_availability_projection_v1\",\n \"manifest\": {\n \"path\": \"crates/event_store/contracts/food_availability_projection_v1.manifest.json\",\n \"byte_length\": 17455,\n \"sha256\": \"02dfe1b450fbdac16e718888215b4dd5c85d8975440fa21e8f439fb24c2b2990\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n }\n },\n \"migration\": {\n \"version\": 4,\n \"name\": \"source_maintenance\",\n \"up\": {\n \"path\": \"crates/event_store/migrations/0004_source_maintenance.up.sql\",\n \"byte_length\": 19841,\n \"sha256\": \"ab2724188f8d08c897eebea2533a635e7c74282a25e84e4c0c37e78b08837a43\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n \"down\": {\n \"path\": \"crates/event_store/migrations/0004_source_maintenance.down.sql\",\n \"byte_length\": 5172,\n \"sha256\": \"fe44fd53c51545c08ea479b385e6781079dab70fc63da2a3c205d727a00ce860\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n \"schema_sha256\": \"074f85b663444ac150239ecd8441ea4a96ad83a798a55e22d2e5e2f7ee943a8c\",\n \"catalog\": {\n \"objects\": [\n \"radroots_event_store_source_capacity_delete_guard\",\n \"radroots_event_store_source_capacity_insert_guard\",\n \"radroots_event_store_source_capacity_marker_close_guard\",\n \"radroots_event_store_source_capacity_update_guard\",\n \"radroots_event_store_source_capacity_v1\",\n \"radroots_event_store_source_generation_capacity_advance\",\n \"radroots_event_store_source_generation_capacity_guard\"\n ],\n \"replaced_objects\": [\n \"radroots_event_store_food_availability_image_delete_guard\",\n \"radroots_event_store_food_availability_projection_delete_guard\",\n \"radroots_event_store_source_rebuild_marker_insert_guard\"\n ],\n \"tables\": [\n \"radroots_event_store_source_capacity_v1\"\n ],\n \"fts5_tables\": []\n }\n },\n \"source_maintenance\": {\n \"version\": 1,\n \"event_contract_registry_version\": 7,\n \"capacity_authority_id\": \"radroots_event_store_source_capacity_v1\",\n \"accounting\": {\n \"algorithm\": \"sqlite_cast_blob_octet_sum_v1\",\n \"raw_event_columns\": [\n \"event_id\",\n \"pubkey\",\n \"tags_json\",\n \"content\",\n \"sig\",\n \"raw_json\"\n ],\n \"raw_tag_columns\": [\n \"event_id\",\n \"tag_name\",\n \"tag_value\",\n \"tag_json\"\n ],\n \"nullable_raw_tag_columns\": [\n \"tag_value\"\n ]\n },\n \"limits\": {\n \"raw_events\": 25000,\n \"raw_tags\": 250000,\n \"raw_event_text_bytes\": 67108864,\n \"raw_tag_text_bytes\": 33554432,\n \"retained_source_generations\": 8\n },\n \"reopen_validation\": {\n \"mode\": \"bounded_full_raw_recount_v1\",\n \"raw_event_rejection_scan_bound\": 25001,\n \"raw_tag_rejection_scan_bound\": 250001,\n \"generation_history_validation\": \"bounded_count_plus_active_ordinal_v1\",\n \"retained_generation_rejection_scan_bound\": 9\n },\n \"rebuild_seal\": {\n \"nip09_hook_id\": \"nip09_reconciliation_v1\",\n \"nip09_manifest_sha256\": \"74af832420ffbaa9805e89df3c0b34f126a443e1598f757e3372f407f9003b77\",\n \"food_hook_id\": \"food_availability_projection_v1\",\n \"food_manifest_sha256\": \"02dfe1b450fbdac16e718888215b4dd5c85d8975440fa21e8f439fb24c2b2990\",\n \"food_scope_fingerprint_sha256\": \"8b63c5ddc48a2cc7db69295238b96d5f814dba50427c80b4d0079f061e6d3de0\",\n \"active_generation_authority\": \"radroots_event_store_source_state\",\n \"marker_close_authority\": \"radroots_event_store_source_capacity_marker_close_guard\"\n }\n },\n \"entry_points\": [\n {\n \"role\": \"migration_registry\",\n \"rust_path\": \"radroots_event_store::migrations::EVENT_STORE_MIGRATIONS[3]\"\n },\n {\n \"role\": \"migration_apply_hook\",\n \"rust_path\": \"radroots_event_store::schema::apply_migration_hook\"\n },\n {\n \"role\": \"migration_validation_hook\",\n \"rust_path\": \"radroots_event_store::schema::validate_migration_hook_state\"\n },\n {\n \"role\": \"capacity_query\",\n \"rust_path\": \"radroots_event_store::RadrootsEventStore::source_capacity_v1\"\n },\n {\n \"role\": \"raw_append_preflight\",\n \"rust_path\": \"radroots_event_store::source_maintenance_v1::preflight_unique_raw_source_append_v1\"\n },\n {\n \"role\": \"raw_append_advance\",\n \"rust_path\": \"radroots_event_store::source_maintenance_v1::advance_source_capacity_after_insert_v1\"\n },\n {\n \"role\": \"generation_append_preflight\",\n \"rust_path\": \"radroots_event_store::source_maintenance_v1::preflight_source_generation_append_v1\"\n },\n {\n \"role\": \"generation_rebuild_bind\",\n \"rust_path\": \"radroots_event_store::source_maintenance_v1::bind_source_capacity_to_generation_v1\"\n },\n {\n \"role\": \"sqlite_encoding_preflight\",\n \"rust_path\": \"radroots_event_store::store::validate_main_database_encoding\"\n },\n {\n \"role\": \"source_generation_history_rollback_guard\",\n \"rust_path\": \"radroots_event_store::schema::validate_rollback_preserves_source_generation_history\"\n },\n {\n \"role\": \"result_vector_executor\",\n \"rust_path\": \"source_maintenance_v1_result_vector\"\n }\n ],\n \"source_files\": [\n {\n \"role\": \"workspace_dependency_authority\",\n \"path\": \"Cargo.toml\",\n \"byte_length\": 12411,\n \"sha256\": \"cad96f080b0cc9ac7ffda703c8807540c9cf89f47a2299b141e6e7949714bf9f\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"core_currency_value_authority\",\n \"path\": \"crates/core/src/currency.rs\",\n \"byte_length\": 4142,\n \"sha256\": \"42e6da2d8d2fdd6955dc2d83e98dd00266e02bc910b69923b117662c05089d14\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"core_decimal_value_authority\",\n \"path\": \"crates/core/src/decimal.rs\",\n \"byte_length\": 7839,\n \"sha256\": \"4b1d681a92d7a9e074bee7e1f20eb1499bb05bfc6528a6c9ba69fa7d00416550\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"core_money_value_authority\",\n \"path\": \"crates/core/src/money.rs\",\n \"byte_length\": 8025,\n \"sha256\": \"3f30bc21e21951a62fdc5d4033736ed42a883df590e8403940775bd2edfeebc5\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"core_percent_value_authority\",\n \"path\": \"crates/core/src/percent.rs\",\n \"byte_length\": 2652,\n \"sha256\": \"42ceab109881329f3539d06a0ee0381ab4359985fe185a18d58a9c9558c5eb7f\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"core_quantity_value_authority\",\n \"path\": \"crates/core/src/quantity.rs\",\n \"byte_length\": 6785,\n \"sha256\": \"d14e619da3829cdaf3ca7385fb892d330c286c1e21455c135c37518cbb588b5f\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"core_quantity_price_value_authority\",\n \"path\": \"crates/core/src/quantity_price.rs\",\n \"byte_length\": 7061,\n \"sha256\": \"d60f70377099470ed283f45868a5119d7bb46143cb250b5082a4c038ba7f6cdc\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"core_unit_value_authority\",\n \"path\": \"crates/core/src/unit.rs\",\n \"byte_length\": 10023,\n \"sha256\": \"550e9582b6a5290aac3f637b83853b21fefcbab92c432d067c83448f4b2fe3e9\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"blossom_public_surface\",\n \"path\": \"crates/blossom/src/lib.rs\",\n \"byte_length\": 510,\n \"sha256\": \"a4dfcbd193457c50c1b0fbfc91bb547981ecd3a6e23cfc6f1030edfb511dc58c\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"blossom_authorization_authority\",\n \"path\": \"crates/blossom/src/authorization.rs\",\n \"byte_length\": 39360,\n \"sha256\": \"461947b30516315a342b3b5697599f701d27050888f29f67f5d7a7ad4afa4c28\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"blossom_descriptor_authority\",\n \"path\": \"crates/blossom/src/descriptor.rs\",\n \"byte_length\": 13702,\n \"sha256\": \"b2a4ffa760256e1316f70e012d200e2b5f4afd8ede771b85a5147f96b247f599\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"blossom_error_authority\",\n \"path\": \"crates/blossom/src/error.rs\",\n \"byte_length\": 17229,\n \"sha256\": \"02af55beacf437040be17d1fc3271d6e2a62915f656ec2dbe06247deef83f95a\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"blossom_hash_authority\",\n \"path\": \"crates/blossom/src/hash.rs\",\n \"byte_length\": 11006,\n \"sha256\": \"45eca0d81ac0f46c305a32f81aafcdd90b14679d0614f72862289a6e5d4cb08f\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"blossom_media_type_authority\",\n \"path\": \"crates/blossom/src/media_type.rs\",\n \"byte_length\": 2368,\n \"sha256\": \"69db5c0f9fcdd7dbe1f22daa499f65603ae4ce198083dab2c73a36813fa18a46\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"blossom_url_authority\",\n \"path\": \"crates/blossom/src/url.rs\",\n \"byte_length\": 14580,\n \"sha256\": \"342c995fcf620e5fb32461a7d8276f5668ba2662890bd32d12780cc9121c6451\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_public_surface\",\n \"path\": \"crates/event/src/lib.rs\",\n \"byte_length\": 1993,\n \"sha256\": \"d7a869dead70892257c0a7a287ddc086c339242f9d8d22c384878315226fe050\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_contract_facade\",\n \"path\": \"crates/event/src/contract.rs\",\n \"byte_length\": 208,\n \"sha256\": \"27466bf36461071931f391c60646a13f7781d19584583166cc54c0eece76d010\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_contract_registry_v7_authority\",\n \"path\": \"crates/event/src/contract/registry_v7.rs\",\n \"byte_length\": 157252,\n \"sha256\": \"4ae8af380fd99c4b9b011981770bb352e104b7bae1784f45b1979f972a97df35\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_envelope_authority\",\n \"path\": \"crates/event/src/envelope.rs\",\n \"byte_length\": 31248,\n \"sha256\": \"3105d9cc32779b8c75bfc272f83981cc0036884c78917168389850af7aecc4cd\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_verification_typestate_authority\",\n \"path\": \"crates/event/src/verification.rs\",\n \"byte_length\": 9645,\n \"sha256\": \"8512710b2730b87c4630f140707d144f3f196685eaa26715f0ee7c99d0d3c6d2\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_admission_typestate_authority\",\n \"path\": \"crates/event/src/admission.rs\",\n \"byte_length\": 7116,\n \"sha256\": \"65034364bca02a26681261ce8dd88ba05857c20048f2f0ddb0dd43d012a6d87a\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_head_facade\",\n \"path\": \"crates/event/src/event_head.rs\",\n \"byte_length\": 97,\n \"sha256\": \"f761ff3e74c4f5e1e28381db00ce698c633ff048669b22984d14a587482e8e83\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_head_v1_authority\",\n \"path\": \"crates/event/src/event_head/v1.rs\",\n \"byte_length\": 7566,\n \"sha256\": \"6ef7537a1188086e4f414b6c5f398a305c2eca5edd0ee188b4f890f07f3322ff\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_ids_authority\",\n \"path\": \"crates/event/src/id.rs\",\n \"byte_length\": 51758,\n \"sha256\": \"8b9a2da028e9621c660dde3c40a34713e7e0e8b3fe66b64aa18de6a6e666db45\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_trade_authority\",\n \"path\": \"crates/event/src/trade.rs\",\n \"byte_length\": 68665,\n \"sha256\": \"5e1aa8bd20bc13a08e4ebc7e6306365cb74f55e1cec62af135a36eb41146dd45\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_kinds_authority\",\n \"path\": \"crates/event/src/kinds.rs\",\n \"byte_length\": 34961,\n \"sha256\": \"8b3ce6193cab1f7e1587d0c1b2880a81b0aa43c77d89671b602772db37edcebf\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_tags_authority\",\n \"path\": \"crates/event/src/tags.rs\",\n \"byte_length\": 4530,\n \"sha256\": \"cb8f12a639fc72d9238e32495d9e67e928e6627fb8c94ec0a58c5d95e7373cd6\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_draft_authority\",\n \"path\": \"crates/event/src/draft.rs\",\n \"byte_length\": 53436,\n \"sha256\": \"1eeefbcb9467eb92a9640b3dbd36faa8d98afd20e26d8a3603646a5131be3196\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_calendar_authority\",\n \"path\": \"crates/event/src/calendar.rs\",\n \"byte_length\": 103877,\n \"sha256\": \"1e0bb92b32198cea2f39df57c365d4a8c43dea301f452f1309df4078401df7fc\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_classified_listing_authority\",\n \"path\": \"crates/event/src/classified_listing.rs\",\n \"byte_length\": 8236,\n \"sha256\": \"ee022b2aaffd1642c2c1e792c79e8fce353b9edd4d6e49afdebeb74af771187e\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_profile_authority\",\n \"path\": \"crates/event/src/profile.rs\",\n \"byte_length\": 18933,\n \"sha256\": \"8f75af27179d62e09da9c4d578e1bbf9e4cda71167888f8ae48ea3d8a9e8fa38\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_post_authority\",\n \"path\": \"crates/event/src/post.rs\",\n \"byte_length\": 23135,\n \"sha256\": \"8671cb3c4da0e2ea68f95ad99688dba209c6206296300394a7d6e771f7bfc3ed\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_comment_authority\",\n \"path\": \"crates/event/src/comment.rs\",\n \"byte_length\": 36453,\n \"sha256\": \"159eb5487e67e1a834072333a7f08b38ac15756c46eaeafecaa1574aade0a824\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_food_availability_authority\",\n \"path\": \"crates/event/src/food_availability.rs\",\n \"byte_length\": 45430,\n \"sha256\": \"389dda590888278b0bd95b4e19a597f47e0f573a24e0ac3cb92c63098191a290\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_deletion_authority\",\n \"path\": \"crates/event/src/deletion.rs\",\n \"byte_length\": 31181,\n \"sha256\": \"99cf3d8e61f107602df345c6e2ac60223b9d0389537b231dd1a30a2ed0e64990\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_relay_hint_authority\",\n \"path\": \"crates/event/src/relay_hint.rs\",\n \"byte_length\": 14016,\n \"sha256\": \"095ce5284796eac71b3aa6630718d398a67ff3836a92d80444fc45fb023b4931\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_media_authority\",\n \"path\": \"crates/event/src/media.rs\",\n \"byte_length\": 3574,\n \"sha256\": \"2e91f3b5624dfab990f18abd4dd6194f1205442c798381af6b648aee88de53ee\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_social_authority\",\n \"path\": \"crates/event/src/social.rs\",\n \"byte_length\": 6284,\n \"sha256\": \"9db55b9eaa8b712430ecd7b4430e3ed50f3224a4a4c2537f9741e3026f4a1857\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_wire_facade\",\n \"path\": \"crates/event/src/wire.rs\",\n \"byte_length\": 68,\n \"sha256\": \"cb52f6006f7ecd862707d6b048f9fc407e0cd5ebcd3091b3c54e195ffa5cba64\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_wire_v1_authority\",\n \"path\": \"crates/event/src/wire/v1.rs\",\n \"byte_length\": 22132,\n \"sha256\": \"8b18760d655c01c3cbb1d1818b486c6aeae324d262c864fc1ed1297d2ecf1196\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_verification_facade\",\n \"path\": \"crates/event_codec/src/verification.rs\",\n \"byte_length\": 253,\n \"sha256\": \"b49a32df605035c87f295c0a151140d43d2e588c5e11b05183e5fc92993dae0e\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_verification_v1_authority\",\n \"path\": \"crates/event_codec/src/verification/v1.rs\",\n \"byte_length\": 8649,\n \"sha256\": \"1ef3d12f90eb7d35f4cafe36c2cc0bbd33731df278b58c9062fb13934e2a98c8\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_registry_v7_admission_authority\",\n \"path\": \"crates/event_codec/src/admission/registry_v7.rs\",\n \"byte_length\": 5360,\n \"sha256\": \"81b26be497e3314564e88b9e6f21aaaf4dee44d6f37b5e127de561553a660c48\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_profile_inbound_facade\",\n \"path\": \"crates/event_codec/src/profile/inbound.rs\",\n \"byte_length\": 86,\n \"sha256\": \"9994cbca9dcc7450ad133b6b927e7c06bee08ef813652452cc1e56a284c1be10\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_profile_registry_v7_authority\",\n \"path\": \"crates/event_codec/src/profile/inbound/registry_v7.rs\",\n \"byte_length\": 10394,\n \"sha256\": \"c37c225ea8153beb098a39c4a56203aa03382af12646f40cd3f8628663700702\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_post_inbound_facade\",\n \"path\": \"crates/event_codec/src/post/inbound.rs\",\n \"byte_length\": 86,\n \"sha256\": \"9994cbca9dcc7450ad133b6b927e7c06bee08ef813652452cc1e56a284c1be10\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_post_registry_v7_authority\",\n \"path\": \"crates/event_codec/src/post/inbound/registry_v7.rs\",\n \"byte_length\": 16025,\n \"sha256\": \"551380f1b188fbd6ac4cba988426218863ec557eb6022153da89ace2aa40d2c7\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_reply_inbound_facade\",\n \"path\": \"crates/event_codec/src/reply/inbound.rs\",\n \"byte_length\": 86,\n \"sha256\": \"9994cbca9dcc7450ad133b6b927e7c06bee08ef813652452cc1e56a284c1be10\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_reply_registry_v7_authority\",\n \"path\": \"crates/event_codec/src/reply/inbound/registry_v7.rs\",\n \"byte_length\": 26825,\n \"sha256\": \"3abb33e8d20097e41d2c81f10d023c3293390718915eb5087c663676d322bfce\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_comment_inbound_facade\",\n \"path\": \"crates/event_codec/src/comment/inbound.rs\",\n \"byte_length\": 86,\n \"sha256\": \"9994cbca9dcc7450ad133b6b927e7c06bee08ef813652452cc1e56a284c1be10\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_comment_registry_v7_authority\",\n \"path\": \"crates/event_codec/src/comment/inbound/registry_v7.rs\",\n \"byte_length\": 53802,\n \"sha256\": \"32413b80b7472cfb024984ae0e0ea67c7a42ebc98b2257d6c9d16a87f2d84ba0\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_deletion_facade\",\n \"path\": \"crates/event_codec/src/deletion/mod.rs\",\n \"byte_length\": 115,\n \"sha256\": \"17d56f82ddb0a86bc97abbcf3e037fe460ea31fff2548f527be4bf004dac3a95\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_deletion_reconciliation_v1_authority\",\n \"path\": \"crates/event_codec/src/deletion/reconciliation_v1.rs\",\n \"byte_length\": 38345,\n \"sha256\": \"dc6c55e5af2cfab0149dbb763cafa603566772fdae378988a583162c95438496\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_error_authority\",\n \"path\": \"crates/event_codec/src/error.rs\",\n \"byte_length\": 3698,\n \"sha256\": \"b20b70056ea2b48a9e3a4f7697a76e87d5f3c445641bfcc7b61d72605b146ce5\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_food_admission_authority\",\n \"path\": \"crates/event_codec/src/food_availability/admission.rs\",\n \"byte_length\": 5815,\n \"sha256\": \"96aea4bdd6938d26f03fa9bcb94e3ce8608bf674895961f8bf237554796debba\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_food_inbound_facade\",\n \"path\": \"crates/event_codec/src/food_availability/inbound.rs\",\n \"byte_length\": 86,\n \"sha256\": \"9994cbca9dcc7450ad133b6b927e7c06bee08ef813652452cc1e56a284c1be10\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_food_registry_v7_authority\",\n \"path\": \"crates/event_codec/src/food_availability/inbound/registry_v7.rs\",\n \"byte_length\": 26785,\n \"sha256\": \"d06807c62333d0b1b8496b51390210b0738ee92b1748bc7e31bd4b095fb62ed2\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_job_traits_authority\",\n \"path\": \"crates/event_codec/src/job/traits.rs\",\n \"byte_length\": 5101,\n \"sha256\": \"bc198764f2825b4b1441781493e13fc7088e7bdd04f70690480f387604b0bd47\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_store_dependency_authority\",\n \"path\": \"crates/event_store/Cargo.toml\",\n \"byte_length\": 1567,\n \"sha256\": \"46e03d3c758e1116638021a0499dfa588b4266498e0d50cfa758f9bef9bcfeb3\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_store_error_and_limits\",\n \"path\": \"crates/event_store/src/error.rs\",\n \"byte_length\": 19516,\n \"sha256\": \"384f81d13dd5a837dd336b1f990fd79718f05ceb9c9272d0e8cd14c9618e4c8b\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"generated_descriptor_registration\",\n \"path\": \"crates/event_store/src/generated.rs\",\n \"byte_length\": 144,\n \"sha256\": \"6b0a8d6f249bd4fc3f878d37cb5e418680f0f1be2d9eec2518dedf03efc47121\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"public_surface\",\n \"path\": \"crates/event_store/src/lib.rs\",\n \"byte_length\": 3844,\n \"sha256\": \"3cd9653bcb752fb3c4442d4904b98a0a6208011a9a238125b7b7073d7f4e312b\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"migration_registry\",\n \"path\": \"crates/event_store/src/migrations.rs\",\n \"byte_length\": 73585,\n \"sha256\": \"a47477d04759ec6e71d14d3d05459864eae78fce0e3c2481a1b03147f04637f7\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"predecessor_model_public_surface\",\n \"path\": \"crates/event_store/src/model.rs\",\n \"byte_length\": 33624,\n \"sha256\": \"b155993cf03f19f392068188e14adad5b5b139996434d1076a86428e1cce4255\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_store_reconciliation_v1_model\",\n \"path\": \"crates/event_store/src/model/reconciliation_v1.rs\",\n \"byte_length\": 11148,\n \"sha256\": \"37f9edd8e1b5ae3f696bc911e8a7eda0a6eac4e05d2d9e6799f041d0abf73b50\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_store_reconciliation_v1_ingest_model\",\n \"path\": \"crates/event_store/src/model/ingest_reconciliation_v1.rs\",\n \"byte_length\": 1626,\n \"sha256\": \"47bf13b3fc0f8a913a660f7d655413de0f6b90568bc4acc510aa6bd741bab47b\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"addressable_transition_feed_model\",\n \"path\": \"crates/event_store/src/model/addressable_transition_feed_v1.rs\",\n \"byte_length\": 22277,\n \"sha256\": \"3fbccc2ab44ceb66ad459ebb56c87aa250732b28248716128e91ca42d7c7656d\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"current_visibility_model\",\n \"path\": \"crates/event_store/src/model/current_visibility_v1.rs\",\n \"byte_length\": 5690,\n \"sha256\": \"57a4ccd377fc314193c34125ca2ea0a235637e888c622f60ed27bb5f55805c9d\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"food_projection_model\",\n \"path\": \"crates/event_store/src/model/food_availability_projection_v1.rs\",\n \"byte_length\": 17437,\n \"sha256\": \"28c259cdea06dd4b4a3b9103dc85a8049abee5a17f64771fd1083ae945dc009a\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"source_generation_rebuild_authority\",\n \"path\": \"crates/event_store/src/nip09/reconciliation_v1.rs\",\n \"byte_length\": 185239,\n \"sha256\": \"fb390d682a84e054d57ec6f845d32b4c28423cb238a246e2008f2e5dd529cdd5\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"nip09_successor_result_vector_executor\",\n \"path\": \"crates/event_store/tests/support/nip09_reconciliation_v1_result_vector_v2.rs\",\n \"byte_length\": 17992,\n \"sha256\": \"24a004135d4f7f4324f4a61db8384601cbcb85b9376c52e5db8ed6a1463fd045\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"schema_migration_and_reopen_authority\",\n \"path\": \"crates/event_store/src/schema.rs\",\n \"byte_length\": 146146,\n \"sha256\": \"93b060e80d3edd73f86208e4bf698fa9d53eaf1eeb04526c9261fb8b5726fb0d\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"public_store_and_transaction_authority\",\n \"path\": \"crates/event_store/src/store.rs\",\n \"byte_length\": 395033,\n \"sha256\": \"9b990626ac85e70277a869bb31870f9e15e8208e1136a574f99a091632797d99\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"addressable_transition_feed_store\",\n \"path\": \"crates/event_store/src/store/addressable_transition_feed_v1.rs\",\n \"byte_length\": 40259,\n \"sha256\": \"ebb3b502c55ad218a1551f8ba2b9cc6dca4b34a1010e21002a3165ac8f66edee\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"current_visibility_store\",\n \"path\": \"crates/event_store/src/store/current_visibility_v1.rs\",\n \"byte_length\": 15785,\n \"sha256\": \"165086b7226189ab67600fb4b3c83abfba099e31c1018962d445437a2fe41ce5\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"food_projection_store\",\n \"path\": \"crates/event_store/src/store/food_availability_projection_v1.rs\",\n \"byte_length\": 48959,\n \"sha256\": \"28197d8d308e14e91391d38d69a45e8286a1513cff4c3e65b40c915e872ad423\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"predecessor_post_core_v1_extension\",\n \"path\": \"crates/event_store/src/store/post_core_extensions_v1.rs\",\n \"byte_length\": 6922,\n \"sha256\": \"fc18d92f6f4d8cb5b8428c4bd64bcf6d0c9b013e9fbe815830b5a4ab9fe07d45\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"predecessor_post_core_v1_storage\",\n \"path\": \"crates/event_store/src/store/post_core_storage_v1.rs\",\n \"byte_length\": 16896,\n \"sha256\": \"8d0349a0d065708448f8e60387861a39099831142f87dd9a60ee3c6dafae031a\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"raw_ingest_capacity_authority\",\n \"path\": \"crates/event_store/src/store/protocol_reconciliation_v1.rs\",\n \"byte_length\": 30162,\n \"sha256\": \"2934caaf352475a9d50ac79eb9f3e5053075e6a66fb71cfe367a86c212d0159a\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"predecessor_protocol_storage\",\n \"path\": \"crates/event_store/src/store/protocol_storage_v1.rs\",\n \"byte_length\": 10939,\n \"sha256\": \"53593f1c4ea0ff524b31a0e9c027803af051f5bd4fd5d70509508f580ee6dea6\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"source_maintenance_runtime\",\n \"path\": \"crates/event_store/src/source_maintenance_v1.rs\",\n \"byte_length\": 51849,\n \"sha256\": \"db43df5849c811d767a87bfa7884ce499400d0b169734e18242542a4415b3a51\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"predecessor_food_result_vector_executor\",\n \"path\": \"crates/event_store/tests/food_availability_projection_v1_result_vector.rs\",\n \"byte_length\": 34062,\n \"sha256\": \"e3778e4f154845a088d32a83055b678efc1511bc7ae5bb82f4be61df2f6ef88e\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"artifact_transaction_authority\",\n \"path\": \"tools/xtask/src/contract/artifact_bundle.rs\",\n \"byte_length\": 38279,\n \"sha256\": \"f326ea57b56d40135f95b6b1e15961f66eed363337180a6d12a5ea903e1a9a29\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"predecessor_successor_governance\",\n \"path\": \"tools/xtask/src/contract/food_availability_projection.rs\",\n \"byte_length\": 198719,\n \"sha256\": \"11e5628b20839fd88e28abef64d4e35a504d7bd42149691bcce67575cbc17a1c\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"transitive_predecessor_membership_governance\",\n \"path\": \"tools/xtask/src/contract/nip09_reconciliation.rs\",\n \"byte_length\": 838346,\n \"sha256\": \"506005717ab5d5785f5d6fcca54fdb1cddffa7eadebb176bf35cc0d6b3f67003\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"source_maintenance_governance\",\n \"path\": \"tools/xtask/src/contract/source_maintenance.rs\",\n \"byte_length\": 196407,\n \"sha256\": \"69dc1b2530ab01ef6059e338f2ef80163d409376b0315dbacb23bab34b641074\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"contract_command_authority\",\n \"path\": \"tools/xtask/src/contract.rs\",\n \"byte_length\": 506342,\n \"sha256\": \"a506f13c9cf95fa60249f7c2aa8947ad5c9c821f82962c549dd324fd69917502\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"dto_root_generation_authority\",\n \"path\": \"tools/xtask/src/dto_roots.rs\",\n \"byte_length\": 35940,\n \"sha256\": \"a899a5695d7533c151d03477c4bd697a6e55c47a4980549724ac42046af694f5\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"xtask_dispatch_and_release_preflight\",\n \"path\": \"tools/xtask/src/main.rs\",\n \"byte_length\": 16426,\n \"sha256\": \"abc24896c6c740c10811a3e003ec4be8ebdb376a7b6b01445bfa7a5889f094a7\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n }\n ],\n \"public_api\": {\n \"inherited_predecessor_symbols\": [\n \"RADROOTS_ADDRESSABLE_TRANSITION_CURSOR_JSON_MAX_BYTES_V1\",\n \"RADROOTS_ADDRESSABLE_TRANSITION_D_TAG_MAX_BYTES_V1\",\n \"RADROOTS_ADDRESSABLE_TRANSITION_FEED_VERSION_V1\",\n \"RADROOTS_ADDRESSABLE_TRANSITION_PAGE_LIMIT_MAX_V1\",\n \"RADROOTS_ADDRESSABLE_TRANSITION_PAGE_RAW_JSON_MAX_BYTES_V1\",\n \"RADROOTS_ADDRESSABLE_TRANSITION_PAGE_SCAN_MAX_V1\",\n \"RADROOTS_ADDRESSABLE_TRANSITION_SCOPE_KIND_MAX_V1\",\n \"RADROOTS_FOOD_AVAILABILITY_PROJECTION_APPLY_PAGE_LIMIT_V1\",\n \"RADROOTS_FOOD_AVAILABILITY_PROJECTION_VERSION_V1\",\n \"RADROOTS_FOOD_AVAILABILITY_SEARCH_QUERY_MAX_BYTES_V1\",\n \"RADROOTS_FOOD_AVAILABILITY_SEARCH_QUERY_MAX_TERMS_V1\",\n \"RadrootsAddressableTransitionCauseV1\",\n \"RadrootsAddressableTransitionCoordinateV1\",\n \"RadrootsAddressableTransitionCursorV1\",\n \"RadrootsAddressableTransitionEventReferenceV1\",\n \"RadrootsAddressableTransitionOriginV1\",\n \"RadrootsAddressableTransitionPageV1\",\n \"RadrootsAddressableTransitionRawHeadDecisionV1\",\n \"RadrootsAddressableTransitionScopeFingerprintV1\",\n \"RadrootsAddressableTransitionScopeV1\",\n \"RadrootsAddressableTransitionV1\",\n \"RadrootsAddressableTransitionVisibilityV1\",\n \"RadrootsCurrentEventVisibilityV1\",\n \"RadrootsCurrentVisibilityDecisionV1\",\n \"RadrootsFoodAvailabilitySearchQueryV1\",\n \"RadrootsFoodAvailabilityStatusFilterV1\",\n \"RadrootsNip09SuppressionEvidenceV1\",\n \"RadrootsNip09SuppressionOutcome\",\n \"RadrootsNip09SuppressionReason\",\n \"RadrootsStoreProducedCanonicalEventV1\",\n \"RadrootsStoredFoodAvailabilityImageV1\",\n \"RadrootsStoredFoodAvailabilityV1\"\n ],\n \"added_symbols\": [\n \"RADROOTS_EVENT_STORE_RAW_EVENT_COUNT_LIMIT_V1\",\n \"RADROOTS_EVENT_STORE_RAW_EVENT_TEXT_BYTES_LIMIT_V1\",\n \"RADROOTS_EVENT_STORE_RAW_TAG_COUNT_LIMIT_V1\",\n \"RADROOTS_EVENT_STORE_RAW_TAG_TEXT_BYTES_LIMIT_V1\",\n \"RADROOTS_EVENT_STORE_RETAINED_SOURCE_GENERATION_LIMIT_V1\",\n \"RadrootsEventStoreSourceCapacityResourceV1\",\n \"RadrootsEventStoreSourceCapacityV1\"\n ],\n \"methods\": [\n \"RadrootsEventStore::source_capacity_v1\",\n \"RadrootsEventStoreSourceCapacityResourceV1::as_str\",\n \"RadrootsEventStoreSourceCapacityV1::source_generation\",\n \"RadrootsEventStoreSourceCapacityV1::raw_event_count\",\n \"RadrootsEventStoreSourceCapacityV1::raw_tag_count\",\n \"RadrootsEventStoreSourceCapacityV1::raw_event_text_bytes\",\n \"RadrootsEventStoreSourceCapacityV1::raw_tag_text_bytes\",\n \"RadrootsEventStoreSourceCapacityV1::raw_high_water_seq\",\n \"RadrootsEventStoreSourceCapacityV1::retained_generation_count\",\n \"RadrootsEventStoreSourceCapacityV1::retained_generation_limit\"\n ],\n \"error_variants\": [\n \"SourceCapacityExceeded\",\n \"SourceGenerationHistoryLimitReached\",\n \"PersistedEphemeralRawEvent\",\n \"SourceCapacityStateDrift\",\n \"SqliteMainDatabaseEncodingNotUtf8\",\n \"RollbackWouldDiscardSourceGenerationHistory\"\n ],\n \"removed_symbols\": [\n \"RadrootsEventStoreReconciliationResource\",\n \"RadrootsEventStoreError::ReconciliationCapacityExceeded\"\n ],\n \"breaking_replacements\": [\n {\n \"removed\": \"RadrootsEventStoreReconciliationResource\",\n \"replacement\": \"RadrootsEventStoreSourceCapacityResourceV1\"\n },\n {\n \"removed\": \"RadrootsEventStoreError::ReconciliationCapacityExceeded\",\n \"replacement\": \"RadrootsEventStoreError::SourceCapacityExceeded\"\n }\n ]\n },\n \"result_vector\": {\n \"canonical_path\": \"contracts/conformance/vectors/event_store/source_maintenance.v1.json\",\n \"mirror_path\": \"crates/event_store/tests/fixtures/source_maintenance.v1.json\",\n \"byte_length\": 16253,\n \"sha256\": \"997aba2604a2b9d199fb87dc9d07942ca50d91863aeadcf3eeacf16d191dd71f\",\n \"hash_algorithm\": \"sha256_bytes_v1\",\n \"executor_id\": \"radroots_event_store.source_maintenance_v1.result_vector_executor.v1\",\n \"executor_path\": \"crates/event_store/tests/source_maintenance_v1_result_vector.rs\",\n \"executor_test\": \"source_maintenance_v1_result_vector\",\n \"executor_byte_length\": 23510,\n \"executor_sha256\": \"a7487afdfe19fc5fc794811d0f0e6035203e1aabcf0a33a1d398f6b3555d38f3\",\n \"executor_hash_algorithm\": \"sha256_bytes_v1\"\n }\n}\n";
-pub(crate) const SOURCE_MAINTENANCE_MANIFEST_BYTE_LENGTH: usize = 33844;
+pub(crate) const SOURCE_MAINTENANCE_MANIFEST_JSON: &str = "{\n \"schema_version\": 1,\n \"contract_id\": \"radroots_event_store.source_maintenance_v1\",\n \"hook_id\": \"source_maintenance_v1\",\n \"manifest_schema\": {\n \"path\": \"crates/event_store/contracts/source_maintenance_v1.manifest.schema.json\",\n \"byte_length\": 12315,\n \"sha256\": \"96ea98a5abf3348b61565954cd34f2c622411d8dd34205ef04134bbe0e3d3f2b\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n \"predecessor\": {\n \"hook_id\": \"food_availability_projection_v1\",\n \"manifest\": {\n \"path\": \"crates/event_store/contracts/food_availability_projection_v1.manifest.json\",\n \"byte_length\": 17455,\n \"sha256\": \"02dfe1b450fbdac16e718888215b4dd5c85d8975440fa21e8f439fb24c2b2990\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n }\n },\n \"migration\": {\n \"version\": 4,\n \"name\": \"source_maintenance\",\n \"up\": {\n \"path\": \"crates/event_store/migrations/0004_source_maintenance.up.sql\",\n \"byte_length\": 19841,\n \"sha256\": \"ab2724188f8d08c897eebea2533a635e7c74282a25e84e4c0c37e78b08837a43\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n \"down\": {\n \"path\": \"crates/event_store/migrations/0004_source_maintenance.down.sql\",\n \"byte_length\": 5172,\n \"sha256\": \"fe44fd53c51545c08ea479b385e6781079dab70fc63da2a3c205d727a00ce860\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n \"schema_sha256\": \"074f85b663444ac150239ecd8441ea4a96ad83a798a55e22d2e5e2f7ee943a8c\",\n \"catalog\": {\n \"objects\": [\n \"radroots_event_store_source_capacity_delete_guard\",\n \"radroots_event_store_source_capacity_insert_guard\",\n \"radroots_event_store_source_capacity_marker_close_guard\",\n \"radroots_event_store_source_capacity_update_guard\",\n \"radroots_event_store_source_capacity_v1\",\n \"radroots_event_store_source_generation_capacity_advance\",\n \"radroots_event_store_source_generation_capacity_guard\"\n ],\n \"replaced_objects\": [\n \"radroots_event_store_food_availability_image_delete_guard\",\n \"radroots_event_store_food_availability_projection_delete_guard\",\n \"radroots_event_store_source_rebuild_marker_insert_guard\"\n ],\n \"tables\": [\n \"radroots_event_store_source_capacity_v1\"\n ],\n \"fts5_tables\": []\n }\n },\n \"source_maintenance\": {\n \"version\": 1,\n \"event_contract_registry_version\": 7,\n \"capacity_authority_id\": \"radroots_event_store_source_capacity_v1\",\n \"accounting\": {\n \"algorithm\": \"sqlite_cast_blob_octet_sum_v1\",\n \"raw_event_columns\": [\n \"event_id\",\n \"pubkey\",\n \"tags_json\",\n \"content\",\n \"sig\",\n \"raw_json\"\n ],\n \"raw_tag_columns\": [\n \"event_id\",\n \"tag_name\",\n \"tag_value\",\n \"tag_json\"\n ],\n \"nullable_raw_tag_columns\": [\n \"tag_value\"\n ]\n },\n \"limits\": {\n \"raw_events\": 25000,\n \"raw_tags\": 250000,\n \"raw_event_text_bytes\": 67108864,\n \"raw_tag_text_bytes\": 33554432,\n \"retained_source_generations\": 8\n },\n \"reopen_validation\": {\n \"mode\": \"bounded_full_raw_recount_v1\",\n \"raw_event_rejection_scan_bound\": 25001,\n \"raw_tag_rejection_scan_bound\": 250001,\n \"generation_history_validation\": \"bounded_count_plus_active_ordinal_v1\",\n \"retained_generation_rejection_scan_bound\": 9\n },\n \"rebuild_seal\": {\n \"nip09_hook_id\": \"nip09_reconciliation_v1\",\n \"nip09_manifest_sha256\": \"74af832420ffbaa9805e89df3c0b34f126a443e1598f757e3372f407f9003b77\",\n \"food_hook_id\": \"food_availability_projection_v1\",\n \"food_manifest_sha256\": \"02dfe1b450fbdac16e718888215b4dd5c85d8975440fa21e8f439fb24c2b2990\",\n \"food_scope_fingerprint_sha256\": \"8b63c5ddc48a2cc7db69295238b96d5f814dba50427c80b4d0079f061e6d3de0\",\n \"active_generation_authority\": \"radroots_event_store_source_state\",\n \"marker_close_authority\": \"radroots_event_store_source_capacity_marker_close_guard\"\n }\n },\n \"entry_points\": [\n {\n \"role\": \"migration_registry\",\n \"rust_path\": \"radroots_event_store::migrations::EVENT_STORE_MIGRATIONS[3]\"\n },\n {\n \"role\": \"migration_apply_hook\",\n \"rust_path\": \"radroots_event_store::schema::apply_migration_hook\"\n },\n {\n \"role\": \"migration_validation_hook\",\n \"rust_path\": \"radroots_event_store::schema::validate_migration_hook_state\"\n },\n {\n \"role\": \"capacity_query\",\n \"rust_path\": \"radroots_event_store::RadrootsEventStore::source_capacity_v1\"\n },\n {\n \"role\": \"raw_append_preflight\",\n \"rust_path\": \"radroots_event_store::source_maintenance_v1::preflight_unique_raw_source_append_v1\"\n },\n {\n \"role\": \"raw_append_advance\",\n \"rust_path\": \"radroots_event_store::source_maintenance_v1::advance_source_capacity_after_insert_v1\"\n },\n {\n \"role\": \"generation_append_preflight\",\n \"rust_path\": \"radroots_event_store::source_maintenance_v1::preflight_source_generation_append_v1\"\n },\n {\n \"role\": \"generation_rebuild_bind\",\n \"rust_path\": \"radroots_event_store::source_maintenance_v1::bind_source_capacity_to_generation_v1\"\n },\n {\n \"role\": \"sqlite_encoding_preflight\",\n \"rust_path\": \"radroots_event_store::store::validate_main_database_encoding\"\n },\n {\n \"role\": \"source_generation_history_rollback_guard\",\n \"rust_path\": \"radroots_event_store::schema::validate_rollback_preserves_source_generation_history\"\n },\n {\n \"role\": \"result_vector_executor\",\n \"rust_path\": \"source_maintenance_v1_result_vector\"\n }\n ],\n \"source_files\": [\n {\n \"role\": \"workspace_dependency_authority\",\n \"path\": \"Cargo.toml\",\n \"byte_length\": 12411,\n \"sha256\": \"cad96f080b0cc9ac7ffda703c8807540c9cf89f47a2299b141e6e7949714bf9f\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"core_currency_value_authority\",\n \"path\": \"crates/core/src/currency.rs\",\n \"byte_length\": 4142,\n \"sha256\": \"42e6da2d8d2fdd6955dc2d83e98dd00266e02bc910b69923b117662c05089d14\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"core_decimal_value_authority\",\n \"path\": \"crates/core/src/decimal.rs\",\n \"byte_length\": 7839,\n \"sha256\": \"4b1d681a92d7a9e074bee7e1f20eb1499bb05bfc6528a6c9ba69fa7d00416550\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"core_money_value_authority\",\n \"path\": \"crates/core/src/money.rs\",\n \"byte_length\": 8025,\n \"sha256\": \"3f30bc21e21951a62fdc5d4033736ed42a883df590e8403940775bd2edfeebc5\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"core_percent_value_authority\",\n \"path\": \"crates/core/src/percent.rs\",\n \"byte_length\": 2652,\n \"sha256\": \"42ceab109881329f3539d06a0ee0381ab4359985fe185a18d58a9c9558c5eb7f\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"core_quantity_value_authority\",\n \"path\": \"crates/core/src/quantity.rs\",\n \"byte_length\": 6785,\n \"sha256\": \"d14e619da3829cdaf3ca7385fb892d330c286c1e21455c135c37518cbb588b5f\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"core_quantity_price_value_authority\",\n \"path\": \"crates/core/src/quantity_price.rs\",\n \"byte_length\": 7061,\n \"sha256\": \"d60f70377099470ed283f45868a5119d7bb46143cb250b5082a4c038ba7f6cdc\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"core_unit_value_authority\",\n \"path\": \"crates/core/src/unit.rs\",\n \"byte_length\": 10023,\n \"sha256\": \"550e9582b6a5290aac3f637b83853b21fefcbab92c432d067c83448f4b2fe3e9\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"blossom_public_surface\",\n \"path\": \"crates/blossom/src/lib.rs\",\n \"byte_length\": 510,\n \"sha256\": \"a4dfcbd193457c50c1b0fbfc91bb547981ecd3a6e23cfc6f1030edfb511dc58c\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"blossom_authorization_authority\",\n \"path\": \"crates/blossom/src/authorization.rs\",\n \"byte_length\": 39360,\n \"sha256\": \"461947b30516315a342b3b5697599f701d27050888f29f67f5d7a7ad4afa4c28\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"blossom_descriptor_authority\",\n \"path\": \"crates/blossom/src/descriptor.rs\",\n \"byte_length\": 13702,\n \"sha256\": \"b2a4ffa760256e1316f70e012d200e2b5f4afd8ede771b85a5147f96b247f599\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"blossom_error_authority\",\n \"path\": \"crates/blossom/src/error.rs\",\n \"byte_length\": 17229,\n \"sha256\": \"02af55beacf437040be17d1fc3271d6e2a62915f656ec2dbe06247deef83f95a\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"blossom_hash_authority\",\n \"path\": \"crates/blossom/src/hash.rs\",\n \"byte_length\": 11006,\n \"sha256\": \"45eca0d81ac0f46c305a32f81aafcdd90b14679d0614f72862289a6e5d4cb08f\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"blossom_media_type_authority\",\n \"path\": \"crates/blossom/src/media_type.rs\",\n \"byte_length\": 2368,\n \"sha256\": \"69db5c0f9fcdd7dbe1f22daa499f65603ae4ce198083dab2c73a36813fa18a46\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"blossom_url_authority\",\n \"path\": \"crates/blossom/src/url.rs\",\n \"byte_length\": 14580,\n \"sha256\": \"342c995fcf620e5fb32461a7d8276f5668ba2662890bd32d12780cc9121c6451\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_public_surface\",\n \"path\": \"crates/event/src/lib.rs\",\n \"byte_length\": 1892,\n \"sha256\": \"5d609b963a9b8db18ef96a10f394617413734d2631774d3296e6d8fc029cb02c\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_contract_facade\",\n \"path\": \"crates/event/src/contract.rs\",\n \"byte_length\": 208,\n \"sha256\": \"27466bf36461071931f391c60646a13f7781d19584583166cc54c0eece76d010\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_contract_registry_v7_authority\",\n \"path\": \"crates/event/src/contract/registry_v7.rs\",\n \"byte_length\": 145805,\n \"sha256\": \"0a62603f6fc05dc9f758561cf7da258c676ada810ceaeca7fb151364a5c83d62\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_envelope_authority\",\n \"path\": \"crates/event/src/envelope.rs\",\n \"byte_length\": 29310,\n \"sha256\": \"29f8d8c4b17c01cb5a8c7f59e4ce52e134180e0e6f37d265063d278b8f2ff26e\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_verification_typestate_authority\",\n \"path\": \"crates/event/src/verification.rs\",\n \"byte_length\": 9400,\n \"sha256\": \"417acb2ce670d266b1fa4fcafd6b48a910218deab38f57fb8b942056db76f94d\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_admission_typestate_authority\",\n \"path\": \"crates/event/src/admission.rs\",\n \"byte_length\": 7052,\n \"sha256\": \"62bd2ceb0f434946fdfc2b81f4efb13738676a29a6936c23a427e43aadf2d9cb\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_head_facade\",\n \"path\": \"crates/event/src/event_head.rs\",\n \"byte_length\": 97,\n \"sha256\": \"f761ff3e74c4f5e1e28381db00ce698c633ff048669b22984d14a587482e8e83\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_head_v1_authority\",\n \"path\": \"crates/event/src/event_head/v1.rs\",\n \"byte_length\": 6849,\n \"sha256\": \"9f4144d8d240023cf493ce0b538ade4c16dc44204d6b5f2797152caf6f9e7dba\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_ids_authority\",\n \"path\": \"crates/event/src/id.rs\",\n \"byte_length\": 48381,\n \"sha256\": \"a08fe3873815453a03318a706e2fa98a8a6728ec69d24368a87ec60025566fe0\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_trade_authority\",\n \"path\": \"crates/event/src/trade.rs\",\n \"byte_length\": 65549,\n \"sha256\": \"f818a7287ed82de3fb9ef1d973f0fb18d84b30eb4827ddc576ee502dd980145f\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_kinds_authority\",\n \"path\": \"crates/event/src/kinds.rs\",\n \"byte_length\": 34961,\n \"sha256\": \"8b3ce6193cab1f7e1587d0c1b2880a81b0aa43c77d89671b602772db37edcebf\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_tags_authority\",\n \"path\": \"crates/event/src/tags.rs\",\n \"byte_length\": 4530,\n \"sha256\": \"cb8f12a639fc72d9238e32495d9e67e928e6627fb8c94ec0a58c5d95e7373cd6\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_draft_authority\",\n \"path\": \"crates/event/src/draft.rs\",\n \"byte_length\": 51154,\n \"sha256\": \"7fab3174e7fa6c317287ae53f049c9a5f7590c3432b99f1698c415df663265c0\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_calendar_authority\",\n \"path\": \"crates/event/src/calendar.rs\",\n \"byte_length\": 97992,\n \"sha256\": \"73e79d61ee175cb46e6123e1d28239252ddf0ad094dc1113bdb1286b63b88d57\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_classified_listing_authority\",\n \"path\": \"crates/event/src/classified_listing.rs\",\n \"byte_length\": 7956,\n \"sha256\": \"ac58484b87c7712c81f50f884d1c0dd60938571aa5f6f05d555191f529a4c2b0\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_profile_authority\",\n \"path\": \"crates/event/src/profile.rs\",\n \"byte_length\": 17011,\n \"sha256\": \"572bfe3b6f1711d109db445077f0a8453cad3f021cc0638f79201b618e16b978\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_post_authority\",\n \"path\": \"crates/event/src/post.rs\",\n \"byte_length\": 19968,\n \"sha256\": \"a822cd51eff9cbaa39db998cc5c90d117f7a983f0fe2d42d42118cb00e95982c\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_comment_authority\",\n \"path\": \"crates/event/src/comment.rs\",\n \"byte_length\": 34745,\n \"sha256\": \"24b7fda13229f21cee5cef2a9941e3aaafdbc486b19ed42731b0b6ee37c28703\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_food_availability_authority\",\n \"path\": \"crates/event/src/food_availability.rs\",\n \"byte_length\": 42829,\n \"sha256\": \"52472c07eb0855d884c60755dc3a3e1a963793451d707e51f769f2d78384f318\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_deletion_authority\",\n \"path\": \"crates/event/src/deletion.rs\",\n \"byte_length\": 30022,\n \"sha256\": \"8c3f2e32407520a8e8242c1293af32613c648fb76218b8003a18929ac0b3811f\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_dto_authority\",\n \"path\": \"crates/event/src/dto.rs\",\n \"byte_length\": 5038,\n \"sha256\": \"9e228c95ff6ff33f99441d8682781fd0a1c4d3f1db24284a43985dcbac3ba136\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_farm_crdt_authority\",\n \"path\": \"crates/event/src/farm_crdt.rs\",\n \"byte_length\": 21118,\n \"sha256\": \"cec265ac9c42b59a14be4eb96924d26a83477c27291f667f23e6e47a64b6b2c7\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_knowledge_authority\",\n \"path\": \"crates/event/src/knowledge.rs\",\n \"byte_length\": 54624,\n \"sha256\": \"3d55ff88a4e30d5d605f9ae4b2e96b9df6978d6c14e52f9aeb0b8039cfc200d7\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_operational_listing_authority\",\n \"path\": \"crates/event/src/operational_listing.rs\",\n \"byte_length\": 10307,\n \"sha256\": \"52e710db816c89c8d4b87c86541987f7447f2f7091c394c68d9cb98a27f90159\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_order_authority\",\n \"path\": \"crates/event/src/order.rs\",\n \"byte_length\": 60218,\n \"sha256\": \"4203fcc469612cac5c705884564e140b9fb076cd57079e22ed85275a8b936e50\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_reply_authority\",\n \"path\": \"crates/event/src/reply.rs\",\n \"byte_length\": 15581,\n \"sha256\": \"b0b83a1e96125c0892d932e9314519242a715fa8f46334aff765ffd248c91d9a\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_trade_validation_authority\",\n \"path\": \"crates/event/src/trade_validation.rs\",\n \"byte_length\": 4669,\n \"sha256\": \"1486f79bd1d0eadea6cc1b7646ce1f7f57ccade18334a3ea37286426676b9b98\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_relay_hint_authority\",\n \"path\": \"crates/event/src/relay_hint.rs\",\n \"byte_length\": 13598,\n \"sha256\": \"fb8b026eeccf51d78f20771c44223e7b48825aa0e3c760d6b3cb90148021a674\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_media_authority\",\n \"path\": \"crates/event/src/media.rs\",\n \"byte_length\": 3455,\n \"sha256\": \"10678af3a202d5367dbcf3bcdc0bf9fdf8d8fb89b045d7d3fb96b3cc195ab6f9\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_social_authority\",\n \"path\": \"crates/event/src/social.rs\",\n \"byte_length\": 6076,\n \"sha256\": \"a2dab19caad46eab14fac86e7c878a801a450d8ac374b0e728b71a5a224eef19\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_wire_facade\",\n \"path\": \"crates/event/src/wire.rs\",\n \"byte_length\": 68,\n \"sha256\": \"cb52f6006f7ecd862707d6b048f9fc407e0cd5ebcd3091b3c54e195ffa5cba64\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_wire_v1_authority\",\n \"path\": \"crates/event/src/wire/v1.rs\",\n \"byte_length\": 21218,\n \"sha256\": \"c3f82fefcf52b3f208f31dedceae64a29ec6ba2804896a0bb957235fd8d9ff6b\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_verification_facade\",\n \"path\": \"crates/event_codec/src/verification.rs\",\n \"byte_length\": 253,\n \"sha256\": \"b49a32df605035c87f295c0a151140d43d2e588c5e11b05183e5fc92993dae0e\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_verification_v1_authority\",\n \"path\": \"crates/event_codec/src/verification/v1.rs\",\n \"byte_length\": 8489,\n \"sha256\": \"ca52f783e8b23fa53e91b13bdefff3a9da0adafa2847556ca1a4ffe74538f421\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_registry_v7_admission_authority\",\n \"path\": \"crates/event_codec/src/admission/registry_v7.rs\",\n \"byte_length\": 5228,\n \"sha256\": \"62da30cb6ef7d0ed2d43715a73bd529283e8ae8c12571bc5c68722cb400f17b8\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_admission_facade\",\n \"path\": \"crates/event_codec/src/admission.rs\",\n \"byte_length\": 20622,\n \"sha256\": \"72a1bc6abcb32398e33567071af1469cf32ce8498e4a1c7b0ba71e1e066fb14c\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_profile_inbound_facade\",\n \"path\": \"crates/event_codec/src/profile/inbound.rs\",\n \"byte_length\": 86,\n \"sha256\": \"9994cbca9dcc7450ad133b6b927e7c06bee08ef813652452cc1e56a284c1be10\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_profile_registry_v7_authority\",\n \"path\": \"crates/event_codec/src/profile/inbound/registry_v7.rs\",\n \"byte_length\": 10347,\n \"sha256\": \"32111c0e0592229c11a93a3a8054e7b124b039451aa696a9abcb56df2a6608d3\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_post_inbound_facade\",\n \"path\": \"crates/event_codec/src/post/inbound.rs\",\n \"byte_length\": 86,\n \"sha256\": \"9994cbca9dcc7450ad133b6b927e7c06bee08ef813652452cc1e56a284c1be10\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_post_registry_v7_authority\",\n \"path\": \"crates/event_codec/src/post/inbound/registry_v7.rs\",\n \"byte_length\": 15985,\n \"sha256\": \"e17083b0596e3a55994c399bc6272c0ebf04cabaa513260b3d45dd546f7f50ef\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_reply_inbound_facade\",\n \"path\": \"crates/event_codec/src/reply/inbound.rs\",\n \"byte_length\": 86,\n \"sha256\": \"9994cbca9dcc7450ad133b6b927e7c06bee08ef813652452cc1e56a284c1be10\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_reply_registry_v7_authority\",\n \"path\": \"crates/event_codec/src/reply/inbound/registry_v7.rs\",\n \"byte_length\": 26662,\n \"sha256\": \"d1d11116ca27801b7e2f17da60900e6a9ca0b6f27ea9ee0bf19e97dbf24c0c32\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_comment_inbound_facade\",\n \"path\": \"crates/event_codec/src/comment/inbound.rs\",\n \"byte_length\": 86,\n \"sha256\": \"9994cbca9dcc7450ad133b6b927e7c06bee08ef813652452cc1e56a284c1be10\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_comment_registry_v7_authority\",\n \"path\": \"crates/event_codec/src/comment/inbound/registry_v7.rs\",\n \"byte_length\": 53311,\n \"sha256\": \"c63fe853536b17bded6073f32b53434b60fc5123f911d01c642a6b3982f09c70\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_deletion_facade\",\n \"path\": \"crates/event_codec/src/deletion/mod.rs\",\n \"byte_length\": 115,\n \"sha256\": \"17d56f82ddb0a86bc97abbcf3e037fe460ea31fff2548f527be4bf004dac3a95\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_deletion_reconciliation_v1_authority\",\n \"path\": \"crates/event_codec/src/deletion/reconciliation_v1.rs\",\n \"byte_length\": 38052,\n \"sha256\": \"06faad60285584a5910ad6b078b0141d461d62511e3ddceb8b021c8457f6a57c\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_error_authority\",\n \"path\": \"crates/event_codec/src/error.rs\",\n \"byte_length\": 3666,\n \"sha256\": \"174ce982bca37fac28d016c3ab3236441c9b31b2169ec94db6c9288b36c72849\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_food_admission_authority\",\n \"path\": \"crates/event_codec/src/food_availability/admission.rs\",\n \"byte_length\": 5681,\n \"sha256\": \"99809859090f5295572688d06bbb30dbe50524ba2c996de7ec5b26f6dd390643\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_food_authored_authority\",\n \"path\": \"crates/event_codec/src/food_availability/authored.rs\",\n \"byte_length\": 9724,\n \"sha256\": \"8673ec62ed3fc47b691efd9ca828643719803971e72b756c5b4603d409d0fba5\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_food_inbound_facade\",\n \"path\": \"crates/event_codec/src/food_availability/inbound.rs\",\n \"byte_length\": 86,\n \"sha256\": \"9994cbca9dcc7450ad133b6b927e7c06bee08ef813652452cc1e56a284c1be10\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_food_registry_v7_authority\",\n \"path\": \"crates/event_codec/src/food_availability/inbound/registry_v7.rs\",\n \"byte_length\": 26037,\n \"sha256\": \"92a7e75da3293967cec17a514479144c3c948a64542577dd58c7f07992968e4f\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_job_traits_authority\",\n \"path\": \"crates/event_codec/src/job/traits.rs\",\n \"byte_length\": 4946,\n \"sha256\": \"1b3558a3196744005978dceddd33d3a72ad1ab8f50fb1cbfd997dcfe98bb9e39\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_knowledge_verification_authority\",\n \"path\": \"crates/event_codec/src/knowledge/verification.rs\",\n \"byte_length\": 6986,\n \"sha256\": \"6f8a10ed262ce37f05acd9c89a1e37ca2fa99ce7da18407891e8abe228ee2349\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_tag_builders_authority\",\n \"path\": \"crates/event_codec/src/tag_builders.rs\",\n \"byte_length\": 9232,\n \"sha256\": \"bd81ccf04fd72358331b48eddcde087a95e115c5bd90c05fd9332644979ad5e6\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_codec_trade_facade\",\n \"path\": \"crates/event_codec/src/trade/mod.rs\",\n \"byte_length\": 21562,\n \"sha256\": \"97fd292f2ed47719098a55cad20d1f420d4c313a1349cb76a479ac620f809f48\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_store_dependency_authority\",\n \"path\": \"crates/event_store/Cargo.toml\",\n \"byte_length\": 1567,\n \"sha256\": \"46e03d3c758e1116638021a0499dfa588b4266498e0d50cfa758f9bef9bcfeb3\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_store_error_and_limits\",\n \"path\": \"crates/event_store/src/error.rs\",\n \"byte_length\": 19464,\n \"sha256\": \"47be522eb0541619683f8b30eb6f66da821b65eb310a60815c81c7b7f3349947\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"generated_descriptor_registration\",\n \"path\": \"crates/event_store/src/generated.rs\",\n \"byte_length\": 144,\n \"sha256\": \"6b0a8d6f249bd4fc3f878d37cb5e418680f0f1be2d9eec2518dedf03efc47121\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"public_surface\",\n \"path\": \"crates/event_store/src/lib.rs\",\n \"byte_length\": 3844,\n \"sha256\": \"3cd9653bcb752fb3c4442d4904b98a0a6208011a9a238125b7b7073d7f4e312b\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"migration_registry\",\n \"path\": \"crates/event_store/src/migrations.rs\",\n \"byte_length\": 73585,\n \"sha256\": \"a47477d04759ec6e71d14d3d05459864eae78fce0e3c2481a1b03147f04637f7\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"predecessor_model_public_surface\",\n \"path\": \"crates/event_store/src/model.rs\",\n \"byte_length\": 32314,\n \"sha256\": \"d7ffa47719783c9f08cb4e00fbe47123cf0310ead06f77d3ad1d81edfda96b2c\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_store_reconciliation_v1_model\",\n \"path\": \"crates/event_store/src/model/reconciliation_v1.rs\",\n \"byte_length\": 10452,\n \"sha256\": \"bd3a8f0efe6d4b2959ab8a5b8048cd940fd078dce842083be2386544722017ef\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"event_store_reconciliation_v1_ingest_model\",\n \"path\": \"crates/event_store/src/model/ingest_reconciliation_v1.rs\",\n \"byte_length\": 1594,\n \"sha256\": \"27b02ef508b4df45a801ef72e9f92b43819ea6372a3936bc2507c67a42acd07a\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"addressable_transition_feed_model\",\n \"path\": \"crates/event_store/src/model/addressable_transition_feed_v1.rs\",\n \"byte_length\": 22229,\n \"sha256\": \"e651952d73ed0a29d2b137076f56f699beada205ac84ed8a96834e86e343fa78\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"current_visibility_model\",\n \"path\": \"crates/event_store/src/model/current_visibility_v1.rs\",\n \"byte_length\": 5634,\n \"sha256\": \"7d5b2b35ceb52d7472d68444515fa4a6aab43f6838b557aefff74fcebf487657\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"food_projection_model\",\n \"path\": \"crates/event_store/src/model/food_availability_projection_v1.rs\",\n \"byte_length\": 17109,\n \"sha256\": \"2fd51989da7f07b3e80557fb1a4b89814126eb3ffd80023e42012f0242b0584d\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"source_generation_rebuild_authority\",\n \"path\": \"crates/event_store/src/nip09/reconciliation_v1.rs\",\n \"byte_length\": 184853,\n \"sha256\": \"b6887f9f319809d401ac519137cfa78467ca26594cae53720a58a37ccc72757e\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"nip09_successor_result_vector_executor\",\n \"path\": \"crates/event_store/tests/support/nip09_reconciliation_v1_result_vector_v2.rs\",\n \"byte_length\": 17976,\n \"sha256\": \"f9b17af1b9df22c78b5be76a2a62fb6d55153e0b4173462d6cacc7305aedc967\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"schema_migration_and_reopen_authority\",\n \"path\": \"crates/event_store/src/schema.rs\",\n \"byte_length\": 146146,\n \"sha256\": \"93b060e80d3edd73f86208e4bf698fa9d53eaf1eeb04526c9261fb8b5726fb0d\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"public_store_and_transaction_authority\",\n \"path\": \"crates/event_store/src/store.rs\",\n \"byte_length\": 393835,\n \"sha256\": \"d47f5d8d95599783162533dcd26b0114160a098ddef3447fb2ee6648c3949e5f\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"addressable_transition_feed_store\",\n \"path\": \"crates/event_store/src/store/addressable_transition_feed_v1.rs\",\n \"byte_length\": 40216,\n \"sha256\": \"31ed3390d279aee5261848386889cf256667759b9898be5607856a3f80fd7eb7\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"current_visibility_store\",\n \"path\": \"crates/event_store/src/store/current_visibility_v1.rs\",\n \"byte_length\": 15737,\n \"sha256\": \"aa5d1bff7a5368cbac2b37906bb40f54bfc8aa6906bab34369569fdd105bf899\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"food_projection_store\",\n \"path\": \"crates/event_store/src/store/food_availability_projection_v1.rs\",\n \"byte_length\": 48927,\n \"sha256\": \"78a96d441e2fbfdfc6f9e2787ae773e8fd6aa5c53ca10d658350b843c0d1537e\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"predecessor_post_core_v1_extension\",\n \"path\": \"crates/event_store/src/store/post_core_extensions_v1.rs\",\n \"byte_length\": 6569,\n \"sha256\": \"f5bd8ddb45e1b2144895bd8da737fc92db051be1844ce7e8047a32b47376ce37\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"predecessor_post_core_v1_storage\",\n \"path\": \"crates/event_store/src/store/post_core_storage_v1.rs\",\n \"byte_length\": 16558,\n \"sha256\": \"d88c1f7ff5cc0a19221ad893eb840d55c11535f13adf84ffb3076cbc18d4abf1\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"raw_ingest_capacity_authority\",\n \"path\": \"crates/event_store/src/store/protocol_reconciliation_v1.rs\",\n \"byte_length\": 29950,\n \"sha256\": \"c72aaff06e4f35d0b4523c6625e83345879f9e15b9fe9563dccf589e5d01e277\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"predecessor_protocol_storage\",\n \"path\": \"crates/event_store/src/store/protocol_storage_v1.rs\",\n \"byte_length\": 10835,\n \"sha256\": \"c82179b9f57968191f3e71dd008cc701787c62715ada74090eeecaa3b213076d\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"source_maintenance_runtime\",\n \"path\": \"crates/event_store/src/source_maintenance_v1.rs\",\n \"byte_length\": 51849,\n \"sha256\": \"db43df5849c811d767a87bfa7884ce499400d0b169734e18242542a4415b3a51\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"predecessor_food_result_vector_executor\",\n \"path\": \"crates/event_store/tests/food_availability_projection_v1_result_vector.rs\",\n \"byte_length\": 34046,\n \"sha256\": \"776903c6431ff07f26c6ad6b713db5628efce1a72f34d86de6e47d4404fa3a6d\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"artifact_transaction_authority\",\n \"path\": \"tools/xtask/src/contract/artifact_bundle.rs\",\n \"byte_length\": 38279,\n \"sha256\": \"f326ea57b56d40135f95b6b1e15961f66eed363337180a6d12a5ea903e1a9a29\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"predecessor_successor_governance\",\n \"path\": \"tools/xtask/src/contract/food_availability_projection.rs\",\n \"byte_length\": 198719,\n \"sha256\": \"11e5628b20839fd88e28abef64d4e35a504d7bd42149691bcce67575cbc17a1c\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"transitive_predecessor_membership_governance\",\n \"path\": \"tools/xtask/src/contract/nip09_reconciliation.rs\",\n \"byte_length\": 838146,\n \"sha256\": \"3bfaf8b2cef8a93217b65ba86b914ece93b552e463f8f378ac2659ab31c32c00\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"source_maintenance_governance\",\n \"path\": \"tools/xtask/src/contract/source_maintenance.rs\",\n \"byte_length\": 198386,\n \"sha256\": \"0b27791f0f9695fe7dd2e03d5fcb776dd2cc1ee9c68ca62032ea574ef10086b1\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"contract_command_authority\",\n \"path\": \"tools/xtask/src/contract.rs\",\n \"byte_length\": 503671,\n \"sha256\": \"82a33a2227fe63eed1d8ca5908f51f48c4ac4aa1d4527a7633980673fd9a6a30\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"dto_root_generation_authority\",\n \"path\": \"tools/xtask/src/dto_roots.rs\",\n \"byte_length\": 35940,\n \"sha256\": \"a899a5695d7533c151d03477c4bd697a6e55c47a4980549724ac42046af694f5\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n },\n {\n \"role\": \"xtask_dispatch_and_release_preflight\",\n \"path\": \"tools/xtask/src/main.rs\",\n \"byte_length\": 16426,\n \"sha256\": \"abc24896c6c740c10811a3e003ec4be8ebdb376a7b6b01445bfa7a5889f094a7\",\n \"hash_algorithm\": \"sha256_bytes_v1\"\n }\n ],\n \"public_api\": {\n \"inherited_predecessor_symbols\": [\n \"RADROOTS_ADDRESSABLE_TRANSITION_CURSOR_JSON_MAX_BYTES_V1\",\n \"RADROOTS_ADDRESSABLE_TRANSITION_D_TAG_MAX_BYTES_V1\",\n \"RADROOTS_ADDRESSABLE_TRANSITION_FEED_VERSION_V1\",\n \"RADROOTS_ADDRESSABLE_TRANSITION_PAGE_LIMIT_MAX_V1\",\n \"RADROOTS_ADDRESSABLE_TRANSITION_PAGE_RAW_JSON_MAX_BYTES_V1\",\n \"RADROOTS_ADDRESSABLE_TRANSITION_PAGE_SCAN_MAX_V1\",\n \"RADROOTS_ADDRESSABLE_TRANSITION_SCOPE_KIND_MAX_V1\",\n \"RADROOTS_FOOD_AVAILABILITY_PROJECTION_APPLY_PAGE_LIMIT_V1\",\n \"RADROOTS_FOOD_AVAILABILITY_PROJECTION_VERSION_V1\",\n \"RADROOTS_FOOD_AVAILABILITY_SEARCH_QUERY_MAX_BYTES_V1\",\n \"RADROOTS_FOOD_AVAILABILITY_SEARCH_QUERY_MAX_TERMS_V1\",\n \"RadrootsAddressableTransitionCauseV1\",\n \"RadrootsAddressableTransitionCoordinateV1\",\n \"RadrootsAddressableTransitionCursorV1\",\n \"RadrootsAddressableTransitionEventReferenceV1\",\n \"RadrootsAddressableTransitionOriginV1\",\n \"RadrootsAddressableTransitionPageV1\",\n \"RadrootsAddressableTransitionRawHeadDecisionV1\",\n \"RadrootsAddressableTransitionScopeFingerprintV1\",\n \"RadrootsAddressableTransitionScopeV1\",\n \"RadrootsAddressableTransitionV1\",\n \"RadrootsAddressableTransitionVisibilityV1\",\n \"RadrootsCurrentEventVisibilityV1\",\n \"RadrootsCurrentVisibilityDecisionV1\",\n \"RadrootsFoodAvailabilitySearchQueryV1\",\n \"RadrootsFoodAvailabilityStatusFilterV1\",\n \"RadrootsNip09SuppressionEvidenceV1\",\n \"RadrootsNip09SuppressionOutcome\",\n \"RadrootsNip09SuppressionReason\",\n \"RadrootsStoreProducedCanonicalEventV1\",\n \"RadrootsStoredFoodAvailabilityImageV1\",\n \"RadrootsStoredFoodAvailabilityV1\"\n ],\n \"added_symbols\": [\n \"RADROOTS_EVENT_STORE_RAW_EVENT_COUNT_LIMIT_V1\",\n \"RADROOTS_EVENT_STORE_RAW_EVENT_TEXT_BYTES_LIMIT_V1\",\n \"RADROOTS_EVENT_STORE_RAW_TAG_COUNT_LIMIT_V1\",\n \"RADROOTS_EVENT_STORE_RAW_TAG_TEXT_BYTES_LIMIT_V1\",\n \"RADROOTS_EVENT_STORE_RETAINED_SOURCE_GENERATION_LIMIT_V1\",\n \"RadrootsEventStoreSourceCapacityResourceV1\",\n \"RadrootsEventStoreSourceCapacityV1\"\n ],\n \"methods\": [\n \"RadrootsEventStore::source_capacity_v1\",\n \"RadrootsEventStoreSourceCapacityResourceV1::as_str\",\n \"RadrootsEventStoreSourceCapacityV1::source_generation\",\n \"RadrootsEventStoreSourceCapacityV1::raw_event_count\",\n \"RadrootsEventStoreSourceCapacityV1::raw_tag_count\",\n \"RadrootsEventStoreSourceCapacityV1::raw_event_text_bytes\",\n \"RadrootsEventStoreSourceCapacityV1::raw_tag_text_bytes\",\n \"RadrootsEventStoreSourceCapacityV1::raw_high_water_seq\",\n \"RadrootsEventStoreSourceCapacityV1::retained_generation_count\",\n \"RadrootsEventStoreSourceCapacityV1::retained_generation_limit\"\n ],\n \"error_variants\": [\n \"SourceCapacityExceeded\",\n \"SourceGenerationHistoryLimitReached\",\n \"PersistedEphemeralRawEvent\",\n \"SourceCapacityStateDrift\",\n \"SqliteMainDatabaseEncodingNotUtf8\",\n \"RollbackWouldDiscardSourceGenerationHistory\"\n ],\n \"removed_symbols\": [\n \"RadrootsEventStoreReconciliationResource\",\n \"RadrootsEventStoreError::ReconciliationCapacityExceeded\"\n ],\n \"breaking_replacements\": [\n {\n \"removed\": \"RadrootsEventStoreReconciliationResource\",\n \"replacement\": \"RadrootsEventStoreSourceCapacityResourceV1\"\n },\n {\n \"removed\": \"RadrootsEventStoreError::ReconciliationCapacityExceeded\",\n \"replacement\": \"RadrootsEventStoreError::SourceCapacityExceeded\"\n }\n ]\n },\n \"result_vector\": {\n \"canonical_path\": \"contracts/conformance/vectors/event_store/source_maintenance.v1.json\",\n \"mirror_path\": \"crates/event_store/tests/fixtures/source_maintenance.v1.json\",\n \"byte_length\": 16253,\n \"sha256\": \"997aba2604a2b9d199fb87dc9d07942ca50d91863aeadcf3eeacf16d191dd71f\",\n \"hash_algorithm\": \"sha256_bytes_v1\",\n \"executor_id\": \"radroots_event_store.source_maintenance_v1.result_vector_executor.v1\",\n \"executor_path\": \"crates/event_store/tests/source_maintenance_v1_result_vector.rs\",\n \"executor_test\": \"source_maintenance_v1_result_vector\",\n \"executor_byte_length\": 23510,\n \"executor_sha256\": \"a7487afdfe19fc5fc794811d0f0e6035203e1aabcf0a33a1d398f6b3555d38f3\",\n \"executor_hash_algorithm\": \"sha256_bytes_v1\"\n }\n}\n";
+pub(crate) const SOURCE_MAINTENANCE_MANIFEST_BYTE_LENGTH: usize = 37031;
pub(crate) const SOURCE_MAINTENANCE_MANIFEST_SHA256: &str =
- "0db33542eef54da6a665c00a9c9ee6cbb2d45f955dba5ecf58967c040d2e8d63";
+ "c86ced595111f009e7888ff77c1a18052cbe5ea5889f409d9d338024c7830e0e";
pub(crate) const SOURCE_MAINTENANCE_MANIFEST_SCHEMA_VERSION: u32 = 1;
pub(crate) const SOURCE_MAINTENANCE_CONTRACT_ID: &str =
"radroots_event_store.source_maintenance_v1";
diff --git a/crates/event_store/src/model.rs b/crates/event_store/src/model.rs
@@ -34,12 +34,9 @@ pub use food_availability_projection_v1::{
};
use crate::RadrootsEventStoreError;
-use radroots_event::envelope::RadrootsEventKind;
-use radroots_event::id::{
- RadrootsDTag, RadrootsEventId, RadrootsInventoryBinId, RadrootsTradeCandidateId,
- RadrootsTradeId, RadrootsTradeMutationId,
-};
-use radroots_event::trade::RadrootsTradeMutationKindV1;
+use radroots_event::envelope::EventKind;
+use radroots_event::id::{CandidateId, DTag, EventId, InventoryBinId, MutationId, TradeId};
+use radroots_event::trade::TradeMutationKindV1;
use radroots_identity::PublicKey;
use radroots_transport::{
RadrootsTransportKind, RadrootsTransportTarget, RadrootsTransportTargetFingerprint,
@@ -299,7 +296,7 @@ impl RadrootsStoredValidEvent {
raw_event: RadrootsStoredRawEvent,
) -> Result<Self, RadrootsEventStoreError> {
let expected_class =
- StoredEventClass::from_event_kind_class(RadrootsEventKind::new(raw_event.kind).class());
+ StoredEventClass::from_event_kind_class(EventKind::new(raw_event.kind).class());
if raw_event.admission_status != RadrootsEventAdmissionStatus::Admitted
|| raw_event.event_class != expected_class
|| raw_event.event_class == StoredEventClass::Ephemeral
@@ -387,8 +384,8 @@ pub enum RadrootsEventVisibility {
},
Suppressed {
reason: RadrootsNip09SuppressionReason,
- event_reference_request_id: Option<RadrootsEventId>,
- address_reference_request_id: Option<RadrootsEventId>,
+ event_reference_request_id: Option<EventId>,
+ address_reference_request_id: Option<EventId>,
address_reference_cutoff: Option<u64>,
},
}
@@ -502,49 +499,49 @@ impl RadrootsProjectionRebuildTicket {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsStoredTradeMutation {
- pub mutation_id: RadrootsTradeMutationId,
- pub trade_id: RadrootsTradeId,
- pub root_mutation_id: Option<RadrootsTradeMutationId>,
+ pub mutation_id: MutationId,
+ pub trade_id: TradeId,
+ pub root_mutation_id: Option<MutationId>,
pub contract_id: String,
- pub mutation_kind: RadrootsTradeMutationKindV1,
+ pub mutation_kind: TradeMutationKindV1,
pub schema_version: u16,
- pub candidate_id: Option<RadrootsTradeCandidateId>,
- pub proposal_mutation_id: Option<RadrootsTradeMutationId>,
- pub target_claim_mutation_id: Option<RadrootsTradeMutationId>,
+ pub candidate_id: Option<CandidateId>,
+ pub proposal_mutation_id: Option<MutationId>,
+ pub target_claim_mutation_id: Option<MutationId>,
pub author_pubkey: PublicKey,
pub counterparty_pubkey: PublicKey,
pub buyer_pubkey: PublicKey,
pub seller_pubkey: PublicKey,
- pub farm_id: RadrootsDTag,
+ pub farm_id: DTag,
pub authored_at_unix_s: u64,
pub canonical_payload_bytes: Vec<u8>,
pub payload_sha256: String,
pub first_event_seq: i64,
- pub first_transport_event_id: RadrootsEventId,
+ pub first_transport_event_id: EventId,
pub inserted_at_ms: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsStoredTradeMutationParent {
- pub mutation_id: RadrootsTradeMutationId,
- pub parent_mutation_id: RadrootsTradeMutationId,
+ pub mutation_id: MutationId,
+ pub parent_mutation_id: MutationId,
pub parent_index: u32,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsStoredTradeMissingParent {
- pub trade_id: RadrootsTradeId,
- pub mutation_id: RadrootsTradeMutationId,
- pub missing_parent_mutation_id: RadrootsTradeMutationId,
- pub first_transport_event_id: RadrootsEventId,
+ pub trade_id: TradeId,
+ pub mutation_id: MutationId,
+ pub missing_parent_mutation_id: MutationId,
+ pub first_transport_event_id: EventId,
pub first_seen_at_ms: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsStoredTradeTransportEnvelope {
- pub transport_event_id: RadrootsEventId,
- pub mutation_id: RadrootsTradeMutationId,
- pub trade_id: RadrootsTradeId,
+ pub transport_event_id: EventId,
+ pub mutation_id: MutationId,
+ pub trade_id: TradeId,
pub transport_kind: String,
pub pubkey: PublicKey,
pub created_at: u64,
@@ -555,10 +552,10 @@ pub struct RadrootsStoredTradeTransportEnvelope {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsStoredSellerReservation {
- pub reservation_id: RadrootsDTag,
- pub trade_id: RadrootsTradeId,
- pub candidate_id: RadrootsTradeCandidateId,
- pub claim_mutation_id: RadrootsTradeMutationId,
+ pub reservation_id: DTag,
+ pub trade_id: TradeId,
+ pub candidate_id: CandidateId,
+ pub claim_mutation_id: MutationId,
pub inventory_authority_pubkey: PublicKey,
pub inventory_epoch: u64,
pub assertion_commitment: String,
@@ -569,9 +566,9 @@ pub struct RadrootsStoredSellerReservation {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsStoredSellerReservationLine {
- pub reservation_id: RadrootsDTag,
- pub line_id: RadrootsDTag,
- pub bin_id: RadrootsInventoryBinId,
+ pub reservation_id: DTag,
+ pub line_id: DTag,
+ pub bin_id: InventoryBinId,
pub quantity_mantissa: String,
pub quantity_scale: u8,
pub unit_code: String,
@@ -580,11 +577,11 @@ pub struct RadrootsStoredSellerReservationLine {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsTradeProjectionCheckpoint {
- pub trade_id: RadrootsTradeId,
+ pub trade_id: TradeId,
pub reducer_contract_id: String,
pub reducer_version: u16,
pub projection_digest: String,
- pub root_mutation_id: Option<RadrootsTradeMutationId>,
+ pub root_mutation_id: Option<MutationId>,
pub negotiation_state: String,
pub agreement_state: String,
pub evidence_state: String,
@@ -594,7 +591,7 @@ pub struct RadrootsTradeProjectionCheckpoint {
pub fulfillment_state: String,
pub payment_state: String,
pub projection_json: String,
- pub last_mutation_id: Option<RadrootsTradeMutationId>,
+ pub last_mutation_id: Option<MutationId>,
pub last_transport_event_seq: Option<i64>,
pub updated_at_ms: i64,
}
@@ -603,12 +600,12 @@ pub struct RadrootsTradeProjectionCheckpoint {
mod tests {
use super::*;
use crate::model::reconciliation_v1::{tag_semantic_name, tag_value_type_name};
- use radroots_event::contract::{RadrootsTagSemantic, RadrootsTagValueType};
- use radroots_event::envelope::RadrootsEventKindClass;
+ use radroots_event::contract::{TagSemantic, TagValueType};
+ use radroots_event::envelope::EventKindClass;
use radroots_event::envelope::event_head::{
- RadrootsCurrentEventHead, RadrootsEventHeadCoordinate, RadrootsEventHeadDecision,
+ CurrentEventHead, EventHeadCoordinate, EventHeadDecision,
};
- use radroots_event::id::RadrootsEventId;
+ use radroots_event::id::EventId;
use radroots_identity::PublicKey;
#[test]
@@ -646,19 +643,19 @@ mod tests {
);
}
assert_eq!(
- StoredEventClass::from_event_kind_class(RadrootsEventKindClass::Regular),
+ StoredEventClass::from_event_kind_class(EventKindClass::Regular),
StoredEventClass::Regular
);
assert_eq!(
- StoredEventClass::from_event_kind_class(RadrootsEventKindClass::Replaceable),
+ StoredEventClass::from_event_kind_class(EventKindClass::Replaceable),
StoredEventClass::Replaceable
);
assert_eq!(
- StoredEventClass::from_event_kind_class(RadrootsEventKindClass::Addressable),
+ StoredEventClass::from_event_kind_class(EventKindClass::Addressable),
StoredEventClass::Addressable
);
assert_eq!(
- StoredEventClass::from_event_kind_class(RadrootsEventKindClass::Ephemeral),
+ StoredEventClass::from_event_kind_class(EventKindClass::Ephemeral),
StoredEventClass::Ephemeral
);
assert!(StoredEventClass::parse("bad").is_err());
@@ -798,7 +795,7 @@ mod tests {
#[test]
fn head_decisions_and_tag_metadata_names_cover_all_variants() {
- let coordinate = RadrootsEventHeadCoordinate::Addressable {
+ let coordinate = EventHeadCoordinate::Addressable {
kind: 30_023,
pubkey: PublicKey::from_hex(
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
@@ -806,9 +803,9 @@ mod tests {
.expect("pubkey"),
d_tag: "opaque d value".to_owned(),
};
- let current = RadrootsCurrentEventHead {
+ let current = CurrentEventHead {
coordinate,
- event_id: RadrootsEventId::parse(
+ event_id: EventId::parse(
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
)
.expect("event id"),
@@ -816,129 +813,114 @@ mod tests {
};
assert_eq!(
- RadrootsRawHeadDecision::from_protocol(&RadrootsEventHeadDecision::Applied(current)),
+ RadrootsRawHeadDecision::from_protocol(&EventHeadDecision::Applied(current)),
RadrootsRawHeadDecision::Applied
);
assert_eq!(
- RadrootsRawHeadDecision::from_protocol(&RadrootsEventHeadDecision::SkippedDuplicate),
+ RadrootsRawHeadDecision::from_protocol(&EventHeadDecision::SkippedDuplicate),
RadrootsRawHeadDecision::SkippedDuplicate
);
assert_eq!(
- RadrootsRawHeadDecision::from_protocol(&RadrootsEventHeadDecision::SkippedOlder),
+ RadrootsRawHeadDecision::from_protocol(&EventHeadDecision::SkippedOlder),
RadrootsRawHeadDecision::SkippedOlder
);
assert_eq!(
RadrootsRawHeadDecision::from_protocol(
- &RadrootsEventHeadDecision::SkippedSameTimestampHigherEventId
+ &EventHeadDecision::SkippedSameTimestampHigherEventId
),
RadrootsRawHeadDecision::SkippedSameTimestampHigherEventId
);
assert_eq!(
- RadrootsRawHeadDecision::from_protocol(&RadrootsEventHeadDecision::CoordinateMismatch),
+ RadrootsRawHeadDecision::from_protocol(&EventHeadDecision::CoordinateMismatch),
RadrootsRawHeadDecision::MalformedCoordinate
);
for (semantic, expected) in [
+ (TagSemantic::AddressableCoordinate, "addressable_coordinate"),
+ (TagSemantic::CalendarEventAuthor, "calendar_event_author"),
(
- RadrootsTagSemantic::AddressableCoordinate,
- "addressable_coordinate",
- ),
- (
- RadrootsTagSemantic::CalendarEventAuthor,
- "calendar_event_author",
- ),
- (
- RadrootsTagSemantic::CalendarEventReference,
+ TagSemantic::CalendarEventReference,
"calendar_event_reference",
),
(
- RadrootsTagSemantic::CalendarEventRevision,
+ TagSemantic::CalendarEventRevision,
"calendar_event_revision",
),
(
- RadrootsTagSemantic::CalendarInclusionRequest,
+ TagSemantic::CalendarInclusionRequest,
"calendar_inclusion_request",
),
- (RadrootsTagSemantic::CalendarEnd, "calendar_end"),
- (RadrootsTagSemantic::CalendarStart, "calendar_start"),
- (RadrootsTagSemantic::Category, "category"),
- (RadrootsTagSemantic::Citation, "citation"),
- (RadrootsTagSemantic::Contract, "contract"),
- (RadrootsTagSemantic::Counterparty, "counterparty"),
- (RadrootsTagSemantic::Evidence, "evidence"),
- (RadrootsTagSemantic::EventPointer, "event_pointer"),
- (RadrootsTagSemantic::FreeBusy, "free_busy"),
- (RadrootsTagSemantic::Geohash, "geohash"),
- (RadrootsTagSemantic::GroupId, "group_id"),
- (RadrootsTagSemantic::Identifier, "identifier"),
- (RadrootsTagSemantic::Image, "image"),
- (RadrootsTagSemantic::Kind, "kind"),
- (
- RadrootsTagSemantic::ClassifiedListingAddress,
- "listing_address",
- ),
- (
- RadrootsTagSemantic::OperationalListingSnapshot,
- "listing_snapshot",
- ),
- (RadrootsTagSemantic::ListDescription, "list_description"),
- (RadrootsTagSemantic::Location, "location"),
- (RadrootsTagSemantic::Nip01Coordinate, "nip01_coordinate"),
- (RadrootsTagSemantic::Participant, "participant"),
- (RadrootsTagSemantic::PreviousEvent, "previous_event"),
- (RadrootsTagSemantic::Price, "price"),
- (RadrootsTagSemantic::PublishedAt, "published_at"),
- (RadrootsTagSemantic::Relay, "relay"),
- (RadrootsTagSemantic::Reference, "reference"),
- (RadrootsTagSemantic::ReviewTarget, "review_target"),
- (RadrootsTagSemantic::RootEvent, "root_event"),
- (RadrootsTagSemantic::ServiceInput, "service_input"),
- (RadrootsTagSemantic::ServiceOutput, "service_output"),
- (RadrootsTagSemantic::Source, "source"),
- (RadrootsTagSemantic::Status, "status"),
- (RadrootsTagSemantic::Summary, "summary"),
- (RadrootsTagSemantic::Title, "title"),
- (RadrootsTagSemantic::Topic, "topic"),
- (RadrootsTagSemantic::TimeZone, "time_zone"),
- (RadrootsTagSemantic::Url, "url"),
- (RadrootsTagSemantic::UtcDayCoverage, "utc_day_coverage"),
+ (TagSemantic::CalendarEnd, "calendar_end"),
+ (TagSemantic::CalendarStart, "calendar_start"),
+ (TagSemantic::Category, "category"),
+ (TagSemantic::Citation, "citation"),
+ (TagSemantic::Contract, "contract"),
+ (TagSemantic::Counterparty, "counterparty"),
+ (TagSemantic::Evidence, "evidence"),
+ (TagSemantic::EventPointer, "event_pointer"),
+ (TagSemantic::FreeBusy, "free_busy"),
+ (TagSemantic::Geohash, "geohash"),
+ (TagSemantic::GroupId, "group_id"),
+ (TagSemantic::Identifier, "identifier"),
+ (TagSemantic::Image, "image"),
+ (TagSemantic::Kind, "kind"),
+ (TagSemantic::ClassifiedListingAddress, "listing_address"),
+ (TagSemantic::OperationalListingSnapshot, "listing_snapshot"),
+ (TagSemantic::ListDescription, "list_description"),
+ (TagSemantic::Location, "location"),
+ (TagSemantic::Nip01Coordinate, "nip01_coordinate"),
+ (TagSemantic::Participant, "participant"),
+ (TagSemantic::PreviousEvent, "previous_event"),
+ (TagSemantic::Price, "price"),
+ (TagSemantic::PublishedAt, "published_at"),
+ (TagSemantic::Relay, "relay"),
+ (TagSemantic::Reference, "reference"),
+ (TagSemantic::ReviewTarget, "review_target"),
+ (TagSemantic::RootEvent, "root_event"),
+ (TagSemantic::ServiceInput, "service_input"),
+ (TagSemantic::ServiceOutput, "service_output"),
+ (TagSemantic::Source, "source"),
+ (TagSemantic::Status, "status"),
+ (TagSemantic::Summary, "summary"),
+ (TagSemantic::Title, "title"),
+ (TagSemantic::Topic, "topic"),
+ (TagSemantic::TimeZone, "time_zone"),
+ (TagSemantic::Url, "url"),
+ (TagSemantic::UtcDayCoverage, "utc_day_coverage"),
] {
assert_eq!(tag_semantic_name(semantic), expected);
}
for (value_type, expected) in [
(
- RadrootsTagValueType::AddressableCoordinate,
+ TagValueType::AddressableCoordinate,
"addressable_coordinate",
),
- (RadrootsTagValueType::CalendarDate, "calendar_date"),
+ (TagValueType::CalendarDate, "calendar_date"),
(
- RadrootsTagValueType::CalendarEventCoordinate,
+ TagValueType::CalendarEventCoordinate,
"calendar_event_coordinate",
),
- (RadrootsTagValueType::CalendarFreeBusy, "calendar_free_busy"),
- (
- RadrootsTagValueType::CalendarRsvpStatus,
- "calendar_rsvp_status",
- ),
- (RadrootsTagValueType::CalendarUid, "calendar_uid"),
- (RadrootsTagValueType::ContractId, "contract_id"),
- (RadrootsTagValueType::DTag, "d_tag"),
- (RadrootsTagValueType::EventId, "event_id"),
- (RadrootsTagValueType::EventPointer, "event_pointer"),
- (RadrootsTagValueType::Geohash, "geohash"),
- (RadrootsTagValueType::IanaTimeZoneId, "iana_time_zone_id"),
- (RadrootsTagValueType::Kind, "kind"),
- (RadrootsTagValueType::Nip01Coordinate, "nip01_coordinate"),
- (RadrootsTagValueType::PublicKey, "public_key"),
- (RadrootsTagValueType::RelayUrl, "relay_url"),
- (RadrootsTagValueType::Sha256, "sha256"),
- (RadrootsTagValueType::Text, "text"),
- (RadrootsTagValueType::UnixTimestamp, "unix_timestamp"),
- (RadrootsTagValueType::Uri, "uri"),
- (RadrootsTagValueType::Url, "url"),
- (RadrootsTagValueType::UtcDayIndex, "utc_day_index"),
- (RadrootsTagValueType::Uuid, "uuid"),
+ (TagValueType::CalendarFreeBusy, "calendar_free_busy"),
+ (TagValueType::CalendarRsvpStatus, "calendar_rsvp_status"),
+ (TagValueType::CalendarUid, "calendar_uid"),
+ (TagValueType::ContractId, "contract_id"),
+ (TagValueType::DTag, "d_tag"),
+ (TagValueType::EventId, "event_id"),
+ (TagValueType::EventPointer, "event_pointer"),
+ (TagValueType::Geohash, "geohash"),
+ (TagValueType::IanaTimeZoneId, "iana_time_zone_id"),
+ (TagValueType::Kind, "kind"),
+ (TagValueType::Nip01Coordinate, "nip01_coordinate"),
+ (TagValueType::PublicKey, "public_key"),
+ (TagValueType::RelayUrl, "relay_url"),
+ (TagValueType::Sha256, "sha256"),
+ (TagValueType::Text, "text"),
+ (TagValueType::UnixTimestamp, "unix_timestamp"),
+ (TagValueType::Uri, "uri"),
+ (TagValueType::Url, "url"),
+ (TagValueType::UtcDayIndex, "utc_day_index"),
+ (TagValueType::Uuid, "uuid"),
] {
assert_eq!(tag_value_type_name(value_type), expected);
}
diff --git a/crates/event_store/src/model/addressable_transition_feed_v1.rs b/crates/event_store/src/model/addressable_transition_feed_v1.rs
@@ -3,7 +3,7 @@ use super::{
RadrootsNip09SuppressionEvidenceV1,
};
use crate::RadrootsEventStoreError;
-use radroots_event::id::RadrootsEventId;
+use radroots_event::id::EventId;
use radroots_identity::PublicKey;
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
@@ -283,7 +283,7 @@ impl RadrootsAddressableTransitionRawHeadDecisionV1 {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsAddressableTransitionEventReferenceV1 {
- pub(crate) event_id: RadrootsEventId,
+ pub(crate) event_id: EventId,
pub(crate) event_seq: i64,
}
@@ -330,7 +330,7 @@ impl RadrootsAddressableTransitionCauseV1 {
/// The exact addressable head identity retained by the event store.
///
-/// This is intentionally not a [`radroots_event::id::RadrootsNip01Coordinate`]:
+/// This is intentionally not a [`radroots_event::id::Nip01Coordinate`]:
/// an individually valid maximum-size `d` tag can make the combined NIP-01
/// coordinate too large for a wire tag element while still remaining valid raw
/// head identity.
@@ -356,7 +356,7 @@ impl RadrootsAddressableTransitionCoordinateV1 {
}
impl RadrootsAddressableTransitionEventReferenceV1 {
- pub const fn event_id(&self) -> &RadrootsEventId {
+ pub const fn event_id(&self) -> &EventId {
&self.event_id
}
@@ -373,7 +373,7 @@ impl RadrootsAddressableTransitionEventReferenceV1 {
/// is not proof that the event remains current when a historical page is read.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsStoreProducedCanonicalEventV1 {
- pub(crate) event_id: RadrootsEventId,
+ pub(crate) event_id: EventId,
pub(crate) pubkey: PublicKey,
pub(crate) created_at: u64,
pub(crate) kind: u32,
@@ -381,7 +381,7 @@ pub struct RadrootsStoreProducedCanonicalEventV1 {
}
impl RadrootsStoreProducedCanonicalEventV1 {
- pub const fn event_id(&self) -> &RadrootsEventId {
+ pub const fn event_id(&self) -> &EventId {
&self.event_id
}
diff --git a/crates/event_store/src/model/current_visibility_v1.rs b/crates/event_store/src/model/current_visibility_v1.rs
@@ -1,7 +1,7 @@
use super::{
RadrootsEventAdmissionStatus, RadrootsEventStoreSourceGeneration, RadrootsStoredRawEvent,
};
-use radroots_event::id::RadrootsEventId;
+use radroots_event::id::EventId;
pub use radroots_event_codec::deletion::reconciliation_v1::evaluator::{
RadrootsNip09SuppressionOutcome, RadrootsNip09SuppressionReason,
};
@@ -10,8 +10,8 @@ pub use radroots_event_codec::deletion::reconciliation_v1::evaluator::{
pub struct RadrootsNip09SuppressionEvidenceV1 {
pub(crate) outcome: RadrootsNip09SuppressionOutcome,
pub(crate) reason: RadrootsNip09SuppressionReason,
- pub(crate) event_reference_request_id: Option<RadrootsEventId>,
- pub(crate) address_reference_request_id: Option<RadrootsEventId>,
+ pub(crate) event_reference_request_id: Option<EventId>,
+ pub(crate) address_reference_request_id: Option<EventId>,
pub(crate) address_reference_cutoff: Option<u64>,
}
@@ -24,11 +24,11 @@ impl RadrootsNip09SuppressionEvidenceV1 {
self.reason
}
- pub const fn event_reference_request_id(&self) -> Option<&RadrootsEventId> {
+ pub const fn event_reference_request_id(&self) -> Option<&EventId> {
self.event_reference_request_id.as_ref()
}
- pub const fn address_reference_request_id(&self) -> Option<&RadrootsEventId> {
+ pub const fn address_reference_request_id(&self) -> Option<&EventId> {
self.address_reference_request_id.as_ref()
}
@@ -118,7 +118,7 @@ pub struct RadrootsCurrentEventVisibilityV1 {
pub(crate) source_generation: RadrootsEventStoreSourceGeneration,
pub(crate) event: RadrootsStoredRawEvent,
pub(crate) is_raw_head: bool,
- pub(crate) raw_head_event_id: Option<RadrootsEventId>,
+ pub(crate) raw_head_event_id: Option<EventId>,
pub(crate) suppression: Option<RadrootsNip09SuppressionEvidenceV1>,
pub(crate) decision: RadrootsCurrentVisibilityDecisionV1,
}
@@ -140,7 +140,7 @@ impl RadrootsCurrentEventVisibilityV1 {
self.is_raw_head
}
- pub const fn raw_head_event_id(&self) -> Option<&RadrootsEventId> {
+ pub const fn raw_head_event_id(&self) -> Option<&EventId> {
self.raw_head_event_id.as_ref()
}
diff --git a/crates/event_store/src/model/food_availability_projection_v1.rs b/crates/event_store/src/model/food_availability_projection_v1.rs
@@ -5,11 +5,11 @@ use crate::RadrootsEventStoreError;
use radroots_blossom::Sha256;
use radroots_event::{
food::availability::{
- RADROOTS_FOOD_IMAGE_MAX_COUNT, RadrootsFoodAvailabilityStatus, RadrootsFoodContent,
- RadrootsFoodIdentifier, RadrootsFoodImageDimensions, RadrootsFoodPrice,
- RadrootsFoodPublishedAt, RadrootsFoodQuantity, RadrootsFoodText, food_media_blossom_digest,
+ FoodAvailabilityStatus, FoodContent, FoodIdentifier, FoodImageDimensions, FoodPrice,
+ FoodPublishedAt, FoodQuantity, FoodText, RADROOTS_FOOD_IMAGE_MAX_COUNT,
+ food_media_blossom_digest,
},
- id::RadrootsEventId,
+ id::EventId,
};
use radroots_event_codec::food_availability::inbound::{
RadrootsFoodAvailabilityImageDiagnostic, RadrootsInboundFoodAvailabilityImage,
@@ -129,11 +129,11 @@ pub enum RadrootsFoodAvailabilityStatusFilterV1 {
}
impl RadrootsFoodAvailabilityStatusFilterV1 {
- pub const fn status(self) -> Option<RadrootsFoodAvailabilityStatus> {
+ pub const fn status(self) -> Option<FoodAvailabilityStatus> {
match self {
Self::Any => None,
- Self::Active => Some(RadrootsFoodAvailabilityStatus::Active),
- Self::Sold => Some(RadrootsFoodAvailabilityStatus::Sold),
+ Self::Active => Some(FoodAvailabilityStatus::Active),
+ Self::Sold => Some(FoodAvailabilityStatus::Sold),
}
}
@@ -145,11 +145,11 @@ impl RadrootsFoodAvailabilityStatusFilterV1 {
}
}
-impl From<RadrootsFoodAvailabilityStatus> for RadrootsFoodAvailabilityStatusFilterV1 {
- fn from(value: RadrootsFoodAvailabilityStatus) -> Self {
+impl From<FoodAvailabilityStatus> for RadrootsFoodAvailabilityStatusFilterV1 {
+ fn from(value: FoodAvailabilityStatus) -> Self {
match value {
- RadrootsFoodAvailabilityStatus::Active => Self::Active,
- RadrootsFoodAvailabilityStatus::Sold => Self::Sold,
+ FoodAvailabilityStatus::Active => Self::Active,
+ FoodAvailabilityStatus::Sold => Self::Sold,
}
}
}
@@ -159,7 +159,7 @@ pub struct RadrootsStoredFoodAvailabilityImageV1 {
image_index: u32,
raw_tag: Vec<String>,
url: Option<String>,
- dimensions: Option<RadrootsFoodImageDimensions>,
+ dimensions: Option<FoodImageDimensions>,
blossom_sha256: Option<Sha256>,
diagnostics: Vec<RadrootsFoodAvailabilityImageDiagnostic>,
}
@@ -196,7 +196,7 @@ impl RadrootsStoredFoodAvailabilityImageV1 {
self.url.as_deref()
}
- pub const fn dimensions(&self) -> Option<RadrootsFoodImageDimensions> {
+ pub const fn dimensions(&self) -> Option<FoodImageDimensions> {
self.dimensions
}
@@ -222,18 +222,18 @@ impl RadrootsStoredFoodAvailabilityImageV1 {
pub struct RadrootsStoredFoodAvailabilityV1 {
source_generation: RadrootsEventStoreSourceGeneration,
pubkey: PublicKey,
- identifier: RadrootsFoodIdentifier,
- event_id: RadrootsEventId,
+ identifier: FoodIdentifier,
+ event_id: EventId,
event_seq: i64,
created_at: u64,
- content: RadrootsFoodContent,
- title: RadrootsFoodText,
- summary: RadrootsFoodText,
- published_at: RadrootsFoodPublishedAt,
- location: RadrootsFoodText,
- price: RadrootsFoodPrice,
- quantity: Option<RadrootsFoodQuantity>,
- status: RadrootsFoodAvailabilityStatus,
+ content: FoodContent,
+ title: FoodText,
+ summary: FoodText,
+ published_at: FoodPublishedAt,
+ location: FoodText,
+ price: FoodPrice,
+ quantity: Option<FoodQuantity>,
+ status: FoodAvailabilityStatus,
source_transition_seq: i64,
diagnostics: Vec<RadrootsFoodAvailabilityImageDiagnostic>,
images: Vec<RadrootsStoredFoodAvailabilityImageV1>,
@@ -244,7 +244,7 @@ impl RadrootsStoredFoodAvailabilityV1 {
pub(crate) fn from_projection(
source_generation: RadrootsEventStoreSourceGeneration,
pubkey: PublicKey,
- event_id: RadrootsEventId,
+ event_id: EventId,
event_seq: i64,
created_at: u64,
source_transition_seq: i64,
@@ -318,15 +318,15 @@ impl RadrootsStoredFoodAvailabilityV1 {
&self.pubkey
}
- pub const fn identifier(&self) -> &RadrootsFoodIdentifier {
+ pub const fn identifier(&self) -> &FoodIdentifier {
&self.identifier
}
- pub const fn d_tag(&self) -> &RadrootsFoodIdentifier {
+ pub const fn d_tag(&self) -> &FoodIdentifier {
self.identifier()
}
- pub const fn event_id(&self) -> &RadrootsEventId {
+ pub const fn event_id(&self) -> &EventId {
&self.event_id
}
@@ -338,35 +338,35 @@ impl RadrootsStoredFoodAvailabilityV1 {
self.created_at
}
- pub const fn content(&self) -> &RadrootsFoodContent {
+ pub const fn content(&self) -> &FoodContent {
&self.content
}
- pub const fn title(&self) -> &RadrootsFoodText {
+ pub const fn title(&self) -> &FoodText {
&self.title
}
- pub const fn summary(&self) -> &RadrootsFoodText {
+ pub const fn summary(&self) -> &FoodText {
&self.summary
}
- pub const fn published_at(&self) -> RadrootsFoodPublishedAt {
+ pub const fn published_at(&self) -> FoodPublishedAt {
self.published_at
}
- pub const fn location(&self) -> &RadrootsFoodText {
+ pub const fn location(&self) -> &FoodText {
&self.location
}
- pub const fn price(&self) -> &RadrootsFoodPrice {
+ pub const fn price(&self) -> &FoodPrice {
&self.price
}
- pub const fn quantity(&self) -> Option<&RadrootsFoodQuantity> {
+ pub const fn quantity(&self) -> Option<&FoodQuantity> {
self.quantity.as_ref()
}
- pub const fn status(&self) -> RadrootsFoodAvailabilityStatus {
+ pub const fn status(&self) -> FoodAvailabilityStatus {
self.status
}
@@ -487,7 +487,7 @@ mod tests {
Some("active")
);
assert_eq!(
- RadrootsFoodAvailabilityStatusFilterV1::from(RadrootsFoodAvailabilityStatus::Sold)
+ RadrootsFoodAvailabilityStatusFilterV1::from(FoodAvailabilityStatus::Sold)
.storage_value(),
Some("sold")
);
diff --git a/crates/event_store/src/model/ingest_reconciliation_v1.rs b/crates/event_store/src/model/ingest_reconciliation_v1.rs
@@ -1,12 +1,12 @@
use super::reconciliation_v1::RadrootsEventIngest;
use crate::RadrootsEventStoreError;
-use radroots_event::draft::RadrootsSignedEvent;
-use radroots_event::wire::v1::RadrootsNip01EventWire;
+use radroots_event::draft::SignedEvent;
+use radroots_event::wire::v1::Nip01EventWire;
use radroots_event_codec::verification::v1::verify_nip01_event_v1;
impl RadrootsEventIngest {
pub(crate) fn from_signed_event_reconciliation_v1(
- signed_event: RadrootsSignedEvent,
+ signed_event: SignedEvent,
observed_at_ms: i64,
) -> Result<Self, RadrootsEventStoreError> {
ensure_valid_ingest_timestamp(observed_at_ms)?;
@@ -25,7 +25,7 @@ impl RadrootsEventIngest {
) -> Result<Self, RadrootsEventStoreError> {
ensure_valid_ingest_timestamp(observed_at_ms)?;
let raw_json = raw_json.into();
- let wire = RadrootsNip01EventWire::parse_json(raw_json.as_str())?;
+ let wire = Nip01EventWire::parse_json(raw_json.as_str())?;
let verified_event = verify_nip01_event_v1(wire.into_envelope()?)?;
Ok(Self {
verified_event,
diff --git a/crates/event_store/src/model/reconciliation_v1.rs b/crates/event_store/src/model/reconciliation_v1.rs
@@ -1,9 +1,9 @@
use super::RadrootsTransportObservation;
use crate::RadrootsEventStoreError;
-use radroots_event::contract::registry_v7::{RadrootsTagSemantic, RadrootsTagValueType};
-use radroots_event::draft::RadrootsSignedEvent;
-use radroots_event::envelope::event_head::v1::RadrootsEventHeadDecision;
-use radroots_event::envelope::{RadrootsEventEnvelope, RadrootsEventKindClass};
+use radroots_event::contract::registry_v7::{TagSemantic, TagValueType};
+use radroots_event::draft::SignedEvent;
+use radroots_event::envelope::event_head::v1::EventHeadDecision;
+use radroots_event::envelope::{EventEnvelope, EventKindClass};
use radroots_event_codec::verification::v1::RadrootsSignatureVerifiedEvent;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
@@ -53,12 +53,12 @@ impl StoredEventClass {
}
}
- pub fn from_event_kind_class(value: RadrootsEventKindClass) -> Self {
+ pub fn from_event_kind_class(value: EventKindClass) -> Self {
match value {
- RadrootsEventKindClass::Regular => Self::Regular,
- RadrootsEventKindClass::Replaceable => Self::Replaceable,
- RadrootsEventKindClass::Ephemeral => Self::Ephemeral,
- RadrootsEventKindClass::Addressable => Self::Addressable,
+ EventKindClass::Regular => Self::Regular,
+ EventKindClass::Replaceable => Self::Replaceable,
+ EventKindClass::Ephemeral => Self::Ephemeral,
+ EventKindClass::Addressable => Self::Addressable,
}
}
@@ -151,13 +151,13 @@ pub struct RadrootsEventIngest {
impl RadrootsEventIngest {
#[cfg(test)]
- pub(crate) fn new(signed_event: RadrootsSignedEvent, observed_at_ms: i64) -> Self {
+ pub(crate) fn new(signed_event: SignedEvent, observed_at_ms: i64) -> Self {
Self::from_signed_event(signed_event, observed_at_ms)
.expect("test event must have a valid NIP-01 signature")
}
pub fn from_signed_event(
- signed_event: RadrootsSignedEvent,
+ signed_event: SignedEvent,
observed_at_ms: i64,
) -> Result<Self, RadrootsEventStoreError> {
Self::from_signed_event_reconciliation_v1(signed_event, observed_at_ms)
@@ -175,7 +175,7 @@ impl RadrootsEventIngest {
self
}
- pub fn event(&self) -> &RadrootsEventEnvelope {
+ pub fn event(&self) -> &EventEnvelope {
self.verified_event.event()
}
@@ -208,15 +208,15 @@ pub enum RadrootsRawHeadDecision {
}
impl RadrootsRawHeadDecision {
- pub fn from_protocol(value: &RadrootsEventHeadDecision) -> Self {
+ pub fn from_protocol(value: &EventHeadDecision) -> Self {
match value {
- RadrootsEventHeadDecision::Applied(_) => Self::Applied,
- RadrootsEventHeadDecision::SkippedDuplicate => Self::SkippedDuplicate,
- RadrootsEventHeadDecision::SkippedOlder => Self::SkippedOlder,
- RadrootsEventHeadDecision::SkippedSameTimestampHigherEventId => {
+ EventHeadDecision::Applied(_) => Self::Applied,
+ EventHeadDecision::SkippedDuplicate => Self::SkippedDuplicate,
+ EventHeadDecision::SkippedOlder => Self::SkippedOlder,
+ EventHeadDecision::SkippedSameTimestampHigherEventId => {
Self::SkippedSameTimestampHigherEventId
}
- RadrootsEventHeadDecision::CoordinateMismatch => Self::MalformedCoordinate,
+ EventHeadDecision::CoordinateMismatch => Self::MalformedCoordinate,
}
}
}
@@ -234,77 +234,77 @@ impl RadrootsEventStoreSourceGeneration {
}
}
-pub fn tag_semantic_name(value: RadrootsTagSemantic) -> &'static str {
+pub fn tag_semantic_name(value: TagSemantic) -> &'static str {
match value {
- RadrootsTagSemantic::AddressableCoordinate => "addressable_coordinate",
- RadrootsTagSemantic::CalendarEventAuthor => "calendar_event_author",
- RadrootsTagSemantic::CalendarEventReference => "calendar_event_reference",
- RadrootsTagSemantic::CalendarEventRevision => "calendar_event_revision",
- RadrootsTagSemantic::CalendarInclusionRequest => "calendar_inclusion_request",
- RadrootsTagSemantic::CalendarEnd => "calendar_end",
- RadrootsTagSemantic::CalendarStart => "calendar_start",
- RadrootsTagSemantic::Category => "category",
- RadrootsTagSemantic::Citation => "citation",
- RadrootsTagSemantic::Contract => "contract",
- RadrootsTagSemantic::Counterparty => "counterparty",
- RadrootsTagSemantic::Evidence => "evidence",
- RadrootsTagSemantic::EventPointer => "event_pointer",
- RadrootsTagSemantic::FreeBusy => "free_busy",
- RadrootsTagSemantic::Geohash => "geohash",
- RadrootsTagSemantic::GroupId => "group_id",
- RadrootsTagSemantic::Identifier => "identifier",
- RadrootsTagSemantic::Image => "image",
- RadrootsTagSemantic::Kind => "kind",
- RadrootsTagSemantic::ClassifiedListingAddress => "listing_address",
- RadrootsTagSemantic::OperationalListingSnapshot => "listing_snapshot",
- RadrootsTagSemantic::ListDescription => "list_description",
- RadrootsTagSemantic::Location => "location",
- RadrootsTagSemantic::Nip01Coordinate => "nip01_coordinate",
- RadrootsTagSemantic::Participant => "participant",
- RadrootsTagSemantic::PreviousEvent => "previous_event",
- RadrootsTagSemantic::Price => "price",
- RadrootsTagSemantic::PublishedAt => "published_at",
- RadrootsTagSemantic::Relay => "relay",
- RadrootsTagSemantic::Reference => "reference",
- RadrootsTagSemantic::ReviewTarget => "review_target",
- RadrootsTagSemantic::RootEvent => "root_event",
- RadrootsTagSemantic::ServiceInput => "service_input",
- RadrootsTagSemantic::ServiceOutput => "service_output",
- RadrootsTagSemantic::Source => "source",
- RadrootsTagSemantic::Status => "status",
- RadrootsTagSemantic::Summary => "summary",
- RadrootsTagSemantic::Title => "title",
- RadrootsTagSemantic::Topic => "topic",
- RadrootsTagSemantic::TimeZone => "time_zone",
- RadrootsTagSemantic::Url => "url",
- RadrootsTagSemantic::UtcDayCoverage => "utc_day_coverage",
+ TagSemantic::AddressableCoordinate => "addressable_coordinate",
+ TagSemantic::CalendarEventAuthor => "calendar_event_author",
+ TagSemantic::CalendarEventReference => "calendar_event_reference",
+ TagSemantic::CalendarEventRevision => "calendar_event_revision",
+ TagSemantic::CalendarInclusionRequest => "calendar_inclusion_request",
+ TagSemantic::CalendarEnd => "calendar_end",
+ TagSemantic::CalendarStart => "calendar_start",
+ TagSemantic::Category => "category",
+ TagSemantic::Citation => "citation",
+ TagSemantic::Contract => "contract",
+ TagSemantic::Counterparty => "counterparty",
+ TagSemantic::Evidence => "evidence",
+ TagSemantic::EventPointer => "event_pointer",
+ TagSemantic::FreeBusy => "free_busy",
+ TagSemantic::Geohash => "geohash",
+ TagSemantic::GroupId => "group_id",
+ TagSemantic::Identifier => "identifier",
+ TagSemantic::Image => "image",
+ TagSemantic::Kind => "kind",
+ TagSemantic::ClassifiedListingAddress => "listing_address",
+ TagSemantic::OperationalListingSnapshot => "listing_snapshot",
+ TagSemantic::ListDescription => "list_description",
+ TagSemantic::Location => "location",
+ TagSemantic::Nip01Coordinate => "nip01_coordinate",
+ TagSemantic::Participant => "participant",
+ TagSemantic::PreviousEvent => "previous_event",
+ TagSemantic::Price => "price",
+ TagSemantic::PublishedAt => "published_at",
+ TagSemantic::Relay => "relay",
+ TagSemantic::Reference => "reference",
+ TagSemantic::ReviewTarget => "review_target",
+ TagSemantic::RootEvent => "root_event",
+ TagSemantic::ServiceInput => "service_input",
+ TagSemantic::ServiceOutput => "service_output",
+ TagSemantic::Source => "source",
+ TagSemantic::Status => "status",
+ TagSemantic::Summary => "summary",
+ TagSemantic::Title => "title",
+ TagSemantic::Topic => "topic",
+ TagSemantic::TimeZone => "time_zone",
+ TagSemantic::Url => "url",
+ TagSemantic::UtcDayCoverage => "utc_day_coverage",
}
}
-pub fn tag_value_type_name(value: RadrootsTagValueType) -> &'static str {
+pub fn tag_value_type_name(value: TagValueType) -> &'static str {
match value {
- RadrootsTagValueType::AddressableCoordinate => "addressable_coordinate",
- RadrootsTagValueType::CalendarDate => "calendar_date",
- RadrootsTagValueType::CalendarEventCoordinate => "calendar_event_coordinate",
- RadrootsTagValueType::CalendarFreeBusy => "calendar_free_busy",
- RadrootsTagValueType::CalendarRsvpStatus => "calendar_rsvp_status",
- RadrootsTagValueType::CalendarUid => "calendar_uid",
- RadrootsTagValueType::ContractId => "contract_id",
- RadrootsTagValueType::DTag => "d_tag",
- RadrootsTagValueType::EventId => "event_id",
- RadrootsTagValueType::EventPointer => "event_pointer",
- RadrootsTagValueType::Geohash => "geohash",
- RadrootsTagValueType::IanaTimeZoneId => "iana_time_zone_id",
- RadrootsTagValueType::Kind => "kind",
- RadrootsTagValueType::Nip01Coordinate => "nip01_coordinate",
- RadrootsTagValueType::PublicKey => "public_key",
- RadrootsTagValueType::RelayUrl => "relay_url",
- RadrootsTagValueType::Sha256 => "sha256",
- RadrootsTagValueType::Text => "text",
- RadrootsTagValueType::UnixTimestamp => "unix_timestamp",
- RadrootsTagValueType::Uri => "uri",
- RadrootsTagValueType::Url => "url",
- RadrootsTagValueType::UtcDayIndex => "utc_day_index",
- RadrootsTagValueType::Uuid => "uuid",
+ TagValueType::AddressableCoordinate => "addressable_coordinate",
+ TagValueType::CalendarDate => "calendar_date",
+ TagValueType::CalendarEventCoordinate => "calendar_event_coordinate",
+ TagValueType::CalendarFreeBusy => "calendar_free_busy",
+ TagValueType::CalendarRsvpStatus => "calendar_rsvp_status",
+ TagValueType::CalendarUid => "calendar_uid",
+ TagValueType::ContractId => "contract_id",
+ TagValueType::DTag => "d_tag",
+ TagValueType::EventId => "event_id",
+ TagValueType::EventPointer => "event_pointer",
+ TagValueType::Geohash => "geohash",
+ TagValueType::IanaTimeZoneId => "iana_time_zone_id",
+ TagValueType::Kind => "kind",
+ TagValueType::Nip01Coordinate => "nip01_coordinate",
+ TagValueType::PublicKey => "public_key",
+ TagValueType::RelayUrl => "relay_url",
+ TagValueType::Sha256 => "sha256",
+ TagValueType::Text => "text",
+ TagValueType::UnixTimestamp => "unix_timestamp",
+ TagValueType::Uri => "uri",
+ TagValueType::Url => "url",
+ TagValueType::UtcDayIndex => "utc_day_index",
+ TagValueType::Uuid => "uuid",
}
}
diff --git a/crates/event_store/src/nip09/reconciliation_v1.rs b/crates/event_store/src/nip09/reconciliation_v1.rs
@@ -17,14 +17,13 @@ use crate::{
RADROOTS_EVENT_STORE_RAW_TAG_COUNT_LIMIT_V1, RADROOTS_EVENT_STORE_RAW_TAG_TEXT_BYTES_LIMIT_V1,
RadrootsEventStoreError, RadrootsEventStoreSourceCapacityResourceV1,
};
-use radroots_event::contract::registry_v7::RadrootsEventContract;
+use radroots_event::contract::registry_v7::EventContract;
use radroots_event::envelope::event_head::v1::{
- RadrootsCurrentEventHead, RadrootsEventHeadCandidate, RadrootsEventHeadCandidateResult,
- RadrootsEventHeadCoordinate, RadrootsEventHeadDecision,
- event_head_candidate_for_nip01_event_v1, select_event_head_v1,
+ CurrentEventHead, EventHeadCandidate, EventHeadCandidateResult, EventHeadCoordinate,
+ EventHeadDecision, event_head_candidate_for_nip01_event_v1, select_event_head_v1,
};
-use radroots_event::envelope::{RadrootsEventEnvelope, RadrootsEventKindClass};
-use radroots_event::id::RadrootsNip01Coordinate;
+use radroots_event::envelope::{EventEnvelope, EventKindClass};
+use radroots_event::id::Nip01Coordinate;
use radroots_event_codec::admission::registry_v7::{
RadrootsRegistryV7AdmissionDecision, admit_verified_event_registry_v7,
};
@@ -192,7 +191,7 @@ impl SourceGenerationProvider for OsSourceGenerationProvider {
pub(crate) struct EventAdmission {
pub(crate) status: RadrootsEventAdmissionStatus,
pub(crate) code: Option<String>,
- pub(crate) contract: Option<&'static RadrootsEventContract>,
+ pub(crate) contract: Option<&'static EventContract>,
}
impl EventAdmission {
@@ -234,9 +233,9 @@ impl EventAdmission {
})
}
- pub(crate) fn valid_stream_eligible(&self, kind_class: RadrootsEventKindClass) -> bool {
+ pub(crate) fn valid_stream_eligible(&self, kind_class: EventKindClass) -> bool {
self.status == RadrootsEventAdmissionStatus::Admitted
- && kind_class != RadrootsEventKindClass::Ephemeral
+ && kind_class != EventKindClass::Ephemeral
}
}
@@ -262,7 +261,7 @@ struct ReconciliationSnapshot {
#[derive(Clone)]
struct RawHeadWinner {
- candidate: RadrootsEventHeadCandidate,
+ candidate: EventHeadCandidate,
event_seq: i64,
updated_at_ms: i64,
}
@@ -448,7 +447,7 @@ impl<'a> RequestIndex<'a> {
fn matching<'index>(
&'index self,
- event: &RadrootsEventEnvelope,
+ event: &EventEnvelope,
) -> impl Iterator<Item = &'index RadrootsAdmittedNip09DeletionRequestEventV1> + 'index {
let event_indices = self
.event_targets
@@ -1833,13 +1832,13 @@ async fn validate_raw_heads(
let mut expected = BTreeSet::new();
for winner in select_raw_head_winners(events).into_values() {
let (coordinate_type, kind, pubkey, d_tag) = match winner.candidate.coordinate {
- RadrootsEventHeadCoordinate::Replaceable { kind, pubkey } => (
+ EventHeadCoordinate::Replaceable { kind, pubkey } => (
"replaceable".to_owned(),
i64::from(kind),
pubkey.to_string(),
None,
),
- RadrootsEventHeadCoordinate::Addressable {
+ EventHeadCoordinate::Addressable {
kind,
pubkey,
d_tag,
@@ -1895,7 +1894,7 @@ async fn rebuild_raw_heads(
.await?;
for winner in winners.into_values() {
match &winner.candidate.coordinate {
- RadrootsEventHeadCoordinate::Replaceable { kind, pubkey } => {
+ EventHeadCoordinate::Replaceable { kind, pubkey } => {
sqlx::query(
"INSERT INTO event_envelope_head(coordinate_type, kind, pubkey, d_tag, event_id, created_at, updated_at_ms) VALUES ('replaceable', ?, ?, NULL, ?, ?, ?)",
)
@@ -1910,7 +1909,7 @@ async fn rebuild_raw_heads(
.execute(&mut *connection)
.await?;
}
- RadrootsEventHeadCoordinate::Addressable {
+ EventHeadCoordinate::Addressable {
kind,
pubkey,
d_tag,
@@ -1937,7 +1936,7 @@ async fn rebuild_raw_heads(
fn select_raw_head_winners(
events: &[ReconciledEvent],
-) -> BTreeMap<RadrootsEventHeadCoordinate, RawHeadWinner> {
+) -> BTreeMap<EventHeadCoordinate, RawHeadWinner> {
let mut winners = BTreeMap::new();
for event in events {
apply_raw_head_to_winners(&mut winners, event);
@@ -1946,30 +1945,30 @@ fn select_raw_head_winners(
}
fn apply_raw_head_to_winners(
- winners: &mut BTreeMap<RadrootsEventHeadCoordinate, RawHeadWinner>,
+ winners: &mut BTreeMap<EventHeadCoordinate, RawHeadWinner>,
event: &ReconciledEvent,
) -> RadrootsRawHeadDecision {
let candidate = match event_head_candidate_for_nip01_event_v1(event.verified_event.event()) {
- RadrootsEventHeadCandidateResult::Candidate(candidate) => candidate,
- RadrootsEventHeadCandidateResult::NotHeadSelected => {
+ EventHeadCandidateResult::Candidate(candidate) => candidate,
+ EventHeadCandidateResult::NotHeadSelected => {
return RadrootsRawHeadDecision::NotHeadSelected;
}
- RadrootsEventHeadCandidateResult::NotPersisted => {
+ EventHeadCandidateResult::NotPersisted => {
return RadrootsRawHeadDecision::NotPersisted;
}
- RadrootsEventHeadCandidateResult::Malformed(_) => {
+ EventHeadCandidateResult::Malformed(_) => {
return RadrootsRawHeadDecision::MalformedCoordinate;
}
};
let current = winners
.get(&candidate.coordinate)
- .map(|winner| RadrootsCurrentEventHead {
+ .map(|winner| CurrentEventHead {
coordinate: winner.candidate.coordinate.clone(),
event_id: winner.candidate.event_id.clone(),
created_at: winner.candidate.created_at,
});
let decision = select_event_head_v1(candidate.clone(), current.as_ref());
- if matches!(decision, RadrootsEventHeadDecision::Applied(_)) {
+ if matches!(decision, EventHeadDecision::Applied(_)) {
winners.insert(
candidate.coordinate.clone(),
RawHeadWinner {
@@ -2057,30 +2056,29 @@ fn event_coordinate_fact(
) -> Result<Option<EventCoordinateFact>, RadrootsEventStoreError> {
let envelope = event.verified_event.event();
let kind = envelope.kind_u32();
- let (coordinate_type, raw_d_tag, nip09_d_tag) = if matches!(kind, 0 | 3)
- || (10_000..=19_999).contains(&kind)
- {
- ("replaceable", String::new(), Some(String::new()))
- } else if (30_000..=39_999).contains(&kind) {
- let raw_d_tag_value = envelope
- .tag_slices()
- .iter()
- .find(|tag| tag.as_slice().first().is_some_and(|name| name == "d"))
- .and_then(|tag| tag.as_slice().get(1))
- .cloned();
- let nip09_d_tag = raw_d_tag_value.as_ref().and_then(|d_tag| {
- RadrootsNip01Coordinate::parse(format!("{kind}:{}:{d_tag}", envelope.author().to_hex()))
- .ok()
- .map(|coordinate| coordinate.identifier().to_owned())
- });
- (
- "addressable",
- raw_d_tag_value.unwrap_or_default(),
- nip09_d_tag,
- )
- } else {
- return Ok(None);
- };
+ let (coordinate_type, raw_d_tag, nip09_d_tag) =
+ if matches!(kind, 0 | 3) || (10_000..=19_999).contains(&kind) {
+ ("replaceable", String::new(), Some(String::new()))
+ } else if (30_000..=39_999).contains(&kind) {
+ let raw_d_tag_value = envelope
+ .tag_slices()
+ .iter()
+ .find(|tag| tag.as_slice().first().is_some_and(|name| name == "d"))
+ .and_then(|tag| tag.as_slice().get(1))
+ .cloned();
+ let nip09_d_tag = raw_d_tag_value.as_ref().and_then(|d_tag| {
+ Nip01Coordinate::parse(format!("{kind}:{}:{d_tag}", envelope.author().to_hex()))
+ .ok()
+ .map(|coordinate| coordinate.identifier().to_owned())
+ });
+ (
+ "addressable",
+ raw_d_tag_value.unwrap_or_default(),
+ nip09_d_tag,
+ )
+ } else {
+ return Ok(None);
+ };
Ok(Some(EventCoordinateFact {
event_id: envelope.id_hex().to_owned(),
event_seq: event.seq,
@@ -2314,9 +2312,9 @@ async fn synchronize_insert_delta(
}
if matches!(raw_head_decision, RadrootsRawHeadDecision::Applied)
- && let RadrootsEventHeadCandidateResult::Candidate(candidate) =
+ && let EventHeadCandidateResult::Candidate(candidate) =
event_head_candidate_for_nip01_event_v1(ingest.event())
- && let RadrootsEventHeadCoordinate::Addressable {
+ && let EventHeadCoordinate::Addressable {
kind,
pubkey,
d_tag,
@@ -2611,7 +2609,7 @@ fn desired_addressable_states(
let request_index = RequestIndex::new(requests);
let mut desired = BTreeMap::new();
for (coordinate, winner) in winners {
- let RadrootsEventHeadCoordinate::Addressable {
+ let EventHeadCoordinate::Addressable {
kind,
pubkey,
d_tag,
@@ -2854,7 +2852,7 @@ fn expected_transition_history(
{
let request = admitted_nip09_request(event)?;
for (coordinate, winner) in &winners {
- let RadrootsEventHeadCoordinate::Addressable {
+ let EventHeadCoordinate::Addressable {
kind,
pubkey,
d_tag,
@@ -2882,9 +2880,9 @@ fn expected_transition_history(
requests.push(request);
requests.sort_by(|left, right| left.event().id().cmp(right.event().id()));
} else if matches!(raw_head_decision, RadrootsRawHeadDecision::Applied)
- && let RadrootsEventHeadCandidateResult::Candidate(candidate) =
+ && let EventHeadCandidateResult::Candidate(candidate) =
event_head_candidate_for_nip01_event_v1(event.verified_event.event())
- && let RadrootsEventHeadCoordinate::Addressable {
+ && let EventHeadCoordinate::Addressable {
kind,
pubkey,
d_tag,
@@ -2896,7 +2894,7 @@ fn expected_transition_history(
let request_index = RequestIndex::new(&requests);
for (kind, pubkey, d_tag) in affected_coordinates {
let key = (kind, pubkey.clone(), d_tag.clone());
- let coordinate = RadrootsEventHeadCoordinate::Addressable {
+ let coordinate = EventHeadCoordinate::Addressable {
kind: u32::try_from(kind).map_err(|_| RadrootsEventStoreError::IntegerRange {
field: "transition.kind",
value: kind,
@@ -2990,7 +2988,7 @@ fn admitted_nip09_request(
fn request_references_event(
request: &RadrootsAdmittedNip09DeletionRequestEventV1,
- event: &RadrootsEventEnvelope,
+ event: &EventEnvelope,
) -> bool {
request
.projection()
@@ -3451,17 +3449,17 @@ fn raw_head_decision_code(decision: &RadrootsRawHeadDecision) -> &'static str {
}
}
-fn nip01_coordinate_key(event: &RadrootsEventEnvelope) -> Option<(i64, String, String)> {
- let RadrootsEventHeadCandidateResult::Candidate(candidate) =
+fn nip01_coordinate_key(event: &EventEnvelope) -> Option<(i64, String, String)> {
+ let EventHeadCandidateResult::Candidate(candidate) =
event_head_candidate_for_nip01_event_v1(event)
else {
return None;
};
match candidate.coordinate {
- RadrootsEventHeadCoordinate::Replaceable { kind, pubkey } => {
+ EventHeadCoordinate::Replaceable { kind, pubkey } => {
Some((i64::from(kind), pubkey.to_string(), String::new()))
}
- RadrootsEventHeadCoordinate::Addressable {
+ EventHeadCoordinate::Addressable {
kind,
pubkey,
d_tag,
@@ -3470,7 +3468,7 @@ fn nip01_coordinate_key(event: &RadrootsEventEnvelope) -> Option<(i64, String, S
}
fn request_source_tag_value<'a>(
- event: &'a RadrootsEventEnvelope,
+ event: &'a EventEnvelope,
tag_index: usize,
expected_name: &'static str,
) -> Result<&'a str, RadrootsEventStoreError> {
@@ -3599,9 +3597,9 @@ fn text_payload_bytes<const N: usize>(
mod tests {
use super::*;
use nostr::{Keys, SECP256K1, secp256k1::Message};
- use radroots_event::wire::v1::RadrootsNip01EventWire;
+ use radroots_event::wire::v1::Nip01EventWire;
use radroots_event::{
- envelope::RadrootsEventEnvelopeParts,
+ envelope::EventEnvelopeParts,
envelope::kind::{KIND_DELETION_REQUEST, KIND_LIST_SET_RELAY, KIND_POST},
post::deletion::RADROOTS_NIP09_DELETION_TAG_MAX_COUNT,
wire::compute_canonical_nip01_event_id,
@@ -4258,11 +4256,7 @@ INSERT INTO caller_child(id, parent_id) VALUES (1, 999);",
transaction.commit().await.expect("rotation commit");
}
- async fn seed_v1_raw_event(
- pool: &SqlitePool,
- envelope: RadrootsEventEnvelope,
- observed_at_ms: i64,
- ) {
+ async fn seed_v1_raw_event(pool: &SqlitePool, envelope: EventEnvelope, observed_at_ms: i64) {
let ingest = ingest_for_test(envelope, observed_at_ms);
let event = ingest.event();
let admission = EventAdmission::for_profile(
@@ -4326,11 +4320,8 @@ INSERT INTO caller_child(id, parent_id) VALUES (1, 999);",
}
}
- fn ingest_for_test(
- envelope: RadrootsEventEnvelope,
- observed_at_ms: i64,
- ) -> RadrootsEventIngest {
- let wire = RadrootsNip01EventWire {
+ fn ingest_for_test(envelope: EventEnvelope, observed_at_ms: i64) -> RadrootsEventIngest {
+ let wire = Nip01EventWire {
id: envelope.id_hex().to_owned(),
pubkey: envelope.author().to_hex().to_owned(),
created_at: envelope.created_at_u64(),
@@ -4534,7 +4525,7 @@ INSERT INTO caller_child(id, parent_id) VALUES (1, 999);",
admit_verified_nip09_deletion_request_event_v1(verified).expect("admitted request")
}
- fn unsigned_addressable_target(author: &str, index: usize) -> RadrootsEventEnvelope {
+ fn unsigned_addressable_target(author: &str, index: usize) -> EventEnvelope {
let tags = vec![vec!["d".to_owned(), fanout_identifier(index)]];
let id = compute_canonical_nip01_event_id(
author,
@@ -4544,7 +4535,7 @@ INSERT INTO caller_child(id, parent_id) VALUES (1, 999);",
"{}",
)
.expect("target id");
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ EventEnvelope::new(EventEnvelopeParts {
id: id.into_string(),
author: author.to_owned(),
created_at: TARGET_CREATED_AT,
@@ -4561,7 +4552,7 @@ INSERT INTO caller_child(id, parent_id) VALUES (1, 999);",
kind: u32,
tags: Vec<Vec<String>>,
content: &str,
- ) -> RadrootsEventEnvelope {
+ ) -> EventEnvelope {
let keys = Keys::parse(FIXTURE_SECRET_KEY_HEX).expect("fixture key");
let author = keys.public_key().to_string();
let id =
@@ -4570,7 +4561,7 @@ INSERT INTO caller_child(id, parent_id) VALUES (1, 999);",
let nostr_id = nostr::EventId::from_hex(&id.to_hex()).expect("Nostr event id");
let message = Message::from_digest(nostr_id.to_bytes());
let signature = SECP256K1.sign_schnorr_no_aux_rand(&message, keys.key_pair(SECP256K1));
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ EventEnvelope::new(EventEnvelopeParts {
id: id.into_string(),
author,
created_at,
diff --git a/crates/event_store/src/store.rs b/crates/event_store/src/store.rs
@@ -63,13 +63,13 @@ use crate::schema::{
destroy_event_store_schema_for_test,
rollback_event_store_schema_offline_destructive_for_migration_test,
};
-use radroots_event::envelope::event_head::v1::RadrootsEventHeadCoordinate;
+use radroots_event::envelope::event_head::v1::EventHeadCoordinate;
#[cfg(test)]
use radroots_event::envelope::event_head::v1::{
- RadrootsEventHeadCandidateResult, event_head_candidate_for_nip01_event_v1,
+ EventHeadCandidateResult, event_head_candidate_for_nip01_event_v1,
};
-use radroots_event::id::{RadrootsDTag, RadrootsEventId, RadrootsTradeId, RadrootsTradeMutationId};
-use radroots_event::trade::RadrootsTradeMutationKindV1;
+use radroots_event::id::{DTag, EventId, MutationId, TradeId};
+use radroots_event::trade::TradeMutationKindV1;
use radroots_transport::{
RadrootsTransportKind, RadrootsTransportTarget, RadrootsTransportTargetFingerprint,
RadrootsTransportTargetUri,
@@ -338,7 +338,7 @@ impl RadrootsEventStore {
pub async fn raw_event_head(
&self,
- coordinate: &RadrootsEventHeadCoordinate,
+ coordinate: &EventHeadCoordinate,
) -> Result<Option<RadrootsStoredRawEventHead>, RadrootsEventStoreError> {
let mut tx = self.pool.begin().await?;
let snapshot = raw_head_snapshot_in_transaction(&mut tx, coordinate).await?;
@@ -399,7 +399,7 @@ impl RadrootsEventStore {
}
let event_ids = event_ids
.into_iter()
- .map(|event_id| RadrootsEventId::parse(event_id.as_ref()))
+ .map(|event_id| EventId::parse(event_id.as_ref()))
.collect::<Result<Vec<_>, _>>()?;
let mut unique_event_ids = Vec::new();
let mut seen_event_ids = BTreeMap::new();
@@ -454,7 +454,7 @@ impl RadrootsEventStore {
pub async fn visible_event_head(
&self,
- coordinate: &RadrootsEventHeadCoordinate,
+ coordinate: &EventHeadCoordinate,
) -> Result<Option<RadrootsStoredVisibleEventHead>, RadrootsEventStoreError> {
let mut tx = self.pool.begin().await?;
let Some(snapshot) = raw_head_snapshot_in_transaction(&mut tx, coordinate).await? else {
@@ -927,7 +927,7 @@ impl RadrootsEventStore {
pub async fn get_trade_mutation(
&self,
- mutation_id: &RadrootsTradeMutationId,
+ mutation_id: &MutationId,
) -> Result<Option<RadrootsStoredTradeMutation>, RadrootsEventStoreError> {
let row = sqlx::query(
"SELECT mutation_id, trade_id, root_mutation_id, contract_id, mutation_kind, schema_version, candidate_id, proposal_mutation_id, target_claim_mutation_id, author_pubkey, counterparty_pubkey, buyer_pubkey, seller_pubkey, farm_id, authored_at_unix_s, canonical_payload_bytes, payload_sha256, first_event_seq, first_transport_event_id, inserted_at_ms FROM trade_mutation WHERE mutation_id = ?",
@@ -940,7 +940,7 @@ impl RadrootsEventStore {
pub async fn trade_mutations_for_trade(
&self,
- trade_id: &RadrootsTradeId,
+ trade_id: &TradeId,
limit: u32,
) -> Result<Vec<RadrootsStoredTradeMutation>, RadrootsEventStoreError> {
validate_trade_query_limit(limit)?;
@@ -956,7 +956,7 @@ impl RadrootsEventStore {
pub async fn trade_mutation_parents(
&self,
- mutation_id: &RadrootsTradeMutationId,
+ mutation_id: &MutationId,
) -> Result<Vec<RadrootsStoredTradeMutationParent>, RadrootsEventStoreError> {
let rows = sqlx::query(
"SELECT mutation_id, parent_mutation_id, parent_index FROM trade_mutation_parent WHERE mutation_id = ? ORDER BY parent_index",
@@ -971,7 +971,7 @@ impl RadrootsEventStore {
pub async fn trade_transport_envelopes_for_mutation(
&self,
- mutation_id: &RadrootsTradeMutationId,
+ mutation_id: &MutationId,
) -> Result<Vec<RadrootsStoredTradeTransportEnvelope>, RadrootsEventStoreError> {
let rows = sqlx::query(
"SELECT transport_event_id, mutation_id, trade_id, transport_kind, pubkey, created_at, event_seq, payload_sha256, observed_at_ms FROM trade_transport_envelope WHERE mutation_id = ? ORDER BY observed_at_ms, transport_event_id",
@@ -986,7 +986,7 @@ impl RadrootsEventStore {
pub async fn missing_trade_parents(
&self,
- trade_id: &RadrootsTradeId,
+ trade_id: &TradeId,
) -> Result<Vec<RadrootsStoredTradeMissingParent>, RadrootsEventStoreError> {
let rows = sqlx::query(
"SELECT trade_id, mutation_id, missing_parent_mutation_id, first_transport_event_id, first_seen_at_ms FROM trade_missing_parent WHERE trade_id = ? ORDER BY first_seen_at_ms, mutation_id, missing_parent_mutation_id",
@@ -1001,7 +1001,7 @@ impl RadrootsEventStore {
pub async fn seller_reservation(
&self,
- reservation_id: &RadrootsDTag,
+ reservation_id: &DTag,
) -> Result<Option<RadrootsStoredSellerReservation>, RadrootsEventStoreError> {
let row = sqlx::query(
"SELECT reservation_id, trade_id, candidate_id, claim_mutation_id, inventory_authority_pubkey, inventory_epoch, assertion_commitment, reservation_expires_at_unix_s, reservation_json, inserted_at_ms FROM seller_inventory_reservation WHERE reservation_id = ?",
@@ -1014,7 +1014,7 @@ impl RadrootsEventStore {
pub async fn seller_reservation_lines(
&self,
- reservation_id: &RadrootsDTag,
+ reservation_id: &DTag,
) -> Result<Vec<RadrootsStoredSellerReservationLine>, RadrootsEventStoreError> {
let rows = sqlx::query(
"SELECT reservation_id, line_id, bin_id, quantity_mantissa, quantity_scale, unit_code, line_index FROM seller_inventory_reservation_line WHERE reservation_id = ? ORDER BY line_index",
@@ -1038,7 +1038,7 @@ impl RadrootsEventStore {
.bind(checkpoint.reducer_contract_id.as_str())
.bind(i64::from(checkpoint.reducer_version))
.bind(checkpoint.projection_digest.as_str())
- .bind(checkpoint.root_mutation_id.as_ref().map(RadrootsTradeMutationId::to_hex))
+ .bind(checkpoint.root_mutation_id.as_ref().map(MutationId::to_hex))
.bind(checkpoint.negotiation_state.as_str())
.bind(checkpoint.agreement_state.as_str())
.bind(checkpoint.evidence_state.as_str())
@@ -1048,7 +1048,7 @@ impl RadrootsEventStore {
.bind(checkpoint.fulfillment_state.as_str())
.bind(checkpoint.payment_state.as_str())
.bind(checkpoint.projection_json.as_str())
- .bind(checkpoint.last_mutation_id.as_ref().map(RadrootsTradeMutationId::to_hex))
+ .bind(checkpoint.last_mutation_id.as_ref().map(MutationId::to_hex))
.bind(checkpoint.last_transport_event_seq)
.bind(checkpoint.updated_at_ms)
.execute(&self.pool)
@@ -1058,7 +1058,7 @@ impl RadrootsEventStore {
pub async fn trade_projection_checkpoint(
&self,
- trade_id: &RadrootsTradeId,
+ trade_id: &TradeId,
) -> Result<Option<RadrootsTradeProjectionCheckpoint>, RadrootsEventStoreError> {
let row = sqlx::query(
"SELECT trade_id, reducer_contract_id, reducer_version, projection_digest, root_mutation_id, negotiation_state, agreement_state, evidence_state, conflict_state, private_terms_state, attestation_state, fulfillment_state, payment_state, projection_json, last_mutation_id, last_transport_event_seq, updated_at_ms FROM trade_projection_checkpoint WHERE trade_id = ?",
@@ -1303,15 +1303,13 @@ async fn query_string(
Ok(row.try_get(0)?)
}
-fn parse_trade_mutation_kind(
- value: &str,
-) -> Result<RadrootsTradeMutationKindV1, RadrootsEventStoreError> {
+fn parse_trade_mutation_kind(value: &str) -> Result<TradeMutationKindV1, RadrootsEventStoreError> {
match value {
- "proposal" => Ok(RadrootsTradeMutationKindV1::Proposal),
- "decision" => Ok(RadrootsTradeMutationKindV1::Decision),
- "revision_proposal" => Ok(RadrootsTradeMutationKindV1::RevisionProposal),
- "revision_decision" => Ok(RadrootsTradeMutationKindV1::RevisionDecision),
- "cancellation" => Ok(RadrootsTradeMutationKindV1::Cancellation),
+ "proposal" => Ok(TradeMutationKindV1::Proposal),
+ "decision" => Ok(TradeMutationKindV1::Decision),
+ "revision_proposal" => Ok(TradeMutationKindV1::RevisionProposal),
+ "revision_decision" => Ok(TradeMutationKindV1::RevisionDecision),
+ "cancellation" => Ok(TradeMutationKindV1::Cancellation),
_ => Err(RadrootsEventStoreError::InvalidStoredEnum {
field: "trade_mutation.mutation_kind",
value: value.to_owned(),
@@ -1783,27 +1781,23 @@ mod tests {
SecretKey as RadrootsNostrSecretKey, Tag as RadrootsNostrTag,
TagKind as RadrootsNostrTagKind, Timestamp as RadrootsNostrTimestamp,
};
- use radroots_event::draft::RadrootsSignedEvent;
+ use radroots_event::draft::SignedEvent;
use radroots_event::envelope::kind::{
KIND_CALENDAR_DATE_EVENT, KIND_CLASSIFIED_LISTING, KIND_DELETION_REQUEST, KIND_FARM,
KIND_GEOCHAT, KIND_LIST_SET_RELAY, KIND_POST, KIND_PROFILE, KIND_RELAY_AUTH,
};
- use radroots_event::food::availability::{
- RadrootsFoodAvailabilityStatus, RadrootsFoodIdentifier,
- };
- use radroots_event::id::{RadrootsClassifiedListingAddress, RadrootsInventoryBinId};
+ use radroots_event::food::availability::{FoodAvailabilityStatus, FoodIdentifier};
+ use radroots_event::id::{ClassifiedListingAddress, InventoryBinId};
use radroots_event::trade::{
- RADROOTS_TRADE_DECISION_CONTRACT_ID, RADROOTS_TRADE_PROPOSAL_CONTRACT_ID,
- RADROOTS_TRADE_SCHEMA_VERSION, RadrootsFulfillmentProfileV1,
- RadrootsSellerReservationAssertionV1, RadrootsSellerReservationLineV1,
- RadrootsTradeCancellationProfileV1, RadrootsTradeCandidateLineV1,
- RadrootsTradeCandidateTermsV1, RadrootsTradeCanonicalMutationV1, RadrootsTradeDecisionV1,
- RadrootsTradeEconomicAdjustmentV1, RadrootsTradeEconomicsProfileV1,
- RadrootsTradeMutationBodyV1, RadrootsTradeMutationEnvelopeV1, canonical_jcs_value,
- canonical_trade_mutation_content,
+ FulfillmentProfileV1, RADROOTS_TRADE_DECISION_CONTRACT_ID,
+ RADROOTS_TRADE_PROPOSAL_CONTRACT_ID, RADROOTS_TRADE_SCHEMA_VERSION,
+ SellerReservationAssertionV1, SellerReservationLineV1, TradeCancellationProfileV1,
+ TradeCandidateLineV1, TradeCandidateTermsV1, TradeCanonicalMutationV1, TradeDecisionV1,
+ TradeEconomicAdjustmentV1, TradeEconomicsProfileV1, TradeMutationBodyV1,
+ TradeMutationEnvelopeV1, canonical_jcs_value, canonical_trade_mutation_content,
};
use radroots_event::wire::{
- DEFAULT_CONTENT_MAX_BYTES, DEFAULT_RAW_JSON_MAX_BYTES, RadrootsNip01EventWire,
+ DEFAULT_CONTENT_MAX_BYTES, DEFAULT_RAW_JSON_MAX_BYTES, Nip01EventWire,
compute_canonical_nip01_event_id,
};
use radroots_event_codec::food_availability::inbound::RadrootsFoodAvailabilityImageDiagnostic;
@@ -1890,8 +1884,8 @@ mod tests {
core::iter::repeat_n(character, 64).collect()
}
- fn trade_id() -> RadrootsTradeId {
- RadrootsTradeId::parse("1".repeat(32)).expect("trade id")
+ fn trade_id() -> TradeId {
+ TradeId::parse("1".repeat(32)).expect("trade id")
}
fn public_key(character: char) -> PublicKey {
@@ -1903,27 +1897,27 @@ mod tests {
PublicKey::from_hex(public_key_hex).expect("fixture pubkey")
}
- fn candidate_terms() -> RadrootsTradeCandidateTermsV1 {
- RadrootsTradeCandidateTermsV1 {
+ fn candidate_terms() -> TradeCandidateTermsV1 {
+ TradeCandidateTermsV1 {
candidate_id: None,
schema_version: RADROOTS_TRADE_SCHEMA_VERSION,
base_candidate_id: None,
supersession_intent: None,
buyer_pubkey: public_key('a'),
seller_pubkey: public_key('a'),
- farm_id: RadrootsDTag::parse("farm-1").expect("farm id"),
- lines: vec![RadrootsTradeCandidateLineV1 {
- line_id: RadrootsDTag::parse("line-1").expect("line id"),
- listing_addr: RadrootsClassifiedListingAddress::parse(format!(
+ farm_id: DTag::parse("farm-1").expect("farm id"),
+ lines: vec![TradeCandidateLineV1 {
+ line_id: DTag::parse("line-1").expect("line id"),
+ listing_addr: ClassifiedListingAddress::parse(format!(
"{KIND_CLASSIFIED_LISTING}:{}:listing-1",
FIXTURE_ALICE_PUBLIC_KEY_HEX
))
.expect("listing address"),
- listing_event_id: RadrootsEventId::parse(event_id('c')).expect("listing event id"),
+ listing_event_id: EventId::parse(event_id('c')).expect("listing event id"),
listing_snapshot_sha256: event_id('d'),
product_id: "carrots".to_owned(),
option_id: None,
- bin_id: RadrootsInventoryBinId::parse("bin-1").expect("bin id"),
+ bin_id: InventoryBinId::parse("bin-1").expect("bin id"),
quantity_mantissa: "2".to_owned(),
quantity_scale: 0,
unit_code: "count".to_owned(),
@@ -1934,7 +1928,7 @@ mod tests {
replaces_line_id: None,
}],
line_tombstones: Vec::new(),
- economics: RadrootsTradeEconomicsProfileV1 {
+ economics: TradeEconomicsProfileV1 {
profile_id: "mvp-no-payment".to_owned(),
currency_code: "USD".to_owned(),
currency_exponent: 2,
@@ -1943,9 +1937,9 @@ mod tests {
discount_total_mantissa: "0".to_owned(),
adjustment_total_mantissa: "0".to_owned(),
total_mantissa: "600".to_owned(),
- adjustments: Vec::<RadrootsTradeEconomicAdjustmentV1>::new(),
+ adjustments: Vec::<TradeEconomicAdjustmentV1>::new(),
},
- fulfillment: RadrootsFulfillmentProfileV1 {
+ fulfillment: FulfillmentProfileV1 {
profile_id: "market-pickup".to_owned(),
method: "pickup".to_owned(),
starts_at_unix_s: 1_800_000_000,
@@ -1956,7 +1950,7 @@ mod tests {
location_class: "private_after_agreement".to_owned(),
requires_private_terms: false,
},
- cancellation: RadrootsTradeCancellationProfileV1 {
+ cancellation: TradeCancellationProfileV1 {
profile_id: "mvp".to_owned(),
buyer_pre_agreement: true,
post_agreement_cutoff_unix_s: Some(1_799_999_000),
@@ -1966,8 +1960,8 @@ mod tests {
}
}
- fn proposal_envelope() -> RadrootsTradeMutationEnvelopeV1 {
- RadrootsTradeMutationEnvelopeV1 {
+ fn proposal_envelope() -> TradeMutationEnvelopeV1 {
+ TradeMutationEnvelopeV1 {
mutation_id: None,
contract_id: RADROOTS_TRADE_PROPOSAL_CONTRACT_ID.to_owned(),
schema_version: RADROOTS_TRADE_SCHEMA_VERSION,
@@ -1975,26 +1969,24 @@ mod tests {
root_mutation_id: None,
buyer_pubkey: public_key('a'),
seller_pubkey: public_key('a'),
- farm_id: RadrootsDTag::parse("farm-1").expect("farm id"),
+ farm_id: DTag::parse("farm-1").expect("farm id"),
parent_mutation_ids: Vec::new(),
author_pubkey: public_key('a'),
counterparty_pubkey: public_key('a'),
authored_at_unix_s: 1_799_000_000,
- body: RadrootsTradeMutationBodyV1::Proposal {
+ body: TradeMutationBodyV1::Proposal {
candidate: candidate_terms(),
},
}
}
- fn decision_envelope(
- proposal: &RadrootsTradeCanonicalMutationV1,
- ) -> RadrootsTradeMutationEnvelopeV1 {
- let RadrootsTradeMutationBodyV1::Proposal { candidate } = &proposal.envelope.body else {
+ fn decision_envelope(proposal: &TradeCanonicalMutationV1) -> TradeMutationEnvelopeV1 {
+ let TradeMutationBodyV1::Proposal { candidate } = &proposal.envelope.body else {
panic!("proposal");
};
let candidate_id = candidate.candidate_id.clone().expect("candidate id");
let line = candidate.lines.first().expect("candidate line");
- RadrootsTradeMutationEnvelopeV1 {
+ TradeMutationEnvelopeV1 {
mutation_id: None,
contract_id: RADROOTS_TRADE_DECISION_CONTRACT_ID.to_owned(),
schema_version: RADROOTS_TRADE_SCHEMA_VERSION,
@@ -2002,22 +1994,21 @@ mod tests {
root_mutation_id: Some(proposal.mutation_id.clone()),
buyer_pubkey: public_key('a'),
seller_pubkey: public_key('a'),
- farm_id: RadrootsDTag::parse("farm-1").expect("farm id"),
+ farm_id: DTag::parse("farm-1").expect("farm id"),
parent_mutation_ids: vec![proposal.mutation_id.clone()],
author_pubkey: public_key('a'),
counterparty_pubkey: public_key('a'),
authored_at_unix_s: 1_799_000_060,
- body: RadrootsTradeMutationBodyV1::Decision {
+ body: TradeMutationBodyV1::Decision {
proposal_mutation_id: proposal.mutation_id.clone(),
candidate_id: candidate_id.clone(),
- decision: RadrootsTradeDecisionV1::Accepted {
- reservation_assertion: Some(RadrootsSellerReservationAssertionV1 {
- reservation_id: RadrootsDTag::parse("reservation-1")
- .expect("reservation id"),
+ decision: TradeDecisionV1::Accepted {
+ reservation_assertion: Some(SellerReservationAssertionV1 {
+ reservation_id: DTag::parse("reservation-1").expect("reservation id"),
inventory_authority_id: public_key('a'),
inventory_epoch: 7,
candidate_id,
- commitments: vec![RadrootsSellerReservationLineV1 {
+ commitments: vec![SellerReservationLineV1 {
line_id: line.line_id.clone(),
bin_id: line.bin_id.clone(),
quantity_mantissa: line.quantity_mantissa.clone(),
@@ -2032,15 +2023,15 @@ mod tests {
}
}
- fn signed_trade_mutation(canonical: &RadrootsTradeCanonicalMutationV1) -> RadrootsSignedEvent {
+ fn signed_trade_mutation(canonical: &TradeCanonicalMutationV1) -> SignedEvent {
signed_trade_content_with_keys(canonical, canonical.content.clone(), &fixture_keys())
}
fn signed_trade_content_with_keys(
- canonical: &RadrootsTradeCanonicalMutationV1,
+ canonical: &TradeCanonicalMutationV1,
content: String,
keys: &RadrootsNostrKeys,
- ) -> RadrootsSignedEvent {
+ ) -> SignedEvent {
let counterparty = canonical.envelope.counterparty_pubkey.to_hex();
let mut tags = vec![
vec![
@@ -2071,7 +2062,7 @@ mod tests {
created_at: u32,
tags: Vec<Vec<String>>,
content: &str,
- ) -> RadrootsSignedEvent {
+ ) -> SignedEvent {
signed_event_with_keys(&fixture_keys(), kind, created_at, tags, content)
}
@@ -2081,7 +2072,7 @@ mod tests {
created_at: u32,
tags: Vec<Vec<String>>,
content: &str,
- ) -> RadrootsSignedEvent {
+ ) -> SignedEvent {
let raw_event = test_event_builder(kind, content, tags)
.custom_created_at(RadrootsNostrTimestamp::from_secs(u64::from(created_at)))
.sign_with_keys(keys)
@@ -2089,12 +2080,12 @@ mod tests {
signed_event_from_raw_json(serde_json::to_string(&raw_event).expect("raw json"))
}
- fn signed_event_from_raw_json(raw_json: String) -> RadrootsSignedEvent {
- let wire = RadrootsNip01EventWire::parse_json(raw_json.as_str()).expect("wire");
- RadrootsSignedEvent::from_wire_verified_id(wire, raw_json).expect("signed event")
+ fn signed_event_from_raw_json(raw_json: String) -> SignedEvent {
+ let wire = Nip01EventWire::parse_json(raw_json.as_str()).expect("wire");
+ SignedEvent::from_wire_verified_id(wire, raw_json).expect("signed event")
}
- fn raw_source_text_bytes(event: &RadrootsSignedEvent) -> (u64, u64) {
+ fn raw_source_text_bytes(event: &SignedEvent) -> (u64, u64) {
let tags = event.tags_as_vec();
let tags_json = serde_json::to_string(&tags).expect("tags JSON");
let pubkey = event.pubkey().to_hex();
@@ -2185,7 +2176,7 @@ mod tests {
created_at: u64,
tags: Vec<Vec<String>>,
content: &str,
- ) -> RadrootsSignedEvent {
+ ) -> SignedEvent {
let pubkey = FIXTURE_ALICE_PUBLIC_KEY_HEX.to_owned();
let content = content.to_owned();
let id = compute_canonical_nip01_event_id(
@@ -2197,7 +2188,7 @@ mod tests {
)
.expect("event id")
.into_string();
- let wire = RadrootsNip01EventWire {
+ let wire = Nip01EventWire {
id,
pubkey,
created_at,
@@ -2208,18 +2199,18 @@ mod tests {
extra: Default::default(),
};
let raw_json = serde_json::to_string(&wire).expect("raw json");
- RadrootsSignedEvent::from_wire_verified_id(wire, raw_json).expect("signed event")
+ SignedEvent::from_wire_verified_id(wire, raw_json).expect("signed event")
}
- fn tamper_signature(event: &RadrootsSignedEvent) -> RadrootsSignedEvent {
+ fn tamper_signature(event: &SignedEvent) -> SignedEvent {
let mut wire = event.wire().clone();
let replacement = if wire.sig.starts_with('0') { "1" } else { "0" };
wire.sig.replace_range(0..1, replacement);
let raw_json = serde_json::to_string(&wire).expect("raw json");
- RadrootsSignedEvent::from_wire_verified_id(wire, raw_json).expect("signed event")
+ SignedEvent::from_wire_verified_id(wire, raw_json).expect("signed event")
}
- fn tampered_content_raw_json(event: &RadrootsSignedEvent, content: &str) -> String {
+ fn tampered_content_raw_json(event: &SignedEvent, content: &str) -> String {
let mut wire = event.wire().clone();
wire.content = content.to_owned();
serde_json::to_string(&wire).expect("raw json")
@@ -2278,8 +2269,8 @@ mod tests {
]
}
- fn head_coordinate_for_event(event: &RadrootsSignedEvent) -> RadrootsEventHeadCoordinate {
- let RadrootsEventHeadCandidateResult::Candidate(candidate) =
+ fn head_coordinate_for_event(event: &SignedEvent) -> EventHeadCoordinate {
+ let EventHeadCandidateResult::Candidate(candidate) =
event_head_candidate_for_nip01_event_v1(event.envelope())
else {
panic!("event should select a head");
@@ -2287,8 +2278,8 @@ mod tests {
candidate.coordinate
}
- fn profile_coordinate() -> RadrootsEventHeadCoordinate {
- RadrootsEventHeadCoordinate::Replaceable {
+ fn profile_coordinate() -> EventHeadCoordinate {
+ EventHeadCoordinate::Replaceable {
kind: KIND_PROFILE,
pubkey: PublicKey::from_hex(FIXTURE_ALICE_PUBLIC_KEY_HEX).expect("pubkey"),
}
@@ -2299,7 +2290,7 @@ mod tests {
created_at: u32,
d_tags: Vec<Vec<String>>,
content: &str,
- ) -> RadrootsSignedEvent {
+ ) -> SignedEvent {
signed_event_with_keys(keys, KIND_LIST_SET_RELAY, created_at, d_tags, content)
}
@@ -2307,7 +2298,7 @@ mod tests {
keys: &RadrootsNostrKeys,
created_at: u32,
tags: Vec<Vec<String>>,
- ) -> RadrootsSignedEvent {
+ ) -> SignedEvent {
signed_event_with_keys(keys, KIND_DELETION_REQUEST, created_at, tags, "")
}
@@ -2318,7 +2309,7 @@ mod tests {
summary: &str,
status: &str,
mut images: Vec<Vec<String>>,
- ) -> RadrootsSignedEvent {
+ ) -> SignedEvent {
let mut tags = vec![
vec!["d".to_owned(), d_tag.to_owned()],
vec!["title".to_owned(), title.to_owned()],
@@ -2347,7 +2338,7 @@ mod tests {
created_at: u32,
d_tag: &str,
content: impl Into<String>,
- ) -> RadrootsSignedEvent {
+ ) -> SignedEvent {
let content = content.into();
signed_event(
KIND_CALENDAR_DATE_EVENT,
@@ -2721,7 +2712,7 @@ mod tests {
async fn insert_pending_raw_envelope(
tx: &mut sqlx::Transaction<'_, sqlx::Sqlite>,
- signed_event: RadrootsSignedEvent,
+ signed_event: SignedEvent,
observed_at_ms: i64,
) {
let ingest = RadrootsEventIngest::new(signed_event, observed_at_ms);
@@ -3002,7 +2993,7 @@ mod tests {
let projected = store
.food_availability_v1(
&PublicKey::from_hex(FIXTURE_ALICE_PUBLIC_KEY_HEX).expect("author"),
- &RadrootsFoodIdentifier::parse("v4-rebuild-carrots").expect("identifier"),
+ &FoodIdentifier::parse("v4-rebuild-carrots").expect("identifier"),
)
.await
.expect("projection lookup")
@@ -3132,7 +3123,7 @@ mod tests {
let projected = store
.food_availability_v1(
&PublicKey::from_hex(FIXTURE_ALICE_PUBLIC_KEY_HEX).expect("author"),
- &RadrootsFoodIdentifier::parse("migration-carrots").expect("identifier"),
+ &FoodIdentifier::parse("migration-carrots").expect("identifier"),
)
.await
.expect("projection lookup")
@@ -3184,7 +3175,7 @@ mod tests {
let rebuilt = store
.food_availability_v1(
&PublicKey::from_hex(FIXTURE_ALICE_PUBLIC_KEY_HEX).expect("author"),
- &RadrootsFoodIdentifier::parse("migration-carrots").expect("identifier"),
+ &FoodIdentifier::parse("migration-carrots").expect("identifier"),
)
.await
.expect("rebuilt projection lookup")
@@ -5503,10 +5494,7 @@ CREATE TABLE aux.event_transport_observation (event_id TEXT);",
stored_decision.first_transport_event_id.to_hex(),
decision_event.id_hex()
);
- assert_eq!(
- stored_decision.mutation_kind,
- RadrootsTradeMutationKindV1::Decision
- );
+ assert_eq!(stored_decision.mutation_kind, TradeMutationKindV1::Decision);
let missing = store
.missing_trade_parents(&trade_id())
@@ -5516,7 +5504,7 @@ CREATE TABLE aux.event_transport_observation (event_id TEXT);",
assert_eq!(missing[0].mutation_id, decision.mutation_id);
assert_eq!(missing[0].missing_parent_mutation_id, proposal.mutation_id);
- let reservation_id = RadrootsDTag::parse("reservation-1").expect("reservation id");
+ let reservation_id = DTag::parse("reservation-1").expect("reservation id");
let reservation = store
.seller_reservation(&reservation_id)
.await
@@ -5943,10 +5931,10 @@ CREATE TABLE aux.event_transport_observation (event_id TEXT);",
let proposal = canonical_trade_mutation_content(proposal_envelope()).expect("proposal");
let decision =
canonical_trade_mutation_content(decision_envelope(&proposal)).expect("decision");
- let RadrootsTradeMutationBodyV1::Proposal { candidate } = &proposal.envelope.body else {
+ let TradeMutationBodyV1::Proposal { candidate } = &proposal.envelope.body else {
unreachable!("proposal fixture");
};
- let RadrootsTradeMutationBodyV1::Decision {
+ let TradeMutationBodyV1::Decision {
proposal_mutation_id,
candidate_id,
decision: decision_value,
@@ -5956,23 +5944,23 @@ CREATE TABLE aux.event_transport_observation (event_id TEXT);",
};
let mut revision_proposal = proposal.envelope.clone();
- revision_proposal.body = RadrootsTradeMutationBodyV1::RevisionProposal {
+ revision_proposal.body = TradeMutationBodyV1::RevisionProposal {
candidate: candidate.clone(),
};
let mut revision_decision = decision.envelope.clone();
- revision_decision.body = RadrootsTradeMutationBodyV1::RevisionDecision {
+ revision_decision.body = TradeMutationBodyV1::RevisionDecision {
proposal_mutation_id: proposal_mutation_id.clone(),
candidate_id: candidate_id.clone(),
decision: decision_value.clone(),
};
let mut cancellation = proposal.envelope.clone();
- cancellation.body = RadrootsTradeMutationBodyV1::Cancellation {
+ cancellation.body = TradeMutationBodyV1::Cancellation {
target_candidate_id: Some(candidate_id.clone()),
target_claim_mutation_id: Some(decision.mutation_id.clone()),
reason: "fixture".to_owned(),
};
let mut claim_only_cancellation = cancellation.clone();
- claim_only_cancellation.body = RadrootsTradeMutationBodyV1::Cancellation {
+ claim_only_cancellation.body = TradeMutationBodyV1::Cancellation {
target_candidate_id: None,
target_claim_mutation_id: Some(decision.mutation_id.clone()),
reason: "fixture".to_owned(),
@@ -6004,11 +5992,11 @@ CREATE TABLE aux.event_transport_observation (event_id TEXT);",
assert_eq!(public_key('b').to_hex(), FIXTURE_BOB_PUBLIC_KEY_HEX);
for kind in [
- RadrootsTradeMutationKindV1::Proposal,
- RadrootsTradeMutationKindV1::Decision,
- RadrootsTradeMutationKindV1::RevisionProposal,
- RadrootsTradeMutationKindV1::RevisionDecision,
- RadrootsTradeMutationKindV1::Cancellation,
+ TradeMutationKindV1::Proposal,
+ TradeMutationKindV1::Decision,
+ TradeMutationKindV1::RevisionProposal,
+ TradeMutationKindV1::RevisionDecision,
+ TradeMutationKindV1::Cancellation,
] {
let stored = trade_mutation_kind_storage_value(kind);
assert_eq!(
@@ -6027,9 +6015,9 @@ CREATE TABLE aux.event_transport_observation (event_id TEXT);",
let proposal = canonical_trade_mutation_content(proposal_envelope()).expect("proposal");
let mut invalid_epoch_envelope = decision_envelope(&proposal);
- let RadrootsTradeMutationBodyV1::Decision {
+ let TradeMutationBodyV1::Decision {
decision:
- RadrootsTradeDecisionV1::Accepted {
+ TradeDecisionV1::Accepted {
reservation_assertion: Some(invalid_epoch),
},
..
@@ -6055,9 +6043,9 @@ CREATE TABLE aux.event_transport_observation (event_id TEXT);",
assert_no_event_or_trade_residue(&store, &source_authority).await;
let mut invalid_expiry_envelope = decision_envelope(&proposal);
- let RadrootsTradeMutationBodyV1::Decision {
+ let TradeMutationBodyV1::Decision {
decision:
- RadrootsTradeDecisionV1::Accepted {
+ TradeDecisionV1::Accepted {
reservation_assertion: Some(invalid_expiry),
},
..
@@ -6459,7 +6447,7 @@ CREATE TABLE aux.event_transport_observation (event_id TEXT);",
let coordinate = head_coordinate_for_event(&event);
assert!(matches!(
&coordinate,
- RadrootsEventHeadCoordinate::Addressable { d_tag, .. } if d_tag.is_empty()
+ EventHeadCoordinate::Addressable { d_tag, .. } if d_tag.is_empty()
));
assert_eq!(
store
@@ -6626,7 +6614,7 @@ CREATE TABLE aux.event_transport_observation (event_id TEXT);",
assert_eq!(initial_projection_count, 2);
let author = PublicKey::from_hex(FIXTURE_ALICE_PUBLIC_KEY_HEX).expect("author");
- let carrot_id = RadrootsFoodIdentifier::parse("nantes-carrots").expect("identifier");
+ let carrot_id = FoodIdentifier::parse("nantes-carrots").expect("identifier");
let projected = store
.food_availability_v1(&author, &carrot_id)
.await
@@ -6639,7 +6627,7 @@ CREATE TABLE aux.event_transport_observation (event_id TEXT);",
assert_eq!(projected.price().currency().as_str(), "CAD");
assert_eq!(projected.price().unit().as_str(), "lb");
assert_eq!(projected.quantity().expect("quantity").amount(), "10");
- assert_eq!(projected.status(), RadrootsFoodAvailabilityStatus::Active);
+ assert_eq!(projected.status(), FoodAvailabilityStatus::Active);
assert_eq!(
projected.diagnostics(),
&[
@@ -6719,7 +6707,7 @@ CREATE TABLE aux.event_transport_observation (event_id TEXT);",
.expect("replacement lookup")
.expect("sold projection");
assert_eq!(replacement.event_id().to_hex(), sold.id_hex());
- assert_eq!(replacement.status(), RadrootsFoodAvailabilityStatus::Sold);
+ assert_eq!(replacement.status(), FoodAvailabilityStatus::Sold);
assert_eq!(replacement.published_at().as_u64(), 100);
assert!(replacement.images().is_empty());
let replacement_projection_count: i64 = sqlx::query_scalar(
@@ -7266,7 +7254,7 @@ CREATE TABLE aux.event_transport_observation (event_id TEXT);",
Vec::new(),
);
let author = PublicKey::from_hex(FIXTURE_ALICE_PUBLIC_KEY_HEX).expect("author");
- let identifier = RadrootsFoodIdentifier::parse("nantes-carrots").expect("identifier");
+ let identifier = FoodIdentifier::parse("nantes-carrots").expect("identifier");
for (observed_at_ms, event) in [(20_000, &active), (20_001, &sold)] {
store
@@ -7350,7 +7338,7 @@ CREATE TABLE aux.event_transport_observation (event_id TEXT);",
.expect("recovered lookup")
.expect("recovered projection");
assert_eq!(projection.event_id().to_hex(), recovered.id_hex());
- assert_eq!(projection.status(), RadrootsFoodAvailabilityStatus::Active);
+ assert_eq!(projection.status(), FoodAvailabilityStatus::Active);
let recovered_projection_count: i64 = sqlx::query_scalar(
"SELECT projected_row_count FROM radroots_event_store_food_availability_cursor WHERE singleton = 1",
)
@@ -7425,8 +7413,7 @@ CREATE TABLE aux.event_transport_observation (event_id TEXT);",
#[tokio::test]
async fn admitted_operational_listing_retracts_food_until_a_later_food_revision() {
let store = RadrootsEventStore::open_memory().await.expect("open");
- let identifier =
- RadrootsFoodIdentifier::parse("AAAAAAAAAAAAAAAAAAAAAg").expect("identifier");
+ let identifier = FoodIdentifier::parse("AAAAAAAAAAAAAAAAAAAAAg").expect("identifier");
let author = PublicKey::from_hex(FIXTURE_ALICE_PUBLIC_KEY_HEX).expect("author");
let food = food_availability_event(
200,
@@ -7551,7 +7538,7 @@ CREATE TABLE aux.event_transport_observation (event_id TEXT);",
Vec::new(),
);
let author = PublicKey::from_hex(FIXTURE_ALICE_PUBLIC_KEY_HEX).expect("author");
- let identifier = RadrootsFoodIdentifier::parse("rollback-carrots").expect("identifier");
+ let identifier = FoodIdentifier::parse("rollback-carrots").expect("identifier");
let mut transaction = store.begin_write_transaction().await.expect("transaction");
store
@@ -7647,7 +7634,7 @@ CREATE TABLE aux.event_transport_observation (event_id TEXT);",
.expect("wrong-author deletion remains a valid event");
let author = PublicKey::from_hex(FIXTURE_ALICE_PUBLIC_KEY_HEX).expect("author");
- let identifier = RadrootsFoodIdentifier::parse("protected-carrots").expect("identifier");
+ let identifier = FoodIdentifier::parse("protected-carrots").expect("identifier");
let projection = store
.food_availability_v1(&author, &identifier)
.await
@@ -8538,7 +8525,7 @@ CREATE TABLE aux.event_transport_observation (event_id TEXT);",
);
assert!(matches!(
&missing_coordinate,
- RadrootsEventHeadCoordinate::Addressable { d_tag, .. } if d_tag.is_empty()
+ EventHeadCoordinate::Addressable { d_tag, .. } if d_tag.is_empty()
));
assert_eq!(
store
@@ -8553,7 +8540,7 @@ CREATE TABLE aux.event_transport_observation (event_id TEXT);",
let coordinate = head_coordinate_for_event(event);
assert!(matches!(
&coordinate,
- RadrootsEventHeadCoordinate::Addressable { d_tag, .. } if d_tag == expected_d
+ EventHeadCoordinate::Addressable { d_tag, .. } if d_tag == expected_d
));
let head = store
.raw_event_head(&coordinate)
diff --git a/crates/event_store/src/store/addressable_transition_feed_v1.rs b/crates/event_store/src/store/addressable_transition_feed_v1.rs
@@ -20,7 +20,7 @@ use crate::model::{
use crate::nip09::reconciliation_v1::{
EventAdmission, ReconciliationProfile, generation_from_blob,
};
-use radroots_event::id::RadrootsEventId;
+use radroots_event::id::EventId;
use radroots_identity::PublicKey;
use sqlx::{QueryBuilder, Row, Sqlite, SqliteConnection};
@@ -843,15 +843,12 @@ fn optional_reference(
fn optional_event_id(
field: &'static str,
value: Option<String>,
-) -> Result<Option<RadrootsEventId>, RadrootsEventStoreError> {
+) -> Result<Option<EventId>, RadrootsEventStoreError> {
value.map(|value| parse_event_id(field, value)).transpose()
}
-fn parse_event_id(
- field: &'static str,
- value: String,
-) -> Result<RadrootsEventId, RadrootsEventStoreError> {
- RadrootsEventId::parse(value.as_str())
+fn parse_event_id(field: &'static str, value: String) -> Result<EventId, RadrootsEventStoreError> {
+ EventId::parse(value.as_str())
.map_err(|error| corruption(format!("{field} event id is invalid: {error}")))
}
diff --git a/crates/event_store/src/store/current_visibility_v1.rs b/crates/event_store/src/store/current_visibility_v1.rs
@@ -7,7 +7,7 @@ use crate::model::{
RadrootsNip09SuppressionReason, StoredEventClass,
};
use crate::nip09::reconciliation_v1::generation_from_blob;
-use radroots_event::id::RadrootsEventId;
+use radroots_event::id::EventId;
use sqlx::{Row, Sqlite, Transaction};
impl RadrootsEventStore {
@@ -54,7 +54,7 @@ pub(super) async fn current_visibility_in_transaction(
.map_err(|error| visibility_authority_error("raw-head marker", error))?;
let raw_head_event_id = row
.try_get::<Option<String>, _>("raw_head_event_id")?
- .map(RadrootsEventId::parse)
+ .map(EventId::parse)
.transpose()
.map_err(|error| visibility_authority_error("raw-head event id", error))?;
let decision = RadrootsCurrentVisibilityDecisionV1::parse(
@@ -85,12 +85,12 @@ pub(super) fn suppression_evidence_from_row(
let reason: Option<String> = row.try_get("suppression_reason")?;
let event_reference_request_id = row
.try_get::<Option<String>, _>("event_reference_request_id")?
- .map(RadrootsEventId::parse)
+ .map(EventId::parse)
.transpose()
.map_err(|error| visibility_authority_error("event deletion request id", error))?;
let address_reference_request_id = row
.try_get::<Option<String>, _>("address_reference_request_id")?
- .map(RadrootsEventId::parse)
+ .map(EventId::parse)
.transpose()
.map_err(|error| visibility_authority_error("address deletion request id", error))?;
let address_reference_cutoff = row
@@ -310,11 +310,11 @@ async fn validate_addressable_head_projection(
|| row.try_get::<Option<String>, _>("event_reference_request_id")?
!= evidence
.and_then(|value| value.event_reference_request_id.as_ref())
- .map(RadrootsEventId::to_hex)
+ .map(EventId::to_hex)
|| row.try_get::<Option<String>, _>("address_reference_request_id")?
!= evidence
.and_then(|value| value.address_reference_request_id.as_ref())
- .map(RadrootsEventId::to_hex)
+ .map(EventId::to_hex)
|| stored_cutoff != evidence.and_then(|value| value.address_reference_cutoff)
{
return current_visibility_drift(format!(
diff --git a/crates/event_store/src/store/food_availability_projection_v1.rs b/crates/event_store/src/store/food_availability_projection_v1.rs
@@ -16,8 +16,8 @@ use crate::model::{
use crate::nip09::reconciliation_v1::{
EventAdmission, ReconciliationProfile, generation_from_blob,
};
-use radroots_event::food::availability::RadrootsFoodIdentifier;
-use radroots_event::id::RadrootsEventId;
+use radroots_event::food::availability::FoodIdentifier;
+use radroots_event::id::EventId;
use radroots_event_codec::food_availability::inbound::{
RadrootsFoodAvailabilityImageDiagnostic, RadrootsFoodAvailabilityProjectionOutcome,
project_verified_food_availability_event_registry_v7,
@@ -52,7 +52,7 @@ impl RadrootsEventStore {
pub async fn food_availability_v1(
&self,
pubkey: &PublicKey,
- identifier: &RadrootsFoodIdentifier,
+ identifier: &FoodIdentifier,
) -> Result<Option<RadrootsStoredFoodAvailabilityV1>, RadrootsEventStoreError> {
let mut tx = self.pool.begin().await?;
validate_food_availability_projection_hook_state_fast_v1(&mut tx).await?;
@@ -705,7 +705,7 @@ fn load_and_validate_projection_row(
)?;
let pubkey = PublicKey::from_hex(row.try_get::<String, _>("pubkey")?.as_str())
.map_err(|error| projection_drift(format!("stored pubkey is invalid: {error}")))?;
- let event_id = RadrootsEventId::parse(row.try_get::<String, _>("event_id")?.as_str())
+ let event_id = EventId::parse(row.try_get::<String, _>("event_id")?.as_str())
.map_err(|error| projection_drift(format!("stored event id is invalid: {error}")))?;
let event_seq: i64 = row.try_get("event_seq")?;
let created_at = u64_from_i64("food.created_at", row.try_get("created_at")?)
diff --git a/crates/event_store/src/store/post_core_extensions_v1.rs b/crates/event_store/src/store/post_core_extensions_v1.rs
@@ -2,11 +2,10 @@ use super::post_core_storage_v1::{PostCoreStorageV1, TradeProjectionWrite};
use super::protocol_reconciliation_v1::ProtocolReconciliationV1IngestResult;
use crate::error::RadrootsEventStoreError;
use crate::model::RadrootsEventIngest;
-use radroots_event::id::{RadrootsTradeCandidateId, RadrootsTradeMutationId};
+use radroots_event::id::{CandidateId, MutationId};
use radroots_event::trade::{
- RADROOTS_TRADE_MUTATION_CONTRACT_IDS, RadrootsSellerReservationAssertionV1,
- RadrootsTradeDecisionV1, RadrootsTradeMutationBodyV1, RadrootsTradeMutationEnvelopeV1,
- trade_mutation_from_canonical_content,
+ RADROOTS_TRADE_MUTATION_CONTRACT_IDS, SellerReservationAssertionV1, TradeDecisionV1,
+ TradeMutationBodyV1, TradeMutationEnvelopeV1, trade_mutation_from_canonical_content,
};
use sha2::{Digest, Sha256};
@@ -106,32 +105,26 @@ async fn store_trade_mutation_event(
storage.persist_trade_projection(write).await
}
-fn candidate_id_for_mutation(
- mutation: &RadrootsTradeMutationEnvelopeV1,
-) -> Option<&RadrootsTradeCandidateId> {
+fn candidate_id_for_mutation(mutation: &TradeMutationEnvelopeV1) -> Option<&CandidateId> {
match &mutation.body {
- RadrootsTradeMutationBodyV1::Proposal { candidate }
- | RadrootsTradeMutationBodyV1::RevisionProposal { candidate } => {
- candidate.candidate_id.as_ref()
- }
- RadrootsTradeMutationBodyV1::Decision { candidate_id, .. }
- | RadrootsTradeMutationBodyV1::RevisionDecision { candidate_id, .. } => Some(candidate_id),
- RadrootsTradeMutationBodyV1::Cancellation {
+ TradeMutationBodyV1::Proposal { candidate }
+ | TradeMutationBodyV1::RevisionProposal { candidate } => candidate.candidate_id.as_ref(),
+ TradeMutationBodyV1::Decision { candidate_id, .. }
+ | TradeMutationBodyV1::RevisionDecision { candidate_id, .. } => Some(candidate_id),
+ TradeMutationBodyV1::Cancellation {
target_candidate_id,
..
} => target_candidate_id.as_ref(),
}
}
-fn proposal_mutation_id_for_mutation(
- mutation: &RadrootsTradeMutationEnvelopeV1,
-) -> Option<&RadrootsTradeMutationId> {
+fn proposal_mutation_id_for_mutation(mutation: &TradeMutationEnvelopeV1) -> Option<&MutationId> {
match &mutation.body {
- RadrootsTradeMutationBodyV1::Decision {
+ TradeMutationBodyV1::Decision {
proposal_mutation_id,
..
}
- | RadrootsTradeMutationBodyV1::RevisionDecision {
+ | TradeMutationBodyV1::RevisionDecision {
proposal_mutation_id,
..
} => Some(proposal_mutation_id),
@@ -140,10 +133,10 @@ fn proposal_mutation_id_for_mutation(
}
fn target_claim_mutation_id_for_mutation(
- mutation: &RadrootsTradeMutationEnvelopeV1,
-) -> Option<&RadrootsTradeMutationId> {
+ mutation: &TradeMutationEnvelopeV1,
+) -> Option<&MutationId> {
match &mutation.body {
- RadrootsTradeMutationBodyV1::Cancellation {
+ TradeMutationBodyV1::Cancellation {
target_claim_mutation_id,
..
} => target_claim_mutation_id.as_ref(),
@@ -152,19 +145,19 @@ fn target_claim_mutation_id_for_mutation(
}
fn seller_reservation_for_mutation(
- mutation: &RadrootsTradeMutationEnvelopeV1,
-) -> Option<&RadrootsSellerReservationAssertionV1> {
+ mutation: &TradeMutationEnvelopeV1,
+) -> Option<&SellerReservationAssertionV1> {
match &mutation.body {
- RadrootsTradeMutationBodyV1::Decision {
+ TradeMutationBodyV1::Decision {
decision:
- RadrootsTradeDecisionV1::Accepted {
+ TradeDecisionV1::Accepted {
reservation_assertion: Some(reservation),
},
..
}
- | RadrootsTradeMutationBodyV1::RevisionDecision {
+ | TradeMutationBodyV1::RevisionDecision {
decision:
- RadrootsTradeDecisionV1::Accepted {
+ TradeDecisionV1::Accepted {
reservation_assertion: Some(reservation),
},
..
@@ -179,29 +172,29 @@ fn sha256_hex(bytes: &[u8]) -> String {
#[cfg(test)]
pub(super) fn candidate_id_for_mutation_for_test(
- mutation: &RadrootsTradeMutationEnvelopeV1,
-) -> Option<RadrootsTradeCandidateId> {
+ mutation: &TradeMutationEnvelopeV1,
+) -> Option<CandidateId> {
candidate_id_for_mutation(mutation).cloned()
}
#[cfg(test)]
pub(super) fn proposal_mutation_id_for_mutation_for_test(
- mutation: &RadrootsTradeMutationEnvelopeV1,
-) -> Option<RadrootsTradeMutationId> {
+ mutation: &TradeMutationEnvelopeV1,
+) -> Option<MutationId> {
proposal_mutation_id_for_mutation(mutation).cloned()
}
#[cfg(test)]
pub(super) fn target_claim_mutation_id_for_mutation_for_test(
- mutation: &RadrootsTradeMutationEnvelopeV1,
-) -> Option<RadrootsTradeMutationId> {
+ mutation: &TradeMutationEnvelopeV1,
+) -> Option<MutationId> {
target_claim_mutation_id_for_mutation(mutation).cloned()
}
#[cfg(test)]
pub(super) fn seller_reservation_for_mutation_for_test(
- mutation: &RadrootsTradeMutationEnvelopeV1,
-) -> Option<&RadrootsSellerReservationAssertionV1> {
+ mutation: &TradeMutationEnvelopeV1,
+) -> Option<&SellerReservationAssertionV1> {
seller_reservation_for_mutation(mutation)
}
diff --git a/crates/event_store/src/store/post_core_storage_v1.rs b/crates/event_store/src/store/post_core_storage_v1.rs
@@ -4,11 +4,10 @@ use crate::error::RadrootsEventStoreError;
#[cfg(test)]
use crate::model::RadrootsEventIngest;
use crate::model::RadrootsTransportObservation;
-use radroots_event::envelope::RadrootsEventEnvelope;
-use radroots_event::id::{RadrootsTradeCandidateId, RadrootsTradeMutationId};
+use radroots_event::envelope::EventEnvelope;
+use radroots_event::id::{CandidateId, MutationId};
use radroots_event::trade::{
- RadrootsSellerReservationAssertionV1, RadrootsTradeMutationEnvelopeV1,
- RadrootsTradeMutationKindV1,
+ SellerReservationAssertionV1, TradeMutationEnvelopeV1, TradeMutationKindV1,
};
use radroots_transport::RadrootsTransportKind;
use sqlx::{Sqlite, Transaction};
@@ -18,31 +17,31 @@ pub(super) struct PostCoreStorageV1<'borrow, 'db> {
}
pub(super) struct TradeProjectionWrite<'a> {
- event: &'a RadrootsEventEnvelope,
+ event: &'a EventEnvelope,
stored_event_seq: i64,
- mutation: &'a RadrootsTradeMutationEnvelopeV1,
- mutation_id: &'a RadrootsTradeMutationId,
- candidate_id: Option<&'a RadrootsTradeCandidateId>,
- proposal_mutation_id: Option<&'a RadrootsTradeMutationId>,
- target_claim_mutation_id: Option<&'a RadrootsTradeMutationId>,
+ mutation: &'a TradeMutationEnvelopeV1,
+ mutation_id: &'a MutationId,
+ candidate_id: Option<&'a CandidateId>,
+ proposal_mutation_id: Option<&'a MutationId>,
+ target_claim_mutation_id: Option<&'a MutationId>,
payload_sha256: &'a str,
observed_at_ms: i64,
- reservation: Option<&'a RadrootsSellerReservationAssertionV1>,
+ reservation: Option<&'a SellerReservationAssertionV1>,
}
impl<'a> TradeProjectionWrite<'a> {
#[allow(clippy::too_many_arguments)]
pub(super) fn new(
- event: &'a RadrootsEventEnvelope,
+ event: &'a EventEnvelope,
stored_event_seq: i64,
- mutation: &'a RadrootsTradeMutationEnvelopeV1,
- mutation_id: &'a RadrootsTradeMutationId,
- candidate_id: Option<&'a RadrootsTradeCandidateId>,
- proposal_mutation_id: Option<&'a RadrootsTradeMutationId>,
- target_claim_mutation_id: Option<&'a RadrootsTradeMutationId>,
+ mutation: &'a TradeMutationEnvelopeV1,
+ mutation_id: &'a MutationId,
+ candidate_id: Option<&'a CandidateId>,
+ proposal_mutation_id: Option<&'a MutationId>,
+ target_claim_mutation_id: Option<&'a MutationId>,
payload_sha256: &'a str,
observed_at_ms: i64,
- reservation: Option<&'a RadrootsSellerReservationAssertionV1>,
+ reservation: Option<&'a SellerReservationAssertionV1>,
) -> Self {
Self {
event,
@@ -180,8 +179,8 @@ impl<'borrow, 'db> PostCoreStorageV1<'borrow, 'db> {
async fn insert_trade_mutation_parents(
&mut self,
- mutation_id: &RadrootsTradeMutationId,
- parents: &[RadrootsTradeMutationId],
+ mutation_id: &MutationId,
+ parents: &[MutationId],
) -> Result<(), RadrootsEventStoreError> {
for (index, parent) in parents.iter().enumerate() {
sqlx::query(
@@ -245,7 +244,7 @@ impl<'borrow, 'db> PostCoreStorageV1<'borrow, 'db> {
async fn delete_resolved_missing_parent_records(
&mut self,
- mutation_id: &RadrootsTradeMutationId,
+ mutation_id: &MutationId,
) -> Result<(), RadrootsEventStoreError> {
sqlx::query("DELETE FROM trade_missing_parent WHERE missing_parent_mutation_id = ?")
.bind(mutation_id.to_hex())
@@ -256,9 +255,9 @@ impl<'borrow, 'db> PostCoreStorageV1<'borrow, 'db> {
async fn insert_seller_reservation(
&mut self,
- mutation: &RadrootsTradeMutationEnvelopeV1,
- claim_mutation_id: &RadrootsTradeMutationId,
- reservation: &RadrootsSellerReservationAssertionV1,
+ mutation: &TradeMutationEnvelopeV1,
+ claim_mutation_id: &MutationId,
+ reservation: &SellerReservationAssertionV1,
inserted_at_ms: i64,
) -> Result<(), RadrootsEventStoreError> {
let reservation_json = serde_json::to_string(reservation)?;
@@ -337,13 +336,13 @@ impl<'borrow, 'db> PostCoreStorageV1<'borrow, 'db> {
}
}
-fn trade_mutation_kind_storage_value(kind: RadrootsTradeMutationKindV1) -> &'static str {
+fn trade_mutation_kind_storage_value(kind: TradeMutationKindV1) -> &'static str {
match kind {
- RadrootsTradeMutationKindV1::Proposal => "proposal",
- RadrootsTradeMutationKindV1::Decision => "decision",
- RadrootsTradeMutationKindV1::RevisionProposal => "revision_proposal",
- RadrootsTradeMutationKindV1::RevisionDecision => "revision_decision",
- RadrootsTradeMutationKindV1::Cancellation => "cancellation",
+ TradeMutationKindV1::Proposal => "proposal",
+ TradeMutationKindV1::Decision => "decision",
+ TradeMutationKindV1::RevisionProposal => "revision_proposal",
+ TradeMutationKindV1::RevisionDecision => "revision_decision",
+ TradeMutationKindV1::Cancellation => "cancellation",
}
}
@@ -399,7 +398,7 @@ pub(super) fn register_protocol_post_extension_schema_forge(trigger_event_id: St
#[cfg(test)]
pub(super) fn trade_mutation_kind_storage_value_for_test(
- kind: RadrootsTradeMutationKindV1,
+ kind: TradeMutationKindV1,
) -> &'static str {
trade_mutation_kind_storage_value(kind)
}
diff --git a/crates/event_store/src/store/protocol_reconciliation_v1.rs b/crates/event_store/src/store/protocol_reconciliation_v1.rs
@@ -13,14 +13,13 @@ use crate::source_maintenance_v1::{
advance_source_capacity_after_insert_v1, preflight_unique_raw_source_append_v1,
raw_source_capacity_delta_v1, validate_source_capacity_authority_fast_v1,
};
-use radroots_event::contract::registry_v7::RadrootsEventContract;
+use radroots_event::contract::registry_v7::EventContract;
use radroots_event::envelope::event_head::v1::{
- RadrootsCurrentEventHead, RadrootsEventHeadCandidate, RadrootsEventHeadCandidateResult,
- RadrootsEventHeadCoordinate, RadrootsEventHeadDecision,
- event_head_candidate_for_nip01_event_v1, select_event_head_v1,
+ CurrentEventHead, EventHeadCandidate, EventHeadCandidateResult, EventHeadCoordinate,
+ EventHeadDecision, event_head_candidate_for_nip01_event_v1, select_event_head_v1,
};
-use radroots_event::envelope::{RadrootsEventEnvelope, RadrootsEventKindClass};
-use radroots_event::id::RadrootsEventId;
+use radroots_event::envelope::{EventEnvelope, EventKindClass};
+use radroots_event::id::EventId;
use sqlx::sqlite::SqliteRow;
use sqlx::{Row, Sqlite, SqliteConnection, Transaction};
@@ -84,7 +83,7 @@ pub(super) async fn ingest_event_protocol_reconciliation_v1(
let admission = EventAdmission::for_profile(profile, ingest.verified_event())?;
let kind_class = event.kind_class();
let valid_stream_eligible = admission.valid_stream_eligible(kind_class);
- if kind_class == RadrootsEventKindClass::Ephemeral {
+ if kind_class == EventKindClass::Ephemeral {
let post_extension_authority_seal = read_protocol_post_extension_authority_seal(tx).await?;
return Ok(ProtocolReconciliationV1IngestResult {
receipt: RadrootsEventIngestReceipt {
@@ -525,8 +524,8 @@ async fn event_seq(
#[cfg_attr(coverage_nightly, coverage(off))]
async fn insert_tags(
tx: &mut Transaction<'_, Sqlite>,
- event: &RadrootsEventEnvelope,
- contract: Option<&'static RadrootsEventContract>,
+ event: &EventEnvelope,
+ contract: Option<&'static EventContract>,
) -> Result<(), RadrootsEventStoreError> {
for (index, tag) in event.tag_slices().iter().enumerate() {
let tag_values = tag.as_slice();
@@ -565,25 +564,25 @@ async fn insert_tags(
pub(super) async fn apply_raw_event_head(
tx: &mut Transaction<'_, Sqlite>,
profile: ReconciliationProfile,
- event: &RadrootsEventEnvelope,
+ event: &EventEnvelope,
updated_at_ms: i64,
) -> Result<AppliedHead, RadrootsEventStoreError> {
let candidate = match profile {
ReconciliationProfile::Nip09V1RegistryV7 => event_head_candidate_for_nip01_event_v1(event),
};
let candidate = match candidate {
- RadrootsEventHeadCandidateResult::Candidate(candidate) => candidate,
- RadrootsEventHeadCandidateResult::NotHeadSelected => {
+ EventHeadCandidateResult::Candidate(candidate) => candidate,
+ EventHeadCandidateResult::NotHeadSelected => {
return Ok(AppliedHead {
decision: RadrootsRawHeadDecision::NotHeadSelected,
});
}
- RadrootsEventHeadCandidateResult::NotPersisted => {
+ EventHeadCandidateResult::NotPersisted => {
return Ok(AppliedHead {
decision: RadrootsRawHeadDecision::NotPersisted,
});
}
- RadrootsEventHeadCandidateResult::Malformed(_) => {
+ EventHeadCandidateResult::Malformed(_) => {
return Ok(AppliedHead {
decision: RadrootsRawHeadDecision::MalformedCoordinate,
});
@@ -595,7 +594,7 @@ pub(super) async fn apply_raw_event_head(
select_event_head_v1(candidate.clone(), current.as_ref())
}
};
- if let RadrootsEventHeadDecision::Applied(head) = &protocol_decision {
+ if let EventHeadDecision::Applied(head) = &protocol_decision {
upsert_head(tx, &candidate, head, updated_at_ms).await?;
}
Ok(AppliedHead {
@@ -605,14 +604,14 @@ pub(super) async fn apply_raw_event_head(
async fn current_event_head(
tx: &mut Transaction<'_, Sqlite>,
- coordinate: &RadrootsEventHeadCoordinate,
-) -> Result<Option<RadrootsCurrentEventHead>, RadrootsEventStoreError> {
+ coordinate: &EventHeadCoordinate,
+) -> Result<Option<CurrentEventHead>, RadrootsEventStoreError> {
let snapshot = raw_head_snapshot_in_transaction(tx, coordinate).await?;
snapshot
.map(|snapshot| {
- Ok(RadrootsCurrentEventHead {
+ Ok(CurrentEventHead {
coordinate: coordinate.clone(),
- event_id: RadrootsEventId::parse(snapshot.raw_head.event_id)?,
+ event_id: EventId::parse(snapshot.raw_head.event_id)?,
created_at: snapshot.raw_head.created_at,
})
})
@@ -622,12 +621,12 @@ async fn current_event_head(
#[cfg_attr(coverage_nightly, coverage(off))]
async fn upsert_head(
tx: &mut Transaction<'_, Sqlite>,
- candidate: &RadrootsEventHeadCandidate,
- head: &RadrootsCurrentEventHead,
+ candidate: &EventHeadCandidate,
+ head: &CurrentEventHead,
updated_at_ms: i64,
) -> Result<(), RadrootsEventStoreError> {
match &head.coordinate {
- RadrootsEventHeadCoordinate::Replaceable { kind, pubkey } => {
+ EventHeadCoordinate::Replaceable { kind, pubkey } => {
sqlx::query(
"DELETE FROM event_envelope_head WHERE coordinate_type = 'replaceable' AND kind = ? AND pubkey = ? AND d_tag IS NULL",
)
@@ -646,7 +645,7 @@ async fn upsert_head(
.execute(&mut **tx)
.await?;
}
- RadrootsEventHeadCoordinate::Addressable {
+ EventHeadCoordinate::Addressable {
kind,
pubkey,
d_tag,
diff --git a/crates/event_store/src/store/protocol_storage_v1.rs b/crates/event_store/src/store/protocol_storage_v1.rs
@@ -3,8 +3,8 @@ use crate::model::reconciliation_v1::{
RadrootsEventAdmissionStatus, RadrootsStoredRawEvent, RadrootsStoredRawEventHead,
StoredEventClass,
};
-use radroots_event::envelope::RadrootsEventKind;
-use radroots_event::envelope::event_head::v1::RadrootsEventHeadCoordinate;
+use radroots_event::envelope::EventKind;
+use radroots_event::envelope::event_head::v1::EventHeadCoordinate;
use radroots_identity::PublicKey;
use sqlx::sqlite::SqliteRow;
use sqlx::{Row, Sqlite, Transaction};
@@ -57,8 +57,7 @@ pub(super) fn stored_raw_event_from_row(
if kind > u32::from(u16::MAX) {
return Err(RadrootsEventStoreError::StoredRawEventClassificationInconsistent { event_id });
}
- let expected_class =
- StoredEventClass::from_event_kind_class(RadrootsEventKind::new(kind).class());
+ let expected_class = StoredEventClass::from_event_kind_class(EventKind::new(kind).class());
if expected_class == StoredEventClass::Ephemeral {
return Err(RadrootsEventStoreError::StoredRawEventClassificationInconsistent { event_id });
}
@@ -93,10 +92,10 @@ pub(super) fn stored_raw_event_from_row(
pub(super) async fn raw_head_snapshot_in_transaction(
tx: &mut Transaction<'_, Sqlite>,
- coordinate: &RadrootsEventHeadCoordinate,
+ coordinate: &EventHeadCoordinate,
) -> Result<Option<RawHeadSnapshot>, RadrootsEventStoreError> {
let row = match coordinate {
- RadrootsEventHeadCoordinate::Replaceable { kind, pubkey } => {
+ EventHeadCoordinate::Replaceable { kind, pubkey } => {
sqlx::query(
"SELECT event.seq, event.event_id, event.pubkey, event.created_at, event.kind, event.tags_json, event.content, event.sig, event.raw_json, event.verification_status, event.contract_status, event.contract_id, event.event_class, event.projection_eligible, event.inserted_at_ms, event.updated_at_ms, head.coordinate_type AS raw_head_coordinate_type, head.kind AS raw_head_kind, head.pubkey AS raw_head_pubkey, head.d_tag AS raw_head_d_tag, head.event_id AS raw_head_event_id, head.created_at AS raw_head_created_at, head.updated_at_ms AS raw_head_updated_at_ms FROM event_envelope_head AS head LEFT JOIN event_envelopes AS event ON event.event_id = head.event_id WHERE head.coordinate_type = 'replaceable' AND head.kind = ? AND head.pubkey = ? AND head.d_tag IS NULL",
)
@@ -105,7 +104,7 @@ pub(super) async fn raw_head_snapshot_in_transaction(
.fetch_optional(&mut **tx)
.await?
}
- RadrootsEventHeadCoordinate::Addressable {
+ EventHeadCoordinate::Addressable {
kind,
pubkey,
d_tag,
@@ -136,13 +135,13 @@ pub(super) async fn raw_head_snapshot_in_transaction(
pub(super) fn raw_head_coordinate_for_stored_event(
event: &RadrootsStoredRawEvent,
-) -> Result<RadrootsEventHeadCoordinate, RadrootsEventStoreError> {
+) -> Result<EventHeadCoordinate, RadrootsEventStoreError> {
let inconsistent = || RadrootsEventStoreError::StoredHeadInconsistent {
event_id: event.event_id.clone(),
};
let pubkey = PublicKey::from_hex(&event.pubkey).map_err(|_| inconsistent())?;
match event.event_class {
- StoredEventClass::Replaceable => Ok(RadrootsEventHeadCoordinate::Replaceable {
+ StoredEventClass::Replaceable => Ok(EventHeadCoordinate::Replaceable {
kind: event.kind,
pubkey,
}),
@@ -155,7 +154,7 @@ pub(super) fn raw_head_coordinate_for_stored_event(
.and_then(|tag| tag.get(1))
.cloned()
.unwrap_or_default();
- Ok(RadrootsEventHeadCoordinate::Addressable {
+ Ok(EventHeadCoordinate::Addressable {
kind: event.kind,
pubkey,
d_tag,
@@ -183,14 +182,14 @@ fn stored_raw_head_from_joined_row(
}
fn validate_raw_head_snapshot(
- requested_coordinate: &RadrootsEventHeadCoordinate,
+ requested_coordinate: &EventHeadCoordinate,
raw_head: &RadrootsStoredRawEventHead,
raw_event: &RadrootsStoredRawEvent,
) -> Result<(), RadrootsEventStoreError> {
let expected_coordinate = raw_head_coordinate_for_stored_event(raw_event)?;
let stored_coordinate = match raw_head.coordinate_type {
StoredEventClass::Replaceable if raw_head.d_tag.is_none() => {
- RadrootsEventHeadCoordinate::Replaceable {
+ EventHeadCoordinate::Replaceable {
kind: raw_head.kind,
pubkey: PublicKey::from_hex(&raw_head.pubkey).map_err(|_| {
RadrootsEventStoreError::StoredHeadInconsistent {
@@ -199,7 +198,7 @@ fn validate_raw_head_snapshot(
})?,
}
}
- StoredEventClass::Addressable => RadrootsEventHeadCoordinate::Addressable {
+ StoredEventClass::Addressable => EventHeadCoordinate::Addressable {
kind: raw_head.kind,
pubkey: PublicKey::from_hex(&raw_head.pubkey).map_err(|_| {
RadrootsEventStoreError::StoredHeadInconsistent {
diff --git a/crates/event_store/tests/food_availability_projection_v1_result_vector.rs b/crates/event_store/tests/food_availability_projection_v1_result_vector.rs
@@ -1,7 +1,7 @@
#![forbid(unsafe_code)]
use radroots_blossom::Sha256;
-use radroots_event::food::availability::RadrootsFoodIdentifier;
+use radroots_event::food::availability::FoodIdentifier;
use radroots_event_store::{
RADROOTS_ADDRESSABLE_TRANSITION_FEED_VERSION_V1,
RADROOTS_FOOD_AVAILABILITY_PROJECTION_VERSION_V1,
@@ -404,7 +404,7 @@ async fn execute_case(case: ProjectionCase) {
assert_eq!(case.expected.coordinate.kind, 30_402, "{}", case.id);
let public_key = PublicKey::from_hex(&case.expected.coordinate.pubkey)
.unwrap_or_else(|error| panic!("{}: expected public key: {error}", case.id));
- let identifier = RadrootsFoodIdentifier::parse(&case.expected.coordinate.d_tag)
+ let identifier = FoodIdentifier::parse(&case.expected.coordinate.d_tag)
.unwrap_or_else(|error| panic!("{}: expected identifier: {error}", case.id));
let projection = store
.food_availability_v1(&public_key, &identifier)
diff --git a/crates/event_store/tests/support/nip09_reconciliation_v1_result_vector_v2.rs b/crates/event_store/tests/support/nip09_reconciliation_v1_result_vector_v2.rs
@@ -11,7 +11,7 @@ use crate::model::reconciliation_v1::{
tag_value_type_name,
};
use radroots_event::envelope::kind::KIND_LIST_SET_FOLLOW;
-use radroots_event::wire::v1::RadrootsNip01EventWire;
+use radroots_event::wire::v1::Nip01EventWire;
use sha2::{Digest, Sha256};
use sqlx::sqlite::{SqliteConnectOptions, SqlitePoolOptions};
use sqlx::{Row, SqliteConnection, SqlitePool};
@@ -170,7 +170,7 @@ async fn seed_v1_raw_event(
case_id: &str,
input: &Nip09ReconciliationVectorInput,
) {
- let wire = RadrootsNip01EventWire {
+ let wire = Nip01EventWire {
id: input.event.id.clone(),
pubkey: input.event.pubkey.clone(),
created_at: input.event.created_at,
diff --git a/crates/net/src/nostr_client/events/post.rs b/crates/net/src/nostr_client/events/post.rs
@@ -1,9 +1,6 @@
use crate::error::{NetError, Result};
-use radroots_event::{
- post::reply::RadrootsAuthoredNip10Reply,
- post::{RadrootsAuthoredUpdate, RadrootsPost},
-};
-use radroots_event_codec::parsed::RadrootsParsedData;
+use radroots_event::{post::AuthoredUpdate, post::reply::AuthoredNip10Reply};
+use radroots_event_codec::{parsed::RadrootsParsedData, post::decode::LegacyPost};
use radroots_nostr::prelude::{
radroots_nostr_build_nip10_reply_event, radroots_nostr_build_update_event,
radroots_nostr_fetch_post_events, radroots_nostr_send_nip10_reply_event,
@@ -13,7 +10,7 @@ use radroots_nostr::prelude::{
use crate::nostr_client::manager::NostrClientManager;
impl NostrClientManager {
- pub async fn publish_update_event(&self, update: &RadrootsAuthoredUpdate) -> Result<String> {
+ pub async fn publish_update_event(&self, update: &AuthoredUpdate) -> Result<String> {
let builder =
radroots_nostr_build_update_event(update).map_err(|e| NetError::Msg(e.to_string()))?;
let out = radroots_nostr_send_post_event(&self.inner.client, builder)
@@ -22,16 +19,13 @@ impl NostrClientManager {
Ok(out.val.to_string())
}
- pub fn publish_update_event_blocking(&self, update: RadrootsAuthoredUpdate) -> Result<String> {
+ pub fn publish_update_event_blocking(&self, update: AuthoredUpdate) -> Result<String> {
let rt = self.inner.rt.clone();
let this = self.clone();
rt.block_on(async move { this.publish_update_event(&update).await })
}
- pub async fn publish_nip10_reply_event(
- &self,
- reply: &RadrootsAuthoredNip10Reply,
- ) -> Result<String> {
+ pub async fn publish_nip10_reply_event(&self, reply: &AuthoredNip10Reply) -> Result<String> {
let builder = radroots_nostr_build_nip10_reply_event(reply)
.map_err(|e| NetError::Msg(e.to_string()))?;
let out = radroots_nostr_send_nip10_reply_event(&self.inner.client, builder)
@@ -41,10 +35,7 @@ impl NostrClientManager {
Ok(out.val.to_string())
}
- pub fn publish_nip10_reply_event_blocking(
- &self,
- reply: RadrootsAuthoredNip10Reply,
- ) -> Result<String> {
+ pub fn publish_nip10_reply_event_blocking(&self, reply: AuthoredNip10Reply) -> Result<String> {
let rt = self.inner.rt.clone();
let this = self.clone();
rt.block_on(async move { this.publish_nip10_reply_event(&reply).await })
@@ -56,7 +47,7 @@ impl NostrClientManager {
&self,
limit: u16,
since_unix: Option<u64>,
- ) -> Result<Vec<RadrootsParsedData<RadrootsPost>>> {
+ ) -> Result<Vec<RadrootsParsedData<LegacyPost>>> {
let items = radroots_nostr_fetch_post_events(&self.inner.client, limit, since_unix)
.await
.map_err(|e| NetError::Msg(e.to_string()))?;
@@ -67,7 +58,7 @@ impl NostrClientManager {
&self,
limit: u16,
since_unix: Option<u64>,
- ) -> Result<Vec<RadrootsParsedData<RadrootsPost>>> {
+ ) -> Result<Vec<RadrootsParsedData<LegacyPost>>> {
let rt = self.inner.rt.clone();
let this = self.clone();
rt.block_on(async move { this.fetch_post_events(limit, since_unix).await })
diff --git a/crates/net/src/nostr_client/inner.rs b/crates/net/src/nostr_client/inner.rs
@@ -1,8 +1,7 @@
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
-use radroots_event::post::RadrootsPost;
-use radroots_event_codec::parsed::RadrootsParsedData;
+use radroots_event_codec::{parsed::RadrootsParsedData, post::decode::LegacyPost};
use radroots_nostr::prelude::{
RadrootsNostrClient, RadrootsNostrKeys, RadrootsNostrMonitor, RadrootsNostrRelayStatus,
RadrootsNostrRelayUrl,
@@ -17,7 +16,7 @@ pub(super) struct Inner {
pub statuses: Arc<Mutex<HashMap<RadrootsNostrRelayUrl, RadrootsNostrRelayStatus>>>,
pub last_error: Arc<Mutex<Option<String>>>,
pub rt: Handle,
- pub post_events_tx: broadcast::Sender<RadrootsParsedData<RadrootsPost>>,
+ pub post_events_tx: broadcast::Sender<RadrootsParsedData<LegacyPost>>,
pub post_events_stream: Arc<Mutex<Option<JoinHandle<()>>>>,
}
diff --git a/crates/net/src/nostr_client/manager.rs b/crates/net/src/nostr_client/manager.rs
@@ -84,7 +84,9 @@ impl NostrClientManager {
pub fn subscribe_post_events(
&self,
) -> tokio::sync::broadcast::Receiver<
- radroots_event_codec::parsed::RadrootsParsedData<radroots_event::post::RadrootsPost>,
+ radroots_event_codec::parsed::RadrootsParsedData<
+ radroots_event_codec::post::decode::LegacyPost,
+ >,
> {
self.inner.post_events_tx.subscribe()
}
diff --git a/crates/nostr/README.md b/crates/nostr/README.md
@@ -39,14 +39,14 @@ Strict
[NIP-22](https://github.com/nostr-protocol/nips/blob/bdfa7e62ef87fcfcb992b1a27aee49d36b0b4f91/22.md)
Comment publication is separately exposed through
`RadrootsNostrNip22CommentEventBuilder`. Its only input is a checked
-`RadrootsAuthoredNip22Comment`; callers may choose the timestamp and sign or
+`AuthoredNip22Comment`; callers may choose the timestamp and sign or
publish, but cannot mutate the kind, content, or canonical
root, parent, kind, and participant tags. The profile admits event or address
roots only for kinds `30402`, `31922`, and `31923`; it has no external
`I`/`i` or kind-`1` root surface.
Reply and Comment authoring and verified projection share the portable
-`RadrootsNostrRelayHint` profile rather than the generic relay URL type. It
+`NostrRelayHint` profile rather than the generic relay URL type. It
accepts only exact lowercase `ws://` or `wss://` visible-ASCII URLs with a
canonical lowercase DNS, four-octet IPv4, or bracketed pure-hex RFC 5952 IPv6
authority, an optional canonical port `1..65535`, and RFC 3986
@@ -69,7 +69,7 @@ Strict
[NIP-09](https://github.com/nostr-protocol/nips/blob/bdfa7e62ef87fcfcb992b1a27aee49d36b0b4f91/09.md)
deletion-request publication is exposed through the sealed
`RadrootsNostrNip09DeletionRequestEventBuilder`. Its only input is a checked
-`RadrootsAuthoredNip09DeletionRequest`; callers may choose the timestamp and
+`AuthoredNip09DeletionRequest`; callers may choose the timestamp and
sign or publish, but cannot mutate the kind, content, or canonical `e`, `a`,
and derived `k` tags. Generic kind-5 builders are rejected before signer
access. Admission proves only the signed deletion-request event and its typed
@@ -120,7 +120,7 @@ unsigned-event conversion, or unchecked deserialization path.
Strict kind-0 Profile publication uses
`RadrootsNostrProfileEventBuilder`, constructed only from
-`RadrootsAuthoredProfile`. The sealed wrapper permits timestamp selection and
+`AuthoredProfile`. The sealed wrapper permits timestamp selection and
local signing or client publication, but no raw kind, content, or tag
mutation. A media-bearing Profile still requires runtime-owned proof of
successful BUD-02 upload before it reaches this authoring boundary.
diff --git a/crates/nostr/src/client.rs b/crates/nostr/src/client.rs
@@ -574,8 +574,8 @@ mod tests {
RadrootsNostrSecretKey::from_slice(&[4_u8; 32]).expect("test secret key"),
);
let client = RadrootsNostrClient::new(keys);
- let update = radroots_event::post::RadrootsAuthoredUpdate::new("Farm update")
- .expect("authored update");
+ let update =
+ radroots_event::post::AuthoredUpdate::new("Farm update").expect("authored update");
let builder = crate::events::post::radroots_nostr_build_update_event(&update)
.expect("sealed post builder");
@@ -594,15 +594,14 @@ mod tests {
RadrootsNostrSecretKey::from_slice(&[5_u8; 32]).expect("test secret key"),
);
let client = RadrootsNostrClient::new(keys);
- let reference = radroots_event::post::reply::RadrootsNip10ReplyReference::parse(
+ let reference = radroots_event::post::reply::Nip10ReplyReference::parse(
"a".repeat(64),
FIXTURE_BOB_PUBLIC_KEY_HEX,
None,
)
.expect("reference");
- let reply =
- radroots_event::post::reply::RadrootsAuthoredNip10Reply::direct("Reply", reference)
- .expect("reply");
+ let reply = radroots_event::post::reply::AuthoredNip10Reply::direct("Reply", reference)
+ .expect("reply");
let builder =
crate::events::reply::radroots_nostr_build_nip10_reply_event(&reply).expect("builder");
diff --git a/crates/nostr/src/codec_adapters.rs b/crates/nostr/src/codec_adapters.rs
@@ -4,8 +4,8 @@ use alloc::{string::String, vec::Vec};
use crate::types::RadrootsNostrEvent;
use radroots_event::{
- social::job_feedback::RadrootsJobFeedback, social::job_request::RadrootsJobRequest,
- social::job_result::RadrootsJobResult,
+ social::job_feedback::JobFeedback, social::job_request::JobRequest,
+ social::job_result::JobResult,
};
use radroots_event_codec::job::{
error::JobParseError, feedback::decode as fb_decode, request::decode as req_decode,
@@ -43,7 +43,7 @@ fn sig_hex(e: &RadrootsNostrEvent) -> String {
pub fn to_job_request_metadata(
e: &RadrootsNostrEvent,
-) -> Result<RadrootsParsedData<RadrootsJobRequest>, JobParseError> {
+) -> Result<RadrootsParsedData<JobRequest>, JobParseError> {
req_decode::data_from_event(
event_id(e),
author(e),
@@ -55,7 +55,7 @@ pub fn to_job_request_metadata(
pub fn to_job_result_metadata(
e: &RadrootsNostrEvent,
-) -> Result<RadrootsParsedData<RadrootsJobResult>, JobParseError> {
+) -> Result<RadrootsParsedData<JobResult>, JobParseError> {
res_decode::data_from_event(
event_id(e),
author(e),
@@ -68,7 +68,7 @@ pub fn to_job_result_metadata(
pub fn to_job_feedback_metadata(
e: &RadrootsNostrEvent,
-) -> Result<RadrootsParsedData<RadrootsJobFeedback>, JobParseError> {
+) -> Result<RadrootsParsedData<JobFeedback>, JobParseError> {
fb_decode::data_from_event(
event_id(e),
author(e),
@@ -81,7 +81,7 @@ pub fn to_job_feedback_metadata(
pub fn to_job_request_index(
e: &RadrootsNostrEvent,
-) -> Result<RadrootsParsedEvent<RadrootsJobRequest>, JobParseError> {
+) -> Result<RadrootsParsedEvent<JobRequest>, JobParseError> {
req_decode::parsed_from_event(
event_id(e),
author(e),
@@ -95,7 +95,7 @@ pub fn to_job_request_index(
pub fn to_job_result_index(
e: &RadrootsNostrEvent,
-) -> Result<RadrootsParsedEvent<RadrootsJobResult>, JobParseError> {
+) -> Result<RadrootsParsedEvent<JobResult>, JobParseError> {
res_decode::parsed_from_event(
event_id(e),
author(e),
@@ -109,7 +109,7 @@ pub fn to_job_result_index(
pub fn to_job_feedback_index(
e: &RadrootsNostrEvent,
-) -> Result<RadrootsParsedEvent<RadrootsJobFeedback>, JobParseError> {
+) -> Result<RadrootsParsedEvent<JobFeedback>, JobParseError> {
fb_decode::parsed_from_event(
event_id(e),
author(e),
diff --git a/crates/nostr/src/draft_signing.rs b/crates/nostr/src/draft_signing.rs
@@ -4,13 +4,13 @@ use crate::error::RadrootsNostrError;
use crate::events::radroots_nostr_build_event_unchecked;
use crate::types::{RadrootsNostrKeys, RadrootsNostrTimestamp};
use nostr::JsonUtil;
-use radroots_event::draft::{RadrootsEventDraft, RadrootsSignedEvent};
-use radroots_event::wire::RadrootsNip01EventWire;
+use radroots_event::draft::{EventDraft, SignedEvent};
+use radroots_event::wire::Nip01EventWire;
pub fn radroots_nostr_sign_frozen_draft(
keys: &RadrootsNostrKeys,
- draft: &RadrootsEventDraft,
-) -> Result<RadrootsSignedEvent, RadrootsNostrError> {
+ draft: &EventDraft,
+) -> Result<SignedEvent, RadrootsNostrError> {
draft.validate_for_signing()?;
let actual_pubkey = keys.public_key().to_hex();
if actual_pubkey != draft.expected_pubkey().to_hex() {
@@ -37,8 +37,8 @@ pub fn radroots_nostr_sign_frozen_draft(
}
let raw_json = event.as_json();
- let wire = RadrootsNip01EventWire::parse_json(raw_json.as_str())?;
- RadrootsSignedEvent::from_wire_verified_id(wire, raw_json).map_err(Into::into)
+ let wire = Nip01EventWire::parse_json(raw_json.as_str())?;
+ SignedEvent::from_wire_verified_id(wire, raw_json).map_err(Into::into)
}
#[cfg(test)]
@@ -48,7 +48,7 @@ mod tests {
use crate::test_fixtures::{FIXTURE_ALICE, FIXTURE_BOB};
use crate::types::{RadrootsNostrKeys, RadrootsNostrSecretKey};
use nostr::JsonUtil;
- use radroots_event::draft::RadrootsEventDraft;
+ use radroots_event::draft::EventDraft;
use radroots_event::envelope::kind::KIND_GEOCHAT;
fn fixture_keys(secret_key_hex: &str) -> RadrootsNostrKeys {
@@ -56,8 +56,8 @@ mod tests {
RadrootsNostrKeys::new(secret_key)
}
- fn generic_draft(expected_pubkey: &str) -> RadrootsEventDraft {
- RadrootsEventDraft::new(
+ fn generic_draft(expected_pubkey: &str) -> EventDraft {
+ EventDraft::new(
"radroots.social.geochat.v1",
KIND_GEOCHAT,
1_700_000_000,
@@ -104,7 +104,7 @@ mod tests {
let draft = generic_draft(FIXTURE_ALICE.public_key_hex);
let mut raw = serde_json::to_value(&draft).expect("draft json");
raw["expected_event_id"] = serde_json::Value::String("f".repeat(64));
- serde_json::from_value::<RadrootsEventDraft>(raw)
+ serde_json::from_value::<EventDraft>(raw)
.expect_err("tampered draft must fail before signing");
}
}
diff --git a/crates/nostr/src/error.rs b/crates/nostr/src/error.rs
@@ -46,11 +46,11 @@ pub enum RadrootsNostrError {
#[cfg(feature = "events")]
#[error("Draft error: {0}")]
- DraftError(#[from] radroots_event::draft::RadrootsDraftError),
+ DraftError(#[from] radroots_event::draft::DraftError),
#[cfg(feature = "events")]
#[error("Event wire error: {0}")]
- EventWire(#[from] radroots_event::wire::RadrootsEventWireError),
+ EventWire(#[from] radroots_event::wire::EventWireError),
#[cfg(feature = "events")]
#[error("FoodAvailability encoding error: {0}")]
@@ -67,7 +67,7 @@ pub enum RadrootsNostrError {
#[cfg(feature = "events")]
#[error("Signed event error: {0}")]
- SignedEvent(#[from] radroots_event::draft::RadrootsSignedEventError),
+ SignedEvent(#[from] radroots_event::draft::SignedEventError),
#[cfg(feature = "events")]
#[error(
diff --git a/crates/nostr/src/event_adapters.rs b/crates/nostr/src/event_adapters.rs
@@ -1,13 +1,14 @@
#[cfg(feature = "events")]
-use radroots_event::post::RadrootsPost;
-#[cfg(feature = "events")]
use radroots_event::profile::{
- RADROOTS_PROFILE_TYPE_TAG_KEY, RadrootsProfile, radroots_profile_type_from_tag_value,
+ RADROOTS_PROFILE_TYPE_TAG_KEY, radroots_profile_type_from_tag_value,
};
#[cfg(feature = "events")]
use radroots_event_codec::parsed::RadrootsParsedData;
#[cfg(feature = "events")]
-use radroots_event_codec::profile::RadrootsProfileData;
+use radroots_event_codec::{
+ post::decode::LegacyPost,
+ profile::{LegacyProfile, RadrootsProfileData},
+};
#[cfg(feature = "events")]
use crate::types::{RadrootsNostrEvent, RadrootsNostrMetadata};
@@ -19,13 +20,13 @@ use crate::types::{RadrootsNostrEvent, RadrootsNostrMetadata};
/// Use `verify_and_admit_post_event` over `radroots_event_from_nostr` whenever
/// the caller needs root Update, PhotoUpdate, or Ask admission. Its explicit
/// thread-excluded outcome makes no Reply claim.
-pub fn to_post_event_metadata(e: &RadrootsNostrEvent) -> RadrootsParsedData<RadrootsPost> {
+pub fn to_post_event_metadata(e: &RadrootsNostrEvent) -> RadrootsParsedData<LegacyPost> {
RadrootsParsedData::new(
e.id.to_string(),
e.pubkey.to_string(),
e.created_at.as_secs(),
e.kind.as_u16() as u32,
- RadrootsPost {
+ LegacyPost {
content: e.content.clone(),
farm: None,
address_refs: None,
@@ -59,7 +60,7 @@ pub fn to_profile_event_metadata(
})
.next();
- if let Ok(p) = serde_json::from_str::<RadrootsProfile>(&e.content) {
+ if let Ok(p) = serde_json::from_str::<LegacyProfile>(&e.content) {
return Some(RadrootsParsedData::new(
e.id.to_string(),
e.pubkey.to_string(),
@@ -73,7 +74,7 @@ pub fn to_profile_event_metadata(
}
if let Ok(md) = serde_json::from_str::<RadrootsNostrMetadata>(&e.content) {
- let p = RadrootsProfile {
+ let p = LegacyProfile {
name: md.name.unwrap_or_default(),
display_name: md.display_name,
nip05: md.nip05,
diff --git a/crates/nostr/src/event_convert.rs b/crates/nostr/src/event_convert.rs
@@ -2,14 +2,14 @@
use crate::types::RadrootsNostrEvent as RadrootsNostrRawEvent;
use radroots_event::{
- envelope::RadrootsEventEnvelope, envelope::RadrootsEventEnvelopeError,
- envelope::RadrootsEventEnvelopeParts, tag::RadrootsEventPtr,
+ envelope::EventEnvelope, envelope::EventEnvelopeError, envelope::EventEnvelopeParts,
+ tag::EventPtr,
};
pub fn radroots_event_from_nostr(
event: &RadrootsNostrRawEvent,
-) -> Result<RadrootsEventEnvelope, RadrootsEventEnvelopeError> {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+) -> Result<EventEnvelope, EventEnvelopeError> {
+ EventEnvelope::new(EventEnvelopeParts {
id: event.id.to_string(),
author: event.pubkey.to_string(),
created_at: event.created_at.as_secs(),
@@ -20,8 +20,8 @@ pub fn radroots_event_from_nostr(
})
}
-pub fn radroots_event_ptr_from_nostr(event: &RadrootsNostrRawEvent) -> RadrootsEventPtr {
- RadrootsEventPtr {
+pub fn radroots_event_ptr_from_nostr(event: &RadrootsNostrRawEvent) -> EventPtr {
+ EventPtr {
id: event.id.to_string(),
relays: None,
}
@@ -56,7 +56,7 @@ mod tests {
assert_eq!(
radroots_event_from_nostr(&event),
- Err(RadrootsEventEnvelopeError::ContentTooLarge {
+ Err(EventEnvelopeError::ContentTooLarge {
max: DEFAULT_CONTENT_MAX_BYTES,
actual: DEFAULT_CONTENT_MAX_BYTES + 1,
})
@@ -72,7 +72,7 @@ mod tests {
assert_eq!(
radroots_event_from_nostr(&event),
- Err(RadrootsEventEnvelopeError::TooManyTagElements {
+ Err(EventEnvelopeError::TooManyTagElements {
max: DEFAULT_TAG_TOTAL_ELEMENT_MAX_COUNT,
actual: DEFAULT_TAG_TOTAL_ELEMENT_MAX_COUNT + 1,
})
diff --git a/crates/nostr/src/event_verify.rs b/crates/nostr/src/event_verify.rs
@@ -1,6 +1,6 @@
#![forbid(unsafe_code)]
-use radroots_event::envelope::RadrootsEventEnvelope;
+use radroots_event::envelope::EventEnvelope;
use radroots_event_codec::verification::{
RadrootsNip01VerificationError, verify_event_id, verify_nip01_event,
};
@@ -14,18 +14,14 @@ pub enum RadrootsNostrEventVerification {
MalformedEnvelope,
}
-pub fn radroots_nostr_verify_event(
- event: &RadrootsEventEnvelope,
-) -> RadrootsNostrEventVerification {
+pub fn radroots_nostr_verify_event(event: &EventEnvelope) -> RadrootsNostrEventVerification {
match verify_nip01_event(event.clone()) {
Ok(_) => RadrootsNostrEventVerification::Verified,
Err(error) => verification_error_status(&error),
}
}
-pub fn radroots_nostr_verify_event_id(
- event: &RadrootsEventEnvelope,
-) -> RadrootsNostrEventVerification {
+pub fn radroots_nostr_verify_event_id(event: &EventEnvelope) -> RadrootsNostrEventVerification {
match verify_event_id(event.clone()) {
Ok(_) => RadrootsNostrEventVerification::IdVerified,
Err(error) => verification_error_status(&error),
@@ -59,7 +55,7 @@ mod tests {
use crate::test_fixtures::FIXTURE_ALICE;
use crate::types::{RadrootsNostrKeys, RadrootsNostrSecretKey, RadrootsNostrTimestamp};
use radroots_event::{
- envelope::RadrootsEventEnvelopeParts, envelope::kind::KIND_POST,
+ envelope::EventEnvelopeParts, envelope::kind::KIND_POST,
wire::compute_canonical_nip01_event_id,
};
@@ -69,7 +65,7 @@ mod tests {
RadrootsNostrKeys::new(secret_key)
}
- fn signed_event() -> RadrootsEventEnvelope {
+ fn signed_event() -> EventEnvelope {
let raw_event = radroots_nostr_build_event_unchecked(
KIND_POST,
"hello",
@@ -83,12 +79,12 @@ mod tests {
}
fn envelope_with(
- event: &RadrootsEventEnvelope,
+ event: &EventEnvelope,
content: String,
kind: u32,
sig: String,
- ) -> RadrootsEventEnvelope {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ ) -> EventEnvelope {
+ EventEnvelope::new(EventEnvelopeParts {
id: event.id_hex(),
author: event.author().to_hex().to_owned(),
created_at: event.created_at_u64(),
@@ -182,7 +178,7 @@ mod tests {
)
.expect("canonical id")
.into_string();
- let event = RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ let event = EventEnvelope::new(EventEnvelopeParts {
id,
author: original.author().to_hex().to_owned(),
created_at: original.created_at_u64(),
diff --git a/crates/nostr/src/events/comment.rs b/crates/nostr/src/events/comment.rs
@@ -5,9 +5,7 @@ use crate::{
RadrootsNostrTimestamp,
},
};
-use radroots_event::{
- post::comment::RadrootsAuthoredNip22Comment, wire::RadrootsNip01EventWireParts,
-};
+use radroots_event::{post::comment::AuthoredNip22Comment, wire::Nip01EventWireParts};
use radroots_event_codec::comment::authored::authored_nip22_comment_to_wire_parts;
/// A sealed builder for a validated strict NIP-22 Comment.
@@ -46,13 +44,13 @@ impl RadrootsNostrNip22CommentEventBuilder {
}
pub fn radroots_nostr_build_nip22_comment_event(
- comment: &RadrootsAuthoredNip22Comment,
+ comment: &AuthoredNip22Comment,
) -> Result<RadrootsNostrNip22CommentEventBuilder, RadrootsNostrError> {
builder_from_wire_parts(authored_nip22_comment_to_wire_parts(comment))
}
fn builder_from_wire_parts(
- parts: RadrootsNip01EventWireParts,
+ parts: Nip01EventWireParts,
) -> Result<RadrootsNostrNip22CommentEventBuilder, RadrootsNostrError> {
let inner =
crate::events::radroots_nostr_build_event_unchecked(parts.kind, parts.content, parts.tags)?;
@@ -65,20 +63,19 @@ mod tests {
use crate::test_fixtures::FIXTURE_BOB_PUBLIC_KEY_HEX;
use radroots_event::{
envelope::kind::{KIND_CLASSIFIED_LISTING, KIND_COMMENT},
- post::comment::{RadrootsAuthoredNip22Comment, RadrootsNip22EventRootReference},
+ post::comment::{AuthoredNip22Comment, Nip22EventRootReference},
};
#[test]
fn typed_comment_builder_signs_exact_kind_and_tags() {
- let root = RadrootsNip22EventRootReference::parse(
+ let root = Nip22EventRootReference::parse(
"a".repeat(64),
FIXTURE_BOB_PUBLIC_KEY_HEX,
KIND_CLASSIFIED_LISTING,
None,
)
.expect("root");
- let comment =
- RadrootsAuthoredNip22Comment::top_level_event("Comment", root).expect("comment");
+ let comment = AuthoredNip22Comment::top_level_event("Comment", root).expect("comment");
let keys = RadrootsNostrKeys::generate();
let event = radroots_nostr_build_nip22_comment_event(&comment)
.expect("builder")
diff --git a/crates/nostr/src/events/deletion.rs b/crates/nostr/src/events/deletion.rs
@@ -5,9 +5,7 @@ use crate::{
RadrootsNostrTimestamp,
},
};
-use radroots_event::{
- post::deletion::RadrootsAuthoredNip09DeletionRequest, wire::RadrootsNip01EventWireParts,
-};
+use radroots_event::{post::deletion::AuthoredNip09DeletionRequest, wire::Nip01EventWireParts};
use radroots_event_codec::deletion::authored::authored_nip09_deletion_request_to_wire_parts;
/// A sealed builder for a validated NIP-09 deletion request.
@@ -61,13 +59,13 @@ impl RadrootsNostrNip09DeletionRequestEventBuilder {
}
pub fn radroots_nostr_build_nip09_deletion_request_event(
- request: &RadrootsAuthoredNip09DeletionRequest,
+ request: &AuthoredNip09DeletionRequest,
) -> Result<RadrootsNostrNip09DeletionRequestEventBuilder, RadrootsNostrError> {
builder_from_wire_parts(authored_nip09_deletion_request_to_wire_parts(request))
}
fn builder_from_wire_parts(
- parts: RadrootsNip01EventWireParts,
+ parts: Nip01EventWireParts,
) -> Result<RadrootsNostrNip09DeletionRequestEventBuilder, RadrootsNostrError> {
let inner =
crate::events::radroots_nostr_build_event_unchecked(parts.kind, parts.content, parts.tags)?;
diff --git a/crates/nostr/src/events/food_availability.rs b/crates/nostr/src/events/food_availability.rs
@@ -5,7 +5,7 @@ use crate::{
RadrootsNostrTimestamp,
},
};
-use radroots_event::food::availability::RadrootsFoodAvailabilityDetails;
+use radroots_event::food::availability::FoodAvailabilityDetails;
use radroots_event_codec::food_availability::authored::authored_food_availability_to_wire_parts;
/// A sealed builder for a validated focused FoodAvailability event.
@@ -58,7 +58,7 @@ impl RadrootsNostrFoodAvailabilityEventBuilder {
///
/// This validates media descriptors but does not attest BUD-02 upload.
pub fn radroots_nostr_build_food_availability_event(
- details: &RadrootsFoodAvailabilityDetails,
+ details: &FoodAvailabilityDetails,
created_at: RadrootsNostrTimestamp,
) -> Result<RadrootsNostrFoodAvailabilityEventBuilder, RadrootsNostrError> {
let parts = authored_food_availability_to_wire_parts(details, created_at.as_secs())?;
diff --git a/crates/nostr/src/events/metadata.rs b/crates/nostr/src/events/metadata.rs
@@ -11,7 +11,7 @@ use crate::types::{RadrootsNostrFilter, RadrootsNostrKind, RadrootsNostrPublicKe
#[cfg(feature = "client")]
use core::time::Duration;
#[cfg(feature = "events")]
-use radroots_event::profile::RadrootsAuthoredProfile;
+use radroots_event::profile::AuthoredProfile;
#[cfg(feature = "events")]
use radroots_event_codec::profile::authored::authored_profile_to_wire_parts;
@@ -51,7 +51,7 @@ impl RadrootsNostrProfileEventBuilder {
/// Builds a sealed kind-0 event from the strict authored Profile contract.
#[cfg(feature = "events")]
pub fn radroots_nostr_build_profile_event(
- profile: &RadrootsAuthoredProfile,
+ profile: &AuthoredProfile,
) -> Result<RadrootsNostrProfileEventBuilder, RadrootsNostrError> {
let parts = authored_profile_to_wire_parts(profile)?;
let inner =
diff --git a/crates/nostr/src/events/post.rs b/crates/nostr/src/events/post.rs
@@ -7,11 +7,9 @@ use crate::types::{RadrootsNostrEvent, RadrootsNostrKeys};
use crate::types::{RadrootsNostrFilter, RadrootsNostrKind, RadrootsNostrTimestamp};
#[cfg(feature = "events")]
-use radroots_event::post::{
- RadrootsAuthoredAsk, RadrootsAuthoredPhotoUpdate, RadrootsAuthoredUpdate,
-};
+use radroots_event::post::{AuthoredAsk, AuthoredPhotoUpdate, AuthoredUpdate};
#[cfg(feature = "events")]
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::wire::Nip01EventWireParts;
#[cfg(feature = "events")]
use radroots_event_codec::post::authored::{
authored_ask_to_wire_parts, authored_photo_update_to_wire_parts, authored_update_to_wire_parts,
@@ -56,21 +54,21 @@ impl RadrootsNostrPostEventBuilder {
#[cfg(feature = "events")]
pub fn radroots_nostr_build_update_event(
- update: &RadrootsAuthoredUpdate,
+ update: &AuthoredUpdate,
) -> Result<RadrootsNostrPostEventBuilder, RadrootsNostrError> {
builder_from_wire_parts(authored_update_to_wire_parts(update))
}
#[cfg(feature = "events")]
pub fn radroots_nostr_build_photo_update_event(
- photo: &RadrootsAuthoredPhotoUpdate,
+ photo: &AuthoredPhotoUpdate,
) -> Result<RadrootsNostrPostEventBuilder, RadrootsNostrError> {
builder_from_wire_parts(authored_photo_update_to_wire_parts(photo))
}
#[cfg(feature = "events")]
pub fn radroots_nostr_build_ask_event(
- ask: &RadrootsAuthoredAsk,
+ ask: &AuthoredAsk,
) -> Result<RadrootsNostrPostEventBuilder, RadrootsNostrError> {
builder_from_wire_parts(authored_ask_to_wire_parts(ask))
}
@@ -91,7 +89,7 @@ pub fn radroots_nostr_post_events_filter(
#[cfg(feature = "events")]
fn builder_from_wire_parts(
- parts: RadrootsNip01EventWireParts,
+ parts: Nip01EventWireParts,
) -> Result<RadrootsNostrPostEventBuilder, RadrootsNostrError> {
let inner =
crate::events::radroots_nostr_build_event_unchecked(parts.kind, parts.content, parts.tags)?;
@@ -109,7 +107,11 @@ pub async fn radroots_nostr_fetch_post_events(
limit: u16,
since_unix: Option<u64>,
) -> Result<
- Vec<radroots_event_codec::parsed::RadrootsParsedData<radroots_event::post::RadrootsPost>>,
+ Vec<
+ radroots_event_codec::parsed::RadrootsParsedData<
+ radroots_event_codec::post::decode::LegacyPost,
+ >,
+ >,
RadrootsNostrError,
> {
let filter = radroots_nostr_post_events_filter(Some(limit), since_unix);
diff --git a/crates/nostr/src/events/reply.rs b/crates/nostr/src/events/reply.rs
@@ -5,7 +5,7 @@ use crate::{
RadrootsNostrTimestamp,
},
};
-use radroots_event::{post::reply::RadrootsAuthoredNip10Reply, wire::RadrootsNip01EventWireParts};
+use radroots_event::{post::reply::AuthoredNip10Reply, wire::Nip01EventWireParts};
use radroots_event_codec::reply::authored::authored_nip10_reply_to_wire_parts;
/// A sealed builder for a validated strict marked NIP-10 Reply.
@@ -44,14 +44,14 @@ impl RadrootsNostrNip10ReplyEventBuilder {
}
pub fn radroots_nostr_build_nip10_reply_event(
- reply: &RadrootsAuthoredNip10Reply,
+ reply: &AuthoredNip10Reply,
) -> Result<RadrootsNostrNip10ReplyEventBuilder, RadrootsNostrError> {
let parts = authored_nip10_reply_to_wire_parts(reply);
builder_from_wire_parts(parts)
}
fn builder_from_wire_parts(
- parts: RadrootsNip01EventWireParts,
+ parts: Nip01EventWireParts,
) -> Result<RadrootsNostrNip10ReplyEventBuilder, RadrootsNostrError> {
let inner =
crate::events::radroots_nostr_build_event_unchecked(parts.kind, parts.content, parts.tags)?;
diff --git a/crates/nostr/src/nip11.rs b/crates/nostr/src/nip11.rs
@@ -1,11 +1,11 @@
#[cfg(all(feature = "http", feature = "codec"))]
-use radroots_event::social::relay_document::RadrootsRelayDocument;
+use radroots_event::social::relay_document::RelayDocument;
#[cfg(all(feature = "http", feature = "codec"))]
use crate::util::ws_to_http;
#[cfg(all(feature = "http", feature = "codec"))]
-pub async fn fetch_nip11(ws_url: &str) -> Option<RadrootsRelayDocument> {
+pub async fn fetch_nip11(ws_url: &str) -> Option<RelayDocument> {
let http_url = ws_to_http(ws_url)?;
let client = reqwest::Client::new();
client
@@ -14,7 +14,7 @@ pub async fn fetch_nip11(ws_url: &str) -> Option<RadrootsRelayDocument> {
.send()
.await
.ok()?
- .json::<RadrootsRelayDocument>()
+ .json::<RelayDocument>()
.await
.ok()
}
diff --git a/crates/nostr/src/nip17.rs b/crates/nostr/src/nip17.rs
@@ -11,9 +11,9 @@ use nostr::{
use thiserror::Error;
use radroots_event::envelope::kind::{KIND_MESSAGE, KIND_MESSAGE_FILE};
-use radroots_event::social::message::RadrootsMessage;
-use radroots_event::social::message_file::RadrootsMessageFile;
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::social::message::Message;
+use radroots_event::social::message_file::MessageFile;
+use radroots_event::wire::Nip01EventWireParts;
use radroots_event_codec::error::{EventEncodeError, EventParseError};
use radroots_event_codec::message::decode as message_decode;
use radroots_event_codec::message::encode as message_encode;
@@ -41,8 +41,8 @@ pub enum RadrootsNip17Error {
#[derive(Clone, Debug)]
pub enum RadrootsNip17Rumor {
- Message(RadrootsParsedData<RadrootsMessage>),
- MessageFile(Box<RadrootsParsedData<RadrootsMessageFile>>),
+ Message(RadrootsParsedData<Message>),
+ MessageFile(Box<RadrootsParsedData<MessageFile>>),
}
#[derive(Clone, Debug)]
@@ -76,7 +76,7 @@ fn tags_from_slices(tag_slices: &[Vec<String>]) -> Vec<Tag> {
}
fn rumor_from_parts(
- parts: RadrootsNip01EventWireParts,
+ parts: Nip01EventWireParts,
author: PublicKey,
created_at: Option<u64>,
) -> Result<UnsignedEvent, RadrootsNip17Error> {
@@ -93,7 +93,7 @@ fn rumor_from_parts(
}
fn parse_recipients(
- recipients: &[radroots_event::social::message::RadrootsMessageRecipient],
+ recipients: &[radroots_event::social::message::MessageRecipient],
) -> Result<Vec<PublicKey>, RadrootsNip17Error> {
let mut out = Vec::with_capacity(recipients.len());
for recipient in recipients {
@@ -135,7 +135,7 @@ where
pub async fn radroots_nostr_wrap_message<T>(
signer: &T,
- message: &RadrootsMessage,
+ message: &Message,
options: RadrootsNip17WrapOptions,
) -> Result<Vec<Event>, RadrootsNip17Error>
where
@@ -150,7 +150,7 @@ where
pub async fn radroots_nostr_wrap_message_file<T>(
signer: &T,
- message: &RadrootsMessageFile,
+ message: &MessageFile,
options: RadrootsNip17WrapOptions,
) -> Result<Vec<Event>, RadrootsNip17Error>
where
@@ -210,10 +210,8 @@ mod tests {
use super::*;
use crate::test_fixtures::{FIXTURE_ALICE, FIXTURE_BOB};
use nostr::{Keys, SecretKey};
- use radroots_event::social::message::{RadrootsMessage, RadrootsMessageRecipient};
- use radroots_event::social::message_file::{
- RadrootsMessageFile, RadrootsMessageFileDimensions,
- };
+ use radroots_event::social::message::{Message, MessageRecipient};
+ use radroots_event::social::message_file::{MessageFile, MessageFileDimensions};
fn sender_keys() -> Keys {
Keys::new(SecretKey::from_hex(FIXTURE_ALICE.secret_key_hex).unwrap())
@@ -227,7 +225,7 @@ mod tests {
fn rumor_kind_conversion_is_range_checked() {
let author = sender_keys().public_key();
let max = rumor_from_parts(
- RadrootsNip01EventWireParts {
+ Nip01EventWireParts {
kind: u32::from(u16::MAX),
content: String::new(),
tags: Vec::new(),
@@ -241,7 +239,7 @@ mod tests {
let overflow = u32::from(u16::MAX) + 1;
assert!(matches!(
rumor_from_parts(
- RadrootsNip01EventWireParts {
+ Nip01EventWireParts {
kind: overflow,
content: String::new(),
tags: Vec::new(),
@@ -257,8 +255,8 @@ mod tests {
async fn wrap_and_unwrap_message() {
let sender = sender_keys();
let receiver = receiver_keys();
- let message = RadrootsMessage {
- recipients: vec![RadrootsMessageRecipient {
+ let message = Message {
+ recipients: vec![MessageRecipient {
public_key: receiver.public_key().to_string(),
relay_url: None,
}],
@@ -293,8 +291,8 @@ mod tests {
async fn wrap_and_unwrap_message_file() {
let sender = sender_keys();
let receiver = receiver_keys();
- let message = RadrootsMessageFile {
- recipients: vec![RadrootsMessageRecipient {
+ let message = MessageFile {
+ recipients: vec![MessageRecipient {
public_key: receiver.public_key().to_string(),
relay_url: None,
}],
@@ -308,7 +306,7 @@ mod tests {
encrypted_hash: "hash".to_string(),
original_hash: None,
size: Some(1200),
- dimensions: Some(RadrootsMessageFileDimensions { w: 1200, h: 800 }),
+ dimensions: Some(MessageFileDimensions { w: 1200, h: 800 }),
blurhash: None,
thumb: None,
fallbacks: Vec::new(),
diff --git a/crates/nostr/src/types.rs b/crates/nostr/src/types.rs
@@ -2,7 +2,7 @@
use crate::error::RadrootsNostrError;
use radroots_event::listing::classified::{
- RadrootsClassifiedListingPartition, classify_classified_listing_marker_names,
+ ClassifiedListingPartition, classify_classified_listing_marker_names,
};
pub type RadrootsNostrCoordinate = nostr::nips::nip01::Coordinate;
@@ -256,8 +256,8 @@ impl RadrootsNostrGenericEventBuilder {
let is_reserved_focused_listing = matches!(
classified_listing_partition,
Some(
- RadrootsClassifiedListingPartition::FocusedFoodAvailability
- | RadrootsClassifiedListingPartition::Ambiguous
+ ClassifiedListingPartition::FocusedFoodAvailability
+ | ClassifiedListingPartition::Ambiguous
)
);
if is_profile
diff --git a/crates/nostr/tests/coverage.rs b/crates/nostr/tests/coverage.rs
@@ -5,7 +5,7 @@ use std::borrow::Cow;
use nostr::nips::nip04;
#[cfg(feature = "events")]
-use radroots_event::post::reply::{RadrootsAuthoredNip10Reply, RadrootsNip10ReplyReference};
+use radroots_event::post::reply::{AuthoredNip10Reply, Nip10ReplyReference};
use radroots_nostr::error::RadrootsNostrTagsResolveError;
use radroots_nostr::events::jobs::{
radroots_nostr_build_event_job_feedback, radroots_nostr_build_event_job_result,
@@ -128,13 +128,10 @@ fn post_helpers_cover_success_and_error_paths() {
.expect("parent");
let author_hex = root.pubkey.to_hex();
- let root_reference = RadrootsNip10ReplyReference::parse(
- root.id.to_hex(),
- &author_hex,
- Some(RELAY_PRIMARY_WSS),
- )
- .expect("root reference");
- let direct = RadrootsAuthoredNip10Reply::direct("direct reply", root_reference.clone())
+ let root_reference =
+ Nip10ReplyReference::parse(root.id.to_hex(), &author_hex, Some(RELAY_PRIMARY_WSS))
+ .expect("root reference");
+ let direct = AuthoredNip10Reply::direct("direct reply", root_reference.clone())
.expect("direct reply");
let direct_builder =
radroots_nostr_build_nip10_reply_event(&direct).expect("direct reply builder");
@@ -142,29 +139,27 @@ fn post_helpers_cover_success_and_error_paths() {
.sign_with_keys(&keys)
.expect("direct reply signs through the typed boundary");
- let parent_reference =
- RadrootsNip10ReplyReference::parse(parent.id.to_hex(), &author_hex, None)
- .expect("parent reference");
- let nested =
- RadrootsAuthoredNip10Reply::nested("nested reply", root_reference, parent_reference)
- .expect("nested reply");
+ let parent_reference = Nip10ReplyReference::parse(parent.id.to_hex(), &author_hex, None)
+ .expect("parent reference");
+ let nested = AuthoredNip10Reply::nested("nested reply", root_reference, parent_reference)
+ .expect("nested reply");
let nested_builder =
radroots_nostr_build_nip10_reply_event(&nested).expect("nested reply builder");
let _ = nested_builder
.sign_with_keys(&keys)
.expect("nested reply signs through the typed boundary");
- assert!(RadrootsNip10ReplyReference::parse("bad", &author_hex, None).is_err());
- assert!(RadrootsNip10ReplyReference::parse(root.id.to_hex(), "bad", None).is_err());
+ assert!(Nip10ReplyReference::parse("bad", &author_hex, None).is_err());
+ assert!(Nip10ReplyReference::parse(root.id.to_hex(), "bad", None).is_err());
assert!(
- RadrootsNip10ReplyReference::parse(
+ Nip10ReplyReference::parse(
root.id.to_hex(),
&author_hex,
Some("https://relay.example"),
)
.is_err()
);
- assert!(RadrootsAuthoredNip10Reply::direct(" ", nested.root().clone()).is_err());
+ assert!(AuthoredNip10Reply::direct(" ", nested.root().clone()).is_err());
}
}
diff --git a/crates/nostr/tests/food_availability_profile.rs b/crates/nostr/tests/food_availability_profile.rs
@@ -1,11 +1,10 @@
use radroots_blossom::{BlobDescriptor, BlobUrl, MediaType, Sha256};
use radroots_event::food::availability::{
- RadrootsFoodAvailabilityDetails, RadrootsFoodAvailabilityDetailsParts,
- RadrootsFoodAvailabilityImage, RadrootsFoodAvailabilityStatus, RadrootsFoodContent,
- RadrootsFoodCurrency, RadrootsFoodIdentifier, RadrootsFoodImageDimensions, RadrootsFoodPrice,
- RadrootsFoodPublishedAt, RadrootsFoodQuantity, RadrootsFoodText, RadrootsFoodUnit,
+ FoodAvailabilityDetails, FoodAvailabilityDetailsParts, FoodAvailabilityImage,
+ FoodAvailabilityStatus, FoodContent, FoodCurrency, FoodIdentifier, FoodImageDimensions,
+ FoodPrice, FoodPublishedAt, FoodQuantity, FoodText, FoodUnit,
};
-use radroots_event::media::RadrootsAuthoredImage;
+use radroots_event::media::AuthoredImage;
use radroots_event_codec::food_availability::admission::{
RadrootsFoodAvailabilityAdmissionOutcome, verify_and_admit_food_availability_event,
};
@@ -181,34 +180,32 @@ fn fixture_keys() -> RadrootsNostrKeys {
)
}
-fn details() -> RadrootsFoodAvailabilityDetails {
+fn details() -> FoodAvailabilityDetails {
details_with_images(Vec::new())
}
-fn details_with_images(
- images: Vec<RadrootsFoodAvailabilityImage>,
-) -> RadrootsFoodAvailabilityDetails {
- RadrootsFoodAvailabilityDetails::new(RadrootsFoodAvailabilityDetailsParts {
- content: RadrootsFoodContent::new("Carrots available this week.").expect("content"),
- identifier: RadrootsFoodIdentifier::parse("nantes-carrots").expect("identifier"),
- title: RadrootsFoodText::new("Nantes Carrots").expect("title"),
- summary: RadrootsFoodText::new("Fresh bunches").expect("summary"),
- published_at: RadrootsFoodPublishedAt::new(1_784_347_100).expect("published_at"),
- location: RadrootsFoodText::new("Central Saanich, BC").expect("location"),
- price: RadrootsFoodPrice::new(
+fn details_with_images(images: Vec<FoodAvailabilityImage>) -> FoodAvailabilityDetails {
+ FoodAvailabilityDetails::new(FoodAvailabilityDetailsParts {
+ content: FoodContent::new("Carrots available this week.").expect("content"),
+ identifier: FoodIdentifier::parse("nantes-carrots").expect("identifier"),
+ title: FoodText::new("Nantes Carrots").expect("title"),
+ summary: FoodText::new("Fresh bunches").expect("summary"),
+ published_at: FoodPublishedAt::new(1_784_347_100).expect("published_at"),
+ location: FoodText::new("Central Saanich, BC").expect("location"),
+ price: FoodPrice::new(
"3",
- RadrootsFoodCurrency::parse("CAD").expect("currency"),
- RadrootsFoodUnit::Pound,
+ FoodCurrency::parse("CAD").expect("currency"),
+ FoodUnit::Pound,
)
.expect("price"),
- quantity: Some(RadrootsFoodQuantity::new("24", RadrootsFoodUnit::Pound).expect("quantity")),
- status: RadrootsFoodAvailabilityStatus::Active,
+ quantity: Some(FoodQuantity::new("24", FoodUnit::Pound).expect("quantity")),
+ status: FoodAvailabilityStatus::Active,
images,
})
.expect("FoodAvailability details")
}
-fn blossom_image() -> RadrootsFoodAvailabilityImage {
+fn blossom_image() -> FoodAvailabilityImage {
let bytes = b"victoria-carrots-image-fixture";
let hash = Sha256::digest(bytes);
let media_type = MediaType::parse("image/webp").expect("image media type");
@@ -224,8 +221,7 @@ fn blossom_image() -> RadrootsFoodAvailabilityImage {
.expect("approved Blossom reference")
.verify_bytes(bytes, &media_type)
.expect("byte-verified Blossom descriptor");
- let image =
- RadrootsAuthoredImage::try_from_verified_descriptor(verified).expect("authored image");
- let dimensions = RadrootsFoodImageDimensions::new(640, 480).expect("image dimensions");
- RadrootsFoodAvailabilityImage::new(image, dimensions)
+ let image = AuthoredImage::try_from_verified_descriptor(verified).expect("authored image");
+ let dimensions = FoodImageDimensions::new(640, 480).expect("image dimensions");
+ FoodAvailabilityImage::new(image, dimensions)
}
diff --git a/crates/nostr/tests/nip09_deletion_request_profile.rs b/crates/nostr/tests/nip09_deletion_request_profile.rs
@@ -1,8 +1,7 @@
use radroots_event::{
envelope::kind::KIND_DELETION_REQUEST,
post::deletion::{
- RadrootsAuthoredNip09DeletionRequest, RadrootsNip09DeletionAddressTarget,
- RadrootsNip09DeletionEventTarget,
+ AuthoredNip09DeletionRequest, Nip09DeletionAddressTarget, Nip09DeletionEventTarget,
},
};
use radroots_event_codec::deletion::admission::verify_and_admit_nip09_deletion_request_event;
@@ -129,16 +128,16 @@ async fn typed_nip09_deletion_request_reaches_client_publication() {
assert!(matches!(helper_error, RadrootsNostrError::ClientError(_)));
}
-fn request() -> RadrootsAuthoredNip09DeletionRequest {
- RadrootsAuthoredNip09DeletionRequest::new(
+fn request() -> AuthoredNip09DeletionRequest {
+ AuthoredNip09DeletionRequest::new(
"superseded",
- vec![RadrootsNip09DeletionEventTarget::parse(TARGET_EVENT_ID, 1).expect("event target")],
+ vec![Nip09DeletionEventTarget::parse(TARGET_EVENT_ID, 1).expect("event target")],
vec![
- RadrootsNip09DeletionAddressTarget::parse(format!(
+ Nip09DeletionAddressTarget::parse(format!(
"30402:{FIXTURE_BOB_PUBLIC_KEY_HEX}:carrots"
))
.expect("listing target"),
- RadrootsNip09DeletionAddressTarget::parse(format!("0:{FIXTURE_BOB_PUBLIC_KEY_HEX}:"))
+ Nip09DeletionAddressTarget::parse(format!("0:{FIXTURE_BOB_PUBLIC_KEY_HEX}:"))
.expect("profile target"),
],
)
diff --git a/crates/nostr/tests/nip10_reply_profile.rs b/crates/nostr/tests/nip10_reply_profile.rs
@@ -1,4 +1,4 @@
-use radroots_event::post::reply::{RadrootsAuthoredNip10Reply, RadrootsNip10ReplyReference};
+use radroots_event::post::reply::{AuthoredNip10Reply, Nip10ReplyReference};
use radroots_event_codec::{
post::admission::{RadrootsPostAdmissionOutcome, verify_and_admit_post_event},
reply::{
@@ -33,8 +33,8 @@ fn typed_nip10_reply_builders_sign_exact_marked_direct_and_nested_profiles() {
Some(RELAY_PRIMARY_WSS),
);
- let direct = RadrootsAuthoredNip10Reply::direct("Direct reply", root.clone())
- .expect("authored direct reply");
+ let direct =
+ AuthoredNip10Reply::direct("Direct reply", root.clone()).expect("authored direct reply");
let direct_event = radroots_nostr_build_nip10_reply_event(&direct)
.expect("typed direct Reply builder")
.custom_created_at(created_at)
@@ -57,8 +57,8 @@ fn typed_nip10_reply_builders_sign_exact_marked_direct_and_nested_profiles() {
FIXTURE_CAROL_PUBLIC_KEY_HEX,
Some(RELAY_SECONDARY_WSS),
);
- let nested = RadrootsAuthoredNip10Reply::nested("Nested reply", root, parent)
- .expect("authored nested reply");
+ let nested =
+ AuthoredNip10Reply::nested("Nested reply", root, parent).expect("authored nested reply");
let nested_event = radroots_nostr_build_nip10_reply_event(&nested)
.expect("typed nested Reply builder")
.custom_created_at(created_at)
@@ -93,7 +93,7 @@ fn typed_nip10_reply_builders_sign_exact_marked_direct_and_nested_profiles() {
#[test]
fn signed_nip10_reply_is_thread_excluded_before_semantic_reply_admission() {
- let reply = RadrootsAuthoredNip10Reply::direct(
+ let reply = AuthoredNip10Reply::direct(
"Thread reply",
reference(
ROOT_EVENT_ID,
@@ -182,7 +182,7 @@ fn generic_kind_one_builder_cannot_bypass_typed_nip10_reply_authoring() {
#[tokio::test]
async fn typed_nip10_reply_builder_reaches_client_publication() {
let client = RadrootsNostrClient::new(fixture_keys());
- let reply = RadrootsAuthoredNip10Reply::direct(
+ let reply = AuthoredNip10Reply::direct(
"Publish Reply",
reference(
ROOT_EVENT_ID,
@@ -208,8 +208,8 @@ fn fixture_keys() -> RadrootsNostrKeys {
)
}
-fn reference(event_id: &str, author: &str, relay: Option<&str>) -> RadrootsNip10ReplyReference {
- RadrootsNip10ReplyReference::parse(event_id, author, relay).expect("valid Reply reference")
+fn reference(event_id: &str, author: &str, relay: Option<&str>) -> Nip10ReplyReference {
+ Nip10ReplyReference::parse(event_id, author, relay).expect("valid Reply reference")
}
fn event_tags(event: &nostr::Event) -> Vec<Vec<String>> {
diff --git a/crates/nostr/tests/nip22_comment_profile.rs b/crates/nostr/tests/nip22_comment_profile.rs
@@ -3,8 +3,8 @@ use radroots_event::{
KIND_CALENDAR_DATE_EVENT, KIND_CALENDAR_TIME_EVENT, KIND_CLASSIFIED_LISTING, KIND_COMMENT,
},
post::comment::{
- RadrootsAuthoredNip22Comment, RadrootsNip22AddressRootReference,
- RadrootsNip22CommentParentReference, RadrootsNip22EventRootReference,
+ AuthoredNip22Comment, Nip22AddressRootReference, Nip22CommentParentReference,
+ Nip22EventRootReference,
},
};
use radroots_event_codec::comment::{
@@ -36,9 +36,9 @@ fn typed_nip22_comment_builders_sign_and_admit_all_exact_shapes() {
let keys = fixture_keys();
let created_at = RadrootsNostrTimestamp::from_secs(CREATED_AT);
- let top_event = RadrootsAuthoredNip22Comment::top_level_event(
+ let top_event = AuthoredNip22Comment::top_level_event(
"Are these carrots available Saturday?",
- RadrootsNip22EventRootReference::parse(
+ Nip22EventRootReference::parse(
ROOT_EVENT_ID,
FIXTURE_BOB_PUBLIC_KEY_HEX,
KIND_CLASSIFIED_LISTING,
@@ -68,9 +68,9 @@ fn typed_nip22_comment_builders_sign_and_admit_all_exact_shapes() {
let address =
format!("{KIND_CALENDAR_DATE_EVENT}:{FIXTURE_BOB_PUBLIC_KEY_HEX}:victoria-market");
- let top_address = RadrootsAuthoredNip22Comment::parse_top_level_address(
+ let top_address = AuthoredNip22Comment::parse_top_level_address(
"Looking forward to the Victoria market.",
- RadrootsNip22AddressRootReference::parse(&address, Some(RELAY_SECONDARY_WSS))
+ Nip22AddressRootReference::parse(&address, Some(RELAY_SECONDARY_WSS))
.expect("address root"),
ADDRESS_REVISION_ID,
)
@@ -85,9 +85,9 @@ fn typed_nip22_comment_builders_sign_and_admit_all_exact_shapes() {
tag(&["p", FIXTURE_BOB_PUBLIC_KEY_HEX, RELAY_SECONDARY_WSS]),
];
- let nested_event = RadrootsAuthoredNip22Comment::nested(
+ let nested_event = AuthoredNip22Comment::nested(
"Harvest starts Friday morning.",
- RadrootsNip22EventRootReference::parse(
+ Nip22EventRootReference::parse(
NESTED_ROOT_EVENT_ID,
FIXTURE_BOB_PUBLIC_KEY_HEX,
KIND_CALENDAR_TIME_EVENT,
@@ -113,9 +113,9 @@ fn typed_nip22_comment_builders_sign_and_admit_all_exact_shapes() {
let nested_address_value =
format!("{KIND_CLASSIFIED_LISTING}:{FIXTURE_BOB_PUBLIC_KEY_HEX}:carrots");
- let nested_address = RadrootsAuthoredNip22Comment::nested(
+ let nested_address = AuthoredNip22Comment::nested(
"I can pick up two bunches.",
- RadrootsNip22AddressRootReference::parse(&nested_address_value, Some(RELAY_PRIMARY_WSS))
+ Nip22AddressRootReference::parse(&nested_address_value, Some(RELAY_PRIMARY_WSS))
.expect("nested address root"),
parent(None),
)
@@ -174,9 +174,9 @@ fn generic_kind_1111_builder_cannot_bypass_typed_comment_authoring() {
#[tokio::test]
async fn typed_nip22_comment_builder_reaches_client_publication() {
let client = RadrootsNostrClient::new(fixture_keys());
- let comment = RadrootsAuthoredNip22Comment::top_level_event(
+ let comment = AuthoredNip22Comment::top_level_event(
"Publish Comment",
- RadrootsNip22EventRootReference::parse(
+ Nip22EventRootReference::parse(
ROOT_EVENT_ID,
FIXTURE_BOB_PUBLIC_KEY_HEX,
KIND_CLASSIFIED_LISTING,
@@ -202,8 +202,8 @@ fn fixture_keys() -> RadrootsNostrKeys {
)
}
-fn parent(relay: Option<&str>) -> RadrootsNip22CommentParentReference {
- RadrootsNip22CommentParentReference::parse(PARENT_EVENT_ID, FIXTURE_CAROL_PUBLIC_KEY_HEX, relay)
+fn parent(relay: Option<&str>) -> Nip22CommentParentReference {
+ Nip22CommentParentReference::parse(PARENT_EVENT_ID, FIXTURE_CAROL_PUBLIC_KEY_HEX, relay)
.expect("Comment parent")
}
diff --git a/crates/nostr/tests/post_profile.rs b/crates/nostr/tests/post_profile.rs
@@ -3,10 +3,9 @@ mod test_fixtures;
use radroots_blossom::{BlobDescriptor, BlobUrl, MediaType, Sha256};
use radroots_event::{
- media::RadrootsAuthoredImage,
+ media::AuthoredImage,
post::{
- RadrootsAuthoredAsk, RadrootsAuthoredPhotoUpdate, RadrootsAuthoredPostImage,
- RadrootsAuthoredUpdate, RadrootsPostImageDimensions,
+ AuthoredAsk, AuthoredPhotoUpdate, AuthoredPostImage, AuthoredUpdate, PostImageDimensions,
},
};
use radroots_nostr::{
@@ -23,7 +22,7 @@ fn typed_post_builders_preserve_strict_wire_profiles() {
RadrootsNostrSecretKey::from_hex(test_fixtures::FIXTURE_ALICE_SECRET_KEY_HEX).unwrap(),
);
let created_at = RadrootsNostrTimestamp::from_secs(1_784_347_200);
- let update = RadrootsAuthoredUpdate::new("Farm update").unwrap();
+ let update = AuthoredUpdate::new("Farm update").unwrap();
let event = radroots_nostr_build_update_event(&update)
.unwrap()
.custom_created_at(created_at)
@@ -36,8 +35,7 @@ fn typed_post_builders_preserve_strict_wire_profiles() {
let image = authored_image();
let photo =
- RadrootsAuthoredPhotoUpdate::new(format!("Harvest {}", image.url()), vec![image.clone()])
- .unwrap();
+ AuthoredPhotoUpdate::new(format!("Harvest {}", image.url()), vec![image.clone()]).unwrap();
let event = radroots_nostr_build_photo_update_event(&photo)
.unwrap()
.custom_created_at(created_at)
@@ -47,8 +45,7 @@ fn typed_post_builders_preserve_strict_wire_profiles() {
assert_eq!(event.tags.iter().next().unwrap().as_slice()[0], "imeta");
assert!(event.verify().is_ok());
- let ask =
- RadrootsAuthoredAsk::new(format!("Is this ready? {}", image.url()), vec![image]).unwrap();
+ let ask = AuthoredAsk::new(format!("Is this ready? {}", image.url()), vec![image]).unwrap();
let event = radroots_nostr_build_ask_event(&ask)
.unwrap()
.custom_created_at(created_at)
@@ -61,7 +58,7 @@ fn typed_post_builders_preserve_strict_wire_profiles() {
assert!(event.verify().is_ok());
}
-fn authored_image() -> RadrootsAuthoredPostImage {
+fn authored_image() -> AuthoredPostImage {
let bytes = b"strawberries";
let hash = Sha256::digest(bytes);
let media_type = MediaType::parse("image/webp").unwrap();
@@ -77,9 +74,9 @@ fn authored_image() -> RadrootsAuthoredPostImage {
.unwrap()
.verify_bytes(bytes, &media_type)
.unwrap();
- RadrootsAuthoredPostImage::new(
- RadrootsAuthoredImage::try_from(descriptor).unwrap(),
- RadrootsPostImageDimensions::new(1200, 900).unwrap(),
+ AuthoredPostImage::new(
+ AuthoredImage::try_from(descriptor).unwrap(),
+ PostImageDimensions::new(1200, 900).unwrap(),
"Harvest",
)
.unwrap()
diff --git a/crates/nostr/tests/profile_event_builder.rs b/crates/nostr/tests/profile_event_builder.rs
@@ -1,7 +1,7 @@
#[path = "../src/test_fixtures.rs"]
mod test_fixtures;
-use radroots_event::profile::RadrootsAuthoredProfile;
+use radroots_event::profile::AuthoredProfile;
use radroots_nostr::prelude::{
RadrootsNostrKeys, RadrootsNostrSecretKey, RadrootsNostrTimestamp,
radroots_nostr_build_profile_event,
@@ -13,7 +13,7 @@ fn typed_profile_builder_preserves_the_strict_replacement_snapshot() {
RadrootsNostrSecretKey::from_hex(test_fixtures::FIXTURE_ALICE_SECRET_KEY_HEX).unwrap(),
);
let created_at = RadrootsNostrTimestamp::from_secs(1_784_347_200);
- let profile = RadrootsAuthoredProfile::new("Alice")
+ let profile = AuthoredProfile::new("Alice")
.unwrap()
.with_display_name("Alice's Orchard")
.with_about("Tree fruit")
diff --git a/crates/outbox/src/error.rs b/crates/outbox/src/error.rs
@@ -15,13 +15,13 @@ pub enum RadrootsOutboxError {
EventStore(#[from] radroots_event_store::RadrootsEventStoreError),
#[error("Signed event does not match frozen draft: {0}")]
- SignedEventDraftMismatch(#[from] radroots_event::draft::RadrootsDraftError),
+ SignedEventDraftMismatch(#[from] radroots_event::draft::DraftError),
#[error("Event wire error: {0}")]
- EventWire(#[from] radroots_event::wire::RadrootsEventWireError),
+ EventWire(#[from] radroots_event::wire::EventWireError),
#[error("Signed event error: {0}")]
- SignedEvent(#[from] radroots_event::draft::RadrootsSignedEventError),
+ SignedEvent(#[from] radroots_event::draft::SignedEventError),
#[error("delivery targets cannot be empty")]
EmptyDeliveryTargets,
diff --git a/crates/outbox/src/model.rs b/crates/outbox/src/model.rs
@@ -1,8 +1,8 @@
#![forbid(unsafe_code)]
use crate::RadrootsOutboxError;
-use radroots_event::draft::{RadrootsEventDraft, RadrootsSignedEvent};
-use radroots_event::id::{RadrootsTradeId, RadrootsTradeMutationId};
+use radroots_event::draft::{EventDraft, SignedEvent};
+use radroots_event::id::{MutationId, TradeId};
use radroots_transport::{
RadrootsTransportKind, RadrootsTransportMeshScopeId, RadrootsTransportOutcomeKind,
RadrootsTransportSatisfactionClass, RadrootsTransportSatisfactionPolicy,
@@ -277,7 +277,7 @@ impl RadrootsOutboxDeliveryPlanInput {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsOutboxOperationInput {
pub operation_kind: String,
- pub draft: RadrootsEventDraft,
+ pub draft: EventDraft,
pub delivery_plan: RadrootsOutboxDeliveryPlanInput,
pub idempotency_key: Option<String>,
pub created_at_ms: i64,
@@ -286,7 +286,7 @@ pub struct RadrootsOutboxOperationInput {
impl RadrootsOutboxOperationInput {
pub fn new(
operation_kind: impl Into<String>,
- draft: RadrootsEventDraft,
+ draft: EventDraft,
delivery_plan: RadrootsOutboxDeliveryPlanInput,
created_at_ms: i64,
) -> Self {
@@ -308,8 +308,8 @@ impl RadrootsOutboxOperationInput {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsOutboxSignedOperationInput {
pub operation_kind: String,
- pub draft: RadrootsEventDraft,
- pub signed_event: RadrootsSignedEvent,
+ pub draft: EventDraft,
+ pub signed_event: SignedEvent,
pub delivery_plan: RadrootsOutboxDeliveryPlanInput,
pub idempotency_key: Option<String>,
pub event_store_inserted: bool,
@@ -320,8 +320,8 @@ pub struct RadrootsOutboxSignedOperationInput {
impl RadrootsOutboxSignedOperationInput {
pub fn new(
operation_kind: impl Into<String>,
- draft: RadrootsEventDraft,
- signed_event: RadrootsSignedEvent,
+ draft: EventDraft,
+ signed_event: SignedEvent,
delivery_plan: RadrootsOutboxDeliveryPlanInput,
event_store_inserted: bool,
event_store_ingested_at_ms: i64,
@@ -348,10 +348,10 @@ impl RadrootsOutboxSignedOperationInput {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsOutboxTradeMutationInput {
pub operation_kind: String,
- pub trade_id: RadrootsTradeId,
- pub mutation_id: RadrootsTradeMutationId,
+ pub trade_id: TradeId,
+ pub mutation_id: MutationId,
pub canonical_payload_sha256: String,
- pub draft: RadrootsEventDraft,
+ pub draft: EventDraft,
pub delivery_plan: RadrootsOutboxDeliveryPlanInput,
pub idempotency_key: Option<String>,
pub created_at_ms: i64,
@@ -360,10 +360,10 @@ pub struct RadrootsOutboxTradeMutationInput {
impl RadrootsOutboxTradeMutationInput {
pub fn new(
operation_kind: impl Into<String>,
- trade_id: RadrootsTradeId,
- mutation_id: RadrootsTradeMutationId,
+ trade_id: TradeId,
+ mutation_id: MutationId,
canonical_payload_sha256: impl Into<String>,
- draft: RadrootsEventDraft,
+ draft: EventDraft,
delivery_plan: RadrootsOutboxDeliveryPlanInput,
created_at_ms: i64,
) -> Self {
@@ -388,11 +388,11 @@ impl RadrootsOutboxTradeMutationInput {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsOutboxSignedTradeMutationInput {
pub operation_kind: String,
- pub trade_id: RadrootsTradeId,
- pub mutation_id: RadrootsTradeMutationId,
+ pub trade_id: TradeId,
+ pub mutation_id: MutationId,
pub canonical_payload_sha256: String,
- pub draft: RadrootsEventDraft,
- pub signed_event: RadrootsSignedEvent,
+ pub draft: EventDraft,
+ pub signed_event: SignedEvent,
pub delivery_plan: RadrootsOutboxDeliveryPlanInput,
pub idempotency_key: Option<String>,
pub event_store_inserted: bool,
@@ -404,11 +404,11 @@ impl RadrootsOutboxSignedTradeMutationInput {
#[allow(clippy::too_many_arguments)]
pub fn new(
operation_kind: impl Into<String>,
- trade_id: RadrootsTradeId,
- mutation_id: RadrootsTradeMutationId,
+ trade_id: TradeId,
+ mutation_id: MutationId,
canonical_payload_sha256: impl Into<String>,
- draft: RadrootsEventDraft,
- signed_event: RadrootsSignedEvent,
+ draft: EventDraft,
+ signed_event: SignedEvent,
delivery_plan: RadrootsOutboxDeliveryPlanInput,
event_store_inserted: bool,
event_store_ingested_at_ms: i64,
@@ -464,8 +464,8 @@ pub struct RadrootsOutboxOperationRecord {
pub operation_kind: String,
pub expected_pubkey: String,
pub semantic_scope: String,
- pub trade_id: Option<RadrootsTradeId>,
- pub mutation_id: Option<RadrootsTradeMutationId>,
+ pub trade_id: Option<TradeId>,
+ pub mutation_id: Option<MutationId>,
pub canonical_payload_sha256: Option<String>,
pub idempotency_key: Option<String>,
pub operation_idempotency_digest: String,
@@ -480,8 +480,8 @@ pub struct RadrootsOutboxEventRecord {
pub operation_id: i64,
pub event_id: String,
pub expected_pubkey: String,
- pub draft: RadrootsEventDraft,
- pub signed_event: Option<RadrootsSignedEvent>,
+ pub draft: EventDraft,
+ pub signed_event: Option<SignedEvent>,
pub raw_event_json: Option<String>,
pub state: RadrootsOutboxEventState,
pub attempt_count: i64,
@@ -557,8 +557,8 @@ pub struct RadrootsOutboxClaimedEvent {
pub state: RadrootsOutboxEventState,
pub claim_token: String,
pub active_delivery_plan_id: Option<i64>,
- pub draft: RadrootsEventDraft,
- pub signed_event: Option<RadrootsSignedEvent>,
+ pub draft: EventDraft,
+ pub signed_event: Option<SignedEvent>,
pub delivery_targets: Vec<RadrootsOutboxDeliveryTargetRecord>,
}
diff --git a/crates/outbox/src/store.rs b/crates/outbox/src/store.rs
@@ -14,14 +14,12 @@ use crate::model::{
RadrootsOutboxSignedTradeMutationInput, RadrootsOutboxStatusSummary,
RadrootsOutboxTradeMutationInput,
};
-use radroots_event::draft::{
- RadrootsEventDraft, RadrootsSignedEvent, validate_signed_nostr_event_matches_draft,
-};
-use radroots_event::envelope::RadrootsEventKindClass;
+use radroots_event::draft::{EventDraft, SignedEvent, validate_signed_nostr_event_matches_draft};
+use radroots_event::envelope::EventKindClass;
use radroots_event::envelope::kind::TRADE_MUTATION_EVENT_KINDS;
-use radroots_event::id::{RadrootsTradeId, RadrootsTradeMutationId};
+use radroots_event::id::{MutationId, TradeId};
use radroots_event::trade::trade_mutation_from_canonical_content;
-use radroots_event::wire::RadrootsNip01EventWire;
+use radroots_event::wire::Nip01EventWire;
use radroots_event_store::{
RadrootsEventIngest, RadrootsEventStore, RadrootsTransportObservation,
RadrootsTransportObservationType,
@@ -1117,9 +1115,9 @@ impl RadrootsOutbox {
&self,
outbox_event_id: i64,
claim_token: &str,
- signed_event: RadrootsSignedEvent,
+ signed_event: SignedEvent,
now_ms: i64,
- ) -> Result<RadrootsSignedEvent, RadrootsOutboxError> {
+ ) -> Result<SignedEvent, RadrootsOutboxError> {
let mut tx = self.pool.begin().await?;
let record = event_by_id_tx(&mut tx, outbox_event_id).await?;
let stored = record.claim_token.as_deref();
@@ -2295,7 +2293,7 @@ async fn signed_event_lifecycle_for_plans(
async fn ensure_event_signed(
tx: &mut sqlx::Transaction<'_, sqlx::Sqlite>,
outbox_event_id: i64,
- signed_event: &RadrootsSignedEvent,
+ signed_event: &SignedEvent,
event_store_inserted: bool,
event_store_ingested_at_ms: i64,
) -> Result<(), RadrootsOutboxError> {
@@ -2728,8 +2726,7 @@ fn event_from_row(
) -> Result<RadrootsOutboxEventRecord, RadrootsOutboxError> {
let outbox_event_id = row.try_get("outbox_event_id")?;
let event_id = row.try_get::<String, _>("event_id")?;
- let draft: RadrootsEventDraft =
- serde_json::from_str(row.try_get::<String, _>("draft_json")?.as_str())?;
+ let draft: EventDraft = serde_json::from_str(row.try_get::<String, _>("draft_json")?.as_str())?;
let signed_event = signed_event_from_storage(
outbox_event_id,
row.try_get("signed_event_json")?,
@@ -2788,7 +2785,7 @@ fn signed_event_from_storage(
outbox_event_id: i64,
signed_event_json: Option<String>,
raw_event_json: Option<String>,
-) -> Result<Option<RadrootsSignedEvent>, RadrootsOutboxError> {
+) -> Result<Option<SignedEvent>, RadrootsOutboxError> {
match (signed_event_json, raw_event_json) {
(None, None) => Ok(None),
(Some(_), None) => Err(RadrootsOutboxError::StoredSignedEventMissingRawJson(
@@ -2798,17 +2795,15 @@ fn signed_event_from_storage(
outbox_event_id,
)),
(Some(signed_json), Some(raw_json)) => {
- let wire = RadrootsNip01EventWire::parse_json(signed_json.as_str())?;
- RadrootsSignedEvent::from_wire_verified_id(wire, raw_json)
+ let wire = Nip01EventWire::parse_json(signed_json.as_str())?;
+ SignedEvent::from_wire_verified_id(wire, raw_json)
.map(Some)
.map_err(Into::into)
}
}
}
-fn signed_event_wire_json(
- signed_event: &RadrootsSignedEvent,
-) -> Result<String, RadrootsOutboxError> {
+fn signed_event_wire_json(signed_event: &SignedEvent) -> Result<String, RadrootsOutboxError> {
serde_json::to_string(signed_event.wire()).map_err(Into::into)
}
@@ -3036,7 +3031,7 @@ fn parse_transport_outcome_kind(
struct OperationDigestInput<'a> {
operation_kind: &'a str,
expected_pubkey: &'a str,
- draft: &'a RadrootsEventDraft,
+ draft: &'a EventDraft,
}
struct TradeMutationSemantic {
@@ -3057,7 +3052,7 @@ struct TradeMutationOperationDigestInput<'a> {
fn operation_idempotency_digest(
operation_kind: &str,
expected_pubkey: &str,
- draft: &RadrootsEventDraft,
+ draft: &EventDraft,
) -> String {
let input = OperationDigestInput {
operation_kind,
@@ -3158,7 +3153,7 @@ fn validate_trade_mutation_input(
trade_id: &str,
mutation_id: &str,
canonical_payload_sha256: &str,
- draft: &RadrootsEventDraft,
+ draft: &EventDraft,
) -> Result<TradeMutationSemantic, RadrootsOutboxError> {
if !TRADE_MUTATION_EVENT_KINDS.contains(&draft.kind_u32()) {
return Err(RadrootsOutboxError::TradeMutationMetadataMismatch { field: "kind" });
@@ -3209,13 +3204,11 @@ fn sha256_hex(bytes: &[u8]) -> String {
hex::encode(Sha256::digest(bytes))
}
-fn ensure_generic_outbox_draft_allowed(
- draft: &RadrootsEventDraft,
-) -> Result<(), RadrootsOutboxError> {
+fn ensure_generic_outbox_draft_allowed(draft: &EventDraft) -> Result<(), RadrootsOutboxError> {
if TRADE_MUTATION_EVENT_KINDS.contains(&draft.kind_u32()) {
return Err(RadrootsOutboxError::TradeMutationRequiresSemanticOutbox);
}
- if draft.kind().class() == RadrootsEventKindClass::Ephemeral {
+ if draft.kind().class() == EventKindClass::Ephemeral {
return Err(RadrootsOutboxError::EphemeralEventNotQueueable {
kind: draft.kind_u32(),
});
@@ -3226,10 +3219,10 @@ fn ensure_generic_outbox_draft_allowed(
fn parse_optional_stored_trade_id(
field: &'static str,
value: Option<String>,
-) -> Result<Option<RadrootsTradeId>, RadrootsOutboxError> {
+) -> Result<Option<TradeId>, RadrootsOutboxError> {
value
.map(|value| {
- RadrootsTradeId::parse(value.as_str())
+ TradeId::parse(value.as_str())
.map_err(|_| RadrootsOutboxError::InvalidStoredIdentifier { field, value })
})
.transpose()
@@ -3238,10 +3231,10 @@ fn parse_optional_stored_trade_id(
fn parse_optional_stored_mutation_id(
field: &'static str,
value: Option<String>,
-) -> Result<Option<RadrootsTradeMutationId>, RadrootsOutboxError> {
+) -> Result<Option<MutationId>, RadrootsOutboxError> {
value
.map(|value| {
- RadrootsTradeMutationId::parse(value.as_str())
+ MutationId::parse(value.as_str())
.map_err(|_| RadrootsOutboxError::InvalidStoredIdentifier { field, value })
})
.transpose()
@@ -3397,17 +3390,13 @@ mod tests {
use radroots_event::envelope::kind::{
KIND_CLASSIFIED_LISTING, KIND_FOLLOW, KIND_GEOCHAT, KIND_HTTP_AUTH, KIND_RELAY_AUTH,
};
- use radroots_event::id::{
- RadrootsClassifiedListingAddress, RadrootsDTag, RadrootsEventId, RadrootsInventoryBinId,
- RadrootsTradeId,
- };
+ use radroots_event::id::{ClassifiedListingAddress, DTag, EventId, InventoryBinId, TradeId};
use radroots_event::trade::{
- RADROOTS_TRADE_PROPOSAL_CONTRACT_ID, RADROOTS_TRADE_SCHEMA_VERSION,
- RadrootsFulfillmentProfileV1, RadrootsTradeCancellationProfileV1,
- RadrootsTradeCandidateLineV1, RadrootsTradeCandidateTermsV1,
- RadrootsTradeCanonicalMutationV1, RadrootsTradeEconomicAdjustmentV1,
- RadrootsTradeEconomicsProfileV1, RadrootsTradeMutationBodyV1,
- RadrootsTradeMutationEnvelopeV1, canonical_jcs_value, canonical_trade_mutation_content,
+ FulfillmentProfileV1, RADROOTS_TRADE_PROPOSAL_CONTRACT_ID, RADROOTS_TRADE_SCHEMA_VERSION,
+ TradeCancellationProfileV1, TradeCandidateLineV1, TradeCandidateTermsV1,
+ TradeCanonicalMutationV1, TradeEconomicAdjustmentV1, TradeEconomicsProfileV1,
+ TradeMutationBodyV1, TradeMutationEnvelopeV1, canonical_jcs_value,
+ canonical_trade_mutation_content,
};
use radroots_identity::PublicKey;
use radroots_nostr::prelude::{
@@ -3440,8 +3429,8 @@ mod tests {
PublicKey::from_hex(public_key_hex).expect("fixture pubkey")
}
- fn generic_draft(expected_pubkey: &str, content: &str) -> RadrootsEventDraft {
- RadrootsEventDraft::new(
+ fn generic_draft(expected_pubkey: &str, content: &str) -> EventDraft {
+ EventDraft::new(
"radroots.social.follow_list.v1",
KIND_FOLLOW,
1_700_000_000,
@@ -3452,8 +3441,8 @@ mod tests {
.expect("generic draft")
}
- fn durable_draft(expected_pubkey: &str, label: &str) -> RadrootsEventDraft {
- RadrootsEventDraft::new(
+ fn durable_draft(expected_pubkey: &str, label: &str) -> EventDraft {
+ EventDraft::new(
"radroots.social.follow_list.v1",
KIND_FOLLOW,
1_700_000_000,
@@ -3464,27 +3453,27 @@ mod tests {
.expect("durable draft")
}
- fn candidate_terms() -> RadrootsTradeCandidateTermsV1 {
- RadrootsTradeCandidateTermsV1 {
+ fn candidate_terms() -> TradeCandidateTermsV1 {
+ TradeCandidateTermsV1 {
candidate_id: None,
schema_version: RADROOTS_TRADE_SCHEMA_VERSION,
base_candidate_id: None,
supersession_intent: None,
buyer_pubkey: public_key('a'),
seller_pubkey: public_key('a'),
- farm_id: RadrootsDTag::parse("farm-1").expect("farm id"),
- lines: vec![RadrootsTradeCandidateLineV1 {
- line_id: RadrootsDTag::parse("line-1").expect("line id"),
- listing_addr: RadrootsClassifiedListingAddress::parse(format!(
+ farm_id: DTag::parse("farm-1").expect("farm id"),
+ lines: vec![TradeCandidateLineV1 {
+ line_id: DTag::parse("line-1").expect("line id"),
+ listing_addr: ClassifiedListingAddress::parse(format!(
"{KIND_CLASSIFIED_LISTING}:{}:listing-1",
FIXTURE_ALICE_PUBLIC_KEY_HEX
))
.expect("listing address"),
- listing_event_id: RadrootsEventId::parse(hex_64('c')).expect("listing event id"),
+ listing_event_id: EventId::parse(hex_64('c')).expect("listing event id"),
listing_snapshot_sha256: hex_64('d'),
product_id: "carrots".to_owned(),
option_id: None,
- bin_id: RadrootsInventoryBinId::parse("bin-1").expect("bin id"),
+ bin_id: InventoryBinId::parse("bin-1").expect("bin id"),
quantity_mantissa: "2".to_owned(),
quantity_scale: 0,
unit_code: "count".to_owned(),
@@ -3495,7 +3484,7 @@ mod tests {
replaces_line_id: None,
}],
line_tombstones: Vec::new(),
- economics: RadrootsTradeEconomicsProfileV1 {
+ economics: TradeEconomicsProfileV1 {
profile_id: "mvp-no-payment".to_owned(),
currency_code: "USD".to_owned(),
currency_exponent: 2,
@@ -3504,9 +3493,9 @@ mod tests {
discount_total_mantissa: "0".to_owned(),
adjustment_total_mantissa: "0".to_owned(),
total_mantissa: "600".to_owned(),
- adjustments: Vec::<RadrootsTradeEconomicAdjustmentV1>::new(),
+ adjustments: Vec::<TradeEconomicAdjustmentV1>::new(),
},
- fulfillment: RadrootsFulfillmentProfileV1 {
+ fulfillment: FulfillmentProfileV1 {
profile_id: "market-pickup".to_owned(),
method: "pickup".to_owned(),
starts_at_unix_s: 1_800_000_000,
@@ -3517,7 +3506,7 @@ mod tests {
location_class: "private_after_agreement".to_owned(),
requires_private_terms: false,
},
- cancellation: RadrootsTradeCancellationProfileV1 {
+ cancellation: TradeCancellationProfileV1 {
profile_id: "mvp".to_owned(),
buyer_pre_agreement: true,
post_agreement_cutoff_unix_s: Some(1_799_999_000),
@@ -3527,31 +3516,31 @@ mod tests {
}
}
- fn proposal_envelope() -> RadrootsTradeMutationEnvelopeV1 {
- RadrootsTradeMutationEnvelopeV1 {
+ fn proposal_envelope() -> TradeMutationEnvelopeV1 {
+ TradeMutationEnvelopeV1 {
mutation_id: None,
contract_id: RADROOTS_TRADE_PROPOSAL_CONTRACT_ID.to_owned(),
schema_version: RADROOTS_TRADE_SCHEMA_VERSION,
- trade_id: RadrootsTradeId::parse(hex_32('1')).expect("trade id"),
+ trade_id: TradeId::parse(hex_32('1')).expect("trade id"),
root_mutation_id: None,
buyer_pubkey: public_key('a'),
seller_pubkey: public_key('a'),
- farm_id: RadrootsDTag::parse("farm-1").expect("farm id"),
+ farm_id: DTag::parse("farm-1").expect("farm id"),
parent_mutation_ids: Vec::new(),
author_pubkey: public_key('a'),
counterparty_pubkey: public_key('a'),
authored_at_unix_s: 1_799_000_000,
- body: RadrootsTradeMutationBodyV1::Proposal {
+ body: TradeMutationBodyV1::Proposal {
candidate: candidate_terms(),
},
}
}
- fn canonical_trade_proposal() -> RadrootsTradeCanonicalMutationV1 {
+ fn canonical_trade_proposal() -> TradeCanonicalMutationV1 {
canonical_trade_mutation_content(proposal_envelope()).expect("canonical trade proposal")
}
- fn trade_mutation_draft(canonical: &RadrootsTradeCanonicalMutationV1) -> RadrootsEventDraft {
+ fn trade_mutation_draft(canonical: &TradeCanonicalMutationV1) -> EventDraft {
let mut tags = vec![
vec![
"contract".to_owned(),
@@ -3566,7 +3555,7 @@ mod tests {
for parent in &canonical.envelope.parent_mutation_ids {
tags.push(vec!["e".to_owned(), parent.to_string()]);
}
- RadrootsEventDraft::new(
+ EventDraft::new(
canonical.envelope.contract_id.clone(),
canonical.envelope.mutation_kind().nostr_kind(),
canonical.envelope.authored_at_unix_s,
@@ -3580,9 +3569,9 @@ mod tests {
fn proposal_draft_with_content(
content: impl Into<String>,
expected_pubkey: &str,
- ) -> RadrootsEventDraft {
+ ) -> EventDraft {
let valid = trade_mutation_draft(&canonical_trade_proposal());
- RadrootsEventDraft::new(
+ EventDraft::new(
valid.contract_id(),
valid.kind_u32(),
valid.created_at_u64(),
@@ -3593,9 +3582,7 @@ mod tests {
.expect("proposal draft with custom content")
}
- fn signed_trade_mutation(
- canonical: &RadrootsTradeCanonicalMutationV1,
- ) -> (RadrootsEventDraft, RadrootsSignedEvent) {
+ fn signed_trade_mutation(canonical: &TradeCanonicalMutationV1) -> (EventDraft, SignedEvent) {
let draft = trade_mutation_draft(canonical);
let signed_event =
radroots_nostr_sign_frozen_draft(&fixture_keys(), &draft).expect("signed trade event");
@@ -4004,10 +3991,7 @@ mod tests {
)
}
- fn operation_input(
- draft: RadrootsEventDraft,
- created_at_ms: i64,
- ) -> RadrootsOutboxOperationInput {
+ fn operation_input(draft: EventDraft, created_at_ms: i64) -> RadrootsOutboxOperationInput {
RadrootsOutboxOperationInput::new(
"publish_post",
draft,
@@ -4020,8 +4004,8 @@ mod tests {
}
fn signed_operation_input(
- draft: RadrootsEventDraft,
- signed_event: RadrootsSignedEvent,
+ draft: EventDraft,
+ signed_event: SignedEvent,
created_at_ms: i64,
) -> RadrootsOutboxSignedOperationInput {
RadrootsOutboxSignedOperationInput::new(
@@ -4039,9 +4023,9 @@ mod tests {
}
fn signed_trade_mutation_input(
- canonical: &RadrootsTradeCanonicalMutationV1,
- draft: RadrootsEventDraft,
- signed_event: RadrootsSignedEvent,
+ canonical: &TradeCanonicalMutationV1,
+ draft: EventDraft,
+ signed_event: SignedEvent,
targets: Vec<RadrootsTransportTarget>,
created_at_ms: i64,
) -> RadrootsOutboxSignedTradeMutationInput {
@@ -4060,8 +4044,8 @@ mod tests {
}
fn trade_mutation_input(
- canonical: &RadrootsTradeCanonicalMutationV1,
- draft: RadrootsEventDraft,
+ canonical: &TradeCanonicalMutationV1,
+ draft: EventDraft,
targets: Vec<RadrootsTransportTarget>,
created_at_ms: i64,
) -> RadrootsOutboxTradeMutationInput {
@@ -5526,7 +5510,7 @@ mod tests {
("radroots.relay.auth.v1", KIND_RELAY_AUTH, "{}"),
("radroots.http.auth.v1", KIND_HTTP_AUTH, "{}"),
] {
- let draft = RadrootsEventDraft::new(
+ let draft = EventDraft::new(
contract_id,
kind,
1_700_000_000,
@@ -8220,7 +8204,7 @@ mod tests {
let mut wire = signed.wire().clone();
wire.sig = "0".repeat(128);
let raw_json = serde_json::to_string(&wire).expect("invalid-signature wire JSON");
- let invalid_signed = RadrootsSignedEvent::from_wire_verified_id(wire, raw_json)
+ let invalid_signed = SignedEvent::from_wire_verified_id(wire, raw_json)
.expect("event id remains valid when only the signature changes");
outbox
.complete_signing(
diff --git a/crates/replica_sync/src/emit.rs b/crates/replica_sync/src/emit.rs
@@ -18,12 +18,12 @@ use crate::types::{
};
use radroots_event::envelope::kind::{KIND_FARM, KIND_LIST_SET_GENERIC, KIND_PLOT};
use radroots_event::farm::change_set::{
- RadrootsGcsLocation, RadrootsGeoJsonPoint, RadrootsGeoJsonPolygon,
+ GcsLocation as EventGcsLocation, GeoJsonPoint, GeoJsonPolygon,
};
use radroots_event::farm::location::{has_textual_locality, is_public_geohash5};
-use radroots_event::farm::plot::RadrootsPlot;
-use radroots_event::farm::{RadrootsFarm, RadrootsFarmPublicLocation, RadrootsFarmRef};
-use radroots_event::wire::RadrootsNip01EventWireParts;
+use radroots_event::farm::plot::Plot as EventPlot;
+use radroots_event::farm::{Farm as EventFarm, FarmPublicLocation, FarmRef};
+use radroots_event::wire::Nip01EventWireParts;
use radroots_event_codec::farm::encode as farm_encode;
use radroots_event_codec::farm::list_sets as farm_list_sets;
use radroots_event_codec::list_set::encode as list_set_encode;
@@ -150,7 +150,7 @@ pub fn radroots_replica_farm_event(
) -> Result<RadrootsReplicaEventDraft, RadrootsReplicaEventsError> {
let tags = collect_farm_tags(exec, &farm.id)?;
let location = load_farm_location(exec, farm)?;
- let farm_event = RadrootsFarm {
+ let farm_event = EventFarm {
d_tag: farm.d_tag.clone(),
name: farm.name.clone(),
about: farm.about.clone(),
@@ -162,7 +162,7 @@ pub fn radroots_replica_farm_event(
};
let tags = farm_encode::farm_build_tags(&farm_event)?;
let content = canonical_json_string(&farm_event)?;
- let parts = RadrootsNip01EventWireParts {
+ let parts = Nip01EventWireParts {
kind: KIND_FARM,
content,
tags,
@@ -179,9 +179,9 @@ pub fn radroots_replica_plot_events(
for plot_row in plots {
let tags = collect_plot_tags(exec, &plot_row.id)?;
let location = load_plot_location(exec, &plot_row)?;
- let plot_event = RadrootsPlot {
+ let plot_event = EventPlot {
d_tag: plot_row.d_tag.clone(),
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: farm.pubkey.clone(),
d_tag: farm.d_tag.clone(),
},
@@ -192,7 +192,7 @@ pub fn radroots_replica_plot_events(
};
let tags = plot_encode::plot_build_tags(&plot_event)?;
let content = canonical_json_string(&plot_event)?;
- let parts = RadrootsNip01EventWireParts {
+ let parts = Nip01EventWireParts {
kind: KIND_PLOT,
content,
tags,
@@ -457,7 +457,7 @@ fn load_plots(
fn load_farm_location(
exec: &dyn SqlExecutor,
farm: &Farm,
-) -> Result<Option<RadrootsFarmPublicLocation>, RadrootsReplicaEventsError> {
+) -> Result<Option<FarmPublicLocation>, RadrootsReplicaEventsError> {
let Some(gcs) = load_gcs_location_for_farm(exec, &farm.id)? else {
return Ok(None);
};
@@ -493,7 +493,7 @@ fn load_farm_location(
) {
return Ok(None);
}
- Ok(Some(RadrootsFarmPublicLocation {
+ Ok(Some(FarmPublicLocation {
primary,
city,
region,
@@ -505,10 +505,10 @@ fn load_farm_location(
fn load_plot_location(
exec: &dyn SqlExecutor,
plot: &Plot,
-) -> Result<Option<radroots_event::farm::plot::RadrootsPlotLocation>, RadrootsReplicaEventsError> {
+) -> Result<Option<radroots_event::farm::plot::PlotLocation>, RadrootsReplicaEventsError> {
let location = load_gcs_location_for_plot(exec, &plot.id)?;
Ok(
- location.map(|gcs| radroots_event::farm::plot::RadrootsPlotLocation {
+ location.map(|gcs| radroots_event::farm::plot::PlotLocation {
primary: plot.location_primary.clone(),
city: plot.location_city.clone(),
region: plot.location_region.clone(),
@@ -521,7 +521,7 @@ fn load_plot_location(
fn load_gcs_location_for_farm(
exec: &dyn SqlExecutor,
farm_id: &str,
-) -> Result<Option<RadrootsGcsLocation>, RadrootsReplicaEventsError> {
+) -> Result<Option<EventGcsLocation>, RadrootsReplicaEventsError> {
let primary = load_relation_by_role(exec, farm_id, ROLE_PRIMARY, RelationType::Farm)?;
match primary {
Some(gcs) => Ok(Some(gcs)),
@@ -532,7 +532,7 @@ fn load_gcs_location_for_farm(
fn load_gcs_location_for_plot(
exec: &dyn SqlExecutor,
plot_id: &str,
-) -> Result<Option<RadrootsGcsLocation>, RadrootsReplicaEventsError> {
+) -> Result<Option<EventGcsLocation>, RadrootsReplicaEventsError> {
let primary = load_relation_by_role(exec, plot_id, ROLE_PRIMARY, RelationType::Plot)?;
match primary {
Some(gcs) => Ok(Some(gcs)),
@@ -550,7 +550,7 @@ fn load_relation_by_role(
id: &str,
role: &str,
relation: RelationType,
-) -> Result<Option<RadrootsGcsLocation>, RadrootsReplicaEventsError> {
+) -> Result<Option<EventGcsLocation>, RadrootsReplicaEventsError> {
let mut rels = match relation {
RelationType::Farm => {
let filter = IFarmGcsLocationFieldsFilter {
@@ -635,8 +635,8 @@ fn compare_relation_rows(a: &RelationRow, b: &RelationRow) -> core::cmp::Orderin
}
fn list_set_to_wire_parts(
- list_set: &radroots_event::social::list_set::RadrootsListSet,
-) -> Result<RadrootsNip01EventWireParts, RadrootsReplicaEventsError> {
+ list_set: &radroots_event::social::list_set::ListSet,
+) -> Result<Nip01EventWireParts, RadrootsReplicaEventsError> {
#[cfg(test)]
if failpoints::take_list_set_to_wire_error() {
return Err(RadrootsReplicaEventsError::InvalidData(
@@ -676,7 +676,7 @@ fn location_role_rank(role: &str) -> u8 {
fn gcs_location_to_event(
gcs: &GcsLocation,
-) -> Result<RadrootsGcsLocation, RadrootsReplicaEventsError> {
+) -> Result<EventGcsLocation, RadrootsReplicaEventsError> {
#[cfg(test)]
if failpoints::take_gcs_location_to_event_error() {
return Err(RadrootsReplicaEventsError::InvalidData(
@@ -685,7 +685,7 @@ fn gcs_location_to_event(
}
let point = parse_point(&gcs.point, gcs.lat, gcs.lng);
let polygon = parse_polygon(&gcs.polygon, gcs.lat, gcs.lng);
- Ok(RadrootsGcsLocation {
+ Ok(EventGcsLocation {
lat: gcs.lat,
lng: gcs.lng,
geohash: gcs.geohash.clone(),
@@ -708,18 +708,18 @@ fn gcs_location_to_event(
})
}
-fn parse_point(value: &str, lat: f64, lng: f64) -> RadrootsGeoJsonPoint {
+fn parse_point(value: &str, lat: f64, lng: f64) -> GeoJsonPoint {
if !value.trim().is_empty()
- && let Ok(parsed) = serde_json::from_str::<RadrootsGeoJsonPoint>(value)
+ && let Ok(parsed) = serde_json::from_str::<GeoJsonPoint>(value)
{
return parsed;
}
geojson_point_from_lat_lng(lat, lng)
}
-fn parse_polygon(value: &str, lat: f64, lng: f64) -> RadrootsGeoJsonPolygon {
+fn parse_polygon(value: &str, lat: f64, lng: f64) -> GeoJsonPolygon {
if !value.trim().is_empty()
- && let Ok(parsed) = serde_json::from_str::<RadrootsGeoJsonPolygon>(value)
+ && let Ok(parsed) = serde_json::from_str::<GeoJsonPolygon>(value)
&& !parsed.coordinates.is_empty()
&& !parsed.coordinates[0].is_empty()
{
@@ -770,7 +770,7 @@ fn load_member_claims_for_member(
Ok(result.results)
}
-fn parts_to_draft(author: &str, parts: RadrootsNip01EventWireParts) -> RadrootsReplicaEventDraft {
+fn parts_to_draft(author: &str, parts: Nip01EventWireParts) -> RadrootsReplicaEventDraft {
RadrootsReplicaEventDraft {
kind: parts.kind,
author: author.to_string(),
@@ -1966,7 +1966,7 @@ mod tests {
super::failpoints::set_list_set_to_wire_error();
assert!(radroots_replica_list_set_events(&clean_exec, &clean_farm).is_err());
- let invalid_list_set = radroots_event::social::list_set::RadrootsListSet {
+ let invalid_list_set = radroots_event::social::list_set::ListSet {
d_tag: String::new(),
content: String::new(),
entries: Vec::new(),
@@ -2008,7 +2008,7 @@ mod tests {
super::failpoints::set_list_set_to_wire_error();
assert!(radroots_replica_list_set_events(&exec, &farm_row).is_err());
- let invalid_list_set = radroots_event::social::list_set::RadrootsListSet {
+ let invalid_list_set = radroots_event::social::list_set::ListSet {
d_tag: String::new(),
content: String::new(),
entries: Vec::new(),
diff --git a/crates/replica_sync/src/geo.rs b/crates/replica_sync/src/geo.rs
@@ -3,12 +3,12 @@ use alloc::vec;
#[cfg(not(feature = "std"))]
use alloc::{string::String, vec::Vec};
-use radroots_event::farm::change_set::{RadrootsGeoJsonPoint, RadrootsGeoJsonPolygon};
+use radroots_event::farm::change_set::{GeoJsonPoint, GeoJsonPolygon};
const EARTH_RADIUS_M: f64 = 6_378_137.0;
-pub fn geojson_point_from_lat_lng(lat: f64, lng: f64) -> RadrootsGeoJsonPoint {
- RadrootsGeoJsonPoint {
+pub fn geojson_point_from_lat_lng(lat: f64, lng: f64) -> GeoJsonPoint {
+ GeoJsonPoint {
r#type: String::from("Point"),
coordinates: [lng, lat],
}
@@ -19,7 +19,7 @@ pub fn geojson_polygon_circle_wgs84(
lng: f64,
radius_m: f64,
steps: usize,
-) -> RadrootsGeoJsonPolygon {
+) -> GeoJsonPolygon {
let steps = if steps < 3 { 3 } else { steps };
let lat1 = lat.to_radians();
let lng1 = lng.to_radians();
@@ -46,7 +46,7 @@ pub fn geojson_polygon_circle_wgs84(
ring.push([lng_deg, lat_deg]);
}
- RadrootsGeoJsonPolygon {
+ GeoJsonPolygon {
r#type: String::from("Polygon"),
coordinates: vec![ring],
}
diff --git a/crates/replica_sync/src/ingest.rs b/crates/replica_sync/src/ingest.rs
@@ -12,26 +12,26 @@ use base64::Engine;
use base64::engine::general_purpose::URL_SAFE_NO_PAD;
use radroots_core::Decimal;
-use radroots_event::contract::RadrootsEventClass;
+use radroots_event::contract::EventClass;
#[cfg(test)]
-use radroots_event::envelope::RadrootsEventEnvelopeParts;
+use radroots_event::envelope::EventEnvelopeParts;
use radroots_event::envelope::event_head::{
- RadrootsCurrentEventHead, RadrootsEventHeadCandidateResult, RadrootsEventHeadCoordinate,
- RadrootsEventHeadDecision as ProtocolEventHeadDecision, event_head_candidate_for_class,
+ CurrentEventHead, EventHeadCandidateResult, EventHeadCoordinate,
+ EventHeadDecision as ProtocolEventHeadDecision, event_head_candidate_for_class,
event_head_candidate_for_event, select_event_head,
};
use radroots_event::envelope::kind::{
KIND_CALENDAR, KIND_CLASSIFIED_LISTING, KIND_FARM, KIND_PLOT, KIND_PROFILE,
is_nip51_list_set_kind,
};
-use radroots_event::id::RadrootsEventId;
+use radroots_event::id::EventId;
use radroots_event::listing::operational::{
- RadrootsOperationalListing, RadrootsOperationalListingAvailability,
- RadrootsOperationalListingBin, RadrootsOperationalListingStatus,
+ OperationalListing, OperationalListingAvailability, OperationalListingBin,
+ OperationalListingStatus,
};
use radroots_event::{
- envelope::RadrootsEventEnvelope,
- listing::classified::{RadrootsClassifiedListingPartition, classify_classified_listing_tags},
+ envelope::EventEnvelope,
+ listing::classified::{ClassifiedListingPartition, classify_classified_listing_tags},
};
use radroots_event_codec::farm::decode as farm_decode;
use radroots_event_codec::food_availability::inbound::{
@@ -177,7 +177,7 @@ impl RadrootsReplicaIdFactory for RadrootsReplicaDefaultIdFactory {
/// not the strict Profile inbound-admission boundary.
pub fn radroots_replica_ingest_event(
exec: &dyn SqlExecutor,
- event: &RadrootsEventEnvelope,
+ event: &EventEnvelope,
) -> Result<RadrootsReplicaIngestOutcome, RadrootsReplicaEventsError> {
radroots_replica_ingest_event_with_factory(exec, event, &RadrootsReplicaDefaultIdFactory)
}
@@ -188,7 +188,7 @@ pub fn radroots_replica_ingest_event(
/// not the strict Profile inbound-admission boundary.
pub fn radroots_replica_ingest_event_with_factory(
exec: &dyn SqlExecutor,
- event: &RadrootsEventEnvelope,
+ event: &EventEnvelope,
factory: &dyn RadrootsReplicaIdFactory,
) -> Result<RadrootsReplicaIngestOutcome, RadrootsReplicaEventsError> {
let verified_classified_listing = if event.kind_u32() == KIND_CLASSIFIED_LISTING {
@@ -221,7 +221,7 @@ pub fn radroots_replica_ingest_event_with_factory(
fn ingest_event_inner(
exec: &dyn SqlExecutor,
- event: &RadrootsEventEnvelope,
+ event: &EventEnvelope,
factory: &dyn RadrootsReplicaIdFactory,
verified_classified_listing: Option<&RadrootsSignatureVerifiedEvent>,
) -> Result<RadrootsReplicaIngestOutcome, RadrootsReplicaEventsError> {
@@ -249,7 +249,7 @@ fn ingest_event_inner(
fn ingest_profile_event(
exec: &dyn SqlExecutor,
- event: &RadrootsEventEnvelope,
+ event: &EventEnvelope,
) -> Result<RadrootsReplicaIngestOutcome, RadrootsReplicaEventsError> {
let data_result = profile_decode::data_from_event(
event.id_hex(),
@@ -275,11 +275,11 @@ fn ingest_profile_event(
}
let profile_type = match profile_type {
- radroots_event::profile::RadrootsProfileType::Individual => "individual",
- radroots_event::profile::RadrootsProfileType::Farm => "farm",
- radroots_event::profile::RadrootsProfileType::Coop => "coop",
- radroots_event::profile::RadrootsProfileType::Any => "any",
- radroots_event::profile::RadrootsProfileType::Radrootsd => "radrootsd",
+ radroots_event::profile::ProfileType::Individual => "individual",
+ radroots_event::profile::ProfileType::Farm => "farm",
+ radroots_event::profile::ProfileType::Coop => "coop",
+ radroots_event::profile::ProfileType::Any => "any",
+ radroots_event::profile::ProfileType::Radrootsd => "radrootsd",
};
let existing_result = nostr_profile::find_one(
@@ -340,7 +340,7 @@ fn ingest_profile_event(
fn ingest_farm_event(
exec: &dyn SqlExecutor,
- event: &RadrootsEventEnvelope,
+ event: &EventEnvelope,
_factory: &dyn RadrootsReplicaIdFactory,
) -> Result<RadrootsReplicaIngestOutcome, RadrootsReplicaEventsError> {
let farm =
@@ -424,7 +424,7 @@ fn ingest_farm_event(
fn ingest_plot_event(
exec: &dyn SqlExecutor,
- event: &RadrootsEventEnvelope,
+ event: &EventEnvelope,
factory: &dyn RadrootsReplicaIdFactory,
) -> Result<RadrootsReplicaIngestOutcome, RadrootsReplicaEventsError> {
let plot =
@@ -510,7 +510,7 @@ fn ingest_listing_event(
}
let partition = classify_classified_listing_tags(event.tags());
- if partition == RadrootsClassifiedListingPartition::FocusedFoodAvailability {
+ if partition == ClassifiedListingPartition::FocusedFoodAvailability {
let outcome = match project_verified_food_availability_event(verified_event) {
Ok(RadrootsFoodAvailabilityProjectionOutcome::Focused(_)) => {
RadrootsReplicaIngestOutcome::Excluded
@@ -522,14 +522,14 @@ fn ingest_listing_event(
};
return replace_listing_projection_with_raw_head(exec, &decision, outcome);
}
- if partition == RadrootsClassifiedListingPartition::GenericNip99 {
+ if partition == ClassifiedListingPartition::GenericNip99 {
return replace_listing_projection_with_raw_head(
exec,
&decision,
RadrootsReplicaIngestOutcome::Excluded,
);
}
- if partition == RadrootsClassifiedListingPartition::Ambiguous {
+ if partition == ClassifiedListingPartition::Ambiguous {
return replace_listing_projection_with_raw_head(
exec,
&decision,
@@ -589,7 +589,7 @@ fn replace_listing_projection_with_raw_head(
fn ingest_list_set_event(
exec: &dyn SqlExecutor,
- event: &RadrootsEventEnvelope,
+ event: &EventEnvelope,
) -> Result<RadrootsReplicaIngestOutcome, RadrootsReplicaEventsError> {
if event.kind_u32() != radroots_event::envelope::kind::KIND_LIST_SET_GENERIC {
return Ok(RadrootsReplicaIngestOutcome::Skipped);
@@ -653,17 +653,17 @@ fn ingest_list_set_event(
))
}
-fn listing_is_orderable(listing: &RadrootsOperationalListing) -> bool {
+fn listing_is_orderable(listing: &OperationalListing) -> bool {
match listing.availability.as_ref() {
- Some(RadrootsOperationalListingAvailability::Status { status }) => {
- matches!(status, RadrootsOperationalListingStatus::Active)
+ Some(OperationalListingAvailability::Status { status }) => {
+ matches!(status, OperationalListingStatus::Active)
}
- Some(RadrootsOperationalListingAvailability::Window { .. }) | None => true,
+ Some(OperationalListingAvailability::Window { .. }) | None => true,
}
}
fn trade_product_fields_from_listing(
- listing: &RadrootsOperationalListing,
+ listing: &OperationalListing,
listing_addr: &str,
) -> Result<ITradeProductFields, RadrootsReplicaEventsError> {
let bin = primary_listing_bin(listing)?;
@@ -740,7 +740,7 @@ fn trade_product_fields_from_listing(
}
fn trade_product_notes_from_listing(
- listing: &RadrootsOperationalListing,
+ listing: &OperationalListing,
) -> Result<Option<String>, RadrootsReplicaEventsError> {
let Some(discounts) = listing
.discounts
@@ -758,8 +758,8 @@ fn trade_product_notes_from_listing(
}
fn primary_listing_bin(
- listing: &RadrootsOperationalListing,
-) -> Result<&RadrootsOperationalListingBin, RadrootsReplicaEventsError> {
+ listing: &OperationalListing,
+) -> Result<&OperationalListingBin, RadrootsReplicaEventsError> {
listing
.bins
.iter()
@@ -925,7 +925,7 @@ fn trade_product_partial_from_fields(fields: &ITradeProductFields) -> ITradeProd
/// cleanup must be applied atomically through full replica ingestion.
pub fn radroots_replica_ingest_event_head(
exec: &dyn SqlExecutor,
- event: &RadrootsEventEnvelope,
+ event: &EventEnvelope,
) -> Result<RadrootsReplicaIngestOutcome, RadrootsReplicaEventsError> {
if event.kind_u32() == KIND_CLASSIFIED_LISTING {
verify_nip01_event(event.clone())?;
@@ -994,10 +994,10 @@ fn upsert_event_head(
fn event_head_decision(
exec: &dyn SqlExecutor,
- event: &RadrootsEventEnvelope,
+ event: &EventEnvelope,
) -> Result<EventHeadDecision, RadrootsReplicaEventsError> {
let candidate_result = if event.kind_u32() == KIND_CLASSIFIED_LISTING {
- event_head_candidate_for_class(event, RadrootsEventClass::Addressable)
+ event_head_candidate_for_class(event, EventClass::Addressable)
} else {
match event_head_candidate_for_event(event) {
Ok(candidate) => candidate,
@@ -1009,13 +1009,13 @@ fn event_head_decision(
}
};
let candidate = match candidate_result {
- RadrootsEventHeadCandidateResult::Candidate(candidate) => candidate,
- RadrootsEventHeadCandidateResult::NotHeadSelected => {
+ EventHeadCandidateResult::Candidate(candidate) => candidate,
+ EventHeadCandidateResult::NotHeadSelected => {
return Err(RadrootsReplicaEventsError::InvalidData(
"event is not head-selected".to_string(),
));
}
- RadrootsEventHeadCandidateResult::NotPersisted => {
+ EventHeadCandidateResult::NotPersisted => {
return Ok(EventHeadDecision {
apply: false,
key: String::new(),
@@ -1027,7 +1027,7 @@ fn event_head_decision(
content_hash: String::new(),
});
}
- RadrootsEventHeadCandidateResult::Malformed(err) => {
+ EventHeadCandidateResult::Malformed(err) => {
return Err(RadrootsReplicaEventsError::InvalidData(format!(
"malformed event head: {err:?}"
)));
@@ -1077,25 +1077,23 @@ fn event_head_decision(
fn current_event_head_from_row(
row: &NostrEventHead,
- coordinate: &RadrootsEventHeadCoordinate,
-) -> Result<RadrootsCurrentEventHead, RadrootsReplicaEventsError> {
- let event_id = RadrootsEventId::parse(&row.last_event_id).map_err(|err| {
+ coordinate: &EventHeadCoordinate,
+) -> Result<CurrentEventHead, RadrootsReplicaEventsError> {
+ let event_id = EventId::parse(&row.last_event_id).map_err(|err| {
RadrootsReplicaEventsError::InvalidData(format!(
"nostr event head last_event_id invalid: {err}"
))
})?;
- Ok(RadrootsCurrentEventHead {
+ Ok(CurrentEventHead {
coordinate: coordinate.clone(),
event_id,
created_at: row.last_created_at,
})
}
-fn event_head_coordinate_fields(
- coordinate: &RadrootsEventHeadCoordinate,
-) -> (String, u32, String, String) {
+fn event_head_coordinate_fields(coordinate: &EventHeadCoordinate) -> (String, u32, String, String) {
match coordinate {
- RadrootsEventHeadCoordinate::Replaceable { kind, pubkey } => {
+ EventHeadCoordinate::Replaceable { kind, pubkey } => {
let pubkey = pubkey.to_string();
(
event_head_key(*kind, &pubkey, ""),
@@ -1104,7 +1102,7 @@ fn event_head_coordinate_fields(
String::new(),
)
}
- RadrootsEventHeadCoordinate::Addressable {
+ EventHeadCoordinate::Addressable {
kind,
pubkey,
d_tag,
@@ -1241,7 +1239,7 @@ fn upsert_plot_tags(
fn upsert_plot_location(
exec: &dyn SqlExecutor,
plot_id: &str,
- location: Option<radroots_event::farm::plot::RadrootsPlotLocation>,
+ location: Option<radroots_event::farm::plot::PlotLocation>,
factory: &dyn RadrootsReplicaIdFactory,
) -> Result<(), RadrootsReplicaEventsError> {
clear_plot_locations(exec, plot_id)?;
@@ -1318,7 +1316,7 @@ fn clear_plot_locations(
fn create_gcs_location(
exec: &dyn SqlExecutor,
- gcs: radroots_event::farm::change_set::RadrootsGcsLocation,
+ gcs: radroots_event::farm::change_set::GcsLocation,
factory: &dyn RadrootsReplicaIdFactory,
) -> Result<String, RadrootsReplicaEventsError> {
let d_tag = factory.new_d_tag();
@@ -1370,7 +1368,7 @@ fn map_gcs_polygon_serialize_error(_err: serde_json::Error) -> RadrootsReplicaEv
#[cfg(test)]
fn serialize_gcs_point(
- point: &radroots_event::farm::change_set::RadrootsGeoJsonPoint,
+ point: &radroots_event::farm::change_set::GeoJsonPoint,
) -> Result<String, serde_json::Error> {
#[cfg(test)]
if failpoints::take_gcs_point_serialize_error() {
@@ -1380,13 +1378,13 @@ fn serialize_gcs_point(
}
#[cfg(not(test))]
-fn serialize_gcs_point(point: &radroots_event::farm::change_set::RadrootsGeoJsonPoint) -> String {
+fn serialize_gcs_point(point: &radroots_event::farm::change_set::GeoJsonPoint) -> String {
serde_json::to_string(point).expect("gcs.point serializes")
}
#[cfg(test)]
fn serialize_gcs_polygon(
- polygon: &radroots_event::farm::change_set::RadrootsGeoJsonPolygon,
+ polygon: &radroots_event::farm::change_set::GeoJsonPolygon,
) -> Result<String, serde_json::Error> {
#[cfg(test)]
if failpoints::take_gcs_polygon_serialize_error() {
@@ -1396,9 +1394,7 @@ fn serialize_gcs_polygon(
}
#[cfg(not(test))]
-fn serialize_gcs_polygon(
- polygon: &radroots_event::farm::change_set::RadrootsGeoJsonPolygon,
-) -> String {
+fn serialize_gcs_polygon(polygon: &radroots_event::farm::change_set::GeoJsonPolygon) -> String {
serde_json::to_string(polygon).expect("gcs.polygon serializes")
}
@@ -1411,7 +1407,7 @@ fn upsert_farm_members(
exec: &dyn SqlExecutor,
farm_id: &str,
role: ListSetRole,
- list_set: &radroots_event::social::list_set::RadrootsListSet,
+ list_set: &radroots_event::social::list_set::ListSet,
) -> Result<(), RadrootsReplicaEventsError> {
let role_value = match role {
ListSetRole::Members => ROLE_MEMBER,
@@ -1465,7 +1461,7 @@ fn upsert_farm_members(
fn upsert_member_claims(
exec: &dyn SqlExecutor,
member_pubkey: &str,
- list_set: &radroots_event::social::list_set::RadrootsListSet,
+ list_set: &radroots_event::social::list_set::ListSet,
) -> Result<(), RadrootsReplicaEventsError> {
let existing_query = farm_member_claim::find_many(
exec,
@@ -1531,7 +1527,7 @@ enum ListSetRole {
}
fn unpack_farm_location_strings(
- location: Option<&radroots_event::farm::RadrootsFarmPublicLocation>,
+ location: Option<&radroots_event::farm::FarmPublicLocation>,
) -> (
Option<String>,
Option<String>,
@@ -1550,7 +1546,7 @@ fn unpack_farm_location_strings(
}
fn unpack_plot_location_strings(
- location: Option<&radroots_event::farm::plot::RadrootsPlotLocation>,
+ location: Option<&radroots_event::farm::plot::PlotLocation>,
) -> (
Option<String>,
Option<String>,
@@ -1569,7 +1565,7 @@ fn unpack_plot_location_strings(
}
fn ensure_list_set_entries_tag(
- list_set: &radroots_event::social::list_set::RadrootsListSet,
+ list_set: &radroots_event::social::list_set::ListSet,
expected: &str,
label: &str,
) -> Result<(), RadrootsReplicaEventsError> {
@@ -1627,17 +1623,15 @@ mod tests {
use nostr::{EventBuilder, Keys, Kind, Tag, Timestamp};
use radroots_core::{Currency, Money, Quantity, QuantityPrice, Unit};
use radroots_event::envelope::kind::{KIND_LIST_SET_FOLLOW, KIND_LIST_SET_GENERIC};
- use radroots_event::farm::change_set::{
- RadrootsGcsLocation, RadrootsGeoJsonPoint, RadrootsGeoJsonPolygon,
- };
- use radroots_event::farm::plot::{RadrootsPlot, RadrootsPlotLocation};
- use radroots_event::farm::{RadrootsFarm, RadrootsFarmPublicLocation, RadrootsFarmRef};
- use radroots_event::listing::operational::RadrootsOperationalListingProduct;
+ use radroots_event::farm::change_set::{GcsLocation, GeoJsonPoint, GeoJsonPolygon};
+ use radroots_event::farm::plot::{Plot, PlotLocation};
+ use radroots_event::farm::{Farm, FarmPublicLocation, FarmRef};
+ use radroots_event::listing::operational::OperationalListingProduct;
use radroots_event::profile::{
- RADROOTS_PROFILE_TYPE_TAG_KEY, RadrootsProfileType, radroots_profile_type_tag_value,
+ ProfileType, RADROOTS_PROFILE_TYPE_TAG_KEY, radroots_profile_type_tag_value,
};
- use radroots_event::social::list::RadrootsListEntry;
- use radroots_event::social::list_set::RadrootsListSet;
+ use radroots_event::social::list::ListEntry;
+ use radroots_event::social::list_set::ListSet;
use radroots_event_codec::farm::encode as farm_encode;
use radroots_event_codec::farm::list_sets as farm_list_sets;
use radroots_event_codec::list_set::encode as list_set_encode;
@@ -1667,8 +1661,8 @@ mod tests {
kind: u32,
tags: Vec<Vec<String>>,
content: String,
- ) -> RadrootsEventEnvelope {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ ) -> EventEnvelope {
+ EventEnvelope::new(EventEnvelopeParts {
id: format!("{id:064x}"),
author: author.to_string(),
created_at,
@@ -1681,12 +1675,12 @@ mod tests {
}
fn test_event_with_parts(
- event: &RadrootsEventEnvelope,
+ event: &EventEnvelope,
kind: u32,
tags: Vec<Vec<String>>,
content: String,
- ) -> RadrootsEventEnvelope {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ ) -> EventEnvelope {
+ EventEnvelope::new(EventEnvelopeParts {
id: event.id_hex(),
author: event.author().to_hex().to_owned(),
created_at: event.created_at_u64(),
@@ -1698,10 +1692,7 @@ mod tests {
.expect("test event envelope parts")
}
- fn test_event_with_content(
- event: &RadrootsEventEnvelope,
- content: String,
- ) -> RadrootsEventEnvelope {
+ fn test_event_with_content(event: &EventEnvelope, content: String) -> EventEnvelope {
test_event_with_parts(event, event.kind_u32(), event.tags_as_vec(), content)
}
@@ -1849,16 +1840,16 @@ mod tests {
}
}
- fn sample_gcs(lat: f64, lng: f64, geohash: &str) -> RadrootsGcsLocation {
- RadrootsGcsLocation {
+ fn sample_gcs(lat: f64, lng: f64, geohash: &str) -> GcsLocation {
+ GcsLocation {
lat,
lng,
geohash: geohash.to_string(),
- point: RadrootsGeoJsonPoint {
+ point: GeoJsonPoint {
r#type: "Point".to_string(),
coordinates: [lng, lat],
},
- polygon: RadrootsGeoJsonPolygon {
+ polygon: GeoJsonPolygon {
r#type: "Polygon".to_string(),
coordinates: vec![vec![
[lng, lat],
@@ -1888,9 +1879,9 @@ mod tests {
id: u64,
author: &str,
created_at: u32,
- profile_type: Option<RadrootsProfileType>,
+ profile_type: Option<ProfileType>,
name: &str,
- ) -> RadrootsEventEnvelope {
+ ) -> EventEnvelope {
let profile = serde_json::json!({
"name": name,
"display_name": format!("{name}-display"),
@@ -1925,10 +1916,10 @@ mod tests {
created_at: u32,
d_tag: &str,
name: &str,
- location: Option<RadrootsFarmPublicLocation>,
+ location: Option<FarmPublicLocation>,
tags: Option<Vec<String>>,
- ) -> RadrootsEventEnvelope {
- let farm = RadrootsFarm {
+ ) -> EventEnvelope {
+ let farm = Farm {
d_tag: d_tag.to_string(),
name: name.to_string(),
about: Some("about".to_string()),
@@ -1955,12 +1946,12 @@ mod tests {
author: &str,
created_at: u32,
d_tag: &str,
- farm_ref: RadrootsFarmRef,
+ farm_ref: FarmRef,
name: &str,
- location: Option<RadrootsPlotLocation>,
+ location: Option<PlotLocation>,
tags: Option<Vec<String>>,
- ) -> RadrootsEventEnvelope {
- let plot = RadrootsPlot {
+ ) -> EventEnvelope {
+ let plot = Plot {
d_tag: d_tag.to_string(),
farm: farm_ref,
name: name.to_string(),
@@ -1984,8 +1975,8 @@ mod tests {
author: &str,
created_at: u32,
kind: u32,
- list_set: &RadrootsListSet,
- ) -> RadrootsEventEnvelope {
+ list_set: &ListSet,
+ ) -> EventEnvelope {
let parts = list_set_encode::to_wire_parts_with_kind(list_set, kind).expect("list set");
test_event_envelope(
id,
@@ -2003,7 +1994,7 @@ mod tests {
d_tag: &str,
status: &str,
title: &str,
- ) -> RadrootsEventEnvelope {
+ ) -> EventEnvelope {
let farm_d_tag = "AAAAAAAAAAAAAAAAAAAAAA";
signed_listing_event(
author,
@@ -2055,7 +2046,7 @@ mod tests {
created_at: u64,
tags: Vec<Vec<String>>,
content: String,
- ) -> RadrootsEventEnvelope {
+ ) -> EventEnvelope {
assert_eq!(
author, FIXTURE_ALICE_PUBLIC_KEY_HEX,
"listing tests must use the approved fixture signer"
@@ -2077,7 +2068,7 @@ mod tests {
radroots_event_from_nostr(&event).expect("listing event adapter")
}
- fn focused_listing_event(author: &str, created_at: u64, d_tag: &str) -> RadrootsEventEnvelope {
+ fn focused_listing_event(author: &str, created_at: u64, d_tag: &str) -> EventEnvelope {
focused_listing_event_with_content(
author,
created_at,
@@ -2091,7 +2082,7 @@ mod tests {
created_at: u64,
d_tag: &str,
content: &str,
- ) -> RadrootsEventEnvelope {
+ ) -> EventEnvelope {
signed_listing_event(
author,
created_at,
@@ -2109,7 +2100,7 @@ mod tests {
)
}
- fn generic_listing_event(author: &str, created_at: u64, d_tag: &str) -> RadrootsEventEnvelope {
+ fn generic_listing_event(author: &str, created_at: u64, d_tag: &str) -> EventEnvelope {
signed_listing_event(
author,
created_at,
@@ -2130,15 +2121,15 @@ mod tests {
"USD".parse().expect("currency")
}
- fn listing_model() -> RadrootsOperationalListing {
- RadrootsOperationalListing {
+ fn listing_model() -> OperationalListing {
+ OperationalListing {
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".parse().expect("d tag"),
published_at: Some(1),
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: "c".repeat(64),
d_tag: "AAAAAAAAAAAAAAAAAAAAAZ".to_string(),
},
- product: RadrootsOperationalListingProduct {
+ product: OperationalListingProduct {
key: "pasture-eggs".to_string(),
title: "Pasture Eggs".to_string(),
category: "eggs".to_string(),
@@ -2150,7 +2141,7 @@ mod tests {
year: Some("2026".to_string()),
},
primary_bin_id: "bin-a".parse().expect("primary bin id"),
- bins: vec![RadrootsOperationalListingBin {
+ bins: vec![OperationalListingBin {
bin_id: "bin-a".parse().expect("bin id"),
quantity: Quantity::try_new(listing_decimal("12"), Unit::Each)
.unwrap()
@@ -2170,8 +2161,8 @@ mod tests {
plot: None,
discounts: Some(Vec::new()),
inventory_available: Some(listing_decimal("5")),
- availability: Some(RadrootsOperationalListingAvailability::Status {
- status: RadrootsOperationalListingStatus::Active,
+ availability: Some(OperationalListingAvailability::Status {
+ status: OperationalListingStatus::Active,
}),
delivery_method: None,
location: None,
@@ -2220,7 +2211,7 @@ mod tests {
last_created_at: 1,
content_hash: "hash".to_string(),
};
- let coordinate = RadrootsEventHeadCoordinate::Replaceable {
+ let coordinate = EventHeadCoordinate::Replaceable {
kind: KIND_PROFILE,
pubkey: "a".repeat(64).parse().expect("pubkey"),
};
@@ -2480,7 +2471,7 @@ mod tests {
10,
&profile_pubkey,
1,
- Some(RadrootsProfileType::Individual),
+ Some(ProfileType::Individual),
"alice",
);
let profile_no_type = profile_event(9, &profile_pubkey, 0, None, "alice-none");
@@ -2493,7 +2484,7 @@ mod tests {
11,
&profile_pubkey,
2,
- Some(RadrootsProfileType::Individual),
+ Some(ProfileType::Individual),
"alice-2",
);
assert_eq!(
@@ -2508,7 +2499,7 @@ mod tests {
8,
&profile_pubkey,
1,
- Some(RadrootsProfileType::Individual),
+ Some(ProfileType::Individual),
"alice-old",
);
let decision_old = event_head_decision(&exec, &profile_older).expect("decision old");
@@ -2519,7 +2510,7 @@ mod tests {
12,
&profile_pubkey,
2,
- Some(RadrootsProfileType::Individual),
+ Some(ProfileType::Individual),
"alice-3",
);
let decision = event_head_decision(&exec, &profile_same_time_higher_id).expect("decision");
@@ -2528,7 +2519,7 @@ mod tests {
10,
&profile_pubkey,
2,
- Some(RadrootsProfileType::Individual),
+ Some(ProfileType::Individual),
"alice-0",
);
let decision = event_head_decision(&exec, &profile_same_time_lower_id).expect("decision");
@@ -2542,7 +2533,7 @@ mod tests {
10,
farm_d_tag,
"farm-a",
- Some(RadrootsFarmPublicLocation {
+ Some(FarmPublicLocation {
primary: "primary".to_string(),
city: Some("city".to_string()),
region: Some("region".to_string()),
@@ -2583,12 +2574,12 @@ mod tests {
&farm_pubkey,
20,
plot_d_tag,
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_d_tag.to_string(),
},
"plot-a",
- Some(RadrootsPlotLocation {
+ Some(PlotLocation {
primary: Some("p".to_string()),
city: Some("c".to_string()),
region: Some("r".to_string()),
@@ -2606,7 +2597,7 @@ mod tests {
&farm_pubkey,
21,
plot_d_tag,
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_d_tag.to_string(),
},
@@ -2663,10 +2654,10 @@ mod tests {
);
}
- let bad_description = RadrootsListSet {
+ let bad_description = ListSet {
d_tag: "member_of.farms".to_string(),
content: String::new(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "p".to_string(),
values: vec![farm_pubkey.clone()],
}],
@@ -2683,10 +2674,10 @@ mod tests {
);
assert!(ingest_list_set_event(&exec, &bad_description_event).is_err());
- let bad_image = RadrootsListSet {
+ let bad_image = ListSet {
d_tag: "member_of.farms".to_string(),
content: String::new(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "p".to_string(),
values: vec![farm_pubkey.clone()],
}],
@@ -2698,10 +2689,10 @@ mod tests {
list_set_event(91, &profile_pubkey, 101, KIND_LIST_SET_GENERIC, &bad_image);
assert!(ingest_list_set_event(&exec, &bad_image_event).is_err());
- let bad_title = RadrootsListSet {
+ let bad_title = ListSet {
d_tag: "member_of.farms".to_string(),
content: String::new(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "p".to_string(),
values: vec![farm_pubkey.clone()],
}],
@@ -2713,10 +2704,10 @@ mod tests {
list_set_event(92, &profile_pubkey, 102, KIND_LIST_SET_GENERIC, &bad_title);
assert!(ingest_list_set_event(&exec, &bad_title_event).is_err());
- let bad_content = RadrootsListSet {
+ let bad_content = ListSet {
d_tag: "member_of.farms".to_string(),
content: "bad".to_string(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "p".to_string(),
values: vec![farm_pubkey.clone()],
}],
@@ -2733,10 +2724,10 @@ mod tests {
);
assert!(ingest_list_set_event(&exec, &bad_content_event).is_err());
- let unknown_farm_list_set = RadrootsListSet {
+ let unknown_farm_list_set = ListSet {
d_tag: format!("farm:{farm_d_tag}:unknown"),
content: String::new(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "p".to_string(),
values: vec![profile_pubkey.clone()],
}],
@@ -2757,7 +2748,7 @@ mod tests {
assert!(parse_farm_list_set_d_tag("farm:AAAAAAAAAAAAAAAAAAAAAA:plots").is_some());
assert_eq!(to_value_opt(Some("x".to_string())), Some(Value::from("x")));
assert_eq!(to_value_opt(None), Some(Value::Null));
- let location = RadrootsFarmPublicLocation {
+ let location = FarmPublicLocation {
primary: "p".to_string(),
city: Some("c".to_string()),
region: Some("r".to_string()),
@@ -2769,7 +2760,7 @@ mod tests {
Some("p".to_string())
);
assert_eq!(
- unpack_plot_location_strings(Some(&RadrootsPlotLocation {
+ unpack_plot_location_strings(Some(&PlotLocation {
primary: Some("p".to_string()),
city: None,
region: None,
@@ -2782,10 +2773,10 @@ mod tests {
assert!(ensure_list_set_entries_tag(&bad_image, "p", "x").is_ok());
assert!(
ensure_list_set_entries_tag(
- &RadrootsListSet {
+ &ListSet {
d_tag: "x".to_string(),
content: String::new(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "a".to_string(),
values: vec!["x".to_string()],
}],
@@ -3305,7 +3296,7 @@ mod tests {
upsert_plot_location(
¬_found_plot_locations,
&plot_id,
- Some(RadrootsPlotLocation {
+ Some(PlotLocation {
primary: None,
city: None,
region: None,
@@ -3404,7 +3395,7 @@ mod tests {
upsert_plot_location(
&internal_plot_locations,
&plot_id,
- Some(RadrootsPlotLocation {
+ Some(PlotLocation {
primary: None,
city: None,
region: None,
@@ -3465,7 +3456,7 @@ mod tests {
500,
&profile_pubkey,
50,
- Some(RadrootsProfileType::Individual),
+ Some(ProfileType::Individual),
"pass-profile",
);
assert_eq!(
@@ -3484,7 +3475,7 @@ mod tests {
51,
farm_d_tag,
"pass-farm",
- Some(RadrootsFarmPublicLocation {
+ Some(FarmPublicLocation {
primary: "primary".to_string(),
city: Some("city".to_string()),
region: Some("region".to_string()),
@@ -3503,12 +3494,12 @@ mod tests {
&farm_pubkey,
52,
plot_d_tag,
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_d_tag.to_string(),
},
"pass-plot",
- Some(RadrootsPlotLocation {
+ Some(PlotLocation {
primary: Some("plot".to_string()),
city: None,
region: None,
@@ -3539,15 +3530,15 @@ mod tests {
);
let farm_row = find_farm_by_ref(&pass, &farm_pubkey, farm_d_tag).expect("farm row");
- let mixed_member_entries = RadrootsListSet {
+ let mixed_member_entries = ListSet {
d_tag: format!("farm:{farm_d_tag}:members"),
content: String::new(),
entries: vec![
- RadrootsListEntry {
+ ListEntry {
tag: "p".to_string(),
values: Vec::new(),
},
- RadrootsListEntry {
+ ListEntry {
tag: "p".to_string(),
values: vec!["6".repeat(64)],
},
@@ -3565,15 +3556,15 @@ mod tests {
)
.is_ok()
);
- let mixed_claim_entries = RadrootsListSet {
+ let mixed_claim_entries = ListSet {
d_tag: "member_of.farms".to_string(),
content: String::new(),
entries: vec![
- RadrootsListEntry {
+ ListEntry {
tag: "p".to_string(),
values: Vec::new(),
},
- RadrootsListEntry {
+ ListEntry {
tag: "p".to_string(),
values: vec![farm_pubkey.clone()],
},
@@ -3614,7 +3605,7 @@ mod tests {
60,
farm_d_tag,
"wrapper-farm",
- Some(RadrootsFarmPublicLocation {
+ Some(FarmPublicLocation {
primary: "primary".to_string(),
city: Some("city".to_string()),
region: None,
@@ -3648,12 +3639,12 @@ mod tests {
&farm_pubkey,
62,
plot_d_tag,
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_d_tag.to_string(),
},
"wrapper-plot",
- Some(RadrootsPlotLocation {
+ Some(PlotLocation {
primary: Some("plot-primary".to_string()),
city: None,
region: None,
@@ -3672,7 +3663,7 @@ mod tests {
&farm_pubkey,
63,
plot_d_tag,
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_d_tag.to_string(),
},
@@ -3702,7 +3693,7 @@ mod tests {
700,
&profile_pubkey,
70,
- Some(RadrootsProfileType::Individual),
+ Some(ProfileType::Individual),
"txn-profile",
);
assert_eq!(
@@ -3731,7 +3722,7 @@ mod tests {
71,
farm_d_tag,
"txn-farm",
- Some(RadrootsFarmPublicLocation {
+ Some(FarmPublicLocation {
primary: "primary".to_string(),
city: Some("city".to_string()),
region: None,
@@ -3750,12 +3741,12 @@ mod tests {
&farm_pubkey,
72,
"AAAAAAAAAAAAAAAAAAAAAQ",
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_d_tag.to_string(),
},
"txn-plot",
- Some(RadrootsPlotLocation {
+ Some(PlotLocation {
primary: Some("primary".to_string()),
city: None,
region: None,
@@ -3786,7 +3777,7 @@ mod tests {
upsert_plot_location(
&pass_txn,
&plot_id,
- Some(RadrootsPlotLocation {
+ Some(PlotLocation {
primary: Some("primary".to_string()),
city: None,
region: None,
@@ -3837,7 +3828,7 @@ mod tests {
upsert_plot_location(
&txn,
"plot-id",
- Some(RadrootsPlotLocation {
+ Some(PlotLocation {
primary: Some("primary".to_string()),
city: None,
region: None,
@@ -3883,7 +3874,7 @@ mod tests {
800,
&profile_pubkey,
80,
- Some(RadrootsProfileType::Individual),
+ Some(ProfileType::Individual),
"profile-base",
);
let profile_bad_content = test_event_with_content(&profile, "{".to_string());
@@ -3904,7 +3895,7 @@ mod tests {
801,
&profile_pubkey,
81,
- Some(RadrootsProfileType::Individual),
+ Some(ProfileType::Individual),
"profile-update",
);
let profile_update_fail = QueryFailExecutor {
@@ -3923,7 +3914,7 @@ mod tests {
802,
&"7".repeat(64),
82,
- Some(RadrootsProfileType::Individual),
+ Some(ProfileType::Individual),
"profile-new",
);
assert!(ingest_profile_event(&profile_create_fail, &profile_new).is_err());
@@ -3937,7 +3928,7 @@ mod tests {
803,
&"c".repeat(64),
83,
- Some(RadrootsProfileType::Individual),
+ Some(ProfileType::Individual),
"profile-state",
);
assert!(ingest_profile_event(&profile_state_fail, &profile_state_event).is_err());
@@ -3948,7 +3939,7 @@ mod tests {
90,
farm_d_tag,
"farm-seed",
- Some(RadrootsFarmPublicLocation {
+ Some(FarmPublicLocation {
primary: "primary".to_string(),
city: Some("city".to_string()),
region: Some("region".to_string()),
@@ -4040,7 +4031,7 @@ mod tests {
95,
farm_d_tag,
"farm-gcs",
- Some(RadrootsFarmPublicLocation {
+ Some(FarmPublicLocation {
primary: "primary".to_string(),
city: Some("city".to_string()),
region: None,
@@ -4065,7 +4056,7 @@ mod tests {
96,
farm_d_tag,
"farm-rel",
- Some(RadrootsFarmPublicLocation {
+ Some(FarmPublicLocation {
primary: "primary".to_string(),
city: Some("city".to_string()),
region: None,
@@ -4101,7 +4092,7 @@ mod tests {
98,
farm_d_tag,
"farm-public-location",
- Some(RadrootsFarmPublicLocation {
+ Some(FarmPublicLocation {
primary: "primary".to_string(),
city: Some("city".to_string()),
region: None,
@@ -4122,7 +4113,7 @@ mod tests {
99,
farm_d_tag,
"farm-public-locality",
- Some(RadrootsFarmPublicLocation {
+ Some(FarmPublicLocation {
primary: "primary".to_string(),
city: Some("city".to_string()),
region: None,
@@ -4142,12 +4133,12 @@ mod tests {
&farm_pubkey,
100,
plot_d_tag,
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_d_tag.to_string(),
},
"plot-seed",
- Some(RadrootsPlotLocation {
+ Some(PlotLocation {
primary: Some("primary".to_string()),
city: None,
region: None,
@@ -4174,7 +4165,7 @@ mod tests {
&farm_pubkey,
101,
plot_d_tag,
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_d_tag.to_string(),
},
@@ -4194,7 +4185,7 @@ mod tests {
&farm_pubkey,
102,
plot_d_tag,
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_d_tag.to_string(),
},
@@ -4214,7 +4205,7 @@ mod tests {
&farm_pubkey,
103,
"AAAAAAAAAAAAAAAAAAAAAg",
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_d_tag.to_string(),
},
@@ -4234,7 +4225,7 @@ mod tests {
&farm_pubkey,
104,
"AAAAAAAAAAAAAAAAAAAAAw",
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_d_tag.to_string(),
},
@@ -4254,12 +4245,12 @@ mod tests {
&farm_pubkey,
105,
"AAAAAAAAAAAAAAAAAAAAAw",
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_d_tag.to_string(),
},
"plot-gcs",
- Some(RadrootsPlotLocation {
+ Some(PlotLocation {
primary: Some("primary".to_string()),
city: None,
region: None,
@@ -4280,12 +4271,12 @@ mod tests {
&farm_pubkey,
106,
"AAAAAAAAAAAAAAAAAAAAAw",
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_d_tag.to_string(),
},
"plot-rel",
- Some(RadrootsPlotLocation {
+ Some(PlotLocation {
primary: Some("primary".to_string()),
city: None,
region: None,
@@ -4306,7 +4297,7 @@ mod tests {
&farm_pubkey,
107,
"AAAAAAAAAAAAAAAAAAAAAw",
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_d_tag.to_string(),
},
@@ -4316,13 +4307,8 @@ mod tests {
);
assert!(ingest_plot_event(&plot_state_fail, &plot_state_event, &FixedFactory).is_err());
- let list_decode_fail = profile_event(
- 830,
- &farm_pubkey,
- 108,
- Some(RadrootsProfileType::Farm),
- "unused",
- );
+ let list_decode_fail =
+ profile_event(830, &farm_pubkey, 108, Some(ProfileType::Farm), "unused");
let list_decode_fail = test_event_with_parts(
&list_decode_fail,
KIND_LIST_SET_GENERIC,
@@ -4420,7 +4406,7 @@ mod tests {
808,
&"9".repeat(64),
101,
- Some(RadrootsProfileType::Individual),
+ Some(ProfileType::Individual),
"profile-update-error",
);
assert!(radroots_replica_ingest_event_head(&state_update_fail, &profile_update).is_err());
@@ -4435,7 +4421,7 @@ mod tests {
900,
&"e".repeat(64),
120,
- Some(RadrootsProfileType::Individual),
+ Some(ProfileType::Individual),
"profile-state-insert",
);
let state_insert_fail = QueryFailExecutor {
@@ -4461,7 +4447,7 @@ mod tests {
&farm_pubkey,
122,
"AAAAAAAAAAAAAAAAAAAAAg",
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_d_tag.clone(),
},
@@ -4549,7 +4535,7 @@ mod tests {
upsert_plot_location(
&plot_gcs_insert_fail,
&plot_id,
- Some(RadrootsPlotLocation {
+ Some(PlotLocation {
primary: Some("primary".to_string()),
city: None,
region: None,
@@ -4570,7 +4556,7 @@ mod tests {
upsert_plot_location(
&plot_rel_insert_fail,
&plot_id,
- Some(RadrootsPlotLocation {
+ Some(PlotLocation {
primary: Some("primary".to_string()),
city: None,
region: None,
@@ -4621,19 +4607,19 @@ mod tests {
let (farm_id, farm_pubkey, _, _) = seed_rows(&exec);
let member_pubkey = "6".repeat(64);
- let member_list_set = RadrootsListSet {
+ let member_list_set = ListSet {
d_tag: "farm:AAAAAAAAAAAAAAAAAAAAAQ:members".to_string(),
content: String::new(),
entries: vec![
- RadrootsListEntry {
+ ListEntry {
tag: "p".to_string(),
values: Vec::new(),
},
- RadrootsListEntry {
+ ListEntry {
tag: "p".to_string(),
values: vec![member_pubkey.clone(), "ignored".to_string()],
},
- RadrootsListEntry {
+ ListEntry {
tag: "p".to_string(),
values: vec![member_pubkey.clone()],
},
@@ -4666,19 +4652,19 @@ mod tests {
.expect("plots is no-op");
let claimant_pubkey = "7".repeat(64);
- let claims_list_set = RadrootsListSet {
+ let claims_list_set = ListSet {
d_tag: "member_of.farms".to_string(),
content: String::new(),
entries: vec![
- RadrootsListEntry {
+ ListEntry {
tag: "p".to_string(),
values: Vec::new(),
},
- RadrootsListEntry {
+ ListEntry {
tag: "p".to_string(),
values: vec![farm_pubkey.clone(), "ignored".to_string()],
},
- RadrootsListEntry {
+ ListEntry {
tag: "p".to_string(),
values: vec![farm_pubkey.clone()],
},
@@ -4716,7 +4702,7 @@ mod tests {
&farm_pubkey,
220,
&plot_d_tag,
- RadrootsFarmRef {
+ FarmRef {
pubkey: "1".repeat(64),
d_tag: farm_d_tag.clone(),
},
diff --git a/crates/replica_sync/src/tests.rs b/crates/replica_sync/src/tests.rs
@@ -3,7 +3,7 @@ use crate::{
radroots_replica_sync_all,
};
use radroots_event::envelope::kind::{KIND_FARM, KIND_LIST_SET_GENERIC, KIND_PLOT};
-use radroots_event::farm::change_set::{RadrootsGeoJsonPoint, RadrootsGeoJsonPolygon};
+use radroots_event::farm::change_set::{GeoJsonPoint, GeoJsonPolygon};
use radroots_replica_schema::ReplicaSchemaError;
use radroots_replica_schema::farm::IFarmFields;
use radroots_replica_schema::farm_gcs_location::IFarmGcsLocationFields;
@@ -51,11 +51,11 @@ fn sync_all_emits_expected_order_without_lossy_profiles() {
};
let farm_row = unwrap_sql(farm::create(&exec, &farm_fields), "farm").result;
- let gcs_point = RadrootsGeoJsonPoint {
+ let gcs_point = GeoJsonPoint {
r#type: "Point".to_string(),
coordinates: [-122.4, 37.7],
};
- let gcs_polygon = RadrootsGeoJsonPolygon {
+ let gcs_polygon = GeoJsonPolygon {
r#type: "Polygon".to_string(),
coordinates: vec![vec![
[-122.4, 37.7],
diff --git a/crates/replica_sync/tests/ingest_roundtrip.rs b/crates/replica_sync/tests/ingest_roundtrip.rs
@@ -1,17 +1,15 @@
use radroots_event::envelope::kind::{
KIND_FARM, KIND_LIST_SET_FOLLOW, KIND_LIST_SET_GENERIC, KIND_PLOT, KIND_PROFILE,
};
-use radroots_event::farm::change_set::{
- RadrootsGcsLocation, RadrootsGeoJsonPoint, RadrootsGeoJsonPolygon,
-};
-use radroots_event::farm::plot::{RadrootsPlot, RadrootsPlotLocation};
-use radroots_event::farm::{RadrootsFarm, RadrootsFarmPublicLocation, RadrootsFarmRef};
+use radroots_event::farm::change_set::{GcsLocation, GeoJsonPoint, GeoJsonPolygon};
+use radroots_event::farm::plot::{Plot, PlotLocation};
+use radroots_event::farm::{Farm, FarmPublicLocation, FarmRef};
use radroots_event::profile::{
- RADROOTS_PROFILE_TYPE_TAG_KEY, RadrootsProfileType, radroots_profile_type_tag_value,
+ ProfileType, RADROOTS_PROFILE_TYPE_TAG_KEY, radroots_profile_type_tag_value,
};
-use radroots_event::social::list::RadrootsListEntry;
-use radroots_event::social::list_set::RadrootsListSet;
-use radroots_event::{envelope::RadrootsEventEnvelope, envelope::RadrootsEventEnvelopeParts};
+use radroots_event::social::list::ListEntry;
+use radroots_event::social::list_set::ListSet;
+use radroots_event::{envelope::EventEnvelope, envelope::EventEnvelopeParts};
use radroots_event_codec::error::{EventEncodeError, EventParseError};
use radroots_event_codec::farm::encode as farm_encode;
use radroots_event_codec::farm::list_sets as farm_list_sets;
@@ -180,7 +178,7 @@ fn unwrap_sql_panics_on_error() {
assert!(result.is_err());
}
-fn draft_to_event(draft: &RadrootsReplicaEventDraft, index: u32) -> RadrootsEventEnvelope {
+fn draft_to_event(draft: &RadrootsReplicaEventDraft, index: u32) -> EventEnvelope {
event_with_parts(
u64::from(index) + 1,
draft.author.as_str(),
@@ -218,11 +216,11 @@ fn seed_source(
};
let farm_row = unwrap_sql(farm::create(exec, &farm_fields), "farm").result;
- let point = radroots_event::farm::change_set::RadrootsGeoJsonPoint {
+ let point = radroots_event::farm::change_set::GeoJsonPoint {
r#type: "Point".to_string(),
coordinates: [-122.4, 37.7],
};
- let polygon = radroots_event::farm::change_set::RadrootsGeoJsonPolygon {
+ let polygon = radroots_event::farm::change_set::GeoJsonPolygon {
r#type: "Polygon".to_string(),
coordinates: vec![vec![
[-122.4, 37.7],
@@ -567,7 +565,7 @@ fn ingest_reports_transaction_boundary_errors() {
9_001,
&author,
10,
- Some(RadrootsProfileType::Individual),
+ Some(ProfileType::Individual),
"tx-errors",
);
@@ -626,7 +624,7 @@ fn ingest_reports_parse_and_state_error_paths_for_all_kinds() {
9_201,
&profile_pubkey,
10,
- Some(RadrootsProfileType::Individual),
+ Some(ProfileType::Individual),
"profile-ok",
);
let profile_parse_error = event_with_parts(
@@ -670,7 +668,7 @@ fn ingest_reports_parse_and_state_error_paths_for_all_kinds() {
&farm_pubkey,
14,
"AAAAAAAAAAAAAAAAAAAAAQ",
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_seed_d_tag.to_string(),
},
@@ -727,7 +725,7 @@ fn ingest_reports_parse_and_state_error_paths_for_all_kinds() {
9_209,
&"c".repeat(64),
18,
- Some(RadrootsProfileType::Individual),
+ Some(ProfileType::Individual),
"profile-state-insert",
);
assert!(
@@ -750,7 +748,7 @@ fn ingest_reports_parse_and_state_error_paths_for_all_kinds() {
&farm_pubkey,
20,
"AAAAAAAAAAAAAAAAAAAAAg",
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_seed_d_tag.to_string(),
},
@@ -767,7 +765,7 @@ fn ingest_reports_query_fail_paths_for_profile_farm_plot_and_list_sets() {
let exec = SqlxSqliteExecutor::open_memory().expect("db");
migrations::run_all_up(&exec).expect("migrations");
- let assert_query_fail = |needle: &'static str, event: &RadrootsEventEnvelope| {
+ let assert_query_fail = |needle: &'static str, event: &EventEnvelope| {
let fail = QueryFailExecutor {
inner: &exec,
needle,
@@ -784,7 +782,7 @@ fn ingest_reports_query_fail_paths_for_profile_farm_plot_and_list_sets() {
9_301,
&profile_pubkey,
10,
- Some(RadrootsProfileType::Individual),
+ Some(ProfileType::Individual),
"profile-query",
);
assert_query_fail("select * from nostr_profile", &profile_create);
@@ -797,7 +795,7 @@ fn ingest_reports_query_fail_paths_for_profile_farm_plot_and_list_sets() {
9_302,
&profile_pubkey,
11,
- Some(RadrootsProfileType::Individual),
+ Some(ProfileType::Individual),
"profile-query-updated",
);
assert_query_fail("update nostr_profile", &profile_update);
@@ -810,7 +808,7 @@ fn ingest_reports_query_fail_paths_for_profile_farm_plot_and_list_sets() {
12,
farm_d_tag,
"farm-query",
- Some(RadrootsFarmPublicLocation {
+ Some(FarmPublicLocation {
primary: "farm".to_string(),
city: Some("city".to_string()),
region: None,
@@ -843,12 +841,12 @@ fn ingest_reports_query_fail_paths_for_profile_farm_plot_and_list_sets() {
&farm_pubkey,
14,
plot_d_tag,
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_d_tag.to_string(),
},
"plot-query",
- Some(RadrootsPlotLocation {
+ Some(PlotLocation {
primary: Some("plot".to_string()),
city: None,
region: None,
@@ -870,7 +868,7 @@ fn ingest_reports_query_fail_paths_for_profile_farm_plot_and_list_sets() {
&farm_pubkey,
15,
plot_d_tag,
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_d_tag.to_string(),
},
@@ -916,8 +914,8 @@ fn event_with_parts(
kind: u32,
content: String,
tags: Vec<Vec<String>>,
-) -> RadrootsEventEnvelope {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+) -> EventEnvelope {
+ EventEnvelope::new(EventEnvelopeParts {
id: format!("{id:064x}"),
author: author.to_string(),
created_at: u64::from(created_at),
@@ -929,15 +927,15 @@ fn event_with_parts(
.expect("test event envelope")
}
-fn sample_point(lat: f64, lng: f64) -> RadrootsGeoJsonPoint {
- RadrootsGeoJsonPoint {
+fn sample_point(lat: f64, lng: f64) -> GeoJsonPoint {
+ GeoJsonPoint {
r#type: "Point".to_string(),
coordinates: [lng, lat],
}
}
-fn sample_polygon(lat: f64, lng: f64) -> RadrootsGeoJsonPolygon {
- RadrootsGeoJsonPolygon {
+fn sample_polygon(lat: f64, lng: f64) -> GeoJsonPolygon {
+ GeoJsonPolygon {
r#type: "Polygon".to_string(),
coordinates: vec![vec![
[lng, lat],
@@ -948,8 +946,8 @@ fn sample_polygon(lat: f64, lng: f64) -> RadrootsGeoJsonPolygon {
}
}
-fn sample_gcs(lat: f64, lng: f64, geohash: &str) -> RadrootsGcsLocation {
- RadrootsGcsLocation {
+fn sample_gcs(lat: f64, lng: f64, geohash: &str) -> GcsLocation {
+ GcsLocation {
lat,
lng,
geohash: geohash.to_string(),
@@ -976,9 +974,9 @@ fn profile_event(
id: u64,
author: &str,
created_at: u32,
- profile_type: Option<RadrootsProfileType>,
+ profile_type: Option<ProfileType>,
name: &str,
-) -> RadrootsEventEnvelope {
+) -> EventEnvelope {
let profile = serde_json::json!({
"name": name,
"display_name": format!("{name}_display"),
@@ -1013,10 +1011,10 @@ fn farm_event(
created_at: u32,
d_tag: &str,
name: &str,
- location: Option<RadrootsFarmPublicLocation>,
+ location: Option<FarmPublicLocation>,
tags: Option<Vec<String>>,
-) -> RadrootsEventEnvelope {
- let farm = RadrootsFarm {
+) -> EventEnvelope {
+ let farm = Farm {
d_tag: d_tag.to_string(),
name: name.to_string(),
about: Some(format!("{name} about")),
@@ -1043,12 +1041,12 @@ fn plot_event(
author: &str,
created_at: u32,
d_tag: &str,
- farm_ref: RadrootsFarmRef,
+ farm_ref: FarmRef,
name: &str,
- location: Option<RadrootsPlotLocation>,
+ location: Option<PlotLocation>,
tags: Option<Vec<String>>,
-) -> RadrootsEventEnvelope {
- let plot = RadrootsPlot {
+) -> EventEnvelope {
+ let plot = Plot {
d_tag: d_tag.to_string(),
farm: farm_ref,
name: name.to_string(),
@@ -1072,8 +1070,8 @@ fn list_set_event(
author: &str,
created_at: u32,
kind: u32,
- list_set: &RadrootsListSet,
-) -> RadrootsEventEnvelope {
+ list_set: &ListSet,
+) -> EventEnvelope {
let parts = list_set_encode::to_wire_parts_with_kind(list_set, kind).expect("list set parts");
event_with_parts(id, author, created_at, kind, parts.content, parts.tags)
}
@@ -1088,7 +1086,7 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
101,
&profile_pubkey,
10,
- Some(RadrootsProfileType::Individual),
+ Some(ProfileType::Individual),
"alice",
);
assert_eq!(
@@ -1103,7 +1101,7 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
102,
&profile_pubkey,
9,
- Some(RadrootsProfileType::Individual),
+ Some(ProfileType::Individual),
"alice-older",
);
assert_eq!(
@@ -1114,7 +1112,7 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
103,
&profile_pubkey,
10,
- Some(RadrootsProfileType::Individual),
+ Some(ProfileType::Individual),
"alice-updated",
);
assert_eq!(
@@ -1126,7 +1124,7 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
100,
&profile_pubkey,
10,
- Some(RadrootsProfileType::Individual),
+ Some(ProfileType::Individual),
"alice-lower-id",
);
assert_eq!(
@@ -1140,14 +1138,10 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
assert!(err.to_string().contains("profile_type required"));
let profile_types = [
- (RadrootsProfileType::Farm, "f".repeat(64), "farm-profile"),
- (RadrootsProfileType::Coop, "c".repeat(64), "coop-profile"),
- (RadrootsProfileType::Any, "a".repeat(64), "any-profile"),
- (
- RadrootsProfileType::Radrootsd,
- "d".repeat(64),
- "radrootsd-profile",
- ),
+ (ProfileType::Farm, "f".repeat(64), "farm-profile"),
+ (ProfileType::Coop, "c".repeat(64), "coop-profile"),
+ (ProfileType::Any, "a".repeat(64), "any-profile"),
+ (ProfileType::Radrootsd, "d".repeat(64), "radrootsd-profile"),
];
for (index, (profile_type, pubkey, name)) in profile_types.iter().enumerate() {
let event = profile_event(
@@ -1165,7 +1159,7 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
let farm_pubkey = "e".repeat(64);
let farm_d_tag = "AAAAAAAAAAAAAAAAAAAAAA";
- let farm_location = RadrootsFarmPublicLocation {
+ let farm_location = FarmPublicLocation {
primary: "farm-primary".to_string(),
city: Some("city".to_string()),
region: Some("region".to_string()),
@@ -1284,7 +1278,7 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
assert_eq!(farm_tags[0].tag, "market");
let plot_d_tag = "AAAAAAAAAAAAAAAAAAAAAQ";
- let plot_location = RadrootsPlotLocation {
+ let plot_location = PlotLocation {
primary: Some("plot-primary".to_string()),
city: Some("plot-city".to_string()),
region: Some("plot-region".to_string()),
@@ -1296,7 +1290,7 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
&farm_pubkey,
200,
plot_d_tag,
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_d_tag.to_string(),
},
@@ -1322,7 +1316,7 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
&farm_pubkey,
199,
plot_d_tag,
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_d_tag.to_string(),
},
@@ -1339,7 +1333,7 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
&farm_pubkey,
200,
plot_d_tag,
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_d_tag.to_string(),
},
@@ -1357,7 +1351,7 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
&farm_pubkey,
200,
plot_d_tag,
- RadrootsFarmRef {
+ FarmRef {
pubkey: farm_pubkey.clone(),
d_tag: farm_d_tag.to_string(),
},
@@ -1375,7 +1369,7 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
&farm_pubkey,
201,
"AAAAAAAAAAAAAAAAAAAAAg",
- RadrootsFarmRef {
+ FarmRef {
pubkey: "3".repeat(64),
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
},
@@ -1416,10 +1410,10 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
assert_eq!(plot_tags.len(), 1);
assert_eq!(plot_tags[0].tag, "updated");
- let non_generic_list_set = RadrootsListSet {
+ let non_generic_list_set = ListSet {
d_tag: "member_of.farms".to_string(),
content: String::new(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "p".to_string(),
values: vec![farm_pubkey.clone()],
}],
@@ -1439,10 +1433,10 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
RadrootsReplicaIngestOutcome::Skipped
);
- let metadata_list_set = RadrootsListSet {
+ let metadata_list_set = ListSet {
d_tag: "member_of.farms".to_string(),
content: String::new(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "p".to_string(),
values: vec![farm_pubkey.clone()],
}],
@@ -1461,10 +1455,10 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
.expect_err("metadata must be rejected");
assert!(metadata_err.to_string().contains("must omit metadata"));
- let description_list_set = RadrootsListSet {
+ let description_list_set = ListSet {
d_tag: "member_of.farms".to_string(),
content: String::new(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "p".to_string(),
values: vec![farm_pubkey.clone()],
}],
@@ -1483,10 +1477,10 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
.expect_err("description metadata must be rejected");
assert!(description_err.to_string().contains("must omit metadata"));
- let image_list_set = RadrootsListSet {
+ let image_list_set = ListSet {
d_tag: "member_of.farms".to_string(),
content: String::new(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "p".to_string(),
values: vec![farm_pubkey.clone()],
}],
@@ -1505,10 +1499,10 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
.expect_err("image metadata must be rejected");
assert!(image_err.to_string().contains("must omit metadata"));
- let content_list_set = RadrootsListSet {
+ let content_list_set = ListSet {
d_tag: "member_of.farms".to_string(),
content: "not-empty".to_string(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "p".to_string(),
values: vec![farm_pubkey.clone()],
}],
@@ -1527,10 +1521,10 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
radroots_replica_ingest_event(&exec, &content_event).expect_err("content must be rejected");
assert!(content_err.to_string().contains("must not include content"));
- let invalid_member_of = RadrootsListSet {
+ let invalid_member_of = ListSet {
d_tag: "member_of.farms".to_string(),
content: String::new(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "a".to_string(),
values: vec![farm_pubkey.clone()],
}],
@@ -1553,15 +1547,15 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
.contains("must only include p tags")
);
- let member_of_valid = RadrootsListSet {
+ let member_of_valid = ListSet {
d_tag: "member_of.farms".to_string(),
content: String::new(),
entries: vec![
- RadrootsListEntry {
+ ListEntry {
tag: "p".to_string(),
values: vec![farm_pubkey.clone()],
},
- RadrootsListEntry {
+ ListEntry {
tag: "p".to_string(),
values: vec![farm_pubkey.clone()],
},
@@ -1624,10 +1618,10 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
assert_eq!(claims.len(), 1);
assert_eq!(claims[0].farm_pubkey, farm_pubkey);
- let invalid_members = RadrootsListSet {
+ let invalid_members = ListSet {
d_tag: format!("farm:{farm_d_tag}:members"),
content: String::new(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "a".to_string(),
values: vec!["x".to_string()],
}],
@@ -1723,10 +1717,10 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
.results;
assert_eq!(members.len(), 3);
- let invalid_plots = RadrootsListSet {
+ let invalid_plots = ListSet {
d_tag: format!("farm:{farm_d_tag}:plots"),
content: String::new(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "p".to_string(),
values: vec!["x".to_string()],
}],
@@ -1750,10 +1744,10 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
);
let plot_address = plot_encode::plot_address(&farm_pubkey, plot_d_tag).expect("plot address");
- let plots_valid = RadrootsListSet {
+ let plots_valid = ListSet {
d_tag: format!("farm:{farm_d_tag}:plots"),
content: String::new(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "a".to_string(),
values: vec![plot_address],
}],
@@ -1767,10 +1761,10 @@ fn ingest_event_paths_cover_profile_farm_plot_and_list_set_variants() {
RadrootsReplicaIngestOutcome::Applied
);
- let unsupported_list_set = RadrootsListSet {
+ let unsupported_list_set = ListSet {
d_tag: "unsupported.list".to_string(),
content: String::new(),
- entries: vec![RadrootsListEntry {
+ entries: vec![ListEntry {
tag: "p".to_string(),
values: vec![farm_pubkey.clone()],
}],
diff --git a/crates/runtime/src/transport.rs b/crates/runtime/src/transport.rs
@@ -3,7 +3,7 @@ use std::future::Future;
use std::pin::Pin;
use std::sync::Arc;
-use radroots_event::{draft::RadrootsSignedEvent, wire::RadrootsNip01EventWire};
+use radroots_event::{draft::SignedEvent, wire::Nip01EventWire};
#[cfg(feature = "transport-workers")]
use radroots_transport::RadrootsTransportTargetReceipt;
use radroots_transport::{
@@ -56,17 +56,17 @@ impl From<RadrootsTransportError> for RadrootsRuntimeTransportError {
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum RadrootsRuntimeTransportPayload {
- SignedEvent(Box<RadrootsSignedEvent>),
+ SignedEvent(Box<SignedEvent>),
OpaqueBytes { label: String, bytes: Vec<u8> },
}
impl RadrootsRuntimeTransportPayload {
- pub fn signed_event(event: RadrootsSignedEvent) -> Self {
+ pub fn signed_event(event: SignedEvent) -> Self {
Self::SignedEvent(Box::new(event))
}
pub fn verified_signed_event_json(
- event: &RadrootsSignedEvent,
+ event: &SignedEvent,
) -> Result<RadrootsTransportPayload, RadrootsTransportError> {
verify_signed_event_raw_json_matches_event(event)?;
RadrootsTransportPayload::unchecked_signed_event_json(event.id_str(), event.raw_json())
@@ -83,9 +83,9 @@ impl RadrootsRuntimeTransportPayload {
}
fn verify_signed_event_raw_json_matches_event(
- event: &RadrootsSignedEvent,
+ event: &SignedEvent,
) -> Result<(), RadrootsTransportError> {
- let wire = RadrootsNip01EventWire::parse_json(event.raw_json())
+ let wire = Nip01EventWire::parse_json(event.raw_json())
.map_err(|_| RadrootsTransportError::InvalidPayloadBytes)?;
if wire.id.as_str() != event.id_str() {
return Err(RadrootsTransportError::InvalidPayloadId);
@@ -594,7 +594,7 @@ pub struct RadrootsRuntimeInboundObservation {
#[cfg(feature = "transport-workers")]
impl RadrootsRuntimeInboundObservation {
pub fn verified_signed_event(
- event: &RadrootsSignedEvent,
+ event: &SignedEvent,
transport_kind: RadrootsTransportKind,
endpoint_uri: impl Into<String>,
observed_at_ms: i64,
@@ -610,7 +610,7 @@ impl RadrootsRuntimeInboundObservation {
pub fn require_verified_for_signed_event(
&self,
- event: &RadrootsSignedEvent,
+ event: &SignedEvent,
) -> Result<(), RadrootsRuntimeTransportError> {
if !self.verified {
return Err(
@@ -635,7 +635,7 @@ impl RadrootsRuntimeInboundObservation {
pub trait RadrootsRuntimeInboundObservationSink: Send + Sync {
fn record_verified_observation<'a>(
&'a self,
- event: RadrootsSignedEvent,
+ event: SignedEvent,
observation: RadrootsRuntimeInboundObservation,
) -> RadrootsRuntimeTransportFuture<'a, ()>;
}
@@ -643,7 +643,7 @@ pub trait RadrootsRuntimeInboundObservationSink: Send + Sync {
#[cfg(feature = "transport-workers")]
pub fn record_verified_inbound_observation<'a, S>(
sink: &'a S,
- event: RadrootsSignedEvent,
+ event: SignedEvent,
observation: RadrootsRuntimeInboundObservation,
) -> RadrootsRuntimeTransportFuture<'a, ()>
where
@@ -671,7 +671,7 @@ mod tests {
RadrootsRuntimeLeaseRecord, record_verified_inbound_observation, recover_expired_leases,
};
#[cfg(feature = "transport-workers")]
- use radroots_event::{draft::RadrootsSignedEvent, wire::RadrootsNip01EventWire};
+ use radroots_event::{draft::SignedEvent, wire::Nip01EventWire};
use radroots_transport::{
RadrootsTransport, RadrootsTransportCapabilities, RadrootsTransportCapabilityAvailability,
RadrootsTransportCapabilityMaturity, RadrootsTransportDeliveryReceipt,
@@ -885,10 +885,10 @@ mod tests {
}
#[cfg(feature = "transport-workers")]
- fn signed_event() -> RadrootsSignedEvent {
+ fn signed_event() -> SignedEvent {
let pubkey = "e".repeat(64);
let sig = "f".repeat(128);
- let mut wire = RadrootsNip01EventWire {
+ let mut wire = Nip01EventWire {
id: String::new(),
pubkey: pubkey.clone(),
created_at: 10,
@@ -906,7 +906,7 @@ mod tests {
"{{\"id\":\"{id}\",\"pubkey\":\"{pubkey}\",\"created_at\":10,\"kind\":1,\"tags\":[],\"content\":\"hello\",\"sig\":\"{sig}\"}}",
id = wire.id.as_str()
);
- RadrootsSignedEvent::from_wire_verified_id(wire, raw_json).expect("signed event")
+ SignedEvent::from_wire_verified_id(wire, raw_json).expect("signed event")
}
#[cfg(feature = "transport-workers")]
@@ -939,7 +939,7 @@ mod tests {
impl RadrootsRuntimeInboundObservationSink for RecordingInboundSink {
fn record_verified_observation<'a>(
&'a self,
- event: RadrootsSignedEvent,
+ event: SignedEvent,
observation: RadrootsRuntimeInboundObservation,
) -> RadrootsRuntimeTransportFuture<'a, ()> {
Box::pin(async move {
diff --git a/crates/test_fixtures/src/knowledge.rs b/crates/test_fixtures/src/knowledge.rs
@@ -5,20 +5,19 @@ use radroots_event::envelope::kind::{
KIND_WIKI_MERGE_REQUEST, KIND_WIKI_REDIRECT,
};
use radroots_event::knowledge::{
+ AddressableRef, ContributionAttestation, EvidenceBounty, KnowledgeChangeProposal,
+ KnowledgeCitationSpan, KnowledgeClaim, KnowledgeFieldContext, KnowledgeFieldReport,
+ KnowledgeLocation, KnowledgeLocationPrecision, KnowledgeNodeRef, KnowledgeObservation,
+ KnowledgeObservationValue, KnowledgeRelation, KnowledgeReview, KnowledgeReviewScope,
+ KnowledgeReviewScore, KnowledgeReviewTarget, KnowledgeSource,
RADROOTS_CONTRIBUTION_ATTESTATION_SCHEMA, RADROOTS_EVIDENCE_BOUNTY_SCHEMA,
RADROOTS_KNOWLEDGE_CHANGE_PROPOSAL_SCHEMA, RADROOTS_KNOWLEDGE_CLAIM_SCHEMA,
RADROOTS_KNOWLEDGE_FIELD_REPORT_SCHEMA, RADROOTS_KNOWLEDGE_RELATION_SCHEMA,
RADROOTS_KNOWLEDGE_REVIEW_SCHEMA, RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
- RADROOTS_KNOWLEDGE_SOURCE_SCHEMA, RadrootsAddressableRef, RadrootsContributionAttestation,
- RadrootsEvidenceBounty, RadrootsKnowledgeChangeProposal, RadrootsKnowledgeCitationSpan,
- RadrootsKnowledgeClaim, RadrootsKnowledgeFieldContext, RadrootsKnowledgeFieldReport,
- RadrootsKnowledgeLocation, RadrootsKnowledgeLocationPrecision, RadrootsKnowledgeNodeRef,
- RadrootsKnowledgeObservation, RadrootsKnowledgeObservationValue, RadrootsKnowledgeRelation,
- RadrootsKnowledgeReview, RadrootsKnowledgeReviewScope, RadrootsKnowledgeReviewScore,
- RadrootsKnowledgeReviewTarget, RadrootsKnowledgeSource, RadrootsWikiArticle,
- RadrootsWikiArticleVersionRef, RadrootsWikiMergeRequest, RadrootsWikiRedirect,
+ RADROOTS_KNOWLEDGE_SOURCE_SCHEMA, WikiArticle, WikiArticleVersionRef, WikiMergeRequest,
+ WikiRedirect,
};
-use radroots_event::tag::RadrootsEventRef;
+use radroots_event::tag::EventRef;
use radroots_identity::PublicKey;
use crate::{FIXTURE_ALICE_PUBLIC_KEY_HEX, RELAY_PRIMARY_WSS};
@@ -116,17 +115,17 @@ pub const RADROOTS_KNOWLEDGE_ADVERSARIAL_FIXTURES: [RadrootsKnowledgeAdversarial
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum RadrootsKnowledgeFixture {
- WikiArticle(RadrootsWikiArticle),
- WikiRedirect(RadrootsWikiRedirect),
- WikiMergeRequest(RadrootsWikiMergeRequest),
- KnowledgeSource(RadrootsKnowledgeSource),
- KnowledgeClaim(RadrootsKnowledgeClaim),
- KnowledgeRelation(RadrootsKnowledgeRelation),
- KnowledgeReview(RadrootsKnowledgeReview),
- KnowledgeFieldReport(RadrootsKnowledgeFieldReport),
- EvidenceBounty(RadrootsEvidenceBounty),
- KnowledgeChangeProposal(RadrootsKnowledgeChangeProposal),
- ContributionAttestation(RadrootsContributionAttestation),
+ WikiArticle(WikiArticle),
+ WikiRedirect(WikiRedirect),
+ WikiMergeRequest(WikiMergeRequest),
+ KnowledgeSource(KnowledgeSource),
+ KnowledgeClaim(KnowledgeClaim),
+ KnowledgeRelation(KnowledgeRelation),
+ KnowledgeReview(KnowledgeReview),
+ KnowledgeFieldReport(KnowledgeFieldReport),
+ EvidenceBounty(EvidenceBounty),
+ KnowledgeChangeProposal(KnowledgeChangeProposal),
+ ContributionAttestation(ContributionAttestation),
}
#[derive(Clone, Debug, PartialEq, Eq)]
@@ -141,8 +140,8 @@ pub fn hex_64(character: char) -> String {
core::iter::repeat_n(character, 64).collect()
}
-pub fn event_ref(character: char, kind: u32) -> RadrootsEventRef {
- RadrootsEventRef {
+pub fn event_ref(character: char, kind: u32) -> EventRef {
+ EventRef {
id: hex_64(character),
author: PublicKey::from_hex(FIXTURE_ALICE_PUBLIC_KEY_HEX)
.expect("fixture public key is valid"),
@@ -152,8 +151,8 @@ pub fn event_ref(character: char, kind: u32) -> RadrootsEventRef {
}
}
-pub fn address_ref() -> RadrootsAddressableRef {
- RadrootsAddressableRef {
+pub fn address_ref() -> AddressableRef {
+ AddressableRef {
kind: KIND_WIKI_ARTICLE,
pubkey: hex_64('a'),
d_tag: "soil-health".to_string(),
@@ -161,8 +160,8 @@ pub fn address_ref() -> RadrootsAddressableRef {
}
}
-pub fn deferred_address_ref() -> RadrootsAddressableRef {
- RadrootsAddressableRef {
+pub fn deferred_address_ref() -> AddressableRef {
+ AddressableRef {
kind: KIND_WIKI_ARTICLE,
pubkey: hex_64('a'),
d_tag: "soil-health-v2".to_string(),
@@ -170,22 +169,22 @@ pub fn deferred_address_ref() -> RadrootsAddressableRef {
}
}
-pub fn wiki_article_version_ref() -> RadrootsWikiArticleVersionRef {
- RadrootsWikiArticleVersionRef {
+pub fn wiki_article_version_ref() -> WikiArticleVersionRef {
+ WikiArticleVersionRef {
event_id: hex_64('b'),
address_ref: address_ref(),
}
}
-pub fn wiki_article_deferred_version_ref() -> RadrootsWikiArticleVersionRef {
- RadrootsWikiArticleVersionRef {
+pub fn wiki_article_deferred_version_ref() -> WikiArticleVersionRef {
+ WikiArticleVersionRef {
event_id: hex_64('c'),
address_ref: deferred_address_ref(),
}
}
-pub fn wiki_article() -> RadrootsWikiArticle {
- RadrootsWikiArticle {
+pub fn wiki_article() -> WikiArticle {
+ WikiArticle {
d_tag: "soil-health".to_string(),
title: Some("Soil health".to_string()),
content_djot: "# Soil health\n\nLiving soil supports resilient local food systems."
@@ -198,15 +197,15 @@ pub fn wiki_article() -> RadrootsWikiArticle {
}
}
-pub fn wiki_redirect() -> RadrootsWikiRedirect {
- RadrootsWikiRedirect {
+pub fn wiki_redirect() -> WikiRedirect {
+ WikiRedirect {
d_tag: "soil".to_string(),
target: address_ref(),
}
}
-pub fn wiki_merge_request() -> RadrootsWikiMergeRequest {
- RadrootsWikiMergeRequest {
+pub fn wiki_merge_request() -> WikiMergeRequest {
+ WikiMergeRequest {
target_article: address_ref(),
destination_pubkey: hex_64('a'),
base_version_event_id: Some(hex_64('e')),
@@ -215,15 +214,15 @@ pub fn wiki_merge_request() -> RadrootsWikiMergeRequest {
}
}
-pub fn wiki_merge_request_without_base_version() -> RadrootsWikiMergeRequest {
- RadrootsWikiMergeRequest {
+pub fn wiki_merge_request_without_base_version() -> WikiMergeRequest {
+ WikiMergeRequest {
base_version_event_id: None,
..wiki_merge_request()
}
}
-pub fn knowledge_source() -> RadrootsKnowledgeSource {
- RadrootsKnowledgeSource {
+pub fn knowledge_source() -> KnowledgeSource {
+ KnowledgeSource {
schema: RADROOTS_KNOWLEDGE_SOURCE_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
d_tag: "soil-source".to_string(),
@@ -241,13 +240,13 @@ pub fn knowledge_source() -> RadrootsKnowledgeSource {
}
}
-pub fn knowledge_claim() -> RadrootsKnowledgeClaim {
- RadrootsKnowledgeClaim {
+pub fn knowledge_claim() -> KnowledgeClaim {
+ KnowledgeClaim {
schema: RADROOTS_KNOWLEDGE_CLAIM_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
claim_type: "practice_effect".to_string(),
text: "Cover crops improve soil structure.".to_string(),
- citation_spans: vec![RadrootsKnowledgeCitationSpan {
+ citation_spans: vec![KnowledgeCitationSpan {
source_ref: event_ref('4', KIND_KNOWLEDGE_SOURCE),
artifact_ref: None,
page_start: Some(12),
@@ -263,8 +262,8 @@ pub fn knowledge_claim() -> RadrootsKnowledgeClaim {
}
}
-pub fn knowledge_node_ref(label: &str) -> RadrootsKnowledgeNodeRef {
- RadrootsKnowledgeNodeRef {
+pub fn knowledge_node_ref(label: &str) -> KnowledgeNodeRef {
+ KnowledgeNodeRef {
node_type: "event".to_string(),
event_ref: Some(event_ref('6', KIND_KNOWLEDGE_CLAIM)),
address_ref: None,
@@ -273,8 +272,8 @@ pub fn knowledge_node_ref(label: &str) -> RadrootsKnowledgeNodeRef {
}
}
-pub fn knowledge_relation() -> RadrootsKnowledgeRelation {
- RadrootsKnowledgeRelation {
+pub fn knowledge_relation() -> KnowledgeRelation {
+ KnowledgeRelation {
schema: RADROOTS_KNOWLEDGE_RELATION_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
subject: knowledge_node_ref("cover crops"),
@@ -286,21 +285,21 @@ pub fn knowledge_relation() -> RadrootsKnowledgeRelation {
}
}
-pub fn knowledge_review() -> RadrootsKnowledgeReview {
- RadrootsKnowledgeReview {
+pub fn knowledge_review() -> KnowledgeReview {
+ KnowledgeReview {
schema: RADROOTS_KNOWLEDGE_REVIEW_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
- target: RadrootsKnowledgeReviewTarget {
+ target: KnowledgeReviewTarget {
event_id: hex_64('8'),
author_pubkey: hex_64('a'),
kind: KIND_KNOWLEDGE_CLAIM,
address: None,
relays: vec![RELAY_PRIMARY_WSS.to_string()],
- review_scope: RadrootsKnowledgeReviewScope::SpecificVersion,
+ review_scope: KnowledgeReviewScope::SpecificVersion,
},
reviewer_role: "peer".to_string(),
verdict: "needs_more_evidence".to_string(),
- scores: vec![RadrootsKnowledgeReviewScore {
+ scores: vec![KnowledgeReviewScore {
dimension: "evidence".to_string(),
value: "partial".to_string(),
note: None,
@@ -310,16 +309,16 @@ pub fn knowledge_review() -> RadrootsKnowledgeReview {
}
}
-pub fn knowledge_field_report() -> RadrootsKnowledgeFieldReport {
- RadrootsKnowledgeFieldReport {
+pub fn knowledge_field_report() -> KnowledgeFieldReport {
+ KnowledgeFieldReport {
schema: RADROOTS_KNOWLEDGE_FIELD_REPORT_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
report_type: "observation".to_string(),
title: "Field observation".to_string(),
summary: Some("Observed cover crop residue.".to_string()),
- context: RadrootsKnowledgeFieldContext {
- location_precision: RadrootsKnowledgeLocationPrecision::CoarseGeohash,
- public_location: Some(RadrootsKnowledgeLocation {
+ context: KnowledgeFieldContext {
+ location_precision: KnowledgeLocationPrecision::CoarseGeohash,
+ public_location: Some(KnowledgeLocation {
label: Some("watershed".to_string()),
region: Some("synthetic-region".to_string()),
locality: None,
@@ -329,11 +328,11 @@ pub fn knowledge_field_report() -> RadrootsKnowledgeFieldReport {
topics: vec!["field".to_string()],
context_tags: vec!["observation".to_string()],
},
- observations: vec![RadrootsKnowledgeObservation {
+ observations: vec![KnowledgeObservation {
observation_type: "residue".to_string(),
text: "Residue was visible across beds.".to_string(),
observed_at: Some("2026-07-05".to_string()),
- values: vec![RadrootsKnowledgeObservationValue {
+ values: vec![KnowledgeObservationValue {
key: "coverage".to_string(),
value: "medium".to_string(),
unit: None,
@@ -345,8 +344,8 @@ pub fn knowledge_field_report() -> RadrootsKnowledgeFieldReport {
}
}
-pub fn evidence_bounty() -> RadrootsEvidenceBounty {
- RadrootsEvidenceBounty {
+pub fn evidence_bounty() -> EvidenceBounty {
+ EvidenceBounty {
schema: RADROOTS_EVIDENCE_BOUNTY_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
d_tag: "soil-bounty".to_string(),
@@ -359,8 +358,8 @@ pub fn evidence_bounty() -> RadrootsEvidenceBounty {
}
}
-pub fn knowledge_change_proposal() -> RadrootsKnowledgeChangeProposal {
- RadrootsKnowledgeChangeProposal {
+pub fn knowledge_change_proposal() -> KnowledgeChangeProposal {
+ KnowledgeChangeProposal {
schema: RADROOTS_KNOWLEDGE_CHANGE_PROPOSAL_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
target: event_ref('b', KIND_KNOWLEDGE_CLAIM),
@@ -372,8 +371,8 @@ pub fn knowledge_change_proposal() -> RadrootsKnowledgeChangeProposal {
}
}
-pub fn contribution_attestation() -> RadrootsContributionAttestation {
- RadrootsContributionAttestation {
+pub fn contribution_attestation() -> ContributionAttestation {
+ ContributionAttestation {
schema: RADROOTS_CONTRIBUTION_ATTESTATION_SCHEMA.to_string(),
schema_version: RADROOTS_KNOWLEDGE_SCHEMA_VERSION,
contributor_pubkey: hex_64('a'),
diff --git a/crates/trade/src/dto.rs b/crates/trade/src/dto.rs
@@ -117,28 +117,28 @@ impl Dto for RadrootsOperationalListingTradeProjection {
.with_field(field(
"availability",
"availability",
- ts_ref("RadrootsOperationalListingAvailability"),
+ ts_ref("OperationalListingAvailability"),
"crates/trade/src/operational_listing/validation.rs",
37,
))
.with_field(field(
"location",
"location",
- ts_ref("RadrootsOperationalListingPublicLocation"),
+ ts_ref("OperationalListingPublicLocation"),
"crates/trade/src/operational_listing/validation.rs",
38,
))
.with_field(field(
"delivery_method",
"delivery_method",
- ts_ref("RadrootsOperationalListingDeliveryMethod"),
+ ts_ref("OperationalListingDeliveryMethod"),
"crates/trade/src/operational_listing/validation.rs",
39,
))
.with_field(field(
"listing",
"listing",
- ts_ref("RadrootsOperationalListing"),
+ ts_ref("OperationalListing"),
"crates/trade/src/operational_listing/validation.rs",
40,
));
@@ -289,7 +289,7 @@ mod tests {
);
assert_eq!(
typescript_override_target(field_ty(listing, "listing")),
- Some("RadrootsOperationalListing")
+ Some("OperationalListing")
);
assert_eq!(
typescript_override_target(field_ty(subtotal, "price_currency")),
diff --git a/crates/trade/src/identity.rs b/crates/trade/src/identity.rs
@@ -2,9 +2,7 @@
use core::str::FromStr;
-use radroots_event::id::{
- RadrootsClassifiedListingAddress, RadrootsEventId, RadrootsIdParseError, RadrootsOrderId,
-};
+use radroots_event::id::{ClassifiedListingAddress, EventId, OrderId, ParseError};
use radroots_identity::PublicKey;
#[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))]
@@ -12,18 +10,18 @@ use radroots_identity::PublicKey;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(transparent))]
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct RadrootsTradeId(RadrootsOrderId);
+pub struct TradeId(OrderId);
-impl RadrootsTradeId {
- pub fn parse(value: impl AsRef<str>) -> Result<Self, RadrootsIdParseError> {
- RadrootsOrderId::parse(value).map(Self)
+impl TradeId {
+ pub fn parse(value: impl AsRef<str>) -> Result<Self, ParseError> {
+ OrderId::parse(value).map(Self)
}
- pub fn as_order_id(&self) -> &RadrootsOrderId {
+ pub fn as_order_id(&self) -> &OrderId {
&self.0
}
- pub fn into_order_id(self) -> RadrootsOrderId {
+ pub fn into_order_id(self) -> OrderId {
self.0
}
@@ -32,26 +30,26 @@ impl RadrootsTradeId {
}
}
-impl From<RadrootsOrderId> for RadrootsTradeId {
- fn from(order_id: RadrootsOrderId) -> Self {
+impl From<OrderId> for TradeId {
+ fn from(order_id: OrderId) -> Self {
Self(order_id)
}
}
-impl From<RadrootsTradeId> for RadrootsOrderId {
- fn from(trade_id: RadrootsTradeId) -> Self {
+impl From<TradeId> for OrderId {
+ fn from(trade_id: TradeId) -> Self {
trade_id.into_order_id()
}
}
-impl AsRef<str> for RadrootsTradeId {
+impl AsRef<str> for TradeId {
fn as_ref(&self) -> &str {
self.as_str()
}
}
-impl FromStr for RadrootsTradeId {
- type Err = RadrootsIdParseError;
+impl FromStr for TradeId {
+ type Err = ParseError;
fn from_str(value: &str) -> Result<Self, Self::Err> {
Self::parse(value)
@@ -63,11 +61,11 @@ impl FromStr for RadrootsTradeId {
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsTradeLocator {
- pub trade_id: RadrootsTradeId,
+ pub trade_id: TradeId,
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- pub root_event_id: Option<RadrootsEventId>,
+ pub root_event_id: Option<EventId>,
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- pub listing_addr: Option<RadrootsClassifiedListingAddress>,
+ pub listing_addr: Option<ClassifiedListingAddress>,
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
pub buyer_pubkey: Option<PublicKey>,
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
@@ -75,7 +73,7 @@ pub struct RadrootsTradeLocator {
}
impl RadrootsTradeLocator {
- pub fn new(trade_id: impl Into<RadrootsTradeId>) -> Self {
+ pub fn new(trade_id: impl Into<TradeId>) -> Self {
Self {
trade_id: trade_id.into(),
root_event_id: None,
@@ -85,20 +83,20 @@ impl RadrootsTradeLocator {
}
}
- pub fn from_order_id(order_id: RadrootsOrderId) -> Self {
+ pub fn from_order_id(order_id: OrderId) -> Self {
Self::new(order_id)
}
- pub fn order_id(&self) -> &RadrootsOrderId {
+ pub fn order_id(&self) -> &OrderId {
self.trade_id.as_order_id()
}
- pub fn with_root_event_id(mut self, root_event_id: RadrootsEventId) -> Self {
+ pub fn with_root_event_id(mut self, root_event_id: EventId) -> Self {
self.root_event_id = Some(root_event_id);
self
}
- pub fn with_listing_addr(mut self, listing_addr: RadrootsClassifiedListingAddress) -> Self {
+ pub fn with_listing_addr(mut self, listing_addr: ClassifiedListingAddress) -> Self {
self.listing_addr = Some(listing_addr);
self
}
@@ -119,11 +117,11 @@ impl RadrootsTradeLocator {
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsTradeLocatorCandidate {
- pub trade_id: RadrootsTradeId,
+ pub trade_id: TradeId,
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- pub root_event_id: RadrootsEventId,
+ pub root_event_id: EventId,
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- pub listing_addr: RadrootsClassifiedListingAddress,
+ pub listing_addr: ClassifiedListingAddress,
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
pub buyer_pubkey: PublicKey,
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
@@ -151,20 +149,20 @@ mod tests {
const BUYER: &str = FIXTURE_BOB_PUBLIC_KEY_HEX;
const SELLER: &str = FIXTURE_ALICE_PUBLIC_KEY_HEX;
- fn event_id(raw: u8) -> RadrootsEventId {
- RadrootsEventId::parse(format!("{raw:064x}")).expect("event id")
+ fn event_id(raw: u8) -> EventId {
+ EventId::parse(format!("{raw:064x}")).expect("event id")
}
- fn order_id() -> RadrootsOrderId {
- RadrootsOrderId::parse("order-1").expect("order id")
+ fn order_id() -> OrderId {
+ OrderId::parse("order-1").expect("order id")
}
fn public_key(raw: &str) -> PublicKey {
PublicKey::from_hex(raw).expect("public key")
}
- fn listing_addr() -> RadrootsClassifiedListingAddress {
- RadrootsClassifiedListingAddress::parse(format!(
+ fn listing_addr() -> ClassifiedListingAddress {
+ ClassifiedListingAddress::parse(format!(
"{KIND_CLASSIFIED_LISTING}:{SELLER}:AAAAAAAAAAAAAAAAAAAAAg"
))
.expect("listing address")
@@ -173,15 +171,15 @@ mod tests {
#[test]
fn trade_id_and_locator_accessors_cover_public_surface() {
let order_id = order_id();
- let trade_id = RadrootsTradeId::parse(order_id.as_str()).expect("trade id");
+ let trade_id = TradeId::parse(order_id.as_str()).expect("trade id");
assert_eq!(trade_id.as_order_id(), &order_id);
assert_eq!(trade_id.as_str(), "order-1");
assert_eq!(trade_id.as_ref(), "order-1");
- assert_eq!(RadrootsTradeId::from_str("order-1").unwrap(), trade_id);
- assert!(RadrootsTradeId::parse(" ").is_err());
+ assert_eq!(TradeId::from_str("order-1").unwrap(), trade_id);
+ assert!(TradeId::parse(" ").is_err());
assert_eq!(
- RadrootsOrderId::from(trade_id.clone()),
+ OrderId::from(trade_id.clone()),
trade_id.clone().into_order_id()
);
diff --git a/crates/trade/src/operational_listing/draft.rs b/crates/trade/src/operational_listing/draft.rs
@@ -14,9 +14,9 @@ use radroots_authority::RadrootsActorContext;
use radroots_event::{
contract::AuthorRole,
envelope::kind::KIND_CLASSIFIED_LISTING,
- id::{RadrootsClassifiedListingAddress, RadrootsIdParseError, RadrootsInventoryBinId},
- listing::operational::RadrootsOperationalListing,
- trade::validation::RadrootsOperationalListingValidationError,
+ id::{ClassifiedListingAddress, InventoryBinId, ParseError},
+ listing::operational::OperationalListing,
+ trade::validation::OperationalListingValidationError,
};
use radroots_identity::{Error as PublicKeyError, PublicKey};
@@ -25,11 +25,11 @@ use super::validation::validate_operational_listing_model;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug)]
pub struct RadrootsOperationalListingEditDocumentV1 {
- pub listing: RadrootsOperationalListing,
+ pub listing: OperationalListing,
}
impl RadrootsOperationalListingEditDocumentV1 {
- pub fn new(listing: RadrootsOperationalListing) -> Self {
+ pub fn new(listing: OperationalListing) -> Self {
Self { listing }
}
}
@@ -37,14 +37,14 @@ impl RadrootsOperationalListingEditDocumentV1 {
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[derive(Clone, Debug)]
pub struct RadrootsOperationalListingCanonicalEdit {
- listing: RadrootsOperationalListing,
+ listing: OperationalListing,
seller_pubkey: PublicKey,
- public_listing_addr: RadrootsClassifiedListingAddress,
+ public_listing_addr: ClassifiedListingAddress,
}
impl RadrootsOperationalListingCanonicalEdit {
pub fn new(
- mut listing: RadrootsOperationalListing,
+ mut listing: OperationalListing,
seller_pubkey: PublicKey,
) -> Result<Self, RadrootsOperationalListingEditError> {
let farm_pubkey = PublicKey::from_hex(listing.farm.pubkey.as_str())
@@ -74,7 +74,7 @@ impl RadrootsOperationalListingCanonicalEdit {
})
}
- pub fn listing(&self) -> &RadrootsOperationalListing {
+ pub fn listing(&self) -> &OperationalListing {
&self.listing
}
@@ -82,7 +82,7 @@ impl RadrootsOperationalListingCanonicalEdit {
&self.seller_pubkey
}
- pub fn public_listing_addr(&self) -> &RadrootsClassifiedListingAddress {
+ pub fn public_listing_addr(&self) -> &ClassifiedListingAddress {
&self.public_listing_addr
}
}
@@ -90,8 +90,8 @@ impl RadrootsOperationalListingCanonicalEdit {
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum RadrootsOperationalListingEditError {
InvalidFarmPubkey(PublicKeyError),
- InvalidClassifiedListingAddress(RadrootsIdParseError),
- InvalidModel(RadrootsOperationalListingValidationError),
+ InvalidClassifiedListingAddress(ParseError),
+ InvalidModel(OperationalListingValidationError),
ActorRoleUnsatisfied {
required_role: AuthorRole,
},
@@ -100,10 +100,10 @@ pub enum RadrootsOperationalListingEditError {
actual_pubkey: PublicKey,
},
MissingPrimaryBin {
- primary_bin_id: RadrootsInventoryBinId,
+ primary_bin_id: InventoryBinId,
},
DuplicateBinId {
- bin_id: RadrootsInventoryBinId,
+ bin_id: InventoryBinId,
},
}
@@ -135,7 +135,7 @@ impl fmt::Display for RadrootsOperationalListingEditError {
impl core::error::Error for RadrootsOperationalListingEditError {}
fn validate_listing_bins(
- listing: &RadrootsOperationalListing,
+ listing: &OperationalListing,
) -> Result<(), RadrootsOperationalListingEditError> {
let primary_bin_id = listing.primary_bin_id.clone();
let mut seen_bin_ids = Vec::new();
@@ -161,12 +161,8 @@ fn validate_listing_bins(
Ok(())
}
-fn listing_addr(
- kind: u32,
- seller_pubkey: &PublicKey,
- d_tag: &str,
-) -> RadrootsClassifiedListingAddress {
- RadrootsClassifiedListingAddress::parse(format!("{kind}:{seller_pubkey}:{d_tag}"))
+fn listing_addr(kind: u32, seller_pubkey: &PublicKey, d_tag: &str) -> ClassifiedListingAddress {
+ ClassifiedListingAddress::parse(format!("{kind}:{seller_pubkey}:{d_tag}"))
.expect("typed listing identity must form a listing address")
}
@@ -196,15 +192,14 @@ mod tests {
use radroots_event::{
contract::AuthorRole,
envelope::kind::KIND_CLASSIFIED_LISTING,
- farm::RadrootsFarmRef,
- id::{RadrootsClassifiedListingAddress, RadrootsDTag, RadrootsInventoryBinId},
+ farm::FarmRef,
+ id::{ClassifiedListingAddress, DTag, InventoryBinId},
listing::operational::{
- RadrootsOperationalListing, RadrootsOperationalListingAvailability,
- RadrootsOperationalListingBin, RadrootsOperationalListingDeliveryMethod,
- RadrootsOperationalListingProduct, RadrootsOperationalListingPublicLocation,
- RadrootsOperationalListingStatus,
+ OperationalListing, OperationalListingAvailability, OperationalListingBin,
+ OperationalListingDeliveryMethod, OperationalListingProduct,
+ OperationalListingPublicLocation, OperationalListingStatus,
},
- trade::validation::RadrootsOperationalListingValidationError,
+ trade::validation::OperationalListingValidationError,
};
use radroots_identity::PublicKey;
use radroots_test_fixtures::{FIXTURE_ALICE_PUBLIC_KEY_HEX, FIXTURE_BOB_PUBLIC_KEY_HEX};
@@ -217,23 +212,23 @@ mod tests {
const SELLER: &str = FIXTURE_ALICE_PUBLIC_KEY_HEX;
const OTHER: &str = FIXTURE_BOB_PUBLIC_KEY_HEX;
- fn d_tag(raw: &str) -> RadrootsDTag {
- RadrootsDTag::parse(raw).expect("d tag")
+ fn d_tag(raw: &str) -> DTag {
+ DTag::parse(raw).expect("d tag")
}
- fn bin_id(raw: &str) -> RadrootsInventoryBinId {
- RadrootsInventoryBinId::parse(raw).expect("bin id")
+ fn bin_id(raw: &str) -> InventoryBinId {
+ InventoryBinId::parse(raw).expect("bin id")
}
- fn listing() -> RadrootsOperationalListing {
- RadrootsOperationalListing {
+ fn listing() -> OperationalListing {
+ OperationalListing {
d_tag: d_tag("AAAAAAAAAAAAAAAAAAAAAg"),
published_at: None,
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: SELLER.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
},
- product: RadrootsOperationalListingProduct {
+ product: OperationalListingProduct {
key: "coffee".to_string(),
title: "Coffee".to_string(),
category: "coffee".to_string(),
@@ -245,7 +240,7 @@ mod tests {
year: None,
},
primary_bin_id: bin_id("bin-1"),
- bins: vec![RadrootsOperationalListingBin {
+ bins: vec![OperationalListingBin {
bin_id: bin_id("bin-1"),
quantity: Quantity::try_new(Decimal::from(1000u32), Unit::MassG).unwrap(),
price_per_canonical_unit: QuantityPrice::try_new(
@@ -263,11 +258,11 @@ mod tests {
plot: None,
discounts: None,
inventory_available: Some(Decimal::from(5u32)),
- availability: Some(RadrootsOperationalListingAvailability::Status {
- status: RadrootsOperationalListingStatus::Active,
+ availability: Some(OperationalListingAvailability::Status {
+ status: OperationalListingStatus::Active,
}),
- delivery_method: Some(RadrootsOperationalListingDeliveryMethod::Pickup),
- location: Some(RadrootsOperationalListingPublicLocation {
+ delivery_method: Some(OperationalListingDeliveryMethod::Pickup),
+ location: Some(OperationalListingPublicLocation {
primary: "Victoria".to_string(),
city: Some("Victoria".to_string()),
region: Some("British Columbia".to_string()),
@@ -335,7 +330,7 @@ mod tests {
));
assert!(matches!(
RadrootsOperationalListingEditError::InvalidClassifiedListingAddress(
- RadrootsClassifiedListingAddress::parse("bad").unwrap_err()
+ ClassifiedListingAddress::parse("bad").unwrap_err()
),
RadrootsOperationalListingEditError::InvalidClassifiedListingAddress(_)
));
@@ -516,7 +511,7 @@ mod tests {
assert_eq!(
error,
RadrootsOperationalListingEditError::InvalidModel(
- RadrootsOperationalListingValidationError::MissingInventory
+ OperationalListingValidationError::MissingInventory
)
);
}
@@ -538,7 +533,7 @@ mod tests {
assert_eq!(
error,
RadrootsOperationalListingEditError::InvalidModel(
- RadrootsOperationalListingValidationError::InvalidBin
+ OperationalListingValidationError::InvalidBin
)
);
@@ -561,7 +556,7 @@ mod tests {
assert_eq!(
error,
RadrootsOperationalListingEditError::InvalidModel(
- RadrootsOperationalListingValidationError::InvalidPrice
+ OperationalListingValidationError::InvalidPrice
)
);
}
diff --git a/crates/trade/src/operational_listing/mod.rs b/crates/trade/src/operational_listing/mod.rs
@@ -5,12 +5,9 @@ pub mod price_ext;
pub mod validation;
use radroots_event::{
- envelope::RadrootsEventEnvelope,
- id::{
- RadrootsAddressableCoordinateParts, RadrootsClassifiedListingAddress, RadrootsDTag,
- RadrootsIdParseError,
- },
- listing::operational::{RadrootsOperationalListing, RadrootsOperationalListingParseError},
+ envelope::EventEnvelope,
+ id::{AddressableCoordinateParts, ClassifiedListingAddress, DTag, ParseError},
+ listing::operational::{OperationalListing, OperationalListingParseError},
};
use radroots_event_codec::operational_listing::decode::operational_listing_from_nostr_event;
use radroots_identity::PublicKey;
@@ -31,38 +28,38 @@ pub use self::validation::{
};
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsClassifiedListingAddressParts {
- pub address: RadrootsClassifiedListingAddress,
+ pub address: ClassifiedListingAddress,
pub kind: u32,
pub seller_pubkey: PublicKey,
- pub listing_id: RadrootsDTag,
+ pub listing_id: DTag,
}
impl RadrootsClassifiedListingAddressParts {
- pub fn parse(value: impl AsRef<str>) -> Result<Self, RadrootsIdParseError> {
+ pub fn parse(value: impl AsRef<str>) -> Result<Self, ParseError> {
parse_classified_listing_address(value)
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsPublicClassifiedListingAddress {
- pub address: RadrootsClassifiedListingAddress,
+ pub address: ClassifiedListingAddress,
pub kind: u32,
pub seller_pubkey: PublicKey,
- pub listing_id: RadrootsDTag,
+ pub listing_id: DTag,
}
impl RadrootsPublicClassifiedListingAddress {
- pub fn parse(value: impl AsRef<str>) -> Result<Self, RadrootsIdParseError> {
+ pub fn parse(value: impl AsRef<str>) -> Result<Self, ParseError> {
parse_public_classified_listing_address(value)
}
}
pub fn parse_classified_listing_address(
value: impl AsRef<str>,
-) -> Result<RadrootsClassifiedListingAddressParts, RadrootsIdParseError> {
+) -> Result<RadrootsClassifiedListingAddressParts, ParseError> {
let value = value.as_ref();
- let address = RadrootsClassifiedListingAddress::parse(value)?;
- let parts = RadrootsAddressableCoordinateParts::parse(address.as_str())
+ let address = ClassifiedListingAddress::parse(value)?;
+ let parts = AddressableCoordinateParts::parse(address.as_str())
.expect("typed listing address must contain valid coordinate parts");
Ok(RadrootsClassifiedListingAddressParts {
address,
@@ -74,7 +71,7 @@ pub fn parse_classified_listing_address(
pub fn parse_public_classified_listing_address(
value: impl AsRef<str>,
-) -> Result<RadrootsPublicClassifiedListingAddress, RadrootsIdParseError> {
+) -> Result<RadrootsPublicClassifiedListingAddress, ParseError> {
let parts = parse_classified_listing_address(value)?;
Ok(RadrootsPublicClassifiedListingAddress {
address: parts.address,
@@ -85,8 +82,8 @@ pub fn parse_public_classified_listing_address(
}
pub fn parse_operational_listing_event(
- event: &RadrootsEventEnvelope,
-) -> Result<RadrootsOperationalListing, RadrootsOperationalListingParseError> {
+ event: &EventEnvelope,
+) -> Result<OperationalListing, OperationalListingParseError> {
operational_listing_from_nostr_event(event)
}
@@ -98,17 +95,17 @@ mod tests {
parse_public_classified_listing_address,
};
use radroots_event::{
- envelope::RadrootsEventEnvelope,
- envelope::RadrootsEventEnvelopeParts,
+ envelope::EventEnvelope,
+ envelope::EventEnvelopeParts,
envelope::kind::{KIND_CLASSIFIED_LISTING, KIND_PROFILE},
- id::RadrootsClassifiedListingAddress,
- listing::operational::RadrootsOperationalListingParseError,
+ id::ClassifiedListingAddress,
+ listing::operational::OperationalListingParseError,
};
const SELLER: &str = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
- fn listing_event() -> RadrootsEventEnvelope {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ fn listing_event() -> EventEnvelope {
+ EventEnvelope::new(EventEnvelopeParts {
id: "9".repeat(64),
author: SELLER.to_string(),
created_at: 1,
@@ -145,7 +142,7 @@ mod tests {
#[test]
fn parse_operational_listing_event_rejects_non_listing_kind() {
- let event = RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ let event = EventEnvelope::new(EventEnvelopeParts {
id: "8".repeat(64),
author: SELLER.to_string(),
created_at: 1,
@@ -158,9 +155,7 @@ mod tests {
assert!(matches!(
parse_operational_listing_event(&event),
- Err(RadrootsOperationalListingParseError::InvalidKind(
- KIND_PROFILE
- ))
+ Err(OperationalListingParseError::InvalidKind(KIND_PROFILE))
));
}
@@ -181,7 +176,7 @@ mod tests {
RadrootsClassifiedListingAddressParts::parse(raw.clone()).expect("listing address");
let public = RadrootsPublicClassifiedListingAddress::parse(&raw).expect("public address");
let typed = parse_public_classified_listing_address(
- RadrootsClassifiedListingAddress::parse(&raw).expect("typed addr"),
+ ClassifiedListingAddress::parse(&raw).expect("typed addr"),
)
.expect("typed public address");
@@ -210,14 +205,14 @@ mod tests {
assert!(matches!(
parse_classified_listing_address(&raw),
- Err(radroots_event::id::RadrootsIdParseError::UnexpectedKind {
+ Err(radroots_event::id::ParseError::UnexpectedKind {
expected: KIND_CLASSIFIED_LISTING,
actual: 30403,
})
));
assert!(matches!(
parse_public_classified_listing_address(&raw),
- Err(radroots_event::id::RadrootsIdParseError::UnexpectedKind {
+ Err(radroots_event::id::ParseError::UnexpectedKind {
expected: KIND_CLASSIFIED_LISTING,
actual: 30403,
})
@@ -228,18 +223,18 @@ mod tests {
fn parse_public_classified_listing_address_maps_invalid_listing_addresses() {
assert!(matches!(
parse_public_classified_listing_address("not-an-address"),
- Err(radroots_event::id::RadrootsIdParseError::InvalidFormat)
+ Err(radroots_event::id::ParseError::InvalidFormat)
));
let raw = format!("{KIND_PROFILE}:{SELLER}:listing-1");
assert!(matches!(
parse_public_classified_listing_address(&raw),
- Err(radroots_event::id::RadrootsIdParseError::UnexpectedKind {
+ Err(radroots_event::id::ParseError::UnexpectedKind {
expected: KIND_CLASSIFIED_LISTING,
actual: KIND_PROFILE,
})
));
- assert!(RadrootsClassifiedListingAddress::parse(&raw).is_err());
+ assert!(ClassifiedListingAddress::parse(&raw).is_err());
}
#[test]
@@ -248,7 +243,7 @@ mod tests {
assert!(matches!(
parse_classified_listing_address(&raw),
- Err(radroots_event::id::RadrootsIdParseError::UnexpectedKind {
+ Err(radroots_event::id::ParseError::UnexpectedKind {
expected: KIND_CLASSIFIED_LISTING,
actual: KIND_PROFILE,
})
diff --git a/crates/trade/src/operational_listing/mutation.rs b/crates/trade/src/operational_listing/mutation.rs
@@ -10,10 +10,10 @@ use alloc::string::{String, ToString};
#[cfg(all(feature = "serde_json", feature = "std"))]
use std::string::{String, ToString};
-use radroots_event::id::RadrootsClassifiedListingAddress;
+use radroots_event::id::ClassifiedListingAddress;
#[cfg(feature = "serde_json")]
use radroots_event::{
- draft::{RadrootsDraftError, RadrootsEventDraft},
+ draft::{DraftError, EventDraft},
envelope::kind::KIND_CLASSIFIED_LISTING,
};
#[cfg(feature = "serde_json")]
@@ -37,7 +37,7 @@ pub enum RadrootsOperationalListingMutation {
draft: RadrootsOperationalListingCanonicalEdit,
},
Archive {
- listing_addr: RadrootsClassifiedListingAddress,
+ listing_addr: ClassifiedListingAddress,
},
}
@@ -53,7 +53,7 @@ pub enum RadrootsOperationalListingMutationError {
#[cfg(feature = "serde_json")]
EncodeListing(String),
#[cfg(feature = "serde_json")]
- FrozenDraft(RadrootsDraftError),
+ FrozenDraft(DraftError),
}
impl fmt::Display for RadrootsOperationalListingMutationError {
@@ -90,7 +90,7 @@ impl RadrootsOperationalListingMutation {
Self::SaveDraft { draft }
}
- pub fn archive(listing_addr: RadrootsClassifiedListingAddress) -> Self {
+ pub fn archive(listing_addr: ClassifiedListingAddress) -> Self {
Self::Archive { listing_addr }
}
@@ -125,7 +125,7 @@ impl RadrootsOperationalListingMutation {
pub fn listing_addr(
&self,
- ) -> Result<&RadrootsClassifiedListingAddress, RadrootsOperationalListingMutationError> {
+ ) -> Result<&ClassifiedListingAddress, RadrootsOperationalListingMutationError> {
match self {
Self::Publish { draft } | Self::Update { draft } => Ok(draft.public_listing_addr()),
Self::SaveDraft { draft } => Ok(draft.public_listing_addr()),
@@ -140,7 +140,7 @@ impl RadrootsOperationalListingMutation {
pub fn build_operational_listing_mutation_draft(
mutation: &RadrootsOperationalListingMutation,
created_at: u64,
-) -> Result<RadrootsEventDraft, RadrootsOperationalListingMutationError> {
+) -> Result<EventDraft, RadrootsOperationalListingMutationError> {
let (draft, kind, contract_id) = match mutation {
RadrootsOperationalListingMutation::Publish { draft }
| RadrootsOperationalListingMutation::Update { draft } => (
@@ -156,7 +156,7 @@ pub fn build_operational_listing_mutation_draft(
let parts = to_wire_parts_with_kind(draft.listing(), kind).map_err(|error| {
RadrootsOperationalListingMutationError::EncodeListing(error.to_string())
})?;
- RadrootsEventDraft::new(
+ EventDraft::new(
contract_id,
parts.kind,
created_at,
@@ -173,14 +173,13 @@ mod tests {
use radroots_event::{
contract::validate_event_contract_shape,
envelope::kind::KIND_CLASSIFIED_LISTING,
- farm::RadrootsFarmRef,
- farm::resource_area::RadrootsResourceAreaRef,
- id::{RadrootsClassifiedListingAddress, RadrootsDTag, RadrootsInventoryBinId},
+ farm::FarmRef,
+ farm::resource_area::ResourceAreaRef,
+ id::{ClassifiedListingAddress, DTag, InventoryBinId},
listing::operational::{
- RadrootsOperationalListing, RadrootsOperationalListingAvailability,
- RadrootsOperationalListingBin, RadrootsOperationalListingDeliveryMethod,
- RadrootsOperationalListingProduct, RadrootsOperationalListingPublicLocation,
- RadrootsOperationalListingStatus,
+ OperationalListing, OperationalListingAvailability, OperationalListingBin,
+ OperationalListingDeliveryMethod, OperationalListingProduct,
+ OperationalListingPublicLocation, OperationalListingStatus,
},
};
use radroots_event_codec::verification::verify_nip01_event;
@@ -201,23 +200,23 @@ mod tests {
const SELLER: &str = FIXTURE_ALICE_PUBLIC_KEY_HEX;
- fn d_tag(raw: &str) -> RadrootsDTag {
- RadrootsDTag::parse(raw).expect("d tag")
+ fn d_tag(raw: &str) -> DTag {
+ DTag::parse(raw).expect("d tag")
}
- fn bin_id(raw: &str) -> RadrootsInventoryBinId {
- RadrootsInventoryBinId::parse(raw).expect("bin id")
+ fn bin_id(raw: &str) -> InventoryBinId {
+ InventoryBinId::parse(raw).expect("bin id")
}
- fn listing() -> RadrootsOperationalListing {
- RadrootsOperationalListing {
+ fn listing() -> OperationalListing {
+ OperationalListing {
d_tag: d_tag("AAAAAAAAAAAAAAAAAAAAAg"),
published_at: None,
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: SELLER.to_string(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".to_string(),
},
- product: RadrootsOperationalListingProduct {
+ product: OperationalListingProduct {
key: "coffee".to_string(),
title: "Coffee".to_string(),
category: "coffee".to_string(),
@@ -229,7 +228,7 @@ mod tests {
year: None,
},
primary_bin_id: bin_id("bin-1"),
- bins: vec![RadrootsOperationalListingBin {
+ bins: vec![OperationalListingBin {
bin_id: bin_id("bin-1"),
quantity: Quantity::try_new(Decimal::from(1000u32), Unit::MassG).unwrap(),
price_per_canonical_unit: QuantityPrice::try_new(
@@ -247,11 +246,11 @@ mod tests {
plot: None,
discounts: None,
inventory_available: Some(Decimal::from(5u32)),
- availability: Some(RadrootsOperationalListingAvailability::Status {
- status: RadrootsOperationalListingStatus::Active,
+ availability: Some(OperationalListingAvailability::Status {
+ status: OperationalListingStatus::Active,
}),
- delivery_method: Some(RadrootsOperationalListingDeliveryMethod::Pickup),
- location: Some(RadrootsOperationalListingPublicLocation {
+ delivery_method: Some(OperationalListingDeliveryMethod::Pickup),
+ location: Some(OperationalListingPublicLocation {
primary: "Farm".to_string(),
city: Some("Town".to_string()),
region: Some("Region".to_string()),
@@ -356,7 +355,7 @@ mod tests {
#[test]
fn archive_is_explicitly_unsupported() {
let archive = RadrootsOperationalListingMutation::archive(
- RadrootsClassifiedListingAddress::parse(format!(
+ ClassifiedListingAddress::parse(format!(
"{KIND_CLASSIFIED_LISTING}:{SELLER}:AAAAAAAAAAAAAAAAAAAAAg"
))
.expect("listing address"),
@@ -415,7 +414,7 @@ mod tests {
#[test]
fn build_operational_listing_mutation_draft_rejects_archive() {
let archive = RadrootsOperationalListingMutation::archive(
- RadrootsClassifiedListingAddress::parse(format!(
+ ClassifiedListingAddress::parse(format!(
"{KIND_CLASSIFIED_LISTING}:{SELLER}:AAAAAAAAAAAAAAAAAAAAAg"
))
.expect("listing address"),
@@ -430,7 +429,7 @@ mod tests {
#[test]
fn build_operational_listing_mutation_draft_reports_encode_errors() {
let mut listing = listing();
- listing.resource_area = Some(RadrootsResourceAreaRef {
+ listing.resource_area = Some(ResourceAreaRef {
pubkey: SELLER.to_string(),
d_tag: "bad d tag".to_string(),
});
diff --git a/crates/trade/src/operational_listing/price_ext.rs b/crates/trade/src/operational_listing/price_ext.rs
@@ -3,7 +3,7 @@ use crate::operational_listing::model::{
};
use radroots_core::pricing::{Error as PricingError, QuantityPriceOps};
use radroots_core::{Decimal, Quantity};
-use radroots_event::listing::operational::RadrootsOperationalListingBin;
+use radroots_event::listing::operational::OperationalListingBin;
pub trait BinPricingTryExt {
fn try_subtotal_for_count(
@@ -18,7 +18,7 @@ pub trait BinPricingTryExt {
#[inline]
fn effective_quantity(
- bin: &RadrootsOperationalListingBin,
+ bin: &OperationalListingBin,
bin_count: u32,
) -> Result<Quantity, PricingError> {
let amount = bin
@@ -29,7 +29,7 @@ fn effective_quantity(
Quantity::try_new(amount, bin.quantity.unit()).map_err(|_| PricingError::ArithmeticOverflow)
}
-impl BinPricingTryExt for RadrootsOperationalListingBin {
+impl BinPricingTryExt for OperationalListingBin {
fn try_subtotal_for_count(
&self,
bin_count: u32,
@@ -67,15 +67,15 @@ mod tests {
use super::BinPricingTryExt;
use radroots_core::pricing::Error as PricingError;
use radroots_core::{Currency, Decimal, Money, Quantity, QuantityPrice, Unit};
- use radroots_event::id::RadrootsInventoryBinId;
- use radroots_event::listing::operational::RadrootsOperationalListingBin;
+ use radroots_event::id::InventoryBinId;
+ use radroots_event::listing::operational::OperationalListingBin;
- fn bin_id(raw: &str) -> RadrootsInventoryBinId {
- RadrootsInventoryBinId::parse(raw).expect("bin id")
+ fn bin_id(raw: &str) -> InventoryBinId {
+ InventoryBinId::parse(raw).expect("bin id")
}
- fn valid_bin() -> RadrootsOperationalListingBin {
- RadrootsOperationalListingBin {
+ fn valid_bin() -> OperationalListingBin {
+ OperationalListingBin {
bin_id: bin_id("bin-1"),
quantity: Quantity::try_new(Decimal::from(2u32), Unit::MassG).unwrap(),
price_per_canonical_unit: QuantityPrice::try_new(
@@ -93,7 +93,7 @@ mod tests {
#[test]
fn try_subtotal_for_rejects_unit_mismatch() {
- let bin = RadrootsOperationalListingBin {
+ let bin = OperationalListingBin {
bin_id: bin_id("bin-1"),
quantity: Quantity::try_new(Decimal::from(1u32), Unit::MassG).unwrap(),
price_per_canonical_unit: QuantityPrice::try_new(
@@ -149,7 +149,7 @@ mod tests {
#[test]
fn try_total_for_count_propagates_subtotal_errors() {
- let bin = RadrootsOperationalListingBin {
+ let bin = OperationalListingBin {
bin_id: bin_id("bin-1"),
quantity: Quantity::try_new(Decimal::from(1u32), Unit::MassG).unwrap(),
price_per_canonical_unit: QuantityPrice::try_new(
diff --git a/crates/trade/src/operational_listing/validation.rs b/crates/trade/src/operational_listing/validation.rs
@@ -10,14 +10,13 @@ use radroots_core::{Decimal, Money, Quantity, Unit};
use radroots_event::{
envelope::kind::{KIND_CLASSIFIED_LISTING, is_classified_listing_kind},
farm::location::{has_textual_locality, is_public_geohash5},
- id::RadrootsClassifiedListingAddress,
- listing::classified::{RadrootsClassifiedListingPartition, classify_classified_listing_tags},
+ id::ClassifiedListingAddress,
+ listing::classified::{ClassifiedListingPartition, classify_classified_listing_tags},
listing::operational::{
- RadrootsOperationalListing, RadrootsOperationalListingAvailability,
- RadrootsOperationalListingBin, RadrootsOperationalListingDeliveryMethod,
- RadrootsOperationalListingPublicLocation,
+ OperationalListing, OperationalListingAvailability, OperationalListingBin,
+ OperationalListingDeliveryMethod, OperationalListingPublicLocation,
},
- trade::validation::RadrootsOperationalListingValidationError as OperationalListingValidationError,
+ trade::validation::OperationalListingValidationError,
};
use radroots_identity::PublicKey;
@@ -30,7 +29,7 @@ use radroots_event_codec::{
#[derive(Clone, Debug)]
pub struct RadrootsOperationalListingTradeProjection {
pub listing_id: String,
- pub listing_addr: RadrootsClassifiedListingAddress,
+ pub listing_addr: ClassifiedListingAddress,
pub seller_pubkey: String,
pub title: String,
pub description: String,
@@ -40,10 +39,10 @@ pub struct RadrootsOperationalListingTradeProjection {
pub unit: Unit,
pub unit_price: Money,
pub inventory_available: Decimal,
- pub availability: RadrootsOperationalListingAvailability,
- pub location: RadrootsOperationalListingPublicLocation,
- pub delivery_method: RadrootsOperationalListingDeliveryMethod,
- pub listing: RadrootsOperationalListing,
+ pub availability: OperationalListingAvailability,
+ pub location: OperationalListingPublicLocation,
+ pub delivery_method: OperationalListingDeliveryMethod,
+ pub listing: OperationalListing,
}
/// Validates a signature-verified Operational Listing event.
@@ -51,10 +50,10 @@ pub struct RadrootsOperationalListingTradeProjection {
/// A plain envelope cannot cross this boundary:
///
/// ```compile_fail
-/// use radroots_event::envelope::RadrootsEventEnvelope;
+/// use radroots_event::envelope::EventEnvelope;
/// use radroots_trade::operational_listing::validation::validate_operational_listing_event;
///
-/// fn validate_unverified(event: &RadrootsEventEnvelope) {
+/// fn validate_unverified(event: &EventEnvelope) {
/// let _ = validate_operational_listing_event(event);
/// }
/// ```
@@ -68,7 +67,7 @@ pub fn validate_operational_listing_event(
});
}
if classify_classified_listing_tags(event.tags())
- != RadrootsClassifiedListingPartition::OperationalListing
+ != ClassifiedListingPartition::OperationalListing
{
return Err(OperationalListingValidationError::InvalidProfile);
}
@@ -86,7 +85,7 @@ pub fn validate_operational_listing_event(
/// checks; callers handling Nostr events must use
/// [`validate_operational_listing_event`] instead.
pub fn validate_operational_listing_model(
- listing: RadrootsOperationalListing,
+ listing: OperationalListing,
seller_pubkey: &PublicKey,
) -> Result<RadrootsOperationalListingTradeProjection, OperationalListingValidationError> {
let listing_id = listing.d_tag.as_str().trim().to_string();
@@ -95,7 +94,7 @@ pub fn validate_operational_listing_model(
return Err(OperationalListingValidationError::InvalidSeller);
}
let listing_addr_raw = format!("{KIND_CLASSIFIED_LISTING}:{}:{listing_id}", seller_pubkey);
- let listing_addr = RadrootsClassifiedListingAddress::parse(&listing_addr_raw)
+ let listing_addr = ClassifiedListingAddress::parse(&listing_addr_raw)
.expect("validated listing identity must form a listing address");
let title = listing.product.title.trim().to_string();
@@ -197,7 +196,7 @@ pub fn validate_operational_listing_model(
}
fn validate_listing_bin(
- bin: &RadrootsOperationalListingBin,
+ bin: &OperationalListingBin,
) -> Result<(), OperationalListingValidationError> {
if bin.quantity.amount().is_sign_negative() || !bin.quantity.is_canonical() {
return Err(OperationalListingValidationError::InvalidBin);
@@ -237,15 +236,15 @@ mod tests {
use nostr::{EventBuilder, Keys, Kind, Tag, Timestamp};
use radroots_core::{Currency, Decimal, Money, Quantity, QuantityPrice, Unit};
use radroots_event::{
- envelope::RadrootsEventEnvelope,
- envelope::RadrootsEventEnvelopeParts,
+ envelope::EventEnvelope,
+ envelope::EventEnvelopeParts,
envelope::kind::KIND_CLASSIFIED_LISTING,
- farm::RadrootsFarmRef,
- id::{RadrootsDTag, RadrootsInventoryBinId},
+ farm::FarmRef,
+ id::{DTag, InventoryBinId},
listing::operational::{
- RadrootsOperationalListing, RadrootsOperationalListingAvailability,
- RadrootsOperationalListingBin, RadrootsOperationalListingDeliveryMethod,
- RadrootsOperationalListingProduct, RadrootsOperationalListingPublicLocation,
+ OperationalListing, OperationalListingAvailability, OperationalListingBin,
+ OperationalListingDeliveryMethod, OperationalListingProduct,
+ OperationalListingPublicLocation,
},
};
use radroots_event_codec::verification::{RadrootsSignatureVerifiedEvent, verify_nip01_event};
@@ -259,12 +258,12 @@ mod tests {
const SELLER: &str = FIXTURE_ALICE_PUBLIC_KEY_HEX;
const OTHER_SELLER: &str = FIXTURE_BOB_PUBLIC_KEY_HEX;
- fn d_tag(raw: &str) -> RadrootsDTag {
- RadrootsDTag::parse(raw).expect("d tag")
+ fn d_tag(raw: &str) -> DTag {
+ DTag::parse(raw).expect("d tag")
}
- fn bin_id(raw: &str) -> RadrootsInventoryBinId {
- RadrootsInventoryBinId::parse(raw).expect("bin id")
+ fn bin_id(raw: &str) -> InventoryBinId {
+ InventoryBinId::parse(raw).expect("bin id")
}
fn seller_pubkey() -> PublicKey {
@@ -275,15 +274,15 @@ mod tests {
PublicKey::from_hex(OTHER_SELLER).expect("other seller pubkey")
}
- fn base_listing() -> RadrootsOperationalListing {
- RadrootsOperationalListing {
+ fn base_listing() -> OperationalListing {
+ OperationalListing {
d_tag: d_tag("AAAAAAAAAAAAAAAAAAAAAg"),
published_at: None,
- farm: RadrootsFarmRef {
+ farm: FarmRef {
pubkey: SELLER.into(),
d_tag: "AAAAAAAAAAAAAAAAAAAAAA".into(),
},
- product: RadrootsOperationalListingProduct {
+ product: OperationalListingProduct {
key: "coffee".into(),
title: "Coffee".into(),
category: "coffee".into(),
@@ -295,7 +294,7 @@ mod tests {
year: None,
},
primary_bin_id: bin_id("bin-1"),
- bins: vec![RadrootsOperationalListingBin {
+ bins: vec![OperationalListingBin {
bin_id: bin_id("bin-1"),
quantity: Quantity::try_new(Decimal::from(1000u32), Unit::MassG).unwrap(),
price_per_canonical_unit: QuantityPrice::try_new(
@@ -313,12 +312,11 @@ mod tests {
plot: None,
discounts: None,
inventory_available: Some(Decimal::from(5u32)),
- availability: Some(RadrootsOperationalListingAvailability::Status {
- status:
- radroots_event::listing::operational::RadrootsOperationalListingStatus::Active,
+ availability: Some(OperationalListingAvailability::Status {
+ status: radroots_event::listing::operational::OperationalListingStatus::Active,
}),
- delivery_method: Some(RadrootsOperationalListingDeliveryMethod::Pickup),
- location: Some(RadrootsOperationalListingPublicLocation {
+ delivery_method: Some(OperationalListingDeliveryMethod::Pickup),
+ location: Some(OperationalListingPublicLocation {
primary: "Farm".into(),
city: Some("Town".into()),
region: Some("Region".into()),
@@ -329,7 +327,7 @@ mod tests {
}
}
- fn base_event(listing: &RadrootsOperationalListing) -> RadrootsSignatureVerifiedEvent {
+ fn base_event(listing: &OperationalListing) -> RadrootsSignatureVerifiedEvent {
let mut tags = vec![
vec!["d".into(), listing.d_tag.to_string()],
vec!["p".into(), listing.farm.pubkey.clone()],
@@ -378,17 +376,21 @@ mod tests {
}
if let Some(availability) = &listing.availability {
match availability {
- RadrootsOperationalListingAvailability::Status { status } => tags.push(vec![
+ OperationalListingAvailability::Status { status } => tags.push(vec![
"status".into(),
match status {
- radroots_event::listing::operational::RadrootsOperationalListingStatus::Active => "active".into(),
- radroots_event::listing::operational::RadrootsOperationalListingStatus::Sold => "sold".into(),
- radroots_event::listing::operational::RadrootsOperationalListingStatus::Other { value } => {
- value.clone()
+ radroots_event::listing::operational::OperationalListingStatus::Active => {
+ "active".into()
}
+ radroots_event::listing::operational::OperationalListingStatus::Sold => {
+ "sold".into()
+ }
+ radroots_event::listing::operational::OperationalListingStatus::Other {
+ value,
+ } => value.clone(),
},
]),
- RadrootsOperationalListingAvailability::Window { start, end } => {
+ OperationalListingAvailability::Window { start, end } => {
if let Some(start) = start {
tags.push(vec![
"radroots:availability_start".into(),
@@ -404,12 +406,12 @@ mod tests {
if let Some(delivery) = &listing.delivery_method {
let mut tag = vec!["delivery".into()];
match delivery {
- RadrootsOperationalListingDeliveryMethod::Pickup => tag.push("pickup".into()),
- RadrootsOperationalListingDeliveryMethod::LocalDelivery => {
+ OperationalListingDeliveryMethod::Pickup => tag.push("pickup".into()),
+ OperationalListingDeliveryMethod::LocalDelivery => {
tag.push("local_delivery".into())
}
- RadrootsOperationalListingDeliveryMethod::Shipping => tag.push("shipping".into()),
- RadrootsOperationalListingDeliveryMethod::Other { method } => {
+ OperationalListingDeliveryMethod::Shipping => tag.push("shipping".into()),
+ OperationalListingDeliveryMethod::Other { method } => {
tag.push("other".into());
tag.push(method.clone());
}
@@ -460,7 +462,7 @@ mod tests {
}
fn assert_validation_err(
- listing: RadrootsOperationalListing,
+ listing: OperationalListing,
expected: OperationalListingValidationError,
) {
let event = base_event(&listing);
@@ -469,7 +471,7 @@ mod tests {
}
fn assert_secondary_bin_model_error(
- update: impl FnOnce(&mut RadrootsOperationalListingBin),
+ update: impl FnOnce(&mut OperationalListingBin),
expected: OperationalListingValidationError,
) {
let mut listing = listing_with_secondary_bin();
@@ -482,7 +484,7 @@ mod tests {
);
}
- fn listing_with_secondary_bin() -> RadrootsOperationalListing {
+ fn listing_with_secondary_bin() -> OperationalListing {
let mut listing = base_listing();
let mut secondary_bin = listing.bins[0].clone();
secondary_bin.bin_id = bin_id("bin-2");
@@ -736,7 +738,7 @@ mod tests {
fn tampered_envelope_cannot_reach_operational_validation() {
let verified = base_event(&base_listing());
let event = verified.into_event();
- let tampered = RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ let tampered = EventEnvelope::new(EventEnvelopeParts {
id: event.id_hex(),
author: event.author().to_hex().to_owned(),
created_at: event.created_at_u64(),
@@ -778,14 +780,17 @@ mod tests {
assert_validation_err(
listing,
OperationalListingValidationError::ParseError {
- error: radroots_event::listing::operational::RadrootsOperationalListingParseError::InvalidTag("radroots:primary_bin".into()),
+ error:
+ radroots_event::listing::operational::OperationalListingParseError::InvalidTag(
+ "radroots:primary_bin".into(),
+ ),
},
);
}
#[test]
fn validate_listing_rejects_missing_primary_bin_id() {
- assert!(RadrootsInventoryBinId::parse(" ").is_err());
+ assert!(InventoryBinId::parse(" ").is_err());
}
#[test]
@@ -795,7 +800,10 @@ mod tests {
assert_validation_err(
listing,
OperationalListingValidationError::ParseError {
- error: radroots_event::listing::operational::RadrootsOperationalListingParseError::InvalidTag("radroots:primary_bin".into()),
+ error:
+ radroots_event::listing::operational::OperationalListingParseError::InvalidTag(
+ "radroots:primary_bin".into(),
+ ),
},
);
}
@@ -807,7 +815,10 @@ mod tests {
assert_validation_err(
listing,
OperationalListingValidationError::ParseError {
- error: radroots_event::listing::operational::RadrootsOperationalListingParseError::InvalidTag("radroots:bin".into()),
+ error:
+ radroots_event::listing::operational::OperationalListingParseError::InvalidTag(
+ "radroots:bin".into(),
+ ),
},
);
}
@@ -823,7 +834,10 @@ mod tests {
assert_validation_err(
listing,
OperationalListingValidationError::ParseError {
- error: radroots_event::listing::operational::RadrootsOperationalListingParseError::InvalidTag("radroots:price".into()),
+ error:
+ radroots_event::listing::operational::OperationalListingParseError::InvalidTag(
+ "radroots:price".into(),
+ ),
},
);
}
@@ -839,7 +853,10 @@ mod tests {
assert_validation_err(
listing,
OperationalListingValidationError::ParseError {
- error: radroots_event::listing::operational::RadrootsOperationalListingParseError::InvalidTag("radroots:price".into()),
+ error:
+ radroots_event::listing::operational::OperationalListingParseError::InvalidTag(
+ "radroots:price".into(),
+ ),
},
);
}
@@ -888,7 +905,10 @@ mod tests {
assert_validation_err(
listing,
OperationalListingValidationError::ParseError {
- error: radroots_event::listing::operational::RadrootsOperationalListingParseError::InvalidTag("g".to_string()),
+ error:
+ radroots_event::listing::operational::OperationalListingParseError::InvalidTag(
+ "g".to_string(),
+ ),
},
);
}
@@ -900,7 +920,10 @@ mod tests {
assert_validation_err(
listing,
OperationalListingValidationError::ParseError {
- error: radroots_event::listing::operational::RadrootsOperationalListingParseError::InvalidTag("g".to_string()),
+ error:
+ radroots_event::listing::operational::OperationalListingParseError::InvalidTag(
+ "g".to_string(),
+ ),
},
);
}
@@ -928,7 +951,10 @@ mod tests {
listing_addr: "addr".into(),
},
OperationalListingValidationError::ParseError {
- error: radroots_event::listing::operational::RadrootsOperationalListingParseError::InvalidTag("d".into()),
+ error:
+ radroots_event::listing::operational::OperationalListingParseError::InvalidTag(
+ "d".into(),
+ ),
},
OperationalListingValidationError::InvalidSeller,
OperationalListingValidationError::MissingFarmProfile,
diff --git a/crates/trade/src/validation_receipt.rs b/crates/trade/src/validation_receipt.rs
@@ -9,11 +9,11 @@ use alloc::{
use base64::Engine as _;
use radroots_event::{
- envelope::RadrootsEventEnvelope,
+ envelope::EventEnvelope,
envelope::kind::{KIND_TRADE_VALIDATION_RECEIPT, KIND_VALIDATOR_SET},
- id::{RadrootsAddressableCoordinate, RadrootsAddressableCoordinateParts},
+ id::{AddressableCoordinate, AddressableCoordinateParts},
tag::name::{TAG_A, TAG_D},
- wire::RadrootsNip01EventWireParts,
+ wire::Nip01EventWireParts,
};
use radroots_identity::PublicKey;
use serde::{Deserialize, Serialize};
@@ -52,7 +52,7 @@ pub struct RadrootsValidatorSetV1 {
pub struct RadrootsVerifiedValidatorSetV1 {
pub set: RadrootsValidatorSetV1,
pub event_id: String,
- pub address: RadrootsAddressableCoordinate,
+ pub address: AddressableCoordinate,
pub authority_pubkey: PublicKey,
}
@@ -157,7 +157,7 @@ impl RadrootsTradeCommitmentConfidence {
#[serde(deny_unknown_fields)]
pub struct RadrootsTradeValidationTrustPolicy {
pub validator_set: Option<RadrootsValidatorSetV1>,
- pub validator_set_addr: Option<RadrootsAddressableCoordinate>,
+ pub validator_set_addr: Option<AddressableCoordinate>,
pub validator_set_event_id: Option<String>,
pub require_cryptographic_proof: bool,
}
@@ -185,7 +185,7 @@ impl RadrootsTradeValidationTrustPolicy {
pub fn with_validator_set(
mut self,
validator_set: RadrootsValidatorSetV1,
- validator_set_addr: RadrootsAddressableCoordinate,
+ validator_set_addr: AddressableCoordinate,
validator_set_event_id: impl Into<String>,
) -> Self {
self.validator_set = Some(validator_set);
@@ -298,7 +298,7 @@ pub struct RadrootsValidationReceiptStatement {
pub listing_event_id: String,
pub root_event_id: String,
pub target_event_id: String,
- pub validator_set_addr: RadrootsAddressableCoordinate,
+ pub validator_set_addr: AddressableCoordinate,
pub validator_set_event_id: String,
#[serde(rename = "type")]
pub statement_type: RadrootsValidationReceiptType,
@@ -343,7 +343,7 @@ pub struct RadrootsValidationReceiptTags {
pub reducer_output_root: String,
pub root_event_id: String,
pub target_event_id: String,
- pub validator_set_addr: RadrootsAddressableCoordinate,
+ pub validator_set_addr: AddressableCoordinate,
pub validator_set_event_id: String,
}
@@ -429,18 +429,16 @@ impl RadrootsValidatorSetV1 {
pub fn validator_set_address(
authority_pubkey: &PublicKey,
set_id: &str,
-) -> Result<RadrootsAddressableCoordinate, RadrootsValidationReceiptError> {
+) -> Result<AddressableCoordinate, RadrootsValidationReceiptError> {
validate_uuidv7(set_id, "validator_set.set_id")?;
- RadrootsAddressableCoordinate::parse(format!(
- "{KIND_VALIDATOR_SET}:{authority_pubkey}:{set_id}"
- ))
- .map_err(|_| RadrootsValidationReceiptError::InvalidField("validator_set.address"))
+ AddressableCoordinate::parse(format!("{KIND_VALIDATOR_SET}:{authority_pubkey}:{set_id}"))
+ .map_err(|_| RadrootsValidationReceiptError::InvalidField("validator_set.address"))
}
pub fn validator_set_address_from_str(
value: impl AsRef<str>,
-) -> Result<RadrootsAddressableCoordinate, RadrootsValidationReceiptError> {
- let address = RadrootsAddressableCoordinate::parse(value.as_ref())
+) -> Result<AddressableCoordinate, RadrootsValidationReceiptError> {
+ let address = AddressableCoordinate::parse(value.as_ref())
.map_err(|_| RadrootsValidationReceiptError::InvalidField("validator_set.address"))?;
validate_validator_set_address(&address, "validator_set.address")?;
Ok(address)
@@ -469,8 +467,8 @@ pub fn validator_set_content_from_str(
pub fn validator_set_event_build(
validator_set: &RadrootsValidatorSetV1,
-) -> Result<RadrootsNip01EventWireParts, RadrootsValidationReceiptError> {
- Ok(RadrootsNip01EventWireParts {
+) -> Result<Nip01EventWireParts, RadrootsValidationReceiptError> {
+ Ok(Nip01EventWireParts {
kind: KIND_VALIDATOR_SET,
content: validator_set_canonical_content(validator_set)?,
tags: vec![vec![TAG_D.to_string(), validator_set.set_id.clone()]],
@@ -478,13 +476,13 @@ pub fn validator_set_event_build(
}
pub fn validator_set_from_event(
- event: &RadrootsEventEnvelope,
+ event: &EventEnvelope,
) -> Result<RadrootsVerifiedValidatorSetV1, RadrootsValidationReceiptError> {
verify_validator_set_event(event, None)
}
pub fn verify_validator_set_event(
- event: &RadrootsEventEnvelope,
+ event: &EventEnvelope,
expected_author: Option<&PublicKey>,
) -> Result<RadrootsVerifiedValidatorSetV1, RadrootsValidationReceiptError> {
if event.kind_u32() != KIND_VALIDATOR_SET {
@@ -751,8 +749,8 @@ pub fn validation_receipt_tags_from_tags(
pub fn validation_receipt_event_build(
order_id: &str,
receipt: &RadrootsTradeValidationReceipt,
-) -> Result<RadrootsNip01EventWireParts, RadrootsValidationReceiptError> {
- Ok(RadrootsNip01EventWireParts {
+) -> Result<Nip01EventWireParts, RadrootsValidationReceiptError> {
+ Ok(Nip01EventWireParts {
kind: KIND_TRADE_VALIDATION_RECEIPT,
content: validation_receipt_canonical_content(receipt)?,
tags: validation_receipt_tags(order_id, receipt)?,
@@ -760,13 +758,13 @@ pub fn validation_receipt_event_build(
}
pub fn validation_receipt_from_event(
- event: &RadrootsEventEnvelope,
+ event: &EventEnvelope,
) -> Result<RadrootsVerifiedValidationReceipt, RadrootsValidationReceiptError> {
verify_validation_receipt_event(event, RadrootsValidationReceiptExpectedBinding::default())
}
pub fn verify_validation_receipt_event(
- event: &RadrootsEventEnvelope,
+ event: &EventEnvelope,
expected: RadrootsValidationReceiptExpectedBinding<'_>,
) -> Result<RadrootsVerifiedValidationReceipt, RadrootsValidationReceiptError> {
if event.kind_u32() != KIND_TRADE_VALIDATION_RECEIPT {
@@ -964,7 +962,7 @@ fn required_event_marker(
fn required_address_marker(
tags: &[Vec<String>],
marker: &'static str,
-) -> Result<RadrootsAddressableCoordinate, RadrootsValidationReceiptError> {
+) -> Result<AddressableCoordinate, RadrootsValidationReceiptError> {
let mut matches = tags.iter().filter(|tag| {
tag.first().map(|value| value.as_str()) == Some(TAG_A)
&& tag.get(3).map(|value| value.as_str()) == Some(marker)
@@ -979,7 +977,7 @@ fn required_address_marker(
.get(1)
.ok_or(RadrootsValidationReceiptError::InvalidTag(marker))?;
validate_required_str(value, marker)?;
- RadrootsAddressableCoordinate::parse(value)
+ AddressableCoordinate::parse(value)
.map_err(|_| RadrootsValidationReceiptError::InvalidTag(marker))
}
@@ -1040,10 +1038,10 @@ fn validate_uuidv7(value: &str, field: &'static str) -> Result<(), RadrootsValid
}
fn validate_validator_set_address(
- value: &RadrootsAddressableCoordinate,
+ value: &AddressableCoordinate,
field: &'static str,
) -> Result<(), RadrootsValidationReceiptError> {
- let parts = RadrootsAddressableCoordinateParts::parse(value.as_str())
+ let parts = AddressableCoordinateParts::parse(value.as_str())
.expect("typed addressable coordinates must contain valid coordinate parts");
if parts.kind != KIND_VALIDATOR_SET {
return Err(RadrootsValidationReceiptError::InvalidField(field));
@@ -1146,10 +1144,10 @@ mod tests {
verify_validation_receipt_event, verify_validator_set_event,
};
use radroots_event::{
- envelope::RadrootsEventEnvelope,
- envelope::RadrootsEventEnvelopeParts,
+ envelope::EventEnvelope,
+ envelope::EventEnvelopeParts,
envelope::kind::{KIND_TRADE_VALIDATION_RECEIPT, KIND_VALIDATOR_SET},
- id::RadrootsAddressableCoordinate,
+ id::AddressableCoordinate,
tag::name::TAG_D,
};
use radroots_identity::PublicKey;
@@ -1177,7 +1175,7 @@ mod tests {
PublicKey::from_hex(FIXTURE_CAROL_PUBLIC_KEY_HEX).expect("validator pubkey")
}
- fn validator_set_addr() -> radroots_event::id::RadrootsAddressableCoordinate {
+ fn validator_set_addr() -> radroots_event::id::AddressableCoordinate {
validator_set_address(&validator_set_author(), &validator_set_id())
.expect("validator set address")
}
@@ -1241,7 +1239,7 @@ mod tests {
receipt
}
- fn sample_validation_receipt_event() -> RadrootsEventEnvelope {
+ fn sample_validation_receipt_event() -> EventEnvelope {
let receipt = sample_validation_receipt();
let parts = validation_receipt_event_build("order-1", &receipt).expect("event parts");
validation_receipt_event_with_parts(parts.kind, parts.tags, parts.content)
@@ -1251,8 +1249,8 @@ mod tests {
kind: u32,
tags: Vec<Vec<String>>,
content: String,
- ) -> RadrootsEventEnvelope {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ ) -> EventEnvelope {
+ EventEnvelope::new(EventEnvelopeParts {
id: event_id('9'),
author: event_id('a'),
created_at: 1,
@@ -1264,7 +1262,7 @@ mod tests {
.expect("receipt event")
}
- fn validation_receipt_event_with_tags(tags: Vec<Vec<String>>) -> RadrootsEventEnvelope {
+ fn validation_receipt_event_with_tags(tags: Vec<Vec<String>>) -> EventEnvelope {
let receipt = sample_validation_receipt();
let parts = validation_receipt_event_build("order-1", &receipt).expect("event parts");
validation_receipt_event_with_parts(parts.kind, tags, parts.content)
@@ -1274,8 +1272,8 @@ mod tests {
kind: u32,
tags: Vec<Vec<String>>,
content: String,
- ) -> RadrootsEventEnvelope {
- RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ ) -> EventEnvelope {
+ EventEnvelope::new(EventEnvelopeParts {
id: event_id('7'),
author: validator_set_author().to_hex(),
created_at: 1_700_000_001,
@@ -1426,7 +1424,7 @@ mod tests {
vec![vec![TAG_D.to_string(), validator_set_id()]]
);
- let event = RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ let event = EventEnvelope::new(EventEnvelopeParts {
id: event_id('7'),
author: validator_set_author().to_hex(),
created_at: 1_700_000_001,
@@ -1629,7 +1627,7 @@ mod tests {
);
let mut receipt = sample_validation_receipt();
- receipt.statement.validator_set_addr = RadrootsAddressableCoordinate::parse(format!(
+ receipt.statement.validator_set_addr = AddressableCoordinate::parse(format!(
"1:{}:{}",
validator_set_author(),
validator_set_id()
diff --git a/crates/trade/src/workflow.rs b/crates/trade/src/workflow.rs
@@ -14,14 +14,10 @@ use std::{
};
use radroots_event::{
- id::{
- RadrootsDTag, RadrootsEventId, RadrootsTradeCandidateId, RadrootsTradeId,
- RadrootsTradeMutationId,
- },
+ id::{CandidateId, DTag, EventId, MutationId, TradeId},
trade::{
- RADROOTS_TRADE_SCHEMA_VERSION, RadrootsSellerReservationAssertionV1,
- RadrootsTradeCandidateTermsV1, RadrootsTradeDecisionV1, RadrootsTradeMutationBodyV1,
- RadrootsTradeMutationEnvelopeV1,
+ RADROOTS_TRADE_SCHEMA_VERSION, SellerReservationAssertionV1, TradeCandidateTermsV1,
+ TradeDecisionV1, TradeMutationBodyV1, TradeMutationEnvelopeV1,
},
};
use radroots_identity::PublicKey;
@@ -138,7 +134,7 @@ pub enum RadrootsTradePaymentStateV1 {
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsTradeReductionInputV1 {
- pub trade_id: RadrootsTradeId,
+ pub trade_id: TradeId,
pub mutations: Vec<RadrootsTradeMutationRecordV1>,
pub private_terms: Vec<RadrootsTradePrivateTermsEvidenceV1>,
pub attestations: Vec<RadrootsTradeAttestationRecordV1>,
@@ -147,7 +143,7 @@ pub struct RadrootsTradeReductionInputV1 {
}
impl RadrootsTradeReductionInputV1 {
- pub fn new(trade_id: RadrootsTradeId) -> Self {
+ pub fn new(trade_id: TradeId) -> Self {
Self {
trade_id,
mutations: Vec::new(),
@@ -162,8 +158,8 @@ impl RadrootsTradeReductionInputV1 {
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsTradeMutationRecordV1 {
- pub transport_event_id: Option<RadrootsEventId>,
- pub mutation: RadrootsTradeMutationEnvelopeV1,
+ pub transport_event_id: Option<EventId>,
+ pub mutation: TradeMutationEnvelopeV1,
}
#[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))]
@@ -172,7 +168,7 @@ pub struct RadrootsTradeMutationRecordV1 {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsTradePrivateTermsEvidenceV1 {
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- pub candidate_id: RadrootsTradeCandidateId,
+ pub candidate_id: CandidateId,
pub state: RadrootsTradePrivateTermsStateV1,
}
@@ -191,9 +187,9 @@ pub enum RadrootsTradeAttestationResultV1 {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsTradeAttestationRecordV1 {
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- pub event_id: RadrootsEventId,
+ pub event_id: EventId,
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- pub claim_mutation_id: RadrootsTradeMutationId,
+ pub claim_mutation_id: MutationId,
pub result: RadrootsTradeAttestationResultV1,
}
@@ -205,15 +201,15 @@ pub struct RadrootsTradeProjectionV1 {
pub reducer_contract_id: String,
pub reducer_version: u16,
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- pub trade_id: RadrootsTradeId,
+ pub trade_id: TradeId,
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- pub root_mutation_id: Option<RadrootsTradeMutationId>,
+ pub root_mutation_id: Option<MutationId>,
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
pub buyer_pubkey: Option<PublicKey>,
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
pub seller_pubkey: Option<PublicKey>,
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- pub farm_id: Option<RadrootsDTag>,
+ pub farm_id: Option<DTag>,
pub negotiation_state: RadrootsTradeNegotiationStateV1,
pub agreement_state: RadrootsTradeAgreementStateV1,
pub evidence_state: RadrootsTradeEvidenceStateV1,
@@ -223,29 +219,29 @@ pub struct RadrootsTradeProjectionV1 {
pub fulfillment_state: RadrootsTradeFulfillmentStateV1,
pub payment_state: RadrootsTradePaymentStateV1,
#[cfg_attr(feature = "dto-bindgen", dto(ts(type = "Array<string>")))]
- pub candidate_heads: Vec<RadrootsTradeMutationId>,
+ pub candidate_heads: Vec<MutationId>,
pub agreement_claims: Vec<RadrootsTradeAgreementClaimV1>,
#[cfg_attr(feature = "dto-bindgen", dto(ts(type = "Array<string>")))]
- pub active_agreement_claim_ids: Vec<RadrootsTradeMutationId>,
+ pub active_agreement_claim_ids: Vec<MutationId>,
#[cfg_attr(feature = "dto-bindgen", dto(ts(type = "Array<string>")))]
- pub contested_claim_ids: Vec<RadrootsTradeMutationId>,
+ pub contested_claim_ids: Vec<MutationId>,
#[cfg_attr(feature = "dto-bindgen", dto(ts(type = "Array<string>")))]
- pub cancelled_claim_ids: Vec<RadrootsTradeMutationId>,
+ pub cancelled_claim_ids: Vec<MutationId>,
#[cfg_attr(feature = "dto-bindgen", dto(ts(type = "Array<string>")))]
- pub declined_candidate_ids: Vec<RadrootsTradeCandidateId>,
+ pub declined_candidate_ids: Vec<CandidateId>,
#[cfg_attr(feature = "dto-bindgen", dto(ts(type = "Array<string>")))]
- pub missing_parent_ids: Vec<RadrootsTradeMutationId>,
+ pub missing_parent_ids: Vec<MutationId>,
#[cfg_attr(feature = "dto-bindgen", dto(ts(type = "Array<string>")))]
- pub missing_proposal_ids: Vec<RadrootsTradeMutationId>,
+ pub missing_proposal_ids: Vec<MutationId>,
#[cfg_attr(feature = "dto-bindgen", dto(ts(type = "Array<string>")))]
- pub unsupported_mutation_ids: Vec<RadrootsTradeMutationId>,
+ pub unsupported_mutation_ids: Vec<MutationId>,
pub issues: Vec<RadrootsTradeReducerIssueV1>,
pub attestations: Vec<RadrootsTradeAttestationRecordV1>,
pub projection_digest: String,
}
impl RadrootsTradeProjectionV1 {
- fn empty(trade_id: RadrootsTradeId) -> Self {
+ fn empty(trade_id: TradeId) -> Self {
Self {
reducer_contract_id: RADROOTS_TRADE_REDUCER_CONTRACT_ID.to_string(),
reducer_version: RADROOTS_TRADE_REDUCER_VERSION,
@@ -310,11 +306,11 @@ impl RadrootsTradeProjectionV1 {
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub struct RadrootsTradeAgreementClaimV1 {
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- pub claim_mutation_id: RadrootsTradeMutationId,
+ pub claim_mutation_id: MutationId,
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- pub proposal_mutation_id: RadrootsTradeMutationId,
+ pub proposal_mutation_id: MutationId,
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- pub candidate_id: RadrootsTradeCandidateId,
+ pub candidate_id: CandidateId,
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
pub candidate_author_pubkey: PublicKey,
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
@@ -332,81 +328,81 @@ pub enum RadrootsTradeReducerIssueV1 {
MissingMutationId,
TradeIdentityMismatch {
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- mutation_id: RadrootsTradeMutationId,
+ mutation_id: MutationId,
},
UnsupportedSchema {
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- mutation_id: RadrootsTradeMutationId,
+ mutation_id: MutationId,
schema_version: u16,
},
InvalidMutation {
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- mutation_id: Option<RadrootsTradeMutationId>,
+ mutation_id: Option<MutationId>,
reason: String,
},
MissingParent {
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- mutation_id: RadrootsTradeMutationId,
+ mutation_id: MutationId,
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- parent_mutation_id: RadrootsTradeMutationId,
+ parent_mutation_id: MutationId,
},
MissingProposal {
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- decision_mutation_id: RadrootsTradeMutationId,
+ decision_mutation_id: MutationId,
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- proposal_mutation_id: RadrootsTradeMutationId,
+ proposal_mutation_id: MutationId,
},
CandidateIdMismatch {
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- decision_mutation_id: RadrootsTradeMutationId,
+ decision_mutation_id: MutationId,
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- proposal_mutation_id: RadrootsTradeMutationId,
+ proposal_mutation_id: MutationId,
},
DecisionAuthorMismatch {
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- decision_mutation_id: RadrootsTradeMutationId,
+ decision_mutation_id: MutationId,
},
DecisionParentMissing {
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- decision_mutation_id: RadrootsTradeMutationId,
+ decision_mutation_id: MutationId,
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- proposal_mutation_id: RadrootsTradeMutationId,
+ proposal_mutation_id: MutationId,
},
MissingSellerReservation {
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- decision_mutation_id: RadrootsTradeMutationId,
+ decision_mutation_id: MutationId,
},
ReservationCandidateMismatch {
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- decision_mutation_id: RadrootsTradeMutationId,
+ decision_mutation_id: MutationId,
},
ReservationAuthorityMismatch {
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- decision_mutation_id: RadrootsTradeMutationId,
+ decision_mutation_id: MutationId,
},
ReservationLineMismatch {
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- decision_mutation_id: RadrootsTradeMutationId,
+ decision_mutation_id: MutationId,
},
DecisionConflict {
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- proposal_mutation_id: RadrootsTradeMutationId,
+ proposal_mutation_id: MutationId,
},
DoubleAcceptance {
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- proposal_mutation_id: RadrootsTradeMutationId,
+ proposal_mutation_id: MutationId,
},
CancellationConflict {
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- cancellation_mutation_id: RadrootsTradeMutationId,
+ cancellation_mutation_id: MutationId,
},
InvalidCausalChain {
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- mutation_id: RadrootsTradeMutationId,
+ mutation_id: MutationId,
},
PrivateTermsUnavailable {
#[cfg_attr(feature = "dto-bindgen", dto(as = "string"))]
- candidate_id: RadrootsTradeCandidateId,
+ candidate_id: CandidateId,
},
ProjectionDigestUnavailable {
reason: String,
@@ -415,30 +411,30 @@ pub enum RadrootsTradeReducerIssueV1 {
#[derive(Clone, Debug, PartialEq, Eq)]
struct CandidateRecord {
- proposal_mutation_id: RadrootsTradeMutationId,
+ proposal_mutation_id: MutationId,
author_pubkey: PublicKey,
- candidate: RadrootsTradeCandidateTermsV1,
+ candidate: TradeCandidateTermsV1,
}
struct DecisionApplication<'a> {
- mutation_id: &'a RadrootsTradeMutationId,
- mutation: &'a RadrootsTradeMutationEnvelopeV1,
- proposal_mutation_id: &'a RadrootsTradeMutationId,
- candidate_id: &'a RadrootsTradeCandidateId,
- decision: &'a RadrootsTradeDecisionV1,
+ mutation_id: &'a MutationId,
+ mutation: &'a TradeMutationEnvelopeV1,
+ proposal_mutation_id: &'a MutationId,
+ candidate_id: &'a CandidateId,
+ decision: &'a TradeDecisionV1,
}
#[derive(Clone, Debug, PartialEq, Eq)]
struct CancellationRecord {
- mutation_id: RadrootsTradeMutationId,
- parent_mutation_ids: Vec<RadrootsTradeMutationId>,
- target_candidate_id: Option<RadrootsTradeCandidateId>,
- target_claim_mutation_id: Option<RadrootsTradeMutationId>,
+ mutation_id: MutationId,
+ parent_mutation_ids: Vec<MutationId>,
+ target_candidate_id: Option<CandidateId>,
+ target_claim_mutation_id: Option<MutationId>,
}
pub fn reduce_trade_records(input: RadrootsTradeReductionInputV1) -> RadrootsTradeProjectionV1 {
let mut projection = RadrootsTradeProjectionV1::empty(input.trade_id.clone());
- let mut mutations = BTreeMap::<RadrootsTradeMutationId, RadrootsTradeMutationEnvelopeV1>::new();
+ let mut mutations = BTreeMap::<MutationId, TradeMutationEnvelopeV1>::new();
for record in input.mutations {
let mutation_id = match record.mutation.mutation_id.clone() {
@@ -483,16 +479,15 @@ pub fn reduce_trade_records(input: RadrootsTradeReductionInputV1) -> RadrootsTra
mutations.entry(mutation_id).or_insert(record.mutation);
}
- let mut root_proposals = Vec::<RadrootsTradeMutationId>::new();
- let mut candidates_by_proposal = BTreeMap::<RadrootsTradeMutationId, CandidateRecord>::new();
- let mut claims = BTreeMap::<RadrootsTradeMutationId, RadrootsTradeAgreementClaimV1>::new();
- let mut decisions_by_proposal =
- BTreeMap::<RadrootsTradeMutationId, Vec<RadrootsTradeMutationId>>::new();
+ let mut root_proposals = Vec::<MutationId>::new();
+ let mut candidates_by_proposal = BTreeMap::<MutationId, CandidateRecord>::new();
+ let mut claims = BTreeMap::<MutationId, RadrootsTradeAgreementClaimV1>::new();
+ let mut decisions_by_proposal = BTreeMap::<MutationId, Vec<MutationId>>::new();
let mut cancellations = Vec::<CancellationRecord>::new();
- let mut referenced_parents = BTreeSet::<RadrootsTradeMutationId>::new();
+ let mut referenced_parents = BTreeSet::<MutationId>::new();
for (mutation_id, mutation) in &mutations {
- if matches!(mutation.body, RadrootsTradeMutationBodyV1::Proposal { .. }) {
+ if matches!(mutation.body, TradeMutationBodyV1::Proposal { .. }) {
root_proposals.push(mutation_id.clone());
}
for parent in &mutation.parent_mutation_ids {
@@ -508,8 +503,8 @@ pub fn reduce_trade_records(input: RadrootsTradeReductionInputV1) -> RadrootsTra
}
}
match &mutation.body {
- RadrootsTradeMutationBodyV1::Proposal { candidate }
- | RadrootsTradeMutationBodyV1::RevisionProposal { candidate } => {
+ TradeMutationBodyV1::Proposal { candidate }
+ | TradeMutationBodyV1::RevisionProposal { candidate } => {
candidates_by_proposal.insert(
mutation_id.clone(),
CandidateRecord {
@@ -519,9 +514,9 @@ pub fn reduce_trade_records(input: RadrootsTradeReductionInputV1) -> RadrootsTra
},
);
}
- RadrootsTradeMutationBodyV1::Decision { .. }
- | RadrootsTradeMutationBodyV1::RevisionDecision { .. } => {}
- RadrootsTradeMutationBodyV1::Cancellation {
+ TradeMutationBodyV1::Decision { .. } | TradeMutationBodyV1::RevisionDecision { .. } => {
+ }
+ TradeMutationBodyV1::Cancellation {
target_candidate_id,
target_claim_mutation_id,
reason: _,
@@ -536,12 +531,12 @@ pub fn reduce_trade_records(input: RadrootsTradeReductionInputV1) -> RadrootsTra
for (mutation_id, mutation) in &mutations {
match &mutation.body {
- RadrootsTradeMutationBodyV1::Decision {
+ TradeMutationBodyV1::Decision {
proposal_mutation_id,
candidate_id,
decision,
}
- | RadrootsTradeMutationBodyV1::RevisionDecision {
+ | TradeMutationBodyV1::RevisionDecision {
proposal_mutation_id,
candidate_id,
decision,
@@ -588,7 +583,7 @@ pub fn reduce_trade_records(input: RadrootsTradeReductionInputV1) -> RadrootsTra
}
for (proposal_mutation_id, decision_ids) in &decisions_by_proposal {
- let unique: BTreeSet<RadrootsTradeMutationId> = decision_ids.iter().cloned().collect();
+ let unique: BTreeSet<MutationId> = decision_ids.iter().cloned().collect();
if unique.len() > 1 {
let accept_count = unique
.iter()
@@ -671,8 +666,8 @@ pub fn reduce_trade_records(input: RadrootsTradeReductionInputV1) -> RadrootsTra
fn apply_decision(
application: DecisionApplication<'_>,
- candidates_by_proposal: &BTreeMap<RadrootsTradeMutationId, CandidateRecord>,
- claims: &mut BTreeMap<RadrootsTradeMutationId, RadrootsTradeAgreementClaimV1>,
+ candidates_by_proposal: &BTreeMap<MutationId, CandidateRecord>,
+ claims: &mut BTreeMap<MutationId, RadrootsTradeAgreementClaimV1>,
projection: &mut RadrootsTradeProjectionV1,
) {
let DecisionApplication {
@@ -728,7 +723,7 @@ fn apply_decision(
);
}
match decision {
- RadrootsTradeDecisionV1::Accepted {
+ TradeDecisionV1::Accepted {
reservation_assertion,
} => {
let Some(reservation) = reservation_assertion else {
@@ -759,13 +754,13 @@ fn apply_decision(
);
}
}
- RadrootsTradeDecisionV1::Declined { .. } => {}
+ TradeDecisionV1::Declined { .. } => {}
}
}
fn candidate_record_author_counterparty(
candidate_record: &CandidateRecord,
- mutation: &RadrootsTradeMutationEnvelopeV1,
+ mutation: &TradeMutationEnvelopeV1,
) -> PublicKey {
if candidate_record.author_pubkey == mutation.buyer_pubkey {
mutation.seller_pubkey
@@ -775,10 +770,10 @@ fn candidate_record_author_counterparty(
}
fn validate_reservation(
- decision_mutation_id: &RadrootsTradeMutationId,
- candidate_id: &RadrootsTradeCandidateId,
- candidate: &RadrootsTradeCandidateTermsV1,
- reservation: &RadrootsSellerReservationAssertionV1,
+ decision_mutation_id: &MutationId,
+ candidate_id: &CandidateId,
+ candidate: &TradeCandidateTermsV1,
+ reservation: &SellerReservationAssertionV1,
projection: &mut RadrootsTradeProjectionV1,
) -> bool {
let mut valid = true;
@@ -831,9 +826,9 @@ fn validate_reservation(
fn apply_agreement_state(
projection: &mut RadrootsTradeProjectionV1,
- claims: &BTreeMap<RadrootsTradeMutationId, RadrootsTradeAgreementClaimV1>,
- mutations: &BTreeMap<RadrootsTradeMutationId, RadrootsTradeMutationEnvelopeV1>,
- candidates_by_proposal: &BTreeMap<RadrootsTradeMutationId, CandidateRecord>,
+ claims: &BTreeMap<MutationId, RadrootsTradeAgreementClaimV1>,
+ mutations: &BTreeMap<MutationId, TradeMutationEnvelopeV1>,
+ candidates_by_proposal: &BTreeMap<MutationId, CandidateRecord>,
cancellations: &[CancellationRecord],
) {
if claims.is_empty() {
@@ -891,7 +886,7 @@ fn apply_agreement_state(
fn cancellation_without_claim(
cancellations: &[CancellationRecord],
- candidates_by_proposal: &BTreeMap<RadrootsTradeMutationId, CandidateRecord>,
+ candidates_by_proposal: &BTreeMap<MutationId, CandidateRecord>,
) -> bool {
cancellations.iter().any(|cancellation| {
cancellation
@@ -907,10 +902,10 @@ fn cancellation_without_claim(
}
fn non_dominated_claim_ids(
- claims: &BTreeMap<RadrootsTradeMutationId, RadrootsTradeAgreementClaimV1>,
- mutations: &BTreeMap<RadrootsTradeMutationId, RadrootsTradeMutationEnvelopeV1>,
-) -> Vec<RadrootsTradeMutationId> {
- let mut memo = BTreeMap::<RadrootsTradeMutationId, BTreeSet<RadrootsTradeMutationId>>::new();
+ claims: &BTreeMap<MutationId, RadrootsTradeAgreementClaimV1>,
+ mutations: &BTreeMap<MutationId, TradeMutationEnvelopeV1>,
+) -> Vec<MutationId> {
+ let mut memo = BTreeMap::<MutationId, BTreeSet<MutationId>>::new();
claims
.keys()
.filter(|claim_id| {
@@ -934,10 +929,10 @@ fn compatible_claims(claims: &[&RadrootsTradeAgreementClaimV1]) -> bool {
}
fn ancestors_of(
- mutation_id: &RadrootsTradeMutationId,
- mutations: &BTreeMap<RadrootsTradeMutationId, RadrootsTradeMutationEnvelopeV1>,
- memo: &mut BTreeMap<RadrootsTradeMutationId, BTreeSet<RadrootsTradeMutationId>>,
-) -> BTreeSet<RadrootsTradeMutationId> {
+ mutation_id: &MutationId,
+ mutations: &BTreeMap<MutationId, TradeMutationEnvelopeV1>,
+ memo: &mut BTreeMap<MutationId, BTreeSet<MutationId>>,
+) -> BTreeSet<MutationId> {
if let Some(cached) = memo.get(mutation_id) {
return cached.clone();
}
@@ -954,8 +949,8 @@ fn ancestors_of(
fn apply_negotiation_state(
projection: &mut RadrootsTradeProjectionV1,
- candidates_by_proposal: &BTreeMap<RadrootsTradeMutationId, CandidateRecord>,
- claims: &BTreeMap<RadrootsTradeMutationId, RadrootsTradeAgreementClaimV1>,
+ candidates_by_proposal: &BTreeMap<MutationId, CandidateRecord>,
+ claims: &BTreeMap<MutationId, RadrootsTradeAgreementClaimV1>,
observed_at_unix_s: Option<u64>,
) {
if candidates_by_proposal.is_empty() {
@@ -977,7 +972,7 @@ fn apply_negotiation_state(
fn reduce_private_terms_state(
projection: &RadrootsTradeProjectionV1,
- candidates_by_proposal: &BTreeMap<RadrootsTradeMutationId, CandidateRecord>,
+ candidates_by_proposal: &BTreeMap<MutationId, CandidateRecord>,
private_terms: &[RadrootsTradePrivateTermsEvidenceV1],
) -> RadrootsTradePrivateTermsStateV1 {
let private_terms_by_candidate = private_terms
@@ -1052,19 +1047,19 @@ fn reduce_evidence_state(
}
fn declined_candidate_ids(
- mutations: &BTreeMap<RadrootsTradeMutationId, RadrootsTradeMutationEnvelopeV1>,
-) -> Vec<RadrootsTradeCandidateId> {
+ mutations: &BTreeMap<MutationId, TradeMutationEnvelopeV1>,
+) -> Vec<CandidateId> {
mutations
.values()
.filter_map(|mutation| match &mutation.body {
- RadrootsTradeMutationBodyV1::Decision {
+ TradeMutationBodyV1::Decision {
candidate_id,
- decision: RadrootsTradeDecisionV1::Declined { .. },
+ decision: TradeDecisionV1::Declined { .. },
..
}
- | RadrootsTradeMutationBodyV1::RevisionDecision {
+ | TradeMutationBodyV1::RevisionDecision {
candidate_id,
- decision: RadrootsTradeDecisionV1::Declined { .. },
+ decision: TradeDecisionV1::Declined { .. },
..
} => Some(candidate_id.clone()),
_ => None,
@@ -1072,14 +1067,14 @@ fn declined_candidate_ids(
.collect()
}
-fn is_acceptance(body: &RadrootsTradeMutationBodyV1) -> bool {
+fn is_acceptance(body: &TradeMutationBodyV1) -> bool {
matches!(
body,
- RadrootsTradeMutationBodyV1::Decision {
- decision: RadrootsTradeDecisionV1::Accepted { .. },
+ TradeMutationBodyV1::Decision {
+ decision: TradeDecisionV1::Accepted { .. },
..
- } | RadrootsTradeMutationBodyV1::RevisionDecision {
- decision: RadrootsTradeDecisionV1::Accepted { .. },
+ } | TradeMutationBodyV1::RevisionDecision {
+ decision: TradeDecisionV1::Accepted { .. },
..
}
)
@@ -1118,15 +1113,14 @@ fn projection_digest(_projection: &RadrootsTradeProjectionV1) -> String {
mod tests {
use super::*;
use radroots_event::{
- id::{RadrootsClassifiedListingAddress, RadrootsInventoryBinId},
+ id::{ClassifiedListingAddress, InventoryBinId},
trade::{
- RADROOTS_TRADE_DECISION_CONTRACT_ID, RADROOTS_TRADE_PROPOSAL_CONTRACT_ID,
- RADROOTS_TRADE_REVISION_DECISION_CONTRACT_ID,
- RADROOTS_TRADE_REVISION_PROPOSAL_CONTRACT_ID, RadrootsFulfillmentProfileV1,
- RadrootsSellerReservationLineV1, RadrootsTradeCancellationProfileV1,
- RadrootsTradeCandidateLineV1, RadrootsTradeEconomicAdjustmentV1,
- RadrootsTradeEconomicsProfileV1, RadrootsTradeLineTombstoneV1,
- RadrootsTradePrivateTermsRefV1, canonical_trade_mutation_content,
+ FulfillmentProfileV1, RADROOTS_TRADE_DECISION_CONTRACT_ID,
+ RADROOTS_TRADE_PROPOSAL_CONTRACT_ID, RADROOTS_TRADE_REVISION_DECISION_CONTRACT_ID,
+ RADROOTS_TRADE_REVISION_PROPOSAL_CONTRACT_ID, SellerReservationLineV1,
+ TradeCancellationProfileV1, TradeCandidateLineV1, TradeEconomicAdjustmentV1,
+ TradeEconomicsProfileV1, TradeLineTombstoneV1, TradePrivateTermsRefV1,
+ canonical_trade_mutation_content,
},
};
use radroots_test_fixtures::{FIXTURE_ALICE_PUBLIC_KEY_HEX, FIXTURE_BOB_PUBLIC_KEY_HEX};
@@ -1148,24 +1142,24 @@ mod tests {
PublicKey::from_hex(public_key_hex).expect("fixture pubkey")
}
- fn event_id(character: char) -> RadrootsEventId {
- RadrootsEventId::parse(hex_64(character)).unwrap()
+ fn event_id(character: char) -> EventId {
+ EventId::parse(hex_64(character)).unwrap()
}
- fn trade_id() -> RadrootsTradeId {
- RadrootsTradeId::parse(hex_32('1')).unwrap()
+ fn trade_id() -> TradeId {
+ TradeId::parse(hex_32('1')).unwrap()
}
- fn dtag(value: &str) -> RadrootsDTag {
- RadrootsDTag::parse(value).unwrap()
+ fn dtag(value: &str) -> DTag {
+ DTag::parse(value).unwrap()
}
- fn bin_id(value: &str) -> RadrootsInventoryBinId {
- RadrootsInventoryBinId::parse(value).unwrap()
+ fn bin_id(value: &str) -> InventoryBinId {
+ InventoryBinId::parse(value).unwrap()
}
- fn candidate(line_suffix: &str) -> RadrootsTradeCandidateTermsV1 {
- RadrootsTradeCandidateTermsV1 {
+ fn candidate(line_suffix: &str) -> TradeCandidateTermsV1 {
+ TradeCandidateTermsV1 {
candidate_id: None,
schema_version: RADROOTS_TRADE_SCHEMA_VERSION,
base_candidate_id: None,
@@ -1173,9 +1167,9 @@ mod tests {
buyer_pubkey: pubkey('a'),
seller_pubkey: pubkey('b'),
farm_id: dtag("farm-1"),
- lines: vec![RadrootsTradeCandidateLineV1 {
+ lines: vec![TradeCandidateLineV1 {
line_id: dtag(&format!("line-{line_suffix}")),
- listing_addr: RadrootsClassifiedListingAddress::parse(format!(
+ listing_addr: ClassifiedListingAddress::parse(format!(
"30402:{}:listing-{line_suffix}",
FIXTURE_BOB_PUBLIC_KEY_HEX
))
@@ -1194,8 +1188,8 @@ mod tests {
line_subtotal_mantissa: "1000".to_string(),
replaces_line_id: None,
}],
- line_tombstones: Vec::<RadrootsTradeLineTombstoneV1>::new(),
- economics: RadrootsTradeEconomicsProfileV1 {
+ line_tombstones: Vec::<TradeLineTombstoneV1>::new(),
+ economics: TradeEconomicsProfileV1 {
profile_id: "mvp-fixed".to_string(),
currency_code: "USD".to_string(),
currency_exponent: 2,
@@ -1204,9 +1198,9 @@ mod tests {
discount_total_mantissa: "0".to_string(),
adjustment_total_mantissa: "0".to_string(),
total_mantissa: "1000".to_string(),
- adjustments: Vec::<RadrootsTradeEconomicAdjustmentV1>::new(),
+ adjustments: Vec::<TradeEconomicAdjustmentV1>::new(),
},
- fulfillment: RadrootsFulfillmentProfileV1 {
+ fulfillment: FulfillmentProfileV1 {
profile_id: "market-pickup".to_string(),
method: "pickup".to_string(),
starts_at_unix_s: 1_800_000_000,
@@ -1217,7 +1211,7 @@ mod tests {
location_class: "farmstand".to_string(),
requires_private_terms: false,
},
- cancellation: RadrootsTradeCancellationProfileV1 {
+ cancellation: TradeCancellationProfileV1 {
profile_id: "buyer-pre-agreement".to_string(),
buyer_pre_agreement: true,
post_agreement_cutoff_unix_s: Some(1_799_990_000),
@@ -1227,8 +1221,8 @@ mod tests {
}
}
- fn proposal() -> RadrootsTradeMutationEnvelopeV1 {
- canonical_trade_mutation_content(RadrootsTradeMutationEnvelopeV1 {
+ fn proposal() -> TradeMutationEnvelopeV1 {
+ canonical_trade_mutation_content(TradeMutationEnvelopeV1 {
mutation_id: None,
contract_id: RADROOTS_TRADE_PROPOSAL_CONTRACT_ID.to_string(),
schema_version: RADROOTS_TRADE_SCHEMA_VERSION,
@@ -1241,7 +1235,7 @@ mod tests {
author_pubkey: pubkey('a'),
counterparty_pubkey: pubkey('b'),
authored_at_unix_s: 100,
- body: RadrootsTradeMutationBodyV1::Proposal {
+ body: TradeMutationBodyV1::Proposal {
candidate: candidate("1"),
},
})
@@ -1250,10 +1244,10 @@ mod tests {
}
fn reservation(
- candidate: &RadrootsTradeCandidateTermsV1,
+ candidate: &TradeCandidateTermsV1,
marker: char,
- ) -> RadrootsSellerReservationAssertionV1 {
- RadrootsSellerReservationAssertionV1 {
+ ) -> SellerReservationAssertionV1 {
+ SellerReservationAssertionV1 {
reservation_id: dtag(&format!("reservation-{marker}")),
inventory_authority_id: candidate.seller_pubkey,
inventory_epoch: 42,
@@ -1261,7 +1255,7 @@ mod tests {
commitments: candidate
.lines
.iter()
- .map(|line| RadrootsSellerReservationLineV1 {
+ .map(|line| SellerReservationLineV1 {
line_id: line.line_id.clone(),
bin_id: line.bin_id.clone(),
quantity_mantissa: line.quantity_mantissa.clone(),
@@ -1275,16 +1269,16 @@ mod tests {
}
fn accepted_decision(
- proposal: &RadrootsTradeMutationEnvelopeV1,
+ proposal: &TradeMutationEnvelopeV1,
marker: char,
- ) -> RadrootsTradeMutationEnvelopeV1 {
+ ) -> TradeMutationEnvelopeV1 {
let proposal_id = proposal.mutation_id.clone().unwrap();
let candidate = match &proposal.body {
- RadrootsTradeMutationBodyV1::Proposal { candidate }
- | RadrootsTradeMutationBodyV1::RevisionProposal { candidate } => candidate.clone(),
+ TradeMutationBodyV1::Proposal { candidate }
+ | TradeMutationBodyV1::RevisionProposal { candidate } => candidate.clone(),
_ => unreachable!(),
};
- canonical_trade_mutation_content(RadrootsTradeMutationEnvelopeV1 {
+ canonical_trade_mutation_content(TradeMutationEnvelopeV1 {
mutation_id: None,
contract_id: RADROOTS_TRADE_DECISION_CONTRACT_ID.to_string(),
schema_version: RADROOTS_TRADE_SCHEMA_VERSION,
@@ -1297,10 +1291,10 @@ mod tests {
author_pubkey: pubkey('b'),
counterparty_pubkey: pubkey('a'),
authored_at_unix_s: u64::from(marker),
- body: RadrootsTradeMutationBodyV1::Decision {
+ body: TradeMutationBodyV1::Decision {
proposal_mutation_id: proposal_id,
candidate_id: candidate.candidate_id.clone().unwrap(),
- decision: RadrootsTradeDecisionV1::Accepted {
+ decision: TradeDecisionV1::Accepted {
reservation_assertion: Some(reservation(&candidate, marker)),
},
},
@@ -1309,16 +1303,14 @@ mod tests {
.envelope
}
- fn declined_decision(
- proposal: &RadrootsTradeMutationEnvelopeV1,
- ) -> RadrootsTradeMutationEnvelopeV1 {
+ fn declined_decision(proposal: &TradeMutationEnvelopeV1) -> TradeMutationEnvelopeV1 {
let proposal_id = proposal.mutation_id.clone().unwrap();
let candidate = match &proposal.body {
- RadrootsTradeMutationBodyV1::Proposal { candidate }
- | RadrootsTradeMutationBodyV1::RevisionProposal { candidate } => candidate.clone(),
+ TradeMutationBodyV1::Proposal { candidate }
+ | TradeMutationBodyV1::RevisionProposal { candidate } => candidate.clone(),
_ => unreachable!(),
};
- canonical_trade_mutation_content(RadrootsTradeMutationEnvelopeV1 {
+ canonical_trade_mutation_content(TradeMutationEnvelopeV1 {
mutation_id: None,
contract_id: RADROOTS_TRADE_DECISION_CONTRACT_ID.to_string(),
schema_version: RADROOTS_TRADE_SCHEMA_VERSION,
@@ -1331,10 +1323,10 @@ mod tests {
author_pubkey: pubkey('b'),
counterparty_pubkey: pubkey('a'),
authored_at_unix_s: 102,
- body: RadrootsTradeMutationBodyV1::Decision {
+ body: TradeMutationBodyV1::Decision {
proposal_mutation_id: proposal_id,
candidate_id: candidate.candidate_id.clone().unwrap(),
- decision: RadrootsTradeDecisionV1::Declined {
+ decision: TradeDecisionV1::Declined {
reason: "unavailable".to_string(),
},
},
@@ -1344,12 +1336,12 @@ mod tests {
}
fn revision_proposal(
- root: &RadrootsTradeMutationEnvelopeV1,
- parents: Vec<RadrootsTradeMutationId>,
- ) -> RadrootsTradeMutationEnvelopeV1 {
+ root: &TradeMutationEnvelopeV1,
+ parents: Vec<MutationId>,
+ ) -> TradeMutationEnvelopeV1 {
let mut parents = parents;
parents.sort();
- canonical_trade_mutation_content(RadrootsTradeMutationEnvelopeV1 {
+ canonical_trade_mutation_content(TradeMutationEnvelopeV1 {
mutation_id: None,
contract_id: RADROOTS_TRADE_REVISION_PROPOSAL_CONTRACT_ID.to_string(),
schema_version: RADROOTS_TRADE_SCHEMA_VERSION,
@@ -1362,7 +1354,7 @@ mod tests {
author_pubkey: pubkey('a'),
counterparty_pubkey: pubkey('b'),
authored_at_unix_s: 200,
- body: RadrootsTradeMutationBodyV1::RevisionProposal {
+ body: TradeMutationBodyV1::RevisionProposal {
candidate: candidate("2"),
},
})
@@ -1371,15 +1363,15 @@ mod tests {
}
fn revision_acceptance(
- root: &RadrootsTradeMutationEnvelopeV1,
- proposal: &RadrootsTradeMutationEnvelopeV1,
- ) -> RadrootsTradeMutationEnvelopeV1 {
+ root: &TradeMutationEnvelopeV1,
+ proposal: &TradeMutationEnvelopeV1,
+ ) -> TradeMutationEnvelopeV1 {
let proposal_id = proposal.mutation_id.clone().unwrap();
let candidate = match &proposal.body {
- RadrootsTradeMutationBodyV1::RevisionProposal { candidate } => candidate.clone(),
+ TradeMutationBodyV1::RevisionProposal { candidate } => candidate.clone(),
_ => unreachable!(),
};
- canonical_trade_mutation_content(RadrootsTradeMutationEnvelopeV1 {
+ canonical_trade_mutation_content(TradeMutationEnvelopeV1 {
mutation_id: None,
contract_id: RADROOTS_TRADE_REVISION_DECISION_CONTRACT_ID.to_string(),
schema_version: RADROOTS_TRADE_SCHEMA_VERSION,
@@ -1392,10 +1384,10 @@ mod tests {
author_pubkey: pubkey('b'),
counterparty_pubkey: pubkey('a'),
authored_at_unix_s: 201,
- body: RadrootsTradeMutationBodyV1::RevisionDecision {
+ body: TradeMutationBodyV1::RevisionDecision {
proposal_mutation_id: proposal_id,
candidate_id: candidate.candidate_id.clone().unwrap(),
- decision: RadrootsTradeDecisionV1::Accepted {
+ decision: TradeDecisionV1::Accepted {
reservation_assertion: Some(reservation(&candidate, '9')),
},
},
@@ -1405,11 +1397,11 @@ mod tests {
}
fn cancellation(
- root: &RadrootsTradeMutationEnvelopeV1,
- target_claim: RadrootsTradeMutationId,
- parent: RadrootsTradeMutationId,
- ) -> RadrootsTradeMutationEnvelopeV1 {
- canonical_trade_mutation_content(RadrootsTradeMutationEnvelopeV1 {
+ root: &TradeMutationEnvelopeV1,
+ target_claim: MutationId,
+ parent: MutationId,
+ ) -> TradeMutationEnvelopeV1 {
+ canonical_trade_mutation_content(TradeMutationEnvelopeV1 {
mutation_id: None,
contract_id: radroots_event::trade::RADROOTS_TRADE_CANCELLATION_CONTRACT_ID.to_string(),
schema_version: RADROOTS_TRADE_SCHEMA_VERSION,
@@ -1422,7 +1414,7 @@ mod tests {
author_pubkey: pubkey('a'),
counterparty_pubkey: pubkey('b'),
authored_at_unix_s: 300,
- body: RadrootsTradeMutationBodyV1::Cancellation {
+ body: TradeMutationBodyV1::Cancellation {
target_candidate_id: None,
target_claim_mutation_id: Some(target_claim),
reason: "before cutoff".to_string(),
@@ -1432,42 +1424,38 @@ mod tests {
.envelope
}
- fn root_id(envelope: &RadrootsTradeMutationEnvelopeV1) -> RadrootsTradeMutationId {
+ fn root_id(envelope: &TradeMutationEnvelopeV1) -> MutationId {
envelope.mutation_id.clone().unwrap()
}
- fn record(mutation: RadrootsTradeMutationEnvelopeV1) -> RadrootsTradeMutationRecordV1 {
+ fn record(mutation: TradeMutationEnvelopeV1) -> RadrootsTradeMutationRecordV1 {
RadrootsTradeMutationRecordV1 {
transport_event_id: None,
mutation,
}
}
- fn reduce(mutations: Vec<RadrootsTradeMutationEnvelopeV1>) -> RadrootsTradeProjectionV1 {
+ fn reduce(mutations: Vec<TradeMutationEnvelopeV1>) -> RadrootsTradeProjectionV1 {
let mut input = RadrootsTradeReductionInputV1::new(trade_id());
input.mutations = mutations.into_iter().map(record).collect();
reduce_trade_records(input)
}
- fn recanonicalize(
- mut mutation: RadrootsTradeMutationEnvelopeV1,
- ) -> RadrootsTradeMutationEnvelopeV1 {
+ fn recanonicalize(mut mutation: TradeMutationEnvelopeV1) -> TradeMutationEnvelopeV1 {
mutation.mutation_id = None;
canonical_trade_mutation_content(mutation)
.expect("recanonicalized mutation")
.envelope
}
- fn candidate_cancellation(
- root: &RadrootsTradeMutationEnvelopeV1,
- ) -> RadrootsTradeMutationEnvelopeV1 {
+ fn candidate_cancellation(root: &TradeMutationEnvelopeV1) -> TradeMutationEnvelopeV1 {
let candidate_id = match &root.body {
- RadrootsTradeMutationBodyV1::Proposal { candidate } => {
+ TradeMutationBodyV1::Proposal { candidate } => {
candidate.candidate_id.clone().expect("candidate id")
}
_ => unreachable!(),
};
- canonical_trade_mutation_content(RadrootsTradeMutationEnvelopeV1 {
+ canonical_trade_mutation_content(TradeMutationEnvelopeV1 {
mutation_id: None,
contract_id: radroots_event::trade::RADROOTS_TRADE_CANCELLATION_CONTRACT_ID.to_string(),
schema_version: RADROOTS_TRADE_SCHEMA_VERSION,
@@ -1480,7 +1468,7 @@ mod tests {
author_pubkey: pubkey('a'),
counterparty_pubkey: pubkey('b'),
authored_at_unix_s: 301,
- body: RadrootsTradeMutationBodyV1::Cancellation {
+ body: TradeMutationBodyV1::Cancellation {
target_candidate_id: Some(candidate_id),
target_claim_mutation_id: None,
reason: "cancel before agreement".to_string(),
@@ -1554,9 +1542,9 @@ mod tests {
fn reducer_keeps_missing_parents_as_incomplete_evidence() {
let proposal = proposal();
let mut decision = accepted_decision(&proposal, '1');
- let missing_parent = RadrootsTradeMutationId::parse(hex_64('e')).unwrap();
+ let missing_parent = MutationId::parse(hex_64('e')).unwrap();
decision.parent_mutation_ids = vec![missing_parent.clone()];
- let decision = canonical_trade_mutation_content(RadrootsTradeMutationEnvelopeV1 {
+ let decision = canonical_trade_mutation_content(TradeMutationEnvelopeV1 {
mutation_id: None,
..decision
})
@@ -1619,8 +1607,8 @@ mod tests {
#[test]
fn reducer_tracks_private_terms_without_hiding_claims() {
let mut root = proposal();
- if let RadrootsTradeMutationBodyV1::Proposal { candidate } = &mut root.body {
- candidate.private_terms = Some(RadrootsTradePrivateTermsRefV1 {
+ if let TradeMutationBodyV1::Proposal { candidate } = &mut root.body {
+ candidate.private_terms = Some(TradePrivateTermsRefV1 {
artifact_id: "artifact-1".to_string(),
schema_id: "radroots.private.fulfillment.v1".to_string(),
ciphertext_commitment: hex_64('f'),
@@ -1628,7 +1616,7 @@ mod tests {
});
candidate.fulfillment.requires_private_terms = true;
}
- let root = canonical_trade_mutation_content(RadrootsTradeMutationEnvelopeV1 {
+ let root = canonical_trade_mutation_content(TradeMutationEnvelopeV1 {
mutation_id: None,
..root
})
@@ -1730,7 +1718,7 @@ mod tests {
.contains(&RadrootsTradeReducerIssueV1::MultipleRootProposals)
);
- let foreign_trade = RadrootsTradeId::parse(hex_32('2')).expect("foreign trade");
+ let foreign_trade = TradeId::parse(hex_32('2')).expect("foreign trade");
let mut input = RadrootsTradeReductionInputV1::new(foreign_trade);
input.mutations = vec![record(proposal())];
let foreign = reduce_trade_records(input);
@@ -1753,10 +1741,8 @@ mod tests {
);
let mut wrong_candidate = accepted_decision(&root, '1');
- if let RadrootsTradeMutationBodyV1::Decision { candidate_id, .. } =
- &mut wrong_candidate.body
- {
- *candidate_id = RadrootsTradeCandidateId::parse(hex_64('f')).expect("candidate id");
+ if let TradeMutationBodyV1::Decision { candidate_id, .. } = &mut wrong_candidate.body {
+ *candidate_id = CandidateId::parse(hex_64('f')).expect("candidate id");
}
let wrong_candidate = recanonicalize(wrong_candidate);
let projection = reduce(vec![root.clone(), wrong_candidate]);
@@ -1776,8 +1762,8 @@ mod tests {
)));
let mut no_reservation = accepted_decision(&root, '3');
- if let RadrootsTradeMutationBodyV1::Decision { decision, .. } = &mut no_reservation.body {
- *decision = RadrootsTradeDecisionV1::Accepted {
+ if let TradeMutationBodyV1::Decision { decision, .. } = &mut no_reservation.body {
+ *decision = TradeDecisionV1::Accepted {
reservation_assertion: None,
};
}
@@ -1793,16 +1779,15 @@ mod tests {
fn reducer_rejects_every_reservation_mismatch() {
let root = proposal();
let mut mismatched = accepted_decision(&root, '4');
- if let RadrootsTradeMutationBodyV1::Decision {
+ if let TradeMutationBodyV1::Decision {
decision:
- RadrootsTradeDecisionV1::Accepted {
+ TradeDecisionV1::Accepted {
reservation_assertion: Some(reservation),
},
..
} = &mut mismatched.body
{
- reservation.candidate_id =
- RadrootsTradeCandidateId::parse(hex_64('f')).expect("candidate id");
+ reservation.candidate_id = CandidateId::parse(hex_64('f')).expect("candidate id");
reservation.inventory_authority_id = pubkey('a');
reservation.commitments[0].unit_code = "kg".to_string();
}
@@ -1826,9 +1811,9 @@ mod tests {
);
let mut wrong_count = accepted_decision(&root, '5');
- if let RadrootsTradeMutationBodyV1::Decision {
+ if let TradeMutationBodyV1::Decision {
decision:
- RadrootsTradeDecisionV1::Accepted {
+ TradeDecisionV1::Accepted {
reservation_assertion: Some(reservation),
},
..
@@ -1895,8 +1880,8 @@ mod tests {
#[test]
fn reducer_covers_private_terms_and_attestation_precedence() {
let mut root = proposal();
- if let RadrootsTradeMutationBodyV1::Proposal { candidate } = &mut root.body {
- candidate.private_terms = Some(RadrootsTradePrivateTermsRefV1 {
+ if let TradeMutationBodyV1::Proposal { candidate } = &mut root.body {
+ candidate.private_terms = Some(TradePrivateTermsRefV1 {
artifact_id: "artifact-1".to_string(),
schema_id: "radroots.private.fulfillment.v1".to_string(),
ciphertext_commitment: hex_64('f'),
@@ -1905,7 +1890,7 @@ mod tests {
}
let root = recanonicalize(root);
let candidate_id = match &root.body {
- RadrootsTradeMutationBodyV1::Proposal { candidate } => {
+ TradeMutationBodyV1::Proposal { candidate } => {
candidate.candidate_id.clone().expect("candidate id")
}
_ => unreachable!(),
@@ -1964,7 +1949,7 @@ mod tests {
#[test]
fn reducer_private_helpers_cover_empty_graph_and_conflict_precedence() {
- let missing = RadrootsTradeMutationId::parse(hex_64('e')).expect("mutation id");
+ let missing = MutationId::parse(hex_64('e')).expect("mutation id");
assert!(ancestors_of(&missing, &BTreeMap::new(), &mut BTreeMap::new()).is_empty());
let mut conflict = RadrootsTradeConflictStateV1::DecisionConflict;
@@ -2001,8 +1986,8 @@ mod tests {
let first = declined_decision(&root);
let mut second = first.clone();
second.authored_at_unix_s += 1;
- if let RadrootsTradeMutationBodyV1::Decision {
- decision: RadrootsTradeDecisionV1::Declined { reason },
+ if let TradeMutationBodyV1::Decision {
+ decision: TradeDecisionV1::Declined { reason },
..
} = &mut second.body
{
@@ -2017,7 +2002,7 @@ mod tests {
let revision = revision_proposal(&root, vec![root_id(&root)]);
let mut revision_decline = declined_decision(&revision);
- let RadrootsTradeMutationBodyV1::Decision {
+ let TradeMutationBodyV1::Decision {
proposal_mutation_id,
candidate_id,
decision,
@@ -2027,7 +2012,7 @@ mod tests {
};
revision_decline.contract_id = RADROOTS_TRADE_REVISION_DECISION_CONTRACT_ID.to_string();
revision_decline.root_mutation_id = Some(root_id(&root));
- revision_decline.body = RadrootsTradeMutationBodyV1::RevisionDecision {
+ revision_decline.body = TradeMutationBodyV1::RevisionDecision {
proposal_mutation_id,
candidate_id: candidate_id.clone(),
decision,
@@ -2042,7 +2027,7 @@ mod tests {
);
let candidate = match &root.body {
- RadrootsTradeMutationBodyV1::Proposal { candidate } => candidate.clone(),
+ TradeMutationBodyV1::Proposal { candidate } => candidate.clone(),
_ => unreachable!(),
};
let mut candidate_record = CandidateRecord {
@@ -2066,7 +2051,7 @@ mod tests {
fn reservation_line_validation_checks_each_field() {
let root = proposal();
let candidate = match &root.body {
- RadrootsTradeMutationBodyV1::Proposal { candidate } => candidate.clone(),
+ TradeMutationBodyV1::Proposal { candidate } => candidate.clone(),
_ => unreachable!(),
};
let candidate_id = candidate.candidate_id.clone().expect("candidate id");
@@ -2105,11 +2090,11 @@ mod tests {
let first_id = root_id(&first_decision);
let second_id = root_id(&second_decision);
let candidate = match &root.body {
- RadrootsTradeMutationBodyV1::Proposal { candidate } => candidate.clone(),
+ TradeMutationBodyV1::Proposal { candidate } => candidate.clone(),
_ => unreachable!(),
};
let candidate_id = candidate.candidate_id.clone().expect("candidate id");
- let claim = |claim_mutation_id: RadrootsTradeMutationId| RadrootsTradeAgreementClaimV1 {
+ let claim = |claim_mutation_id: MutationId| RadrootsTradeAgreementClaimV1 {
claim_mutation_id,
proposal_mutation_id: root_id(&root),
candidate_id: candidate_id.clone(),
@@ -2125,22 +2110,22 @@ mod tests {
(first_id.clone(), first_decision),
(second_id.clone(), second_decision),
]);
- let missing_claim = RadrootsTradeMutationId::parse(hex_64('e')).expect("missing claim");
+ let missing_claim = MutationId::parse(hex_64('e')).expect("missing claim");
let cancellations = vec![
CancellationRecord {
- mutation_id: RadrootsTradeMutationId::parse(hex_64('3')).expect("cancellation"),
+ mutation_id: MutationId::parse(hex_64('3')).expect("cancellation"),
parent_mutation_ids: Vec::new(),
target_candidate_id: None,
target_claim_mutation_id: None,
},
CancellationRecord {
- mutation_id: RadrootsTradeMutationId::parse(hex_64('4')).expect("cancellation"),
+ mutation_id: MutationId::parse(hex_64('4')).expect("cancellation"),
parent_mutation_ids: Vec::new(),
target_candidate_id: None,
target_claim_mutation_id: Some(missing_claim),
},
CancellationRecord {
- mutation_id: RadrootsTradeMutationId::parse(hex_64('5')).expect("cancellation"),
+ mutation_id: MutationId::parse(hex_64('5')).expect("cancellation"),
parent_mutation_ids: vec![first_id.clone()],
target_candidate_id: None,
target_claim_mutation_id: Some(first_id.clone()),
@@ -2164,7 +2149,7 @@ mod tests {
incompatible_claims
.get_mut(&second_id)
.expect("second claim")
- .candidate_id = RadrootsTradeCandidateId::parse(hex_64('f')).expect("candidate");
+ .candidate_id = CandidateId::parse(hex_64('f')).expect("candidate");
let mut incompatible = RadrootsTradeProjectionV1::empty(trade_id());
apply_agreement_state(
&mut incompatible,
@@ -2186,10 +2171,10 @@ mod tests {
candidate: candidate.clone(),
},
)]);
- let unknown_candidate = RadrootsTradeCandidateId::parse(hex_64('f')).expect("candidate");
+ let unknown_candidate = CandidateId::parse(hex_64('f')).expect("candidate");
assert!(!cancellation_without_claim(
&[CancellationRecord {
- mutation_id: RadrootsTradeMutationId::parse(hex_64('6')).expect("cancellation"),
+ mutation_id: MutationId::parse(hex_64('6')).expect("cancellation"),
parent_mutation_ids: Vec::new(),
target_candidate_id: Some(unknown_candidate),
target_claim_mutation_id: None,
@@ -2208,7 +2193,7 @@ mod tests {
)]);
assert!(!cancellation_without_claim(
&[CancellationRecord {
- mutation_id: RadrootsTradeMutationId::parse(hex_64('7')).expect("cancellation"),
+ mutation_id: MutationId::parse(hex_64('7')).expect("cancellation"),
parent_mutation_ids: Vec::new(),
target_candidate_id: Some(candidate_id),
target_claim_mutation_id: None,
@@ -2224,7 +2209,7 @@ mod tests {
projection.root_mutation_id = Some(root_id(&root));
projection
.missing_proposal_ids
- .push(RadrootsTradeMutationId::parse(hex_64('e')).expect("proposal"));
+ .push(MutationId::parse(hex_64('e')).expect("proposal"));
assert_eq!(
reduce_evidence_state(&projection, RadrootsTradeEvidenceStateV1::Complete),
RadrootsTradeEvidenceStateV1::Missing
diff --git a/crates/trade/tests/operational_listing_conformance.rs b/crates/trade/tests/operational_listing_conformance.rs
@@ -2,7 +2,7 @@
use nostr::secp256k1::Message;
use nostr::{Event as NostrEvent, JsonUtil, Keys, SECP256K1};
-use radroots_event::{id::RadrootsIdParseError, wire::RadrootsNip01EventWire};
+use radroots_event::{id::ParseError, wire::Nip01EventWire};
use radroots_event_codec::verification::{RadrootsSignatureVerifiedEvent, verify_nip01_event};
use radroots_nostr::prelude::radroots_event_from_nostr;
use radroots_trade::operational_listing::{
@@ -180,23 +180,23 @@ fn address_invalid(vector: &Vector) {
assert_eq!(actual, vector.expected, "{}", vector.id);
}
-fn address_error_value(error: &RadrootsIdParseError) -> Value {
+fn address_error_value(error: &ParseError) -> Value {
match error {
- RadrootsIdParseError::Empty => json!({ "kind": "empty" }),
- RadrootsIdParseError::InvalidFormat => json!({ "kind": "invalid_format" }),
- RadrootsIdParseError::InvalidLength { expected, actual } => json!({
+ ParseError::Empty => json!({ "kind": "empty" }),
+ ParseError::InvalidFormat => json!({ "kind": "invalid_format" }),
+ ParseError::InvalidLength { expected, actual } => json!({
"kind": "invalid_length",
"expected": expected,
"actual": actual,
}),
- RadrootsIdParseError::InvalidCharacter => json!({ "kind": "invalid_character" }),
- RadrootsIdParseError::InvalidPublicKey => json!({ "kind": "invalid_public_key" }),
- RadrootsIdParseError::UnexpectedKind { expected, actual } => json!({
+ ParseError::InvalidCharacter => json!({ "kind": "invalid_character" }),
+ ParseError::InvalidPublicKey => json!({ "kind": "invalid_public_key" }),
+ ParseError::UnexpectedKind { expected, actual } => json!({
"kind": "unexpected_kind",
"expected": expected,
"actual": actual,
}),
- RadrootsIdParseError::TooLong { max, actual } => json!({
+ ParseError::TooLong { max, actual } => json!({
"kind": "too_long",
"max": max,
"actual": actual,
@@ -250,7 +250,7 @@ fn verified_event(vector: &Vector, keys: &Keys) -> RadrootsSignatureVerifiedEven
.verify()
.unwrap_or_else(|error| panic!("{} failed NIP-01 verification: {error}", vector.id));
- let wire = RadrootsNip01EventWire::parse_json(&raw)
+ let wire = Nip01EventWire::parse_json(&raw)
.unwrap_or_else(|error| panic!("{} failed Radroots wire parsing: {error}", vector.id));
assert!(
wire.extra.is_empty(),
diff --git a/crates/trade_sp1_host/src/lib.rs b/crates/trade_sp1_host/src/lib.rs
@@ -1773,7 +1773,7 @@ mod tests {
};
use base64::Engine;
use radroots_event::{
- envelope::RadrootsEventEnvelope, envelope::RadrootsEventEnvelopeParts,
+ envelope::EventEnvelope, envelope::EventEnvelopeParts,
envelope::kind::KIND_TRADE_VALIDATION_RECEIPT,
};
use radroots_trade::validation_receipt::{
@@ -2534,7 +2534,7 @@ mod tests {
);
let parts = validation_receipt_event_build("order-1", &receipt).expect("event parts");
- let event = RadrootsEventEnvelope::new(RadrootsEventEnvelopeParts {
+ let event = EventEnvelope::new(EventEnvelopeParts {
id: "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd".to_string(),
author: "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
.to_string(),
diff --git a/crates/transport/tests/source_boundary.rs b/crates/transport/tests/source_boundary.rs
@@ -655,7 +655,7 @@ fn transport_target_identity_sources_reject_silent_dedupe() {
);
}
for forbidden in [
- "impl<'de> Deserialize<'de> for RadrootsRelayUrl",
+ "impl<'de> Deserialize<'de> for RelayUrl",
"impl<'de> Deserialize<'de> for RadrootsRelayTargetSet",
] {
assert!(
diff --git a/crates/transport_nostr/src/lib.rs b/crates/transport_nostr/src/lib.rs
@@ -39,4 +39,4 @@ pub use publish::{
RadrootsRelayPublishRelayReceipt, RadrootsRelayPublishRequest, publish_signed_event,
verified_signed_event_payload,
};
-pub use relay::{RadrootsRelayTargetSet, RadrootsRelayUrl, RadrootsRelayUrlPolicy};
+pub use relay::{RadrootsRelayTargetSet, RadrootsRelayUrlPolicy, RelayUrl};
diff --git a/crates/transport_nostr/src/outbox.rs b/crates/transport_nostr/src/outbox.rs
@@ -7,7 +7,7 @@ use crate::{
RadrootsRelayTransportError, RadrootsRelayUrlPolicy, publish_signed_event,
verified_signed_event_payload,
};
-use radroots_event::draft::RadrootsSignedEvent;
+use radroots_event::draft::SignedEvent;
use radroots_event_store::{
RadrootsEventIngest, RadrootsEventStore, RadrootsTransportObservation,
RadrootsTransportObservationType,
@@ -1031,7 +1031,7 @@ fn satisfaction_policy_for_remaining_count(
async fn ingest_publish_observation(
event_store: &RadrootsEventStore,
- signed_event: &RadrootsSignedEvent,
+ signed_event: &SignedEvent,
relay_url: &str,
observed_at_ms: i64,
) -> Result<(), RadrootsRelayTransportError> {
diff --git a/crates/transport_nostr/src/publish.rs b/crates/transport_nostr/src/publish.rs
@@ -5,7 +5,7 @@ use crate::{RadrootsRelayOutcome, RadrootsRelayTargetSet, RadrootsRelayTransport
#[cfg(feature = "client")]
use core::time::Duration;
use futures::future::BoxFuture;
-use radroots_event::{draft::RadrootsSignedEvent, wire::RadrootsNip01EventWire};
+use radroots_event::{draft::SignedEvent, wire::Nip01EventWire};
use radroots_transport::{
RadrootsTransport, RadrootsTransportCapabilities, RadrootsTransportDeliveryReceipt,
RadrootsTransportDeliveryRequest, RadrootsTransportError, RadrootsTransportFetchReceipt,
@@ -30,7 +30,7 @@ pub const RADROOTS_RELAY_PUBLISH_IDEMPOTENCY_KEY_MAX_BYTES: usize = 256;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsRelayPublishRequest {
- signed_event: RadrootsSignedEvent,
+ signed_event: SignedEvent,
targets: RadrootsRelayTargetSet,
satisfaction_policy: RadrootsTransportSatisfactionPolicy,
idempotency_key: Option<String>,
@@ -39,7 +39,7 @@ pub struct RadrootsRelayPublishRequest {
impl RadrootsRelayPublishRequest {
pub fn new(
- signed_event: RadrootsSignedEvent,
+ signed_event: SignedEvent,
targets: RadrootsRelayTargetSet,
now_ms: i64,
) -> Result<Self, RadrootsRelayTransportError> {
@@ -71,7 +71,7 @@ impl RadrootsRelayPublishRequest {
Ok(self)
}
- pub fn signed_event(&self) -> &RadrootsSignedEvent {
+ pub fn signed_event(&self) -> &SignedEvent {
&self.signed_event
}
@@ -188,7 +188,7 @@ pub trait RadrootsRelayPublishAdapter: Send + Sync {
}
pub fn verified_signed_event_payload(
- signed_event: &RadrootsSignedEvent,
+ signed_event: &SignedEvent,
) -> Result<RadrootsTransportPayload, RadrootsTransportError> {
RadrootsTransportPayload::unchecked_signed_event_json(
signed_event.id_str(),
@@ -565,19 +565,19 @@ mod contract_tests {
fn signed_event_from_transport_payload(
payload: &RadrootsTransportPayload,
-) -> Result<RadrootsSignedEvent, RadrootsTransportError> {
+) -> Result<SignedEvent, RadrootsTransportError> {
let RadrootsTransportPayload::SignedEventJson {
event_id, raw_json, ..
} = payload
else {
return Err(RadrootsTransportError::InvalidPayloadBytes);
};
- let wire = RadrootsNip01EventWire::parse_json(raw_json)
+ let wire = Nip01EventWire::parse_json(raw_json)
.map_err(|_| RadrootsTransportError::InvalidPayloadBytes)?;
if wire.id != *event_id {
return Err(RadrootsTransportError::InvalidPayloadId);
}
- RadrootsSignedEvent::from_wire_verified_id(wire, raw_json.clone())
+ SignedEvent::from_wire_verified_id(wire, raw_json.clone())
.map_err(|_| RadrootsTransportError::InvalidPayloadBytes)
}
@@ -594,7 +594,7 @@ fn relay_targets_from_transport_targets(
} else {
crate::RadrootsRelayUrlPolicy::Public
};
- let relay = crate::RadrootsRelayUrl::parse(target.uri().as_str(), policy)
+ let relay = crate::RelayUrl::parse(target.uri().as_str(), policy)
.map_err(nostr_error_to_transport_error)?;
if !relays.contains(&relay) {
relays.push(relay);
@@ -1002,7 +1002,7 @@ impl RadrootsRelayPublishAdapter for RadrootsNostrClientPublishAdapter {
#[cfg(feature = "client")]
fn ensure_raw_event_matches_signed_event(
event: &RadrootsNostrEvent,
- signed_event: &RadrootsSignedEvent,
+ signed_event: &SignedEvent,
) -> Result<(), RadrootsRelayTransportError> {
let mismatches = [
("id", event.id.to_hex(), signed_event.id_str().to_owned()),
@@ -1056,9 +1056,9 @@ fn ensure_raw_event_matches_signed_event(
mod tests {
use super::{RadrootsNostrEvent, ensure_raw_event_matches_signed_event};
use nostr::JsonUtil;
- use radroots_event::draft::{RadrootsEventDraft, RadrootsSignedEvent};
+ use radroots_event::draft::{EventDraft, SignedEvent};
use radroots_event::envelope::kind::KIND_GEOCHAT;
- use radroots_event::wire::RadrootsNip01EventWire;
+ use radroots_event::wire::Nip01EventWire;
use radroots_nostr::prelude::{
RadrootsNostrKeys, RadrootsNostrSecretKey, radroots_nostr_sign_frozen_draft,
};
@@ -1068,11 +1068,11 @@ mod tests {
const FIXTURE_ALICE_PUBLIC_KEY_HEX: &str =
"585591529da0bab31b3b1b1f986611cf5f435dca84f978c89ee8a40cca7103df";
- fn signed_post(content: &str) -> (RadrootsNostrEvent, RadrootsSignedEvent) {
+ fn signed_post(content: &str) -> (RadrootsNostrEvent, SignedEvent) {
let secret_key =
RadrootsNostrSecretKey::from_hex(FIXTURE_ALICE_SECRET_KEY_HEX).expect("secret key");
let keys = RadrootsNostrKeys::new(secret_key);
- let draft = RadrootsEventDraft::new(
+ let draft = EventDraft::new(
"radroots.social.geochat.v1",
KIND_GEOCHAT,
1_700_000_000,
@@ -1086,11 +1086,11 @@ mod tests {
(raw_event, signed_event)
}
- fn assert_mismatch(raw_event: RadrootsNostrEvent, signed_event: &RadrootsSignedEvent) {
+ fn assert_mismatch(raw_event: RadrootsNostrEvent, signed_event: &SignedEvent) {
assert!(ensure_raw_event_matches_signed_event(&raw_event, signed_event).is_err());
}
- fn raw_event_from_wire(wire: RadrootsNip01EventWire) -> RadrootsNostrEvent {
+ fn raw_event_from_wire(wire: Nip01EventWire) -> RadrootsNostrEvent {
RadrootsNostrEvent::from_json(serde_json::to_string(&wire).expect("raw event json"))
.expect("raw event")
}
diff --git a/crates/transport_nostr/src/relay.rs b/crates/transport_nostr/src/relay.rs
@@ -26,9 +26,9 @@ impl RadrootsRelayUrlPolicy {
}
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct RadrootsRelayUrl(String);
+pub struct RelayUrl(String);
-impl RadrootsRelayUrl {
+impl RelayUrl {
pub fn parse(
value: impl AsRef<str>,
policy: RadrootsRelayUrlPolicy,
@@ -243,7 +243,7 @@ fn is_supported_global_ipv6_unicast(segments: [u16; 8]) -> bool {
(segments[0] & 0xe000) == 0x2000
}
-impl fmt::Display for RadrootsRelayUrl {
+impl fmt::Display for RelayUrl {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.0.as_str())
}
@@ -251,7 +251,7 @@ impl fmt::Display for RadrootsRelayUrl {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsRelayTargetSet {
- relays: Vec<RadrootsRelayUrl>,
+ relays: Vec<RelayUrl>,
}
impl RadrootsRelayTargetSet {
@@ -265,7 +265,7 @@ impl RadrootsRelayTargetSet {
{
let mut ordered_relays = Vec::new();
for relay in relays {
- let relay = RadrootsRelayUrl::parse(relay, policy)?;
+ let relay = RelayUrl::parse(relay, policy)?;
if ordered_relays.iter().any(|existing| existing == &relay) {
return Err(RadrootsRelayTransportError::DuplicateRelayUrl {
url: relay.into_string(),
@@ -280,7 +280,7 @@ impl RadrootsRelayTargetSet {
Ok(Self { relays })
}
- pub fn from_urls(relays: Vec<RadrootsRelayUrl>) -> Result<Self, RadrootsRelayTransportError> {
+ pub fn from_urls(relays: Vec<RelayUrl>) -> Result<Self, RadrootsRelayTransportError> {
let mut ordered_relays = Vec::new();
for relay in relays {
if ordered_relays.iter().any(|existing| existing == &relay) {
@@ -297,7 +297,7 @@ impl RadrootsRelayTargetSet {
Ok(Self { relays })
}
- pub fn relays(&self) -> &[RadrootsRelayUrl] {
+ pub fn relays(&self) -> &[RelayUrl] {
&self.relays
}
diff --git a/crates/transport_nostr/tests/transport.rs b/crates/transport_nostr/tests/transport.rs
@@ -1,6 +1,6 @@
use futures::future::BoxFuture;
use nostr::{EventBuilder, JsonUtil};
-use radroots_event::draft::{RadrootsEventDraft, RadrootsSignedEvent};
+use radroots_event::draft::{EventDraft, SignedEvent};
use radroots_event::envelope::kind::{
KIND_DELETION_REQUEST, KIND_FOLLOW, KIND_GEOCHAT, KIND_POST, KIND_PROFILE,
};
@@ -37,7 +37,7 @@ use radroots_transport_nostr::{
RadrootsRelayFetchOutcomeKind, RadrootsRelayFetchRequest, RadrootsRelayOutcome,
RadrootsRelayOutcomeKind, RadrootsRelayPublishAdapter, RadrootsRelayPublishRelayReceipt,
RadrootsRelayPublishRequest, RadrootsRelayTargetSet, RadrootsRelayTransportError,
- RadrootsRelayUrl, RadrootsRelayUrlPolicy, fetch_and_ingest_relay_events, fetch_relay_events,
+ RadrootsRelayUrlPolicy, RelayUrl, fetch_and_ingest_relay_events, fetch_relay_events,
fetch_relay_events_blocking, publish_claimed_outbox_event,
publish_claimed_outbox_event_with_transport, publish_signed_event,
verified_signed_event_payload,
@@ -405,22 +405,22 @@ fn test_event_builder(
.allow_self_tagging()
}
-fn signed_post(content: &str) -> RadrootsSignedEvent {
+fn signed_post(content: &str) -> SignedEvent {
signed_event_with_kind_and_hashtag(content, KIND_POST, "soil")
}
-fn signed_ephemeral(content: &str) -> RadrootsSignedEvent {
+fn signed_ephemeral(content: &str) -> SignedEvent {
let raw_event = test_event_builder(KIND_GEOCHAT, content, Vec::new())
.custom_created_at(RadrootsNostrTimestamp::from_secs(1_700_000_000))
.sign_with_keys(&fixture_keys())
.expect("signed ephemeral event");
let raw_json = raw_event.as_json();
- let wire = radroots_event::wire::RadrootsNip01EventWire::parse_json(&raw_json).expect("wire");
- RadrootsSignedEvent::from_wire_verified_id(wire, raw_json).expect("signed event")
+ let wire = radroots_event::wire::Nip01EventWire::parse_json(&raw_json).expect("wire");
+ SignedEvent::from_wire_verified_id(wire, raw_json).expect("signed event")
}
-fn generic_draft(content: &str) -> RadrootsEventDraft {
- RadrootsEventDraft::new(
+fn generic_draft(content: &str) -> EventDraft {
+ EventDraft::new(
"radroots.social.follow_list.v1",
KIND_FOLLOW,
1_700_000_000,
@@ -455,15 +455,11 @@ fn assert_outbox_publish_observations(
);
}
-fn signed_event_with_kind_and_hashtag(
- content: &str,
- kind: u32,
- hashtag: &str,
-) -> RadrootsSignedEvent {
+fn signed_event_with_kind_and_hashtag(content: &str, kind: u32, hashtag: &str) -> SignedEvent {
let raw_event = signed_raw_event_with_kind_and_hashtag(content, kind, hashtag);
let raw_json = raw_event.as_json();
- let wire = radroots_event::wire::RadrootsNip01EventWire::parse_json(&raw_json).expect("wire");
- RadrootsSignedEvent::from_wire_verified_id(wire, raw_json).expect("signed event")
+ let wire = radroots_event::wire::Nip01EventWire::parse_json(&raw_json).expect("wire");
+ SignedEvent::from_wire_verified_id(wire, raw_json).expect("signed event")
}
fn signed_raw_event_with_kind_and_hashtag(content: &str, kind: u32, hashtag: &str) -> nostr::Event {
@@ -481,7 +477,7 @@ async fn complete_claimed_signing(
outbox: &RadrootsOutbox,
claimed: &RadrootsOutboxClaimedEvent,
now_ms: i64,
-) -> RadrootsSignedEvent {
+) -> SignedEvent {
if let Some(signed_event) = claimed.signed_event.clone() {
return signed_event;
}
@@ -512,7 +508,7 @@ fn scoped_nostr_target(relay_url: &str, scope: &str, label: &str) -> RadrootsTra
}
fn outbox_operation_input<I, S>(
- draft: RadrootsEventDraft,
+ draft: EventDraft,
relays: I,
satisfaction_policy: RadrootsTransportSatisfactionPolicy,
) -> RadrootsOutboxOperationInput
@@ -538,7 +534,7 @@ where
}
fn all_accepted_outbox_operation_input<I, S>(
- draft: RadrootsEventDraft,
+ draft: EventDraft,
relays: I,
) -> RadrootsOutboxOperationInput
where
@@ -647,59 +643,46 @@ fn tampered_raw_event() -> String {
#[test]
fn relay_url_validation_and_target_normalization() {
- let relay = RadrootsRelayUrl::parse("wss://Relay.Example.com", RadrootsRelayUrlPolicy::Public)
- .expect("relay");
+ let relay =
+ RelayUrl::parse("wss://Relay.Example.com", RadrootsRelayUrlPolicy::Public).expect("relay");
assert_eq!(relay.as_str(), RELAY_PRIMARY_WSS);
assert_eq!(relay.clone().into_string(), RELAY_PRIMARY_WSS);
- let relay_path = RadrootsRelayUrl::parse(
+ let relay_path = RelayUrl::parse(
"wss://Relay.Example.com/nostr",
RadrootsRelayUrlPolicy::Public,
)
.expect("relay path");
assert_eq!(relay_path.as_str(), "wss://relay.example.com/nostr");
- assert!(
- RadrootsRelayUrl::parse("ws://127.0.0.1:7777", RadrootsRelayUrlPolicy::Public).is_err()
- );
- let local = RadrootsRelayUrl::parse("ws://localhost:7777", RadrootsRelayUrlPolicy::Localhost)
+ assert!(RelayUrl::parse("ws://127.0.0.1:7777", RadrootsRelayUrlPolicy::Public).is_err());
+ let local = RelayUrl::parse("ws://localhost:7777", RadrootsRelayUrlPolicy::Localhost)
.expect("local relay");
assert_eq!(local.as_str(), "ws://localhost:7777");
- let local_ipv4 =
- RadrootsRelayUrl::parse("ws://127.0.0.1:7777", RadrootsRelayUrlPolicy::Localhost)
- .expect("local ipv4 relay");
+ let local_ipv4 = RelayUrl::parse("ws://127.0.0.1:7777", RadrootsRelayUrlPolicy::Localhost)
+ .expect("local ipv4 relay");
assert_eq!(local_ipv4.as_str(), "ws://127.0.0.1:7777");
- let local_ipv6 = RadrootsRelayUrl::parse("ws://[::1]:7777", RadrootsRelayUrlPolicy::Localhost)
+ let local_ipv6 = RelayUrl::parse("ws://[::1]:7777", RadrootsRelayUrlPolicy::Localhost)
.expect("local ipv6 relay");
assert_eq!(local_ipv6.as_str(), "ws://[::1]:7777");
- assert!(
- RadrootsRelayUrl::parse("ws://example.com", RadrootsRelayUrlPolicy::Localhost).is_err()
- );
- assert!(
- RadrootsRelayUrl::parse("ws://192.168.1.10:7777", RadrootsRelayUrlPolicy::Localhost)
- .is_err()
- );
- assert!(
- RadrootsRelayUrl::parse("wss://192.168.1.10", RadrootsRelayUrlPolicy::Localhost).is_err()
- );
- assert!(
- RadrootsRelayUrl::parse("wss://relay.example.com", RadrootsRelayUrlPolicy::Localhost)
- .is_err()
- );
- assert!(RadrootsRelayUrl::parse("wss://localhost", RadrootsRelayUrlPolicy::Localhost).is_ok());
+ assert!(RelayUrl::parse("ws://example.com", RadrootsRelayUrlPolicy::Localhost).is_err());
+ assert!(RelayUrl::parse("ws://192.168.1.10:7777", RadrootsRelayUrlPolicy::Localhost).is_err());
+ assert!(RelayUrl::parse("wss://192.168.1.10", RadrootsRelayUrlPolicy::Localhost).is_err());
+ assert!(RelayUrl::parse("wss://relay.example.com", RadrootsRelayUrlPolicy::Localhost).is_err());
+ assert!(RelayUrl::parse("wss://localhost", RadrootsRelayUrlPolicy::Localhost).is_ok());
assert!(matches!(
- RadrootsRelayUrl::parse("wss://127.0.0.1", RadrootsRelayUrlPolicy::Public),
+ RelayUrl::parse("wss://127.0.0.1", RadrootsRelayUrlPolicy::Public),
Err(RadrootsRelayTransportError::RelayUrlForbiddenDestination { .. })
));
assert!(matches!(
- RadrootsRelayUrl::parse("wss://10.1.2.3", RadrootsRelayUrlPolicy::Public),
+ RelayUrl::parse("wss://10.1.2.3", RadrootsRelayUrlPolicy::Public),
Err(RadrootsRelayTransportError::RelayUrlForbiddenDestination { .. })
));
assert!(matches!(
- RadrootsRelayUrl::parse("wss://[::1]", RadrootsRelayUrlPolicy::Public),
+ RelayUrl::parse("wss://[::1]", RadrootsRelayUrlPolicy::Public),
Err(RadrootsRelayTransportError::RelayUrlForbiddenDestination { .. })
));
assert!(matches!(
- RadrootsRelayUrl::parse("wss://[fd00::1]", RadrootsRelayUrlPolicy::Public),
+ RelayUrl::parse("wss://[fd00::1]", RadrootsRelayUrlPolicy::Public),
Err(RadrootsRelayTransportError::RelayUrlForbiddenDestination { .. })
));
for relay_url in [
@@ -733,13 +716,12 @@ fn relay_url_validation_and_target_normalization() {
"wss://relay",
] {
assert!(matches!(
- RadrootsRelayUrl::parse(relay_url, RadrootsRelayUrlPolicy::Public),
+ RelayUrl::parse(relay_url, RadrootsRelayUrlPolicy::Public),
Err(RadrootsRelayTransportError::RelayUrlForbiddenDestination { .. })
));
}
- let public_relay =
- RadrootsRelayUrl::parse("wss://relay.example.com", RadrootsRelayUrlPolicy::Public)
- .expect("public relay");
+ let public_relay = RelayUrl::parse("wss://relay.example.com", RadrootsRelayUrlPolicy::Public)
+ .expect("public relay");
public_relay
.validate_public_resolved_ip_addrs([IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34))])
.expect("public resolved ip");
@@ -776,56 +758,53 @@ fn relay_url_validation_and_target_normalization() {
Err(RadrootsRelayTransportError::RelayUrlResolvedNoAddresses { .. })
));
+ assert!(RelayUrl::parse("https://relay.example.com", RadrootsRelayUrlPolicy::Public).is_err());
assert!(
- RadrootsRelayUrl::parse("https://relay.example.com", RadrootsRelayUrlPolicy::Public)
- .is_err()
- );
- assert!(
- RadrootsRelayUrl::parse(
+ RelayUrl::parse(
"wss://user@relay.example.com",
RadrootsRelayUrlPolicy::Public
)
.is_err()
);
assert!(matches!(
- RadrootsRelayUrl::parse(
+ RelayUrl::parse(
"wss://user:password@relay.example.com",
RadrootsRelayUrlPolicy::Public
),
Err(RadrootsRelayTransportError::RelayUrlUserinfo { .. })
));
assert!(matches!(
- RadrootsRelayUrl::parse(
+ RelayUrl::parse(
"wss://:password@relay.example.com",
RadrootsRelayUrlPolicy::Public
),
Err(RadrootsRelayTransportError::RelayUrlUserinfo { .. })
));
assert!(
- RadrootsRelayUrl::parse(
+ RelayUrl::parse(
"wss://relay.example.com:bad",
RadrootsRelayUrlPolicy::Public
)
.is_err()
);
- assert!(RadrootsRelayUrl::parse("wss://", RadrootsRelayUrlPolicy::Public).is_err());
+ assert!(RelayUrl::parse("wss://", RadrootsRelayUrlPolicy::Public).is_err());
assert!(matches!(
- RadrootsRelayUrl::parse("radroots:relay", RadrootsRelayUrlPolicy::Public),
+ RelayUrl::parse("radroots:relay", RadrootsRelayUrlPolicy::Public),
Err(RadrootsRelayTransportError::EmptyRelayHost { .. })
));
assert!(matches!(
- RadrootsRelayUrl::parse("relay.example.com", RadrootsRelayUrlPolicy::Public),
+ RelayUrl::parse("relay.example.com", RadrootsRelayUrlPolicy::Public),
Err(RadrootsRelayTransportError::RelayUrlParse { .. })
));
assert!(
- RadrootsRelayUrl::parse(
+ RelayUrl::parse(
"wss://relay.example.com?subscription=1",
RadrootsRelayUrlPolicy::Public
)
.is_err()
);
assert!(
- RadrootsRelayUrl::parse(
+ RelayUrl::parse(
"wss://relay.example.com#fragment",
RadrootsRelayUrlPolicy::Public
)
@@ -848,8 +827,7 @@ fn relay_url_validation_and_target_normalization() {
let from_urls = RadrootsRelayTargetSet::from_urls(vec![
relay_path.clone(),
- RadrootsRelayUrl::parse(RELAY_SECONDARY_WSS, RadrootsRelayUrlPolicy::Public)
- .expect("secondary"),
+ RelayUrl::parse(RELAY_SECONDARY_WSS, RadrootsRelayUrlPolicy::Public).expect("secondary"),
])
.expect("from urls");
assert_eq!(from_urls.len(), 2);
@@ -902,7 +880,7 @@ fn transport_target_and_relay_adapter_share_canonical_url_identity() {
),
] {
let target = RadrootsTransportTarget::nostr_relay(raw).expect("transport target");
- let relay = RadrootsRelayUrl::parse(raw, policy).expect("relay URL");
+ let relay = RelayUrl::parse(raw, policy).expect("relay URL");
assert_eq!(target.uri().as_str(), relay.as_str(), "{raw}");
}
@@ -927,7 +905,7 @@ fn transport_target_and_relay_adapter_share_canonical_url_identity() {
"transport target accepted {raw}"
);
assert!(
- RadrootsRelayUrl::parse(raw, RadrootsRelayUrlPolicy::Public).is_err(),
+ RelayUrl::parse(raw, RadrootsRelayUrlPolicy::Public).is_err(),
"relay adapter accepted {raw}"
);
}
diff --git a/docs/api/radroots_event.txt b/docs/api/radroots_event.txt
@@ -1,10 +1,10 @@
pub mod radroots_event
pub mod radroots_event::admission
#[non_exhaustive] pub enum radroots_event::admission::Error
-pub radroots_event::admission::Error::ContractValidation(crate::contract::registry_v7::RadrootsContractValidationError)
+pub radroots_event::admission::Error::ContractValidation(crate::contract::registry_v7::ContractValidationError)
pub radroots_event::admission::Error::IdMismatch
-pub radroots_event::admission::Error::IdMismatch::actual: radroots_event::id::RadrootsEventId
-pub radroots_event::admission::Error::IdMismatch::expected: radroots_event::id::RadrootsEventId
+pub radroots_event::admission::Error::IdMismatch::actual: radroots_event::id::EventId
+pub radroots_event::admission::Error::IdMismatch::expected: radroots_event::id::EventId
pub radroots_event::admission::Error::MalformedEnvelope
pub radroots_event::admission::Error::SignatureInvalid
impl radroots_event::Error
@@ -14,7 +14,7 @@ impl core::fmt::Display for radroots_event::Error
pub fn radroots_event::Error::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
pub struct radroots_event::admission::AdmittedEvent
impl radroots_event::admission::AdmittedEvent
-pub const fn radroots_event::admission::AdmittedEvent::event(&self) -> &radroots_event::envelope::RadrootsEventEnvelope
+pub const fn radroots_event::admission::AdmittedEvent::event(&self) -> &radroots_event::envelope::EventEnvelope
pub fn radroots_event::admission::AdmittedEvent::into_validated_event(self) -> radroots_event::admission::ContractValidatedEvent
pub fn radroots_event::admission::AdmittedEvent::make_visible_with<P>(self, &P) -> core::result::Result<radroots_event::admission::VisibleEvent, <P as radroots_event::admission::VisibilityPolicy>::Error> where P: radroots_event::admission::VisibilityPolicy + ?core::marker::Sized
pub const fn radroots_event::admission::AdmittedEvent::policy_id(&self) -> &'static str
@@ -23,32 +23,32 @@ pub struct radroots_event::admission::ContractValidatedEvent
impl radroots_event::admission::ContractValidatedEvent
pub fn radroots_event::admission::ContractValidatedEvent::admit_with<P>(self, &P) -> core::result::Result<radroots_event::admission::AdmittedEvent, <P as radroots_event::admission::AdmissionPolicy>::Error> where P: radroots_event::admission::AdmissionPolicy + ?core::marker::Sized
impl radroots_event::admission::ContractValidatedEvent
-pub const fn radroots_event::admission::ContractValidatedEvent::contract(&self) -> &'static RadrootsEventContract
+pub const fn radroots_event::admission::ContractValidatedEvent::contract(&self) -> &'static EventContract
pub const fn radroots_event::admission::ContractValidatedEvent::contract_id(&self) -> &'static str
-pub const fn radroots_event::admission::ContractValidatedEvent::event(&self) -> &radroots_event::envelope::RadrootsEventEnvelope
-pub fn radroots_event::admission::ContractValidatedEvent::into_event(self) -> radroots_event::envelope::RadrootsEventEnvelope
+pub const fn radroots_event::admission::ContractValidatedEvent::event(&self) -> &radroots_event::envelope::EventEnvelope
+pub fn radroots_event::admission::ContractValidatedEvent::into_event(self) -> radroots_event::envelope::EventEnvelope
pub fn radroots_event::admission::ContractValidatedEvent::into_verified_event(self) -> radroots_event::VerifiedEvent
pub const fn radroots_event::admission::ContractValidatedEvent::verified_event(&self) -> &radroots_event::VerifiedEvent
pub struct radroots_event::admission::IdVerifiedEvent(_)
impl radroots_event::admission::IdVerifiedEvent
-pub const fn radroots_event::admission::IdVerifiedEvent::event(&self) -> &radroots_event::envelope::RadrootsEventEnvelope
-pub fn radroots_event::admission::IdVerifiedEvent::into_event(self) -> radroots_event::envelope::RadrootsEventEnvelope
+pub const fn radroots_event::admission::IdVerifiedEvent::event(&self) -> &radroots_event::envelope::EventEnvelope
+pub fn radroots_event::admission::IdVerifiedEvent::into_event(self) -> radroots_event::envelope::EventEnvelope
pub fn radroots_event::admission::IdVerifiedEvent::verify_signature<V>(self, &V) -> core::result::Result<radroots_event::VerifiedEvent, radroots_event::Error> where V: radroots_event::admission::SignatureVerifier + ?core::marker::Sized
pub struct radroots_event::admission::RawEvent(_)
impl radroots_event::admission::RawEvent
-pub const fn radroots_event::admission::RawEvent::event(&self) -> &radroots_event::envelope::RadrootsEventEnvelope
-pub fn radroots_event::admission::RawEvent::into_event(self) -> radroots_event::envelope::RadrootsEventEnvelope
-pub const fn radroots_event::admission::RawEvent::new(radroots_event::envelope::RadrootsEventEnvelope) -> Self
+pub const fn radroots_event::admission::RawEvent::event(&self) -> &radroots_event::envelope::EventEnvelope
+pub fn radroots_event::admission::RawEvent::into_event(self) -> radroots_event::envelope::EventEnvelope
+pub const fn radroots_event::admission::RawEvent::new(radroots_event::envelope::EventEnvelope) -> Self
pub fn radroots_event::admission::RawEvent::verify_id(self) -> core::result::Result<radroots_event::admission::IdVerifiedEvent, radroots_event::Error>
pub struct radroots_event::admission::SignatureVerifiedEvent(_)
impl radroots_event::VerifiedEvent
-pub const fn radroots_event::VerifiedEvent::event(&self) -> &radroots_event::envelope::RadrootsEventEnvelope
-pub fn radroots_event::VerifiedEvent::into_event(self) -> radroots_event::envelope::RadrootsEventEnvelope
+pub const fn radroots_event::VerifiedEvent::event(&self) -> &radroots_event::envelope::EventEnvelope
+pub fn radroots_event::VerifiedEvent::into_event(self) -> radroots_event::envelope::EventEnvelope
pub fn radroots_event::VerifiedEvent::validate_contract(self) -> core::result::Result<radroots_event::admission::ContractValidatedEvent, radroots_event::Error>
pub struct radroots_event::admission::VisibleEvent
impl radroots_event::admission::VisibleEvent
pub const fn radroots_event::admission::VisibleEvent::admitted_event(&self) -> &radroots_event::admission::AdmittedEvent
-pub const fn radroots_event::admission::VisibleEvent::event(&self) -> &radroots_event::envelope::RadrootsEventEnvelope
+pub const fn radroots_event::admission::VisibleEvent::event(&self) -> &radroots_event::envelope::EventEnvelope
pub fn radroots_event::admission::VisibleEvent::into_admitted_event(self) -> radroots_event::admission::AdmittedEvent
pub const fn radroots_event::admission::VisibleEvent::policy_id(&self) -> &'static str
pub trait radroots_event::admission::AdmissionPolicy: core::marker::Send + core::marker::Sync
@@ -56,380 +56,380 @@ pub type radroots_event::admission::AdmissionPolicy::Error
pub fn radroots_event::admission::AdmissionPolicy::admit(&self, &radroots_event::admission::ContractValidatedEvent) -> core::result::Result<(), Self::Error>
pub fn radroots_event::admission::AdmissionPolicy::policy_id(&self) -> &'static str
pub trait radroots_event::admission::SignatureVerifier: core::marker::Send + core::marker::Sync
-pub fn radroots_event::admission::SignatureVerifier::verify_signature(&self, &radroots_event::envelope::RadrootsEventEnvelope) -> core::result::Result<(), radroots_event::Error>
+pub fn radroots_event::admission::SignatureVerifier::verify_signature(&self, &radroots_event::envelope::EventEnvelope) -> core::result::Result<(), radroots_event::Error>
pub trait radroots_event::admission::VisibilityPolicy: core::marker::Send + core::marker::Sync
pub type radroots_event::admission::VisibilityPolicy::Error
pub fn radroots_event::admission::VisibilityPolicy::make_visible(&self, &radroots_event::admission::AdmittedEvent) -> core::result::Result<(), Self::Error>
pub fn radroots_event::admission::VisibilityPolicy::policy_id(&self) -> &'static str
pub mod radroots_event::calendar
-#[non_exhaustive] pub enum radroots_event::calendar::RadrootsCalendarAdmissionError
-pub radroots_event::calendar::RadrootsCalendarAdmissionError::AuthorHintMismatch
-pub radroots_event::calendar::RadrootsCalendarAdmissionError::CoveredDayLimitExceeded
-pub radroots_event::calendar::RadrootsCalendarAdmissionError::CoveredDayLimitExceeded::actual: u64
-pub radroots_event::calendar::RadrootsCalendarAdmissionError::CoveredDayLimitExceeded::max: u64
-pub radroots_event::calendar::RadrootsCalendarAdmissionError::DuplicateEventReference
-pub radroots_event::calendar::RadrootsCalendarAdmissionError::ForbiddenDateDayIndex
-pub radroots_event::calendar::RadrootsCalendarAdmissionError::IncompleteDayCoverage
-pub radroots_event::calendar::RadrootsCalendarAdmissionError::NonBlossomImage
-pub radroots_event::calendar::RadrootsCalendarAdmissionError::NonCanonicalField(&'static str)
-impl radroots_event::calendar::RadrootsCalendarAdmissionError
-pub const fn radroots_event::calendar::RadrootsCalendarAdmissionError::code(&self) -> &'static str
-impl core::error::Error for radroots_event::calendar::RadrootsCalendarAdmissionError
-impl core::fmt::Display for radroots_event::calendar::RadrootsCalendarAdmissionError
-pub fn radroots_event::calendar::RadrootsCalendarAdmissionError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-#[non_exhaustive] pub enum radroots_event::calendar::RadrootsCalendarEventError
-pub radroots_event::calendar::RadrootsCalendarEventError::AuthorHintMismatch
-pub radroots_event::calendar::RadrootsCalendarEventError::ContentTooLarge
-pub radroots_event::calendar::RadrootsCalendarEventError::ContentTooLarge::actual: usize
-pub radroots_event::calendar::RadrootsCalendarEventError::ContentTooLarge::max: usize
-pub radroots_event::calendar::RadrootsCalendarEventError::CoveredDayLimitExceeded
-pub radroots_event::calendar::RadrootsCalendarEventError::CoveredDayLimitExceeded::actual: u64
-pub radroots_event::calendar::RadrootsCalendarEventError::CoveredDayLimitExceeded::max: u64
-pub radroots_event::calendar::RadrootsCalendarEventError::DeclinedFreeBusyForbidden
-pub radroots_event::calendar::RadrootsCalendarEventError::DuplicateEventReference
-pub radroots_event::calendar::RadrootsCalendarEventError::InvalidAuthorReference
-pub radroots_event::calendar::RadrootsCalendarEventError::InvalidCalendarUid
-pub radroots_event::calendar::RadrootsCalendarEventError::InvalidDate
-pub radroots_event::calendar::RadrootsCalendarEventError::InvalidEventReference
-pub radroots_event::calendar::RadrootsCalendarEventError::InvalidGeohash
-pub radroots_event::calendar::RadrootsCalendarEventError::InvalidIdentifier
-pub radroots_event::calendar::RadrootsCalendarEventError::InvalidParticipant
-pub radroots_event::calendar::RadrootsCalendarEventError::InvalidParticipant::index: usize
-pub radroots_event::calendar::RadrootsCalendarEventError::InvalidRange
-pub radroots_event::calendar::RadrootsCalendarEventError::InvalidRevisionReference
-pub radroots_event::calendar::RadrootsCalendarEventError::InvalidText(&'static str)
-pub radroots_event::calendar::RadrootsCalendarEventError::InvalidTimeZone
-pub radroots_event::calendar::RadrootsCalendarEventError::InvalidTitle
-pub radroots_event::calendar::RadrootsCalendarEventError::InvalidUrl(&'static str)
-pub radroots_event::calendar::RadrootsCalendarEventError::TagBytesExceeded
-pub radroots_event::calendar::RadrootsCalendarEventError::TagBytesExceeded::actual: usize
-pub radroots_event::calendar::RadrootsCalendarEventError::TagBytesExceeded::max: usize
-pub radroots_event::calendar::RadrootsCalendarEventError::TagCountExceeded
-pub radroots_event::calendar::RadrootsCalendarEventError::TagCountExceeded::actual: usize
-pub radroots_event::calendar::RadrootsCalendarEventError::TagCountExceeded::max: usize
-pub radroots_event::calendar::RadrootsCalendarEventError::TagElementTooLarge
-pub radroots_event::calendar::RadrootsCalendarEventError::TagElementTooLarge::actual: usize
-pub radroots_event::calendar::RadrootsCalendarEventError::TagElementTooLarge::field: &'static str
-pub radroots_event::calendar::RadrootsCalendarEventError::TagElementTooLarge::max: usize
-pub radroots_event::calendar::RadrootsCalendarEventError::TooManyParticipants
-pub radroots_event::calendar::RadrootsCalendarEventError::TooManyParticipants::actual: usize
-pub radroots_event::calendar::RadrootsCalendarEventError::TooManyParticipants::max: usize
-impl radroots_event::calendar::RadrootsCalendarEventError
-pub const fn radroots_event::calendar::RadrootsCalendarEventError::code(&self) -> &'static str
-impl core::error::Error for radroots_event::calendar::RadrootsCalendarEventError
-impl core::fmt::Display for radroots_event::calendar::RadrootsCalendarEventError
-pub fn radroots_event::calendar::RadrootsCalendarEventError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub enum radroots_event::calendar::RadrootsCalendarEventFreeBusy
-pub radroots_event::calendar::RadrootsCalendarEventFreeBusy::Busy
-pub radroots_event::calendar::RadrootsCalendarEventFreeBusy::Free
-pub enum radroots_event::calendar::RadrootsCalendarEventRsvpStatus
-pub radroots_event::calendar::RadrootsCalendarEventRsvpStatus::Accepted
-pub radroots_event::calendar::RadrootsCalendarEventRsvpStatus::Declined
-pub radroots_event::calendar::RadrootsCalendarEventRsvpStatus::Tentative
-pub struct radroots_event::calendar::RadrootsAdmittedCalendar
-impl radroots_event::calendar::RadrootsAdmittedCalendar
-pub fn radroots_event::calendar::RadrootsAdmittedCalendar::blossom_image(&self) -> core::option::Option<&radroots_blossom::url::BlobUrl>
-pub fn radroots_event::calendar::RadrootsAdmittedCalendar::content(&self) -> &str
-pub fn radroots_event::calendar::RadrootsAdmittedCalendar::event_references(&self) -> &[radroots_event::calendar::RadrootsCalendarEventReference]
-pub fn radroots_event::calendar::RadrootsAdmittedCalendar::list_description(&self) -> core::option::Option<&str>
-pub fn radroots_event::calendar::RadrootsAdmittedCalendar::parsed(&self) -> &radroots_event::calendar::RadrootsParsedNip52Calendar
-pub fn radroots_event::calendar::RadrootsAdmittedCalendar::title(&self) -> &str
-pub fn radroots_event::calendar::RadrootsAdmittedCalendar::try_from_parsed(radroots_event::calendar::RadrootsParsedNip52Calendar) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarAdmissionError>
-pub fn radroots_event::calendar::RadrootsAdmittedCalendar::uid(&self) -> &radroots_event::calendar::RadrootsCalendarUid
-pub struct radroots_event::calendar::RadrootsAdmittedCalendarDateEvent
-impl radroots_event::calendar::RadrootsAdmittedCalendarDateEvent
-pub fn radroots_event::calendar::RadrootsAdmittedCalendarDateEvent::blossom_image(&self) -> core::option::Option<&radroots_blossom::url::BlobUrl>
-pub fn radroots_event::calendar::RadrootsAdmittedCalendarDateEvent::d_tag(&self) -> &radroots_event::id::RadrootsDTag
-pub fn radroots_event::calendar::RadrootsAdmittedCalendarDateEvent::parsed(&self) -> &radroots_event::calendar::RadrootsParsedNip52CalendarDateEvent
-pub fn radroots_event::calendar::RadrootsAdmittedCalendarDateEvent::try_from_parsed(radroots_event::calendar::RadrootsParsedNip52CalendarDateEvent) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarAdmissionError>
-pub struct radroots_event::calendar::RadrootsAdmittedCalendarEventRsvp
-impl radroots_event::calendar::RadrootsAdmittedCalendarEventRsvp
-pub fn radroots_event::calendar::RadrootsAdmittedCalendarEventRsvp::author_hint(&self) -> core::option::Option<&radroots_event::calendar::RadrootsCalendarEventAuthorReference>
-pub fn radroots_event::calendar::RadrootsAdmittedCalendarEventRsvp::effective_free_busy(&self) -> core::option::Option<&radroots_event::calendar::RadrootsCalendarEventFreeBusy>
-pub fn radroots_event::calendar::RadrootsAdmittedCalendarEventRsvp::event_reference(&self) -> &radroots_event::calendar::RadrootsCalendarEventReference
-pub fn radroots_event::calendar::RadrootsAdmittedCalendarEventRsvp::note(&self) -> core::option::Option<&str>
-pub fn radroots_event::calendar::RadrootsAdmittedCalendarEventRsvp::observed_free_busy(&self) -> core::option::Option<&radroots_event::calendar::RadrootsCalendarEventFreeBusy>
-pub fn radroots_event::calendar::RadrootsAdmittedCalendarEventRsvp::parsed(&self) -> &radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvp
-pub fn radroots_event::calendar::RadrootsAdmittedCalendarEventRsvp::revision_reference(&self) -> core::option::Option<&radroots_event::calendar::RadrootsCalendarEventRevisionReference>
-pub fn radroots_event::calendar::RadrootsAdmittedCalendarEventRsvp::status(&self) -> &radroots_event::calendar::RadrootsCalendarEventRsvpStatus
-pub fn radroots_event::calendar::RadrootsAdmittedCalendarEventRsvp::try_from_parsed(radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvp) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarAdmissionError>
-pub fn radroots_event::calendar::RadrootsAdmittedCalendarEventRsvp::uid(&self) -> &radroots_event::calendar::RadrootsCalendarUid
-pub struct radroots_event::calendar::RadrootsAdmittedCalendarTimeEvent
-impl radroots_event::calendar::RadrootsAdmittedCalendarTimeEvent
-pub fn radroots_event::calendar::RadrootsAdmittedCalendarTimeEvent::blossom_image(&self) -> core::option::Option<&radroots_blossom::url::BlobUrl>
-pub fn radroots_event::calendar::RadrootsAdmittedCalendarTimeEvent::covered_utc_days(&self) -> &[u64]
-pub fn radroots_event::calendar::RadrootsAdmittedCalendarTimeEvent::d_tag(&self) -> &radroots_event::id::RadrootsDTag
-pub fn radroots_event::calendar::RadrootsAdmittedCalendarTimeEvent::parsed(&self) -> &radroots_event::calendar::RadrootsParsedNip52CalendarTimeEvent
-pub fn radroots_event::calendar::RadrootsAdmittedCalendarTimeEvent::try_from_parsed(radroots_event::calendar::RadrootsParsedNip52CalendarTimeEvent) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarAdmissionError>
-pub struct radroots_event::calendar::RadrootsAuthoredCalendar
-impl radroots_event::calendar::RadrootsAuthoredCalendar
-pub fn radroots_event::calendar::RadrootsAuthoredCalendar::content(&self) -> &str
-pub fn radroots_event::calendar::RadrootsAuthoredCalendar::event_references(&self) -> &[radroots_event::calendar::RadrootsCalendarEventReference]
-pub fn radroots_event::calendar::RadrootsAuthoredCalendar::image(&self) -> core::option::Option<&radroots_event::media::RadrootsAuthoredImage>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendar::list_description(&self) -> core::option::Option<&str>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendar::new(radroots_event::calendar::RadrootsCalendarUid, impl core::convert::Into<alloc::string::String>, impl core::convert::Into<alloc::string::String>, alloc::vec::Vec<radroots_event::calendar::RadrootsCalendarEventReference>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendar::title(&self) -> &str
-pub fn radroots_event::calendar::RadrootsAuthoredCalendar::uid(&self) -> &radroots_event::calendar::RadrootsCalendarUid
-pub fn radroots_event::calendar::RadrootsAuthoredCalendar::with_image(self, radroots_event::media::RadrootsAuthoredImage) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendar::with_list_description(self, impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub struct radroots_event::calendar::RadrootsAuthoredCalendarDateEvent
-impl radroots_event::calendar::RadrootsAuthoredCalendarDateEvent
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::calendar_requests(&self) -> &[radroots_event::calendar::RadrootsCalendarRequest]
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::categories(&self) -> &[alloc::string::String]
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::d_tag(&self) -> &radroots_event::id::RadrootsDTag
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::description(&self) -> core::option::Option<&str>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::end(&self) -> core::option::Option<&radroots_event::calendar::RadrootsCalendarDate>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::geohash(&self) -> core::option::Option<&str>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::image(&self) -> core::option::Option<&radroots_event::media::RadrootsAuthoredImage>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::locations(&self) -> &[alloc::string::String]
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::new(impl core::convert::AsRef<str>, impl core::convert::Into<alloc::string::String>, radroots_event::calendar::RadrootsCalendarDate) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::participants(&self) -> core::option::Option<&alloc::vec::Vec<radroots_event::calendar::RadrootsCalendarParticipant>>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::references(&self) -> &[radroots_event::calendar::RadrootsCalendarUri]
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::start(&self) -> &radroots_event::calendar::RadrootsCalendarDate
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::summary(&self) -> core::option::Option<&str>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::title(&self) -> &str
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::with_calendar_requests(self, alloc::vec::Vec<radroots_event::calendar::RadrootsCalendarRequest>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::with_categories(self, alloc::vec::Vec<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::with_description(self, impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::with_end(self, radroots_event::calendar::RadrootsCalendarDate) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::with_geohash(self, impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::with_image(self, radroots_event::media::RadrootsAuthoredImage) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::with_locations(self, alloc::vec::Vec<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::with_participants(self, alloc::vec::Vec<radroots_event::calendar::RadrootsCalendarParticipant>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::with_references(self, alloc::vec::Vec<radroots_event::calendar::RadrootsCalendarUri>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarDateEvent::with_summary(self, impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub struct radroots_event::calendar::RadrootsAuthoredCalendarEventRsvp
-impl radroots_event::calendar::RadrootsAuthoredCalendarEventRsvp
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarEventRsvp::author_hint(&self) -> core::option::Option<&radroots_event::calendar::RadrootsCalendarEventAuthorReference>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarEventRsvp::effective_free_busy(&self) -> core::option::Option<&radroots_event::calendar::RadrootsCalendarEventFreeBusy>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarEventRsvp::event_reference(&self) -> &radroots_event::calendar::RadrootsCalendarEventReference
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarEventRsvp::new(radroots_event::calendar::RadrootsCalendarUid, radroots_event::calendar::RadrootsCalendarEventReference, radroots_event::calendar::RadrootsCalendarEventRsvpStatus) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarEventRsvp::note(&self) -> core::option::Option<&str>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarEventRsvp::observed_free_busy(&self) -> core::option::Option<&radroots_event::calendar::RadrootsCalendarEventFreeBusy>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarEventRsvp::revision_reference(&self) -> core::option::Option<&radroots_event::calendar::RadrootsCalendarEventRevisionReference>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarEventRsvp::status(&self) -> &radroots_event::calendar::RadrootsCalendarEventRsvpStatus
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarEventRsvp::uid(&self) -> &radroots_event::calendar::RadrootsCalendarUid
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarEventRsvp::with_author_hint(self, radroots_event::calendar::RadrootsCalendarEventAuthorReference) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarEventRsvp::with_free_busy(self, radroots_event::calendar::RadrootsCalendarEventFreeBusy) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarEventRsvp::with_note(self, impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarEventRsvp::with_revision_reference(self, radroots_event::calendar::RadrootsCalendarEventRevisionReference) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub struct radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent
-impl radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::calendar_requests(&self) -> &[radroots_event::calendar::RadrootsCalendarRequest]
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::categories(&self) -> &[alloc::string::String]
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::d_tag(&self) -> &radroots_event::id::RadrootsDTag
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::description(&self) -> core::option::Option<&str>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::effective_end_tzid(&self) -> core::option::Option<&radroots_event::calendar::RadrootsIanaTimeZoneId>
-pub const fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::end(&self) -> core::option::Option<u64>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::end_tzid(&self) -> core::option::Option<&radroots_event::calendar::RadrootsIanaTimeZoneId>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::geohash(&self) -> core::option::Option<&str>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::image(&self) -> core::option::Option<&radroots_event::media::RadrootsAuthoredImage>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::locations(&self) -> &[alloc::string::String]
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::new(impl core::convert::AsRef<str>, impl core::convert::Into<alloc::string::String>, u64) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::participants(&self) -> core::option::Option<&alloc::vec::Vec<radroots_event::calendar::RadrootsCalendarParticipant>>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::references(&self) -> &[radroots_event::calendar::RadrootsCalendarUri]
-pub const fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::start(&self) -> u64
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::start_tzid(&self) -> core::option::Option<&radroots_event::calendar::RadrootsIanaTimeZoneId>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::summary(&self) -> core::option::Option<&str>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::title(&self) -> &str
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::with_calendar_requests(self, alloc::vec::Vec<radroots_event::calendar::RadrootsCalendarRequest>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::with_categories(self, alloc::vec::Vec<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::with_description(self, impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::with_end(self, u64) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::with_end_tzid(self, impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::with_geohash(self, impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::with_image(self, radroots_event::media::RadrootsAuthoredImage) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::with_locations(self, alloc::vec::Vec<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::with_participants(self, alloc::vec::Vec<radroots_event::calendar::RadrootsCalendarParticipant>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::with_references(self, alloc::vec::Vec<radroots_event::calendar::RadrootsCalendarUri>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::with_start_tzid(self, impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent::with_summary(self, impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub struct radroots_event::calendar::RadrootsCalendarDate(_)
-impl radroots_event::calendar::RadrootsCalendarDate
-pub fn radroots_event::calendar::RadrootsCalendarDate::as_str(&self) -> &str
-pub fn radroots_event::calendar::RadrootsCalendarDate::parse(&str) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-impl core::convert::AsRef<str> for radroots_event::calendar::RadrootsCalendarDate
-pub fn radroots_event::calendar::RadrootsCalendarDate::as_ref(&self) -> &str
-impl core::fmt::Display for radroots_event::calendar::RadrootsCalendarDate
-pub fn radroots_event::calendar::RadrootsCalendarDate::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::calendar::RadrootsCalendarDate
-pub type radroots_event::calendar::RadrootsCalendarDate::Err = radroots_event::calendar::RadrootsCalendarEventError
-pub fn radroots_event::calendar::RadrootsCalendarDate::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::calendar::RadrootsCalendarDate
-pub fn radroots_event::calendar::RadrootsCalendarDate::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::calendar::RadrootsCalendarDate
-pub fn radroots_event::calendar::RadrootsCalendarDate::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::calendar::RadrootsCalendarEventAuthorReference
-impl radroots_event::calendar::RadrootsCalendarEventAuthorReference
-pub fn radroots_event::calendar::RadrootsCalendarEventAuthorReference::is_canonical(&self) -> bool
-pub fn radroots_event::calendar::RadrootsCalendarEventAuthorReference::parse(impl core::convert::AsRef<str>, core::option::Option<&str>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsCalendarEventAuthorReference::pubkey(&self) -> &radroots_identity::key::PublicKey
-pub fn radroots_event::calendar::RadrootsCalendarEventAuthorReference::raw_pubkey(&self) -> &str
-pub fn radroots_event::calendar::RadrootsCalendarEventAuthorReference::relay(&self) -> core::option::Option<&str>
-pub struct radroots_event::calendar::RadrootsCalendarEventReference
-impl radroots_event::calendar::RadrootsCalendarEventReference
-pub fn radroots_event::calendar::RadrootsCalendarEventReference::author(&self) -> &radroots_identity::key::PublicKey
-pub fn radroots_event::calendar::RadrootsCalendarEventReference::coordinate(&self) -> &radroots_event::id::RadrootsAddressableCoordinate
-pub fn radroots_event::calendar::RadrootsCalendarEventReference::d_tag(&self) -> &radroots_event::id::RadrootsDTag
-pub fn radroots_event::calendar::RadrootsCalendarEventReference::is_canonical(&self) -> bool
-pub const fn radroots_event::calendar::RadrootsCalendarEventReference::kind(&self) -> u32
-pub fn radroots_event::calendar::RadrootsCalendarEventReference::parse(impl core::convert::AsRef<str>, core::option::Option<&str>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsCalendarEventReference::relay(&self) -> core::option::Option<&str>
-pub struct radroots_event::calendar::RadrootsCalendarEventRevisionReference
-impl radroots_event::calendar::RadrootsCalendarEventRevisionReference
-pub fn radroots_event::calendar::RadrootsCalendarEventRevisionReference::event_id(&self) -> &radroots_event::id::RadrootsEventId
-pub fn radroots_event::calendar::RadrootsCalendarEventRevisionReference::is_canonical(&self) -> bool
-pub fn radroots_event::calendar::RadrootsCalendarEventRevisionReference::parse(impl core::convert::AsRef<str>, core::option::Option<&str>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsCalendarEventRevisionReference::raw_event_id(&self) -> &str
-pub fn radroots_event::calendar::RadrootsCalendarEventRevisionReference::relay(&self) -> core::option::Option<&str>
-pub struct radroots_event::calendar::RadrootsCalendarParticipant
-pub radroots_event::calendar::RadrootsCalendarParticipant::pubkey: alloc::string::String
-pub radroots_event::calendar::RadrootsCalendarParticipant::relay: core::option::Option<alloc::string::String>
-pub radroots_event::calendar::RadrootsCalendarParticipant::role: core::option::Option<alloc::string::String>
-pub struct radroots_event::calendar::RadrootsCalendarRequest
-impl radroots_event::calendar::RadrootsCalendarRequest
-pub fn radroots_event::calendar::RadrootsCalendarRequest::calendar(&self) -> &radroots_event::id::RadrootsAddressableCoordinate
-pub fn radroots_event::calendar::RadrootsCalendarRequest::is_canonical(&self) -> bool
-pub fn radroots_event::calendar::RadrootsCalendarRequest::new(impl core::convert::AsRef<str>, core::option::Option<&str>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsCalendarRequest::relay(&self) -> core::option::Option<&str>
-pub struct radroots_event::calendar::RadrootsCalendarUid(_)
-impl radroots_event::calendar::RadrootsCalendarUid
-pub fn radroots_event::calendar::RadrootsCalendarUid::as_str(&self) -> &str
-pub fn radroots_event::calendar::RadrootsCalendarUid::into_string(self) -> alloc::string::String
-pub fn radroots_event::calendar::RadrootsCalendarUid::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-impl core::convert::AsRef<str> for radroots_event::calendar::RadrootsCalendarUid
-pub fn radroots_event::calendar::RadrootsCalendarUid::as_ref(&self) -> &str
-impl core::convert::TryFrom<&str> for radroots_event::calendar::RadrootsCalendarUid
-pub type radroots_event::calendar::RadrootsCalendarUid::Error = radroots_event::calendar::RadrootsCalendarEventError
-pub fn radroots_event::calendar::RadrootsCalendarUid::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::calendar::RadrootsCalendarUid
-pub type radroots_event::calendar::RadrootsCalendarUid::Error = radroots_event::calendar::RadrootsCalendarEventError
-pub fn radroots_event::calendar::RadrootsCalendarUid::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::calendar::RadrootsCalendarUid
-pub fn radroots_event::calendar::RadrootsCalendarUid::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::calendar::RadrootsCalendarUid
-pub type radroots_event::calendar::RadrootsCalendarUid::Err = radroots_event::calendar::RadrootsCalendarEventError
-pub fn radroots_event::calendar::RadrootsCalendarUid::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::calendar::RadrootsCalendarUid
-pub fn radroots_event::calendar::RadrootsCalendarUid::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-pub struct radroots_event::calendar::RadrootsCalendarUri(_)
-impl radroots_event::calendar::RadrootsCalendarUri
-pub fn radroots_event::calendar::RadrootsCalendarUri::as_str(&self) -> &str
-pub fn radroots_event::calendar::RadrootsCalendarUri::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-impl core::convert::AsRef<str> for radroots_event::calendar::RadrootsCalendarUri
-pub fn radroots_event::calendar::RadrootsCalendarUri::as_ref(&self) -> &str
-impl core::fmt::Display for radroots_event::calendar::RadrootsCalendarUri
-pub fn radroots_event::calendar::RadrootsCalendarUri::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::calendar::RadrootsCalendarUri
-pub type radroots_event::calendar::RadrootsCalendarUri::Err = radroots_event::calendar::RadrootsCalendarEventError
-pub fn radroots_event::calendar::RadrootsCalendarUri::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::calendar::RadrootsCalendarUri
-pub fn radroots_event::calendar::RadrootsCalendarUri::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::calendar::RadrootsCalendarUri
-pub fn radroots_event::calendar::RadrootsCalendarUri::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::calendar::RadrootsIanaTimeZoneId(_)
-impl radroots_event::calendar::RadrootsIanaTimeZoneId
-pub fn radroots_event::calendar::RadrootsIanaTimeZoneId::as_str(&self) -> &str
-pub fn radroots_event::calendar::RadrootsIanaTimeZoneId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-impl core::convert::AsRef<str> for radroots_event::calendar::RadrootsIanaTimeZoneId
-pub fn radroots_event::calendar::RadrootsIanaTimeZoneId::as_ref(&self) -> &str
-impl core::fmt::Display for radroots_event::calendar::RadrootsIanaTimeZoneId
-pub fn radroots_event::calendar::RadrootsIanaTimeZoneId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::calendar::RadrootsIanaTimeZoneId
-pub type radroots_event::calendar::RadrootsIanaTimeZoneId::Err = radroots_event::calendar::RadrootsCalendarEventError
-pub fn radroots_event::calendar::RadrootsIanaTimeZoneId::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::calendar::RadrootsIanaTimeZoneId
-pub fn radroots_event::calendar::RadrootsIanaTimeZoneId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::calendar::RadrootsIanaTimeZoneId
-pub fn radroots_event::calendar::RadrootsIanaTimeZoneId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::calendar::RadrootsObservedUtcDay
-impl radroots_event::calendar::RadrootsObservedUtcDay
-pub const fn radroots_event::calendar::RadrootsObservedUtcDay::index(&self) -> u64
-pub fn radroots_event::calendar::RadrootsObservedUtcDay::is_canonical(&self) -> bool
-pub fn radroots_event::calendar::RadrootsObservedUtcDay::parse(impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub fn radroots_event::calendar::RadrootsObservedUtcDay::wire_value(&self) -> &str
-pub struct radroots_event::calendar::RadrootsParsedNip52Calendar
-impl radroots_event::calendar::RadrootsParsedNip52Calendar
-pub fn radroots_event::calendar::RadrootsParsedNip52Calendar::content(&self) -> &str
-pub fn radroots_event::calendar::RadrootsParsedNip52Calendar::d_tag(&self) -> &str
-pub fn radroots_event::calendar::RadrootsParsedNip52Calendar::event_references(&self) -> &[radroots_event::calendar::RadrootsCalendarEventReference]
-pub fn radroots_event::calendar::RadrootsParsedNip52Calendar::image(&self) -> core::option::Option<&radroots_event::calendar::RadrootsCalendarUri>
-pub fn radroots_event::calendar::RadrootsParsedNip52Calendar::list_description(&self) -> core::option::Option<&str>
-pub fn radroots_event::calendar::RadrootsParsedNip52Calendar::title(&self) -> &str
-pub fn radroots_event::calendar::RadrootsParsedNip52Calendar::try_new(radroots_event::calendar::RadrootsParsedNip52CalendarParts) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub struct radroots_event::calendar::RadrootsParsedNip52CalendarCommon
-impl radroots_event::calendar::RadrootsParsedNip52CalendarCommon
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarCommon::calendar_requests(&self) -> &[radroots_event::calendar::RadrootsCalendarRequest]
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarCommon::categories(&self) -> &[alloc::string::String]
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarCommon::d_tag(&self) -> &str
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarCommon::description(&self) -> core::option::Option<&str>
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarCommon::geohash(&self) -> core::option::Option<&str>
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarCommon::image(&self) -> core::option::Option<&radroots_event::calendar::RadrootsCalendarUri>
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarCommon::legacy_name(&self) -> core::option::Option<&str>
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarCommon::locations(&self) -> &[alloc::string::String]
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarCommon::participants(&self) -> &[radroots_event::calendar::RadrootsCalendarParticipant]
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarCommon::references(&self) -> &[radroots_event::calendar::RadrootsCalendarUri]
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarCommon::summary(&self) -> core::option::Option<&str>
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarCommon::title(&self) -> &str
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarCommon::try_new(radroots_event::calendar::RadrootsParsedNip52CalendarCommonParts) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub struct radroots_event::calendar::RadrootsParsedNip52CalendarCommonParts
-pub radroots_event::calendar::RadrootsParsedNip52CalendarCommonParts::calendar_requests: alloc::vec::Vec<radroots_event::calendar::RadrootsCalendarRequest>
-pub radroots_event::calendar::RadrootsParsedNip52CalendarCommonParts::categories: alloc::vec::Vec<alloc::string::String>
-pub radroots_event::calendar::RadrootsParsedNip52CalendarCommonParts::d_tag: alloc::string::String
-pub radroots_event::calendar::RadrootsParsedNip52CalendarCommonParts::description: core::option::Option<alloc::string::String>
-pub radroots_event::calendar::RadrootsParsedNip52CalendarCommonParts::geohash: core::option::Option<alloc::string::String>
-pub radroots_event::calendar::RadrootsParsedNip52CalendarCommonParts::image: core::option::Option<radroots_event::calendar::RadrootsCalendarUri>
-pub radroots_event::calendar::RadrootsParsedNip52CalendarCommonParts::legacy_name: core::option::Option<alloc::string::String>
-pub radroots_event::calendar::RadrootsParsedNip52CalendarCommonParts::locations: alloc::vec::Vec<alloc::string::String>
-pub radroots_event::calendar::RadrootsParsedNip52CalendarCommonParts::participants: alloc::vec::Vec<radroots_event::calendar::RadrootsCalendarParticipant>
-pub radroots_event::calendar::RadrootsParsedNip52CalendarCommonParts::references: alloc::vec::Vec<radroots_event::calendar::RadrootsCalendarUri>
-pub radroots_event::calendar::RadrootsParsedNip52CalendarCommonParts::summary: core::option::Option<alloc::string::String>
-pub radroots_event::calendar::RadrootsParsedNip52CalendarCommonParts::title: alloc::string::String
-pub struct radroots_event::calendar::RadrootsParsedNip52CalendarDateEvent
-impl radroots_event::calendar::RadrootsParsedNip52CalendarDateEvent
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarDateEvent::common(&self) -> &radroots_event::calendar::RadrootsParsedNip52CalendarCommon
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarDateEvent::end(&self) -> core::option::Option<&radroots_event::calendar::RadrootsCalendarDate>
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarDateEvent::extension_day_tags(&self) -> &[alloc::vec::Vec<alloc::string::String>]
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarDateEvent::start(&self) -> &radroots_event::calendar::RadrootsCalendarDate
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarDateEvent::try_new(radroots_event::calendar::RadrootsParsedNip52CalendarCommon, radroots_event::calendar::RadrootsCalendarDate, core::option::Option<radroots_event::calendar::RadrootsCalendarDate>, alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub struct radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvp
-impl radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvp
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvp::author_hint(&self) -> core::option::Option<&radroots_event::calendar::RadrootsCalendarEventAuthorReference>
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvp::d_tag(&self) -> &str
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvp::effective_free_busy(&self) -> core::option::Option<&radroots_event::calendar::RadrootsCalendarEventFreeBusy>
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvp::event_reference(&self) -> &radroots_event::calendar::RadrootsCalendarEventReference
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvp::note(&self) -> core::option::Option<&str>
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvp::observed_free_busy(&self) -> core::option::Option<&radroots_event::calendar::RadrootsCalendarEventFreeBusy>
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvp::revision_reference(&self) -> core::option::Option<&radroots_event::calendar::RadrootsCalendarEventRevisionReference>
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvp::status(&self) -> &radroots_event::calendar::RadrootsCalendarEventRsvpStatus
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvp::try_new(radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvpParts) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
-pub struct radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvpParts
-pub radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvpParts::author_hint: core::option::Option<radroots_event::calendar::RadrootsCalendarEventAuthorReference>
-pub radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvpParts::d_tag: alloc::string::String
-pub radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvpParts::event_reference: radroots_event::calendar::RadrootsCalendarEventReference
-pub radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvpParts::note: core::option::Option<alloc::string::String>
-pub radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvpParts::observed_free_busy: core::option::Option<radroots_event::calendar::RadrootsCalendarEventFreeBusy>
-pub radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvpParts::revision_reference: core::option::Option<radroots_event::calendar::RadrootsCalendarEventRevisionReference>
-pub radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvpParts::status: radroots_event::calendar::RadrootsCalendarEventRsvpStatus
-pub struct radroots_event::calendar::RadrootsParsedNip52CalendarParts
-pub radroots_event::calendar::RadrootsParsedNip52CalendarParts::content: alloc::string::String
-pub radroots_event::calendar::RadrootsParsedNip52CalendarParts::d_tag: alloc::string::String
-pub radroots_event::calendar::RadrootsParsedNip52CalendarParts::event_references: alloc::vec::Vec<radroots_event::calendar::RadrootsCalendarEventReference>
-pub radroots_event::calendar::RadrootsParsedNip52CalendarParts::image: core::option::Option<radroots_event::calendar::RadrootsCalendarUri>
-pub radroots_event::calendar::RadrootsParsedNip52CalendarParts::list_description: core::option::Option<alloc::string::String>
-pub radroots_event::calendar::RadrootsParsedNip52CalendarParts::title: alloc::string::String
-pub struct radroots_event::calendar::RadrootsParsedNip52CalendarTimeEvent
-impl radroots_event::calendar::RadrootsParsedNip52CalendarTimeEvent
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarTimeEvent::common(&self) -> &radroots_event::calendar::RadrootsParsedNip52CalendarCommon
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarTimeEvent::effective_end_tzid(&self) -> core::option::Option<&radroots_event::calendar::RadrootsIanaTimeZoneId>
-pub const fn radroots_event::calendar::RadrootsParsedNip52CalendarTimeEvent::end(&self) -> core::option::Option<u64>
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarTimeEvent::end_tzid(&self) -> core::option::Option<&radroots_event::calendar::RadrootsIanaTimeZoneId>
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarTimeEvent::end_wire(&self) -> core::option::Option<&str>
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarTimeEvent::observed_day_indices(&self) -> &[radroots_event::calendar::RadrootsObservedUtcDay]
-pub const fn radroots_event::calendar::RadrootsParsedNip52CalendarTimeEvent::start(&self) -> u64
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarTimeEvent::start_tzid(&self) -> core::option::Option<&radroots_event::calendar::RadrootsIanaTimeZoneId>
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarTimeEvent::start_wire(&self) -> &str
-pub fn radroots_event::calendar::RadrootsParsedNip52CalendarTimeEvent::try_new(radroots_event::calendar::RadrootsParsedNip52CalendarCommon, alloc::string::String, u64, core::option::Option<alloc::string::String>, core::option::Option<u64>, alloc::vec::Vec<radroots_event::calendar::RadrootsObservedUtcDay>, core::option::Option<radroots_event::calendar::RadrootsIanaTimeZoneId>, core::option::Option<radroots_event::calendar::RadrootsIanaTimeZoneId>) -> core::result::Result<Self, radroots_event::calendar::RadrootsCalendarEventError>
+#[non_exhaustive] pub enum radroots_event::calendar::CalendarAdmissionError
+pub radroots_event::calendar::CalendarAdmissionError::AuthorHintMismatch
+pub radroots_event::calendar::CalendarAdmissionError::CoveredDayLimitExceeded
+pub radroots_event::calendar::CalendarAdmissionError::CoveredDayLimitExceeded::actual: u64
+pub radroots_event::calendar::CalendarAdmissionError::CoveredDayLimitExceeded::max: u64
+pub radroots_event::calendar::CalendarAdmissionError::DuplicateEventReference
+pub radroots_event::calendar::CalendarAdmissionError::ForbiddenDateDayIndex
+pub radroots_event::calendar::CalendarAdmissionError::IncompleteDayCoverage
+pub radroots_event::calendar::CalendarAdmissionError::NonBlossomImage
+pub radroots_event::calendar::CalendarAdmissionError::NonCanonicalField(&'static str)
+impl radroots_event::calendar::CalendarAdmissionError
+pub const fn radroots_event::calendar::CalendarAdmissionError::code(&self) -> &'static str
+impl core::error::Error for radroots_event::calendar::CalendarAdmissionError
+impl core::fmt::Display for radroots_event::calendar::CalendarAdmissionError
+pub fn radroots_event::calendar::CalendarAdmissionError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+#[non_exhaustive] pub enum radroots_event::calendar::CalendarEventError
+pub radroots_event::calendar::CalendarEventError::AuthorHintMismatch
+pub radroots_event::calendar::CalendarEventError::ContentTooLarge
+pub radroots_event::calendar::CalendarEventError::ContentTooLarge::actual: usize
+pub radroots_event::calendar::CalendarEventError::ContentTooLarge::max: usize
+pub radroots_event::calendar::CalendarEventError::CoveredDayLimitExceeded
+pub radroots_event::calendar::CalendarEventError::CoveredDayLimitExceeded::actual: u64
+pub radroots_event::calendar::CalendarEventError::CoveredDayLimitExceeded::max: u64
+pub radroots_event::calendar::CalendarEventError::DeclinedFreeBusyForbidden
+pub radroots_event::calendar::CalendarEventError::DuplicateEventReference
+pub radroots_event::calendar::CalendarEventError::InvalidAuthorReference
+pub radroots_event::calendar::CalendarEventError::InvalidCalendarUid
+pub radroots_event::calendar::CalendarEventError::InvalidDate
+pub radroots_event::calendar::CalendarEventError::InvalidEventReference
+pub radroots_event::calendar::CalendarEventError::InvalidGeohash
+pub radroots_event::calendar::CalendarEventError::InvalidIdentifier
+pub radroots_event::calendar::CalendarEventError::InvalidParticipant
+pub radroots_event::calendar::CalendarEventError::InvalidParticipant::index: usize
+pub radroots_event::calendar::CalendarEventError::InvalidRange
+pub radroots_event::calendar::CalendarEventError::InvalidRevisionReference
+pub radroots_event::calendar::CalendarEventError::InvalidText(&'static str)
+pub radroots_event::calendar::CalendarEventError::InvalidTimeZone
+pub radroots_event::calendar::CalendarEventError::InvalidTitle
+pub radroots_event::calendar::CalendarEventError::InvalidUrl(&'static str)
+pub radroots_event::calendar::CalendarEventError::TagBytesExceeded
+pub radroots_event::calendar::CalendarEventError::TagBytesExceeded::actual: usize
+pub radroots_event::calendar::CalendarEventError::TagBytesExceeded::max: usize
+pub radroots_event::calendar::CalendarEventError::TagCountExceeded
+pub radroots_event::calendar::CalendarEventError::TagCountExceeded::actual: usize
+pub radroots_event::calendar::CalendarEventError::TagCountExceeded::max: usize
+pub radroots_event::calendar::CalendarEventError::TagElementTooLarge
+pub radroots_event::calendar::CalendarEventError::TagElementTooLarge::actual: usize
+pub radroots_event::calendar::CalendarEventError::TagElementTooLarge::field: &'static str
+pub radroots_event::calendar::CalendarEventError::TagElementTooLarge::max: usize
+pub radroots_event::calendar::CalendarEventError::TooManyParticipants
+pub radroots_event::calendar::CalendarEventError::TooManyParticipants::actual: usize
+pub radroots_event::calendar::CalendarEventError::TooManyParticipants::max: usize
+impl radroots_event::calendar::CalendarEventError
+pub const fn radroots_event::calendar::CalendarEventError::code(&self) -> &'static str
+impl core::error::Error for radroots_event::calendar::CalendarEventError
+impl core::fmt::Display for radroots_event::calendar::CalendarEventError
+pub fn radroots_event::calendar::CalendarEventError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub enum radroots_event::calendar::CalendarEventFreeBusy
+pub radroots_event::calendar::CalendarEventFreeBusy::Busy
+pub radroots_event::calendar::CalendarEventFreeBusy::Free
+pub enum radroots_event::calendar::CalendarEventRsvpStatus
+pub radroots_event::calendar::CalendarEventRsvpStatus::Accepted
+pub radroots_event::calendar::CalendarEventRsvpStatus::Declined
+pub radroots_event::calendar::CalendarEventRsvpStatus::Tentative
+pub struct radroots_event::calendar::AdmittedCalendar
+impl radroots_event::calendar::AdmittedCalendar
+pub fn radroots_event::calendar::AdmittedCalendar::blossom_image(&self) -> core::option::Option<&radroots_blossom::url::BlobUrl>
+pub fn radroots_event::calendar::AdmittedCalendar::content(&self) -> &str
+pub fn radroots_event::calendar::AdmittedCalendar::event_references(&self) -> &[radroots_event::calendar::CalendarEventReference]
+pub fn radroots_event::calendar::AdmittedCalendar::list_description(&self) -> core::option::Option<&str>
+pub fn radroots_event::calendar::AdmittedCalendar::parsed(&self) -> &radroots_event::calendar::ParsedNip52Calendar
+pub fn radroots_event::calendar::AdmittedCalendar::title(&self) -> &str
+pub fn radroots_event::calendar::AdmittedCalendar::try_from_parsed(radroots_event::calendar::ParsedNip52Calendar) -> core::result::Result<Self, radroots_event::calendar::CalendarAdmissionError>
+pub fn radroots_event::calendar::AdmittedCalendar::uid(&self) -> &radroots_event::calendar::CalendarUid
+pub struct radroots_event::calendar::AdmittedCalendarDateEvent
+impl radroots_event::calendar::AdmittedCalendarDateEvent
+pub fn radroots_event::calendar::AdmittedCalendarDateEvent::blossom_image(&self) -> core::option::Option<&radroots_blossom::url::BlobUrl>
+pub fn radroots_event::calendar::AdmittedCalendarDateEvent::d_tag(&self) -> &radroots_event::id::DTag
+pub fn radroots_event::calendar::AdmittedCalendarDateEvent::parsed(&self) -> &radroots_event::calendar::ParsedNip52CalendarDateEvent
+pub fn radroots_event::calendar::AdmittedCalendarDateEvent::try_from_parsed(radroots_event::calendar::ParsedNip52CalendarDateEvent) -> core::result::Result<Self, radroots_event::calendar::CalendarAdmissionError>
+pub struct radroots_event::calendar::AdmittedCalendarEventRsvp
+impl radroots_event::calendar::AdmittedCalendarEventRsvp
+pub fn radroots_event::calendar::AdmittedCalendarEventRsvp::author_hint(&self) -> core::option::Option<&radroots_event::calendar::CalendarEventAuthorReference>
+pub fn radroots_event::calendar::AdmittedCalendarEventRsvp::effective_free_busy(&self) -> core::option::Option<&radroots_event::calendar::CalendarEventFreeBusy>
+pub fn radroots_event::calendar::AdmittedCalendarEventRsvp::event_reference(&self) -> &radroots_event::calendar::CalendarEventReference
+pub fn radroots_event::calendar::AdmittedCalendarEventRsvp::note(&self) -> core::option::Option<&str>
+pub fn radroots_event::calendar::AdmittedCalendarEventRsvp::observed_free_busy(&self) -> core::option::Option<&radroots_event::calendar::CalendarEventFreeBusy>
+pub fn radroots_event::calendar::AdmittedCalendarEventRsvp::parsed(&self) -> &radroots_event::calendar::ParsedNip52CalendarEventRsvp
+pub fn radroots_event::calendar::AdmittedCalendarEventRsvp::revision_reference(&self) -> core::option::Option<&radroots_event::calendar::CalendarEventRevisionReference>
+pub fn radroots_event::calendar::AdmittedCalendarEventRsvp::status(&self) -> &radroots_event::calendar::CalendarEventRsvpStatus
+pub fn radroots_event::calendar::AdmittedCalendarEventRsvp::try_from_parsed(radroots_event::calendar::ParsedNip52CalendarEventRsvp) -> core::result::Result<Self, radroots_event::calendar::CalendarAdmissionError>
+pub fn radroots_event::calendar::AdmittedCalendarEventRsvp::uid(&self) -> &radroots_event::calendar::CalendarUid
+pub struct radroots_event::calendar::AdmittedCalendarTimeEvent
+impl radroots_event::calendar::AdmittedCalendarTimeEvent
+pub fn radroots_event::calendar::AdmittedCalendarTimeEvent::blossom_image(&self) -> core::option::Option<&radroots_blossom::url::BlobUrl>
+pub fn radroots_event::calendar::AdmittedCalendarTimeEvent::covered_utc_days(&self) -> &[u64]
+pub fn radroots_event::calendar::AdmittedCalendarTimeEvent::d_tag(&self) -> &radroots_event::id::DTag
+pub fn radroots_event::calendar::AdmittedCalendarTimeEvent::parsed(&self) -> &radroots_event::calendar::ParsedNip52CalendarTimeEvent
+pub fn radroots_event::calendar::AdmittedCalendarTimeEvent::try_from_parsed(radroots_event::calendar::ParsedNip52CalendarTimeEvent) -> core::result::Result<Self, radroots_event::calendar::CalendarAdmissionError>
+pub struct radroots_event::calendar::AuthoredCalendar
+impl radroots_event::calendar::AuthoredCalendar
+pub fn radroots_event::calendar::AuthoredCalendar::content(&self) -> &str
+pub fn radroots_event::calendar::AuthoredCalendar::event_references(&self) -> &[radroots_event::calendar::CalendarEventReference]
+pub fn radroots_event::calendar::AuthoredCalendar::image(&self) -> core::option::Option<&radroots_event::media::AuthoredImage>
+pub fn radroots_event::calendar::AuthoredCalendar::list_description(&self) -> core::option::Option<&str>
+pub fn radroots_event::calendar::AuthoredCalendar::new(radroots_event::calendar::CalendarUid, impl core::convert::Into<alloc::string::String>, impl core::convert::Into<alloc::string::String>, alloc::vec::Vec<radroots_event::calendar::CalendarEventReference>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendar::title(&self) -> &str
+pub fn radroots_event::calendar::AuthoredCalendar::uid(&self) -> &radroots_event::calendar::CalendarUid
+pub fn radroots_event::calendar::AuthoredCalendar::with_image(self, radroots_event::media::AuthoredImage) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendar::with_list_description(self, impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub struct radroots_event::calendar::AuthoredCalendarDateEvent
+impl radroots_event::calendar::AuthoredCalendarDateEvent
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::calendar_requests(&self) -> &[radroots_event::calendar::CalendarRequest]
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::categories(&self) -> &[alloc::string::String]
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::d_tag(&self) -> &radroots_event::id::DTag
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::description(&self) -> core::option::Option<&str>
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::end(&self) -> core::option::Option<&radroots_event::calendar::CalendarDate>
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::geohash(&self) -> core::option::Option<&str>
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::image(&self) -> core::option::Option<&radroots_event::media::AuthoredImage>
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::locations(&self) -> &[alloc::string::String]
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::new(impl core::convert::AsRef<str>, impl core::convert::Into<alloc::string::String>, radroots_event::calendar::CalendarDate) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::participants(&self) -> core::option::Option<&alloc::vec::Vec<radroots_event::calendar::CalendarParticipant>>
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::references(&self) -> &[radroots_event::calendar::CalendarUri]
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::start(&self) -> &radroots_event::calendar::CalendarDate
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::summary(&self) -> core::option::Option<&str>
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::title(&self) -> &str
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::with_calendar_requests(self, alloc::vec::Vec<radroots_event::calendar::CalendarRequest>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::with_categories(self, alloc::vec::Vec<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::with_description(self, impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::with_end(self, radroots_event::calendar::CalendarDate) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::with_geohash(self, impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::with_image(self, radroots_event::media::AuthoredImage) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::with_locations(self, alloc::vec::Vec<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::with_participants(self, alloc::vec::Vec<radroots_event::calendar::CalendarParticipant>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::with_references(self, alloc::vec::Vec<radroots_event::calendar::CalendarUri>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarDateEvent::with_summary(self, impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub struct radroots_event::calendar::AuthoredCalendarEventRsvp
+impl radroots_event::calendar::AuthoredCalendarEventRsvp
+pub fn radroots_event::calendar::AuthoredCalendarEventRsvp::author_hint(&self) -> core::option::Option<&radroots_event::calendar::CalendarEventAuthorReference>
+pub fn radroots_event::calendar::AuthoredCalendarEventRsvp::effective_free_busy(&self) -> core::option::Option<&radroots_event::calendar::CalendarEventFreeBusy>
+pub fn radroots_event::calendar::AuthoredCalendarEventRsvp::event_reference(&self) -> &radroots_event::calendar::CalendarEventReference
+pub fn radroots_event::calendar::AuthoredCalendarEventRsvp::new(radroots_event::calendar::CalendarUid, radroots_event::calendar::CalendarEventReference, radroots_event::calendar::CalendarEventRsvpStatus) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarEventRsvp::note(&self) -> core::option::Option<&str>
+pub fn radroots_event::calendar::AuthoredCalendarEventRsvp::observed_free_busy(&self) -> core::option::Option<&radroots_event::calendar::CalendarEventFreeBusy>
+pub fn radroots_event::calendar::AuthoredCalendarEventRsvp::revision_reference(&self) -> core::option::Option<&radroots_event::calendar::CalendarEventRevisionReference>
+pub fn radroots_event::calendar::AuthoredCalendarEventRsvp::status(&self) -> &radroots_event::calendar::CalendarEventRsvpStatus
+pub fn radroots_event::calendar::AuthoredCalendarEventRsvp::uid(&self) -> &radroots_event::calendar::CalendarUid
+pub fn radroots_event::calendar::AuthoredCalendarEventRsvp::with_author_hint(self, radroots_event::calendar::CalendarEventAuthorReference) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarEventRsvp::with_free_busy(self, radroots_event::calendar::CalendarEventFreeBusy) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarEventRsvp::with_note(self, impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarEventRsvp::with_revision_reference(self, radroots_event::calendar::CalendarEventRevisionReference) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub struct radroots_event::calendar::AuthoredCalendarTimeEvent
+impl radroots_event::calendar::AuthoredCalendarTimeEvent
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::calendar_requests(&self) -> &[radroots_event::calendar::CalendarRequest]
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::categories(&self) -> &[alloc::string::String]
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::d_tag(&self) -> &radroots_event::id::DTag
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::description(&self) -> core::option::Option<&str>
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::effective_end_tzid(&self) -> core::option::Option<&radroots_event::calendar::IanaTimeZoneId>
+pub const fn radroots_event::calendar::AuthoredCalendarTimeEvent::end(&self) -> core::option::Option<u64>
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::end_tzid(&self) -> core::option::Option<&radroots_event::calendar::IanaTimeZoneId>
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::geohash(&self) -> core::option::Option<&str>
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::image(&self) -> core::option::Option<&radroots_event::media::AuthoredImage>
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::locations(&self) -> &[alloc::string::String]
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::new(impl core::convert::AsRef<str>, impl core::convert::Into<alloc::string::String>, u64) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::participants(&self) -> core::option::Option<&alloc::vec::Vec<radroots_event::calendar::CalendarParticipant>>
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::references(&self) -> &[radroots_event::calendar::CalendarUri]
+pub const fn radroots_event::calendar::AuthoredCalendarTimeEvent::start(&self) -> u64
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::start_tzid(&self) -> core::option::Option<&radroots_event::calendar::IanaTimeZoneId>
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::summary(&self) -> core::option::Option<&str>
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::title(&self) -> &str
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::with_calendar_requests(self, alloc::vec::Vec<radroots_event::calendar::CalendarRequest>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::with_categories(self, alloc::vec::Vec<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::with_description(self, impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::with_end(self, u64) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::with_end_tzid(self, impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::with_geohash(self, impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::with_image(self, radroots_event::media::AuthoredImage) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::with_locations(self, alloc::vec::Vec<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::with_participants(self, alloc::vec::Vec<radroots_event::calendar::CalendarParticipant>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::with_references(self, alloc::vec::Vec<radroots_event::calendar::CalendarUri>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::with_start_tzid(self, impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::AuthoredCalendarTimeEvent::with_summary(self, impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub struct radroots_event::calendar::CalendarDate(_)
+impl radroots_event::calendar::CalendarDate
+pub fn radroots_event::calendar::CalendarDate::as_str(&self) -> &str
+pub fn radroots_event::calendar::CalendarDate::parse(&str) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+impl core::convert::AsRef<str> for radroots_event::calendar::CalendarDate
+pub fn radroots_event::calendar::CalendarDate::as_ref(&self) -> &str
+impl core::fmt::Display for radroots_event::calendar::CalendarDate
+pub fn radroots_event::calendar::CalendarDate::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::calendar::CalendarDate
+pub type radroots_event::calendar::CalendarDate::Err = radroots_event::calendar::CalendarEventError
+pub fn radroots_event::calendar::CalendarDate::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::calendar::CalendarDate
+pub fn radroots_event::calendar::CalendarDate::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::calendar::CalendarDate
+pub fn radroots_event::calendar::CalendarDate::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+pub struct radroots_event::calendar::CalendarEventAuthorReference
+impl radroots_event::calendar::CalendarEventAuthorReference
+pub fn radroots_event::calendar::CalendarEventAuthorReference::is_canonical(&self) -> bool
+pub fn radroots_event::calendar::CalendarEventAuthorReference::parse(impl core::convert::AsRef<str>, core::option::Option<&str>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::CalendarEventAuthorReference::pubkey(&self) -> &radroots_identity::key::PublicKey
+pub fn radroots_event::calendar::CalendarEventAuthorReference::raw_pubkey(&self) -> &str
+pub fn radroots_event::calendar::CalendarEventAuthorReference::relay(&self) -> core::option::Option<&str>
+pub struct radroots_event::calendar::CalendarEventReference
+impl radroots_event::calendar::CalendarEventReference
+pub fn radroots_event::calendar::CalendarEventReference::author(&self) -> &radroots_identity::key::PublicKey
+pub fn radroots_event::calendar::CalendarEventReference::coordinate(&self) -> &radroots_event::id::AddressableCoordinate
+pub fn radroots_event::calendar::CalendarEventReference::d_tag(&self) -> &radroots_event::id::DTag
+pub fn radroots_event::calendar::CalendarEventReference::is_canonical(&self) -> bool
+pub const fn radroots_event::calendar::CalendarEventReference::kind(&self) -> u32
+pub fn radroots_event::calendar::CalendarEventReference::parse(impl core::convert::AsRef<str>, core::option::Option<&str>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::CalendarEventReference::relay(&self) -> core::option::Option<&str>
+pub struct radroots_event::calendar::CalendarEventRevisionReference
+impl radroots_event::calendar::CalendarEventRevisionReference
+pub fn radroots_event::calendar::CalendarEventRevisionReference::event_id(&self) -> &radroots_event::id::EventId
+pub fn radroots_event::calendar::CalendarEventRevisionReference::is_canonical(&self) -> bool
+pub fn radroots_event::calendar::CalendarEventRevisionReference::parse(impl core::convert::AsRef<str>, core::option::Option<&str>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::CalendarEventRevisionReference::raw_event_id(&self) -> &str
+pub fn radroots_event::calendar::CalendarEventRevisionReference::relay(&self) -> core::option::Option<&str>
+pub struct radroots_event::calendar::CalendarParticipant
+pub radroots_event::calendar::CalendarParticipant::pubkey: alloc::string::String
+pub radroots_event::calendar::CalendarParticipant::relay: core::option::Option<alloc::string::String>
+pub radroots_event::calendar::CalendarParticipant::role: core::option::Option<alloc::string::String>
+pub struct radroots_event::calendar::CalendarRequest
+impl radroots_event::calendar::CalendarRequest
+pub fn radroots_event::calendar::CalendarRequest::calendar(&self) -> &radroots_event::id::AddressableCoordinate
+pub fn radroots_event::calendar::CalendarRequest::is_canonical(&self) -> bool
+pub fn radroots_event::calendar::CalendarRequest::new(impl core::convert::AsRef<str>, core::option::Option<&str>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::CalendarRequest::relay(&self) -> core::option::Option<&str>
+pub struct radroots_event::calendar::CalendarUid(_)
+impl radroots_event::calendar::CalendarUid
+pub fn radroots_event::calendar::CalendarUid::as_str(&self) -> &str
+pub fn radroots_event::calendar::CalendarUid::into_string(self) -> alloc::string::String
+pub fn radroots_event::calendar::CalendarUid::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+impl core::convert::AsRef<str> for radroots_event::calendar::CalendarUid
+pub fn radroots_event::calendar::CalendarUid::as_ref(&self) -> &str
+impl core::convert::TryFrom<&str> for radroots_event::calendar::CalendarUid
+pub type radroots_event::calendar::CalendarUid::Error = radroots_event::calendar::CalendarEventError
+pub fn radroots_event::calendar::CalendarUid::try_from(&str) -> core::result::Result<Self, Self::Error>
+impl core::convert::TryFrom<alloc::string::String> for radroots_event::calendar::CalendarUid
+pub type radroots_event::calendar::CalendarUid::Error = radroots_event::calendar::CalendarEventError
+pub fn radroots_event::calendar::CalendarUid::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
+impl core::fmt::Display for radroots_event::calendar::CalendarUid
+pub fn radroots_event::calendar::CalendarUid::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::calendar::CalendarUid
+pub type radroots_event::calendar::CalendarUid::Err = radroots_event::calendar::CalendarEventError
+pub fn radroots_event::calendar::CalendarUid::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::calendar::CalendarUid
+pub fn radroots_event::calendar::CalendarUid::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+pub struct radroots_event::calendar::CalendarUri(_)
+impl radroots_event::calendar::CalendarUri
+pub fn radroots_event::calendar::CalendarUri::as_str(&self) -> &str
+pub fn radroots_event::calendar::CalendarUri::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+impl core::convert::AsRef<str> for radroots_event::calendar::CalendarUri
+pub fn radroots_event::calendar::CalendarUri::as_ref(&self) -> &str
+impl core::fmt::Display for radroots_event::calendar::CalendarUri
+pub fn radroots_event::calendar::CalendarUri::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::calendar::CalendarUri
+pub type radroots_event::calendar::CalendarUri::Err = radroots_event::calendar::CalendarEventError
+pub fn radroots_event::calendar::CalendarUri::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::calendar::CalendarUri
+pub fn radroots_event::calendar::CalendarUri::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::calendar::CalendarUri
+pub fn radroots_event::calendar::CalendarUri::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+pub struct radroots_event::calendar::IanaTimeZoneId(_)
+impl radroots_event::calendar::IanaTimeZoneId
+pub fn radroots_event::calendar::IanaTimeZoneId::as_str(&self) -> &str
+pub fn radroots_event::calendar::IanaTimeZoneId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+impl core::convert::AsRef<str> for radroots_event::calendar::IanaTimeZoneId
+pub fn radroots_event::calendar::IanaTimeZoneId::as_ref(&self) -> &str
+impl core::fmt::Display for radroots_event::calendar::IanaTimeZoneId
+pub fn radroots_event::calendar::IanaTimeZoneId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::calendar::IanaTimeZoneId
+pub type radroots_event::calendar::IanaTimeZoneId::Err = radroots_event::calendar::CalendarEventError
+pub fn radroots_event::calendar::IanaTimeZoneId::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::calendar::IanaTimeZoneId
+pub fn radroots_event::calendar::IanaTimeZoneId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::calendar::IanaTimeZoneId
+pub fn radroots_event::calendar::IanaTimeZoneId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+pub struct radroots_event::calendar::ObservedUtcDay
+impl radroots_event::calendar::ObservedUtcDay
+pub const fn radroots_event::calendar::ObservedUtcDay::index(&self) -> u64
+pub fn radroots_event::calendar::ObservedUtcDay::is_canonical(&self) -> bool
+pub fn radroots_event::calendar::ObservedUtcDay::parse(impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub fn radroots_event::calendar::ObservedUtcDay::wire_value(&self) -> &str
+pub struct radroots_event::calendar::ParsedNip52Calendar
+impl radroots_event::calendar::ParsedNip52Calendar
+pub fn radroots_event::calendar::ParsedNip52Calendar::content(&self) -> &str
+pub fn radroots_event::calendar::ParsedNip52Calendar::d_tag(&self) -> &str
+pub fn radroots_event::calendar::ParsedNip52Calendar::event_references(&self) -> &[radroots_event::calendar::CalendarEventReference]
+pub fn radroots_event::calendar::ParsedNip52Calendar::image(&self) -> core::option::Option<&radroots_event::calendar::CalendarUri>
+pub fn radroots_event::calendar::ParsedNip52Calendar::list_description(&self) -> core::option::Option<&str>
+pub fn radroots_event::calendar::ParsedNip52Calendar::title(&self) -> &str
+pub fn radroots_event::calendar::ParsedNip52Calendar::try_new(radroots_event::calendar::ParsedNip52CalendarParts) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub struct radroots_event::calendar::ParsedNip52CalendarCommon
+impl radroots_event::calendar::ParsedNip52CalendarCommon
+pub fn radroots_event::calendar::ParsedNip52CalendarCommon::calendar_requests(&self) -> &[radroots_event::calendar::CalendarRequest]
+pub fn radroots_event::calendar::ParsedNip52CalendarCommon::categories(&self) -> &[alloc::string::String]
+pub fn radroots_event::calendar::ParsedNip52CalendarCommon::d_tag(&self) -> &str
+pub fn radroots_event::calendar::ParsedNip52CalendarCommon::description(&self) -> core::option::Option<&str>
+pub fn radroots_event::calendar::ParsedNip52CalendarCommon::geohash(&self) -> core::option::Option<&str>
+pub fn radroots_event::calendar::ParsedNip52CalendarCommon::image(&self) -> core::option::Option<&radroots_event::calendar::CalendarUri>
+pub fn radroots_event::calendar::ParsedNip52CalendarCommon::legacy_name(&self) -> core::option::Option<&str>
+pub fn radroots_event::calendar::ParsedNip52CalendarCommon::locations(&self) -> &[alloc::string::String]
+pub fn radroots_event::calendar::ParsedNip52CalendarCommon::participants(&self) -> &[radroots_event::calendar::CalendarParticipant]
+pub fn radroots_event::calendar::ParsedNip52CalendarCommon::references(&self) -> &[radroots_event::calendar::CalendarUri]
+pub fn radroots_event::calendar::ParsedNip52CalendarCommon::summary(&self) -> core::option::Option<&str>
+pub fn radroots_event::calendar::ParsedNip52CalendarCommon::title(&self) -> &str
+pub fn radroots_event::calendar::ParsedNip52CalendarCommon::try_new(radroots_event::calendar::ParsedNip52CalendarCommonParts) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub struct radroots_event::calendar::ParsedNip52CalendarCommonParts
+pub radroots_event::calendar::ParsedNip52CalendarCommonParts::calendar_requests: alloc::vec::Vec<radroots_event::calendar::CalendarRequest>
+pub radroots_event::calendar::ParsedNip52CalendarCommonParts::categories: alloc::vec::Vec<alloc::string::String>
+pub radroots_event::calendar::ParsedNip52CalendarCommonParts::d_tag: alloc::string::String
+pub radroots_event::calendar::ParsedNip52CalendarCommonParts::description: core::option::Option<alloc::string::String>
+pub radroots_event::calendar::ParsedNip52CalendarCommonParts::geohash: core::option::Option<alloc::string::String>
+pub radroots_event::calendar::ParsedNip52CalendarCommonParts::image: core::option::Option<radroots_event::calendar::CalendarUri>
+pub radroots_event::calendar::ParsedNip52CalendarCommonParts::legacy_name: core::option::Option<alloc::string::String>
+pub radroots_event::calendar::ParsedNip52CalendarCommonParts::locations: alloc::vec::Vec<alloc::string::String>
+pub radroots_event::calendar::ParsedNip52CalendarCommonParts::participants: alloc::vec::Vec<radroots_event::calendar::CalendarParticipant>
+pub radroots_event::calendar::ParsedNip52CalendarCommonParts::references: alloc::vec::Vec<radroots_event::calendar::CalendarUri>
+pub radroots_event::calendar::ParsedNip52CalendarCommonParts::summary: core::option::Option<alloc::string::String>
+pub radroots_event::calendar::ParsedNip52CalendarCommonParts::title: alloc::string::String
+pub struct radroots_event::calendar::ParsedNip52CalendarDateEvent
+impl radroots_event::calendar::ParsedNip52CalendarDateEvent
+pub fn radroots_event::calendar::ParsedNip52CalendarDateEvent::common(&self) -> &radroots_event::calendar::ParsedNip52CalendarCommon
+pub fn radroots_event::calendar::ParsedNip52CalendarDateEvent::end(&self) -> core::option::Option<&radroots_event::calendar::CalendarDate>
+pub fn radroots_event::calendar::ParsedNip52CalendarDateEvent::extension_day_tags(&self) -> &[alloc::vec::Vec<alloc::string::String>]
+pub fn radroots_event::calendar::ParsedNip52CalendarDateEvent::start(&self) -> &radroots_event::calendar::CalendarDate
+pub fn radroots_event::calendar::ParsedNip52CalendarDateEvent::try_new(radroots_event::calendar::ParsedNip52CalendarCommon, radroots_event::calendar::CalendarDate, core::option::Option<radroots_event::calendar::CalendarDate>, alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub struct radroots_event::calendar::ParsedNip52CalendarEventRsvp
+impl radroots_event::calendar::ParsedNip52CalendarEventRsvp
+pub fn radroots_event::calendar::ParsedNip52CalendarEventRsvp::author_hint(&self) -> core::option::Option<&radroots_event::calendar::CalendarEventAuthorReference>
+pub fn radroots_event::calendar::ParsedNip52CalendarEventRsvp::d_tag(&self) -> &str
+pub fn radroots_event::calendar::ParsedNip52CalendarEventRsvp::effective_free_busy(&self) -> core::option::Option<&radroots_event::calendar::CalendarEventFreeBusy>
+pub fn radroots_event::calendar::ParsedNip52CalendarEventRsvp::event_reference(&self) -> &radroots_event::calendar::CalendarEventReference
+pub fn radroots_event::calendar::ParsedNip52CalendarEventRsvp::note(&self) -> core::option::Option<&str>
+pub fn radroots_event::calendar::ParsedNip52CalendarEventRsvp::observed_free_busy(&self) -> core::option::Option<&radroots_event::calendar::CalendarEventFreeBusy>
+pub fn radroots_event::calendar::ParsedNip52CalendarEventRsvp::revision_reference(&self) -> core::option::Option<&radroots_event::calendar::CalendarEventRevisionReference>
+pub fn radroots_event::calendar::ParsedNip52CalendarEventRsvp::status(&self) -> &radroots_event::calendar::CalendarEventRsvpStatus
+pub fn radroots_event::calendar::ParsedNip52CalendarEventRsvp::try_new(radroots_event::calendar::ParsedNip52CalendarEventRsvpParts) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
+pub struct radroots_event::calendar::ParsedNip52CalendarEventRsvpParts
+pub radroots_event::calendar::ParsedNip52CalendarEventRsvpParts::author_hint: core::option::Option<radroots_event::calendar::CalendarEventAuthorReference>
+pub radroots_event::calendar::ParsedNip52CalendarEventRsvpParts::d_tag: alloc::string::String
+pub radroots_event::calendar::ParsedNip52CalendarEventRsvpParts::event_reference: radroots_event::calendar::CalendarEventReference
+pub radroots_event::calendar::ParsedNip52CalendarEventRsvpParts::note: core::option::Option<alloc::string::String>
+pub radroots_event::calendar::ParsedNip52CalendarEventRsvpParts::observed_free_busy: core::option::Option<radroots_event::calendar::CalendarEventFreeBusy>
+pub radroots_event::calendar::ParsedNip52CalendarEventRsvpParts::revision_reference: core::option::Option<radroots_event::calendar::CalendarEventRevisionReference>
+pub radroots_event::calendar::ParsedNip52CalendarEventRsvpParts::status: radroots_event::calendar::CalendarEventRsvpStatus
+pub struct radroots_event::calendar::ParsedNip52CalendarParts
+pub radroots_event::calendar::ParsedNip52CalendarParts::content: alloc::string::String
+pub radroots_event::calendar::ParsedNip52CalendarParts::d_tag: alloc::string::String
+pub radroots_event::calendar::ParsedNip52CalendarParts::event_references: alloc::vec::Vec<radroots_event::calendar::CalendarEventReference>
+pub radroots_event::calendar::ParsedNip52CalendarParts::image: core::option::Option<radroots_event::calendar::CalendarUri>
+pub radroots_event::calendar::ParsedNip52CalendarParts::list_description: core::option::Option<alloc::string::String>
+pub radroots_event::calendar::ParsedNip52CalendarParts::title: alloc::string::String
+pub struct radroots_event::calendar::ParsedNip52CalendarTimeEvent
+impl radroots_event::calendar::ParsedNip52CalendarTimeEvent
+pub fn radroots_event::calendar::ParsedNip52CalendarTimeEvent::common(&self) -> &radroots_event::calendar::ParsedNip52CalendarCommon
+pub fn radroots_event::calendar::ParsedNip52CalendarTimeEvent::effective_end_tzid(&self) -> core::option::Option<&radroots_event::calendar::IanaTimeZoneId>
+pub const fn radroots_event::calendar::ParsedNip52CalendarTimeEvent::end(&self) -> core::option::Option<u64>
+pub fn radroots_event::calendar::ParsedNip52CalendarTimeEvent::end_tzid(&self) -> core::option::Option<&radroots_event::calendar::IanaTimeZoneId>
+pub fn radroots_event::calendar::ParsedNip52CalendarTimeEvent::end_wire(&self) -> core::option::Option<&str>
+pub fn radroots_event::calendar::ParsedNip52CalendarTimeEvent::observed_day_indices(&self) -> &[radroots_event::calendar::ObservedUtcDay]
+pub const fn radroots_event::calendar::ParsedNip52CalendarTimeEvent::start(&self) -> u64
+pub fn radroots_event::calendar::ParsedNip52CalendarTimeEvent::start_tzid(&self) -> core::option::Option<&radroots_event::calendar::IanaTimeZoneId>
+pub fn radroots_event::calendar::ParsedNip52CalendarTimeEvent::start_wire(&self) -> &str
+pub fn radroots_event::calendar::ParsedNip52CalendarTimeEvent::try_new(radroots_event::calendar::ParsedNip52CalendarCommon, alloc::string::String, u64, core::option::Option<alloc::string::String>, core::option::Option<u64>, alloc::vec::Vec<radroots_event::calendar::ObservedUtcDay>, core::option::Option<radroots_event::calendar::IanaTimeZoneId>, core::option::Option<radroots_event::calendar::IanaTimeZoneId>) -> core::result::Result<Self, radroots_event::calendar::CalendarEventError>
pub const radroots_event::calendar::RADROOTS_CALENDAR_MAX_COVERED_UTC_DAYS: u64
pub const radroots_event::calendar::RADROOTS_CALENDAR_MAX_PARTICIPANTS: usize
pub const radroots_event::calendar::RADROOTS_CALENDAR_SECONDS_PER_DAY: u64
@@ -438,126 +438,126 @@ pub fn radroots_event::calendar::calendar_relay_url_is_valid(&str) -> bool
pub fn radroots_event::calendar::calendar_tag_text_is_valid(&str) -> bool
pub fn radroots_event::calendar::canonical_calendar_geohash_is_valid(&str) -> bool
pub fn radroots_event::calendar::canonical_calendar_tag_text_is_valid(&str) -> bool
-pub fn radroots_event::calendar::covered_utc_days(u64, core::option::Option<u64>) -> core::result::Result<core::ops::range::RangeInclusive<u64>, radroots_event::calendar::RadrootsCalendarEventError>
+pub fn radroots_event::calendar::covered_utc_days(u64, core::option::Option<u64>) -> core::result::Result<core::ops::range::RangeInclusive<u64>, radroots_event::calendar::CalendarEventError>
pub mod radroots_event::contract
pub const radroots_event::contract::VERSION: &str
pub mod radroots_event::draft
-pub enum radroots_event::draft::RadrootsDraftError
-pub radroots_event::draft::RadrootsDraftError::CanonicalEventId(crate::wire::v1::RadrootsCanonicalEventIdError)
-pub radroots_event::draft::RadrootsDraftError::ContractKindMismatch
-pub radroots_event::draft::RadrootsDraftError::ContractKindMismatch::actual_kind: u32
-pub radroots_event::draft::RadrootsDraftError::ContractKindMismatch::contract_id: alloc::string::String
-pub radroots_event::draft::RadrootsDraftError::ContractKindMismatch::expected_kind: u32
-pub radroots_event::draft::RadrootsDraftError::ContractNotDraftAuthorable
-pub radroots_event::draft::RadrootsDraftError::ContractNotDraftAuthorable::contract_id: alloc::string::String
-pub radroots_event::draft::RadrootsDraftError::ContractRegistryVersionMismatch
-pub radroots_event::draft::RadrootsDraftError::ContractRegistryVersionMismatch::actual: u32
-pub radroots_event::draft::RadrootsDraftError::ContractRegistryVersionMismatch::expected: u32
-pub radroots_event::draft::RadrootsDraftError::ContractShape
-pub radroots_event::draft::RadrootsDraftError::ContractShape::contract_id: alloc::string::String
-pub radroots_event::draft::RadrootsDraftError::ContractShape::error: crate::contract::registry_v7::RadrootsContractValidationError
-pub radroots_event::draft::RadrootsDraftError::DraftExpectedEventIdMismatch
-pub radroots_event::draft::RadrootsDraftError::DraftExpectedEventIdMismatch::actual_event_id: alloc::string::String
-pub radroots_event::draft::RadrootsDraftError::DraftExpectedEventIdMismatch::expected_event_id: alloc::string::String
-pub radroots_event::draft::RadrootsDraftError::Envelope(radroots_event::envelope::RadrootsEventEnvelopeError)
-pub radroots_event::draft::RadrootsDraftError::IdParse(radroots_event::id::RadrootsIdParseError)
-pub radroots_event::draft::RadrootsDraftError::SignedEvent(radroots_event::draft::RadrootsSignedEventError)
-pub radroots_event::draft::RadrootsDraftError::SignedEventComputedIdMismatch
-pub radroots_event::draft::RadrootsDraftError::SignedEventComputedIdMismatch::computed_event_id: alloc::string::String
-pub radroots_event::draft::RadrootsDraftError::SignedEventComputedIdMismatch::expected_event_id: alloc::string::String
-pub radroots_event::draft::RadrootsDraftError::SignedEventContentMismatch
-pub radroots_event::draft::RadrootsDraftError::SignedEventContentMismatch::actual_len: usize
-pub radroots_event::draft::RadrootsDraftError::SignedEventContentMismatch::expected_len: usize
-pub radroots_event::draft::RadrootsDraftError::SignedEventCreatedAtMismatch
-pub radroots_event::draft::RadrootsDraftError::SignedEventCreatedAtMismatch::actual_created_at: u64
-pub radroots_event::draft::RadrootsDraftError::SignedEventCreatedAtMismatch::expected_created_at: u64
-pub radroots_event::draft::RadrootsDraftError::SignedEventIdMismatch
-pub radroots_event::draft::RadrootsDraftError::SignedEventIdMismatch::actual_event_id: alloc::string::String
-pub radroots_event::draft::RadrootsDraftError::SignedEventIdMismatch::expected_event_id: alloc::string::String
-pub radroots_event::draft::RadrootsDraftError::SignedEventKindMismatch
-pub radroots_event::draft::RadrootsDraftError::SignedEventKindMismatch::actual_kind: u32
-pub radroots_event::draft::RadrootsDraftError::SignedEventKindMismatch::expected_kind: u32
-pub radroots_event::draft::RadrootsDraftError::SignedEventPubkeyMismatch
-pub radroots_event::draft::RadrootsDraftError::SignedEventPubkeyMismatch::actual_pubkey: alloc::string::String
-pub radroots_event::draft::RadrootsDraftError::SignedEventPubkeyMismatch::expected_pubkey: alloc::string::String
-pub radroots_event::draft::RadrootsDraftError::SignedEventTagsMismatch
-pub radroots_event::draft::RadrootsDraftError::SignedEventTagsMismatch::actual_len: usize
-pub radroots_event::draft::RadrootsDraftError::SignedEventTagsMismatch::expected_len: usize
-pub radroots_event::draft::RadrootsDraftError::UnknownContract(alloc::string::String)
-impl core::convert::From<radroots_event::draft::RadrootsSignedEventError> for radroots_event::draft::RadrootsDraftError
-pub fn radroots_event::draft::RadrootsDraftError::from(radroots_event::draft::RadrootsSignedEventError) -> Self
-impl core::convert::From<radroots_event::envelope::RadrootsEventEnvelopeError> for radroots_event::draft::RadrootsDraftError
-pub fn radroots_event::draft::RadrootsDraftError::from(radroots_event::envelope::RadrootsEventEnvelopeError) -> Self
-impl core::convert::From<radroots_event::id::RadrootsIdParseError> for radroots_event::draft::RadrootsDraftError
-pub fn radroots_event::draft::RadrootsDraftError::from(radroots_event::id::RadrootsIdParseError) -> Self
-impl core::error::Error for radroots_event::draft::RadrootsDraftError
-impl core::fmt::Display for radroots_event::draft::RadrootsDraftError
-pub fn radroots_event::draft::RadrootsDraftError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub enum radroots_event::draft::RadrootsSignedEventError
-pub radroots_event::draft::RadrootsSignedEventError::Envelope(radroots_event::envelope::RadrootsEventEnvelopeError)
-pub radroots_event::draft::RadrootsSignedEventError::RawJson(crate::wire::v1::RadrootsEventWireError)
-pub radroots_event::draft::RadrootsSignedEventError::RawJsonMismatch
-pub radroots_event::draft::RadrootsSignedEventError::Wire(crate::wire::v1::RadrootsEventWireError)
-impl core::convert::From<radroots_event::draft::RadrootsSignedEventError> for radroots_event::draft::RadrootsDraftError
-pub fn radroots_event::draft::RadrootsDraftError::from(radroots_event::draft::RadrootsSignedEventError) -> Self
-impl core::convert::From<radroots_event::envelope::RadrootsEventEnvelopeError> for radroots_event::draft::RadrootsSignedEventError
-pub fn radroots_event::draft::RadrootsSignedEventError::from(radroots_event::envelope::RadrootsEventEnvelopeError) -> Self
-impl core::error::Error for radroots_event::draft::RadrootsSignedEventError
-impl core::fmt::Display for radroots_event::draft::RadrootsSignedEventError
-pub fn radroots_event::draft::RadrootsSignedEventError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub struct radroots_event::draft::RadrootsEventDraft
-impl radroots_event::draft::RadrootsEventDraft
-pub fn radroots_event::draft::RadrootsEventDraft::content(&self) -> &str
-pub fn radroots_event::draft::RadrootsEventDraft::contract_id(&self) -> &str
-pub fn radroots_event::draft::RadrootsEventDraft::contract_registry_version(&self) -> u32
-pub fn radroots_event::draft::RadrootsEventDraft::created_at(&self) -> radroots_event::envelope::RadrootsEventTimestamp
-pub fn radroots_event::draft::RadrootsEventDraft::created_at_u64(&self) -> u64
-pub fn radroots_event::draft::RadrootsEventDraft::expected_event_id(&self) -> &radroots_event::id::RadrootsEventId
-pub fn radroots_event::draft::RadrootsEventDraft::expected_event_id_hex(&self) -> alloc::string::String
-pub fn radroots_event::draft::RadrootsEventDraft::expected_pubkey(&self) -> &radroots_identity::key::PublicKey
-pub fn radroots_event::draft::RadrootsEventDraft::kind(&self) -> radroots_event::envelope::RadrootsEventKind
-pub fn radroots_event::draft::RadrootsEventDraft::kind_u32(&self) -> u32
-pub fn radroots_event::draft::RadrootsEventDraft::new(impl core::convert::Into<alloc::string::String>, u32, u64, alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>, impl core::convert::Into<alloc::string::String>, impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::draft::RadrootsDraftError>
-pub fn radroots_event::draft::RadrootsEventDraft::nip01_preimage(&self) -> core::result::Result<alloc::string::String, radroots_event::draft::RadrootsDraftError>
-pub fn radroots_event::draft::RadrootsEventDraft::tags(&self) -> &radroots_event::envelope::RadrootsEventTags
-pub fn radroots_event::draft::RadrootsEventDraft::tags_as_vec(&self) -> alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>
-pub fn radroots_event::draft::RadrootsEventDraft::validate_for_signing(&self) -> core::result::Result<(), radroots_event::draft::RadrootsDraftError>
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::draft::RadrootsEventDraft
-pub fn radroots_event::draft::RadrootsEventDraft::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::draft::RadrootsSignedEvent
-impl radroots_event::draft::RadrootsSignedEvent
-pub fn radroots_event::draft::RadrootsSignedEvent::content(&self) -> &str
-pub fn radroots_event::draft::RadrootsSignedEvent::created_at(&self) -> u64
-pub fn radroots_event::draft::RadrootsSignedEvent::envelope(&self) -> &radroots_event::envelope::RadrootsEventEnvelope
-pub fn radroots_event::draft::RadrootsSignedEvent::from_wire_verified_id(RadrootsNip01EventWire, impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::draft::RadrootsSignedEventError>
-pub fn radroots_event::draft::RadrootsSignedEvent::id(&self) -> &radroots_event::id::RadrootsEventId
-pub fn radroots_event::draft::RadrootsSignedEvent::id_hex(&self) -> alloc::string::String
-pub fn radroots_event::draft::RadrootsSignedEvent::id_str(&self) -> &str
-pub fn radroots_event::draft::RadrootsSignedEvent::kind(&self) -> u32
-pub fn radroots_event::draft::RadrootsSignedEvent::new(radroots_event::draft::RadrootsSignedEventParts) -> core::result::Result<Self, radroots_event::draft::RadrootsSignedEventError>
-pub fn radroots_event::draft::RadrootsSignedEvent::pubkey(&self) -> &radroots_identity::key::PublicKey
-pub fn radroots_event::draft::RadrootsSignedEvent::raw_json(&self) -> &str
-pub fn radroots_event::draft::RadrootsSignedEvent::sig(&self) -> &radroots_event::id::RadrootsEventSignature
-pub fn radroots_event::draft::RadrootsSignedEvent::sig_str(&self) -> &str
-pub fn radroots_event::draft::RadrootsSignedEvent::signature_hex(&self) -> alloc::string::String
-pub fn radroots_event::draft::RadrootsSignedEvent::tags_as_vec(&self) -> alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>
-pub fn radroots_event::draft::RadrootsSignedEvent::wire(&self) -> &RadrootsNip01EventWire
-impl serde_core::ser::Serialize for radroots_event::draft::RadrootsSignedEvent
-pub fn radroots_event::draft::RadrootsSignedEvent::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::draft::RadrootsSignedEvent
-pub fn radroots_event::draft::RadrootsSignedEvent::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::draft::RadrootsSignedEventParts
-pub radroots_event::draft::RadrootsSignedEventParts::content: alloc::string::String
-pub radroots_event::draft::RadrootsSignedEventParts::created_at: u64
-pub radroots_event::draft::RadrootsSignedEventParts::id: alloc::string::String
-pub radroots_event::draft::RadrootsSignedEventParts::kind: u32
-pub radroots_event::draft::RadrootsSignedEventParts::pubkey: alloc::string::String
-pub radroots_event::draft::RadrootsSignedEventParts::raw_json: alloc::string::String
-pub radroots_event::draft::RadrootsSignedEventParts::sig: alloc::string::String
-pub radroots_event::draft::RadrootsSignedEventParts::tags: alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>
-pub fn radroots_event::draft::compute_nip01_event_id(&str, u64, u32, &[alloc::vec::Vec<alloc::string::String>], &str) -> core::result::Result<radroots_event::id::RadrootsEventId, radroots_event::draft::RadrootsDraftError>
-pub fn radroots_event::draft::nip01_event_id_preimage(&str, u64, u32, &[alloc::vec::Vec<alloc::string::String>], &str) -> core::result::Result<alloc::string::String, radroots_event::draft::RadrootsDraftError>
-pub fn radroots_event::draft::validate_signed_nostr_event_matches_draft(&radroots_event::draft::RadrootsSignedEvent, &radroots_event::draft::RadrootsEventDraft) -> core::result::Result<(), radroots_event::draft::RadrootsDraftError>
+pub enum radroots_event::draft::DraftError
+pub radroots_event::draft::DraftError::CanonicalEventId(crate::wire::v1::CanonicalEventIdError)
+pub radroots_event::draft::DraftError::ContractKindMismatch
+pub radroots_event::draft::DraftError::ContractKindMismatch::actual_kind: u32
+pub radroots_event::draft::DraftError::ContractKindMismatch::contract_id: alloc::string::String
+pub radroots_event::draft::DraftError::ContractKindMismatch::expected_kind: u32
+pub radroots_event::draft::DraftError::ContractNotDraftAuthorable
+pub radroots_event::draft::DraftError::ContractNotDraftAuthorable::contract_id: alloc::string::String
+pub radroots_event::draft::DraftError::ContractRegistryVersionMismatch
+pub radroots_event::draft::DraftError::ContractRegistryVersionMismatch::actual: u32
+pub radroots_event::draft::DraftError::ContractRegistryVersionMismatch::expected: u32
+pub radroots_event::draft::DraftError::ContractShape
+pub radroots_event::draft::DraftError::ContractShape::contract_id: alloc::string::String
+pub radroots_event::draft::DraftError::ContractShape::error: crate::contract::registry_v7::ContractValidationError
+pub radroots_event::draft::DraftError::DraftExpectedEventIdMismatch
+pub radroots_event::draft::DraftError::DraftExpectedEventIdMismatch::actual_event_id: alloc::string::String
+pub radroots_event::draft::DraftError::DraftExpectedEventIdMismatch::expected_event_id: alloc::string::String
+pub radroots_event::draft::DraftError::Envelope(radroots_event::envelope::EventEnvelopeError)
+pub radroots_event::draft::DraftError::IdParse(radroots_event::id::ParseError)
+pub radroots_event::draft::DraftError::SignedEvent(radroots_event::draft::SignedEventError)
+pub radroots_event::draft::DraftError::SignedEventComputedIdMismatch
+pub radroots_event::draft::DraftError::SignedEventComputedIdMismatch::computed_event_id: alloc::string::String
+pub radroots_event::draft::DraftError::SignedEventComputedIdMismatch::expected_event_id: alloc::string::String
+pub radroots_event::draft::DraftError::SignedEventContentMismatch
+pub radroots_event::draft::DraftError::SignedEventContentMismatch::actual_len: usize
+pub radroots_event::draft::DraftError::SignedEventContentMismatch::expected_len: usize
+pub radroots_event::draft::DraftError::SignedEventCreatedAtMismatch
+pub radroots_event::draft::DraftError::SignedEventCreatedAtMismatch::actual_created_at: u64
+pub radroots_event::draft::DraftError::SignedEventCreatedAtMismatch::expected_created_at: u64
+pub radroots_event::draft::DraftError::SignedEventIdMismatch
+pub radroots_event::draft::DraftError::SignedEventIdMismatch::actual_event_id: alloc::string::String
+pub radroots_event::draft::DraftError::SignedEventIdMismatch::expected_event_id: alloc::string::String
+pub radroots_event::draft::DraftError::SignedEventKindMismatch
+pub radroots_event::draft::DraftError::SignedEventKindMismatch::actual_kind: u32
+pub radroots_event::draft::DraftError::SignedEventKindMismatch::expected_kind: u32
+pub radroots_event::draft::DraftError::SignedEventPubkeyMismatch
+pub radroots_event::draft::DraftError::SignedEventPubkeyMismatch::actual_pubkey: alloc::string::String
+pub radroots_event::draft::DraftError::SignedEventPubkeyMismatch::expected_pubkey: alloc::string::String
+pub radroots_event::draft::DraftError::SignedEventTagsMismatch
+pub radroots_event::draft::DraftError::SignedEventTagsMismatch::actual_len: usize
+pub radroots_event::draft::DraftError::SignedEventTagsMismatch::expected_len: usize
+pub radroots_event::draft::DraftError::UnknownContract(alloc::string::String)
+impl core::convert::From<radroots_event::draft::SignedEventError> for radroots_event::draft::DraftError
+pub fn radroots_event::draft::DraftError::from(radroots_event::draft::SignedEventError) -> Self
+impl core::convert::From<radroots_event::envelope::EventEnvelopeError> for radroots_event::draft::DraftError
+pub fn radroots_event::draft::DraftError::from(radroots_event::envelope::EventEnvelopeError) -> Self
+impl core::convert::From<radroots_event::id::ParseError> for radroots_event::draft::DraftError
+pub fn radroots_event::draft::DraftError::from(radroots_event::id::ParseError) -> Self
+impl core::error::Error for radroots_event::draft::DraftError
+impl core::fmt::Display for radroots_event::draft::DraftError
+pub fn radroots_event::draft::DraftError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub enum radroots_event::draft::SignedEventError
+pub radroots_event::draft::SignedEventError::Envelope(radroots_event::envelope::EventEnvelopeError)
+pub radroots_event::draft::SignedEventError::RawJson(crate::wire::v1::EventWireError)
+pub radroots_event::draft::SignedEventError::RawJsonMismatch
+pub radroots_event::draft::SignedEventError::Wire(crate::wire::v1::EventWireError)
+impl core::convert::From<radroots_event::draft::SignedEventError> for radroots_event::draft::DraftError
+pub fn radroots_event::draft::DraftError::from(radroots_event::draft::SignedEventError) -> Self
+impl core::convert::From<radroots_event::envelope::EventEnvelopeError> for radroots_event::draft::SignedEventError
+pub fn radroots_event::draft::SignedEventError::from(radroots_event::envelope::EventEnvelopeError) -> Self
+impl core::error::Error for radroots_event::draft::SignedEventError
+impl core::fmt::Display for radroots_event::draft::SignedEventError
+pub fn radroots_event::draft::SignedEventError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub struct radroots_event::draft::EventDraft
+impl radroots_event::draft::EventDraft
+pub fn radroots_event::draft::EventDraft::content(&self) -> &str
+pub fn radroots_event::draft::EventDraft::contract_id(&self) -> &str
+pub fn radroots_event::draft::EventDraft::contract_registry_version(&self) -> u32
+pub fn radroots_event::draft::EventDraft::created_at(&self) -> radroots_event::envelope::EventTimestamp
+pub fn radroots_event::draft::EventDraft::created_at_u64(&self) -> u64
+pub fn radroots_event::draft::EventDraft::expected_event_id(&self) -> &radroots_event::id::EventId
+pub fn radroots_event::draft::EventDraft::expected_event_id_hex(&self) -> alloc::string::String
+pub fn radroots_event::draft::EventDraft::expected_pubkey(&self) -> &radroots_identity::key::PublicKey
+pub fn radroots_event::draft::EventDraft::kind(&self) -> radroots_event::envelope::EventKind
+pub fn radroots_event::draft::EventDraft::kind_u32(&self) -> u32
+pub fn radroots_event::draft::EventDraft::new(impl core::convert::Into<alloc::string::String>, u32, u64, alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>, impl core::convert::Into<alloc::string::String>, impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::draft::DraftError>
+pub fn radroots_event::draft::EventDraft::nip01_preimage(&self) -> core::result::Result<alloc::string::String, radroots_event::draft::DraftError>
+pub fn radroots_event::draft::EventDraft::tags(&self) -> &radroots_event::envelope::EventTags
+pub fn radroots_event::draft::EventDraft::tags_as_vec(&self) -> alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>
+pub fn radroots_event::draft::EventDraft::validate_for_signing(&self) -> core::result::Result<(), radroots_event::draft::DraftError>
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::draft::EventDraft
+pub fn radroots_event::draft::EventDraft::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+pub struct radroots_event::draft::SignedEvent
+impl radroots_event::draft::SignedEvent
+pub fn radroots_event::draft::SignedEvent::content(&self) -> &str
+pub fn radroots_event::draft::SignedEvent::created_at(&self) -> u64
+pub fn radroots_event::draft::SignedEvent::envelope(&self) -> &radroots_event::envelope::EventEnvelope
+pub fn radroots_event::draft::SignedEvent::from_wire_verified_id(Nip01EventWire, impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::draft::SignedEventError>
+pub fn radroots_event::draft::SignedEvent::id(&self) -> &radroots_event::id::EventId
+pub fn radroots_event::draft::SignedEvent::id_hex(&self) -> alloc::string::String
+pub fn radroots_event::draft::SignedEvent::id_str(&self) -> &str
+pub fn radroots_event::draft::SignedEvent::kind(&self) -> u32
+pub fn radroots_event::draft::SignedEvent::new(radroots_event::draft::SignedEventParts) -> core::result::Result<Self, radroots_event::draft::SignedEventError>
+pub fn radroots_event::draft::SignedEvent::pubkey(&self) -> &radroots_identity::key::PublicKey
+pub fn radroots_event::draft::SignedEvent::raw_json(&self) -> &str
+pub fn radroots_event::draft::SignedEvent::sig(&self) -> &radroots_event::id::EventSignature
+pub fn radroots_event::draft::SignedEvent::sig_str(&self) -> &str
+pub fn radroots_event::draft::SignedEvent::signature_hex(&self) -> alloc::string::String
+pub fn radroots_event::draft::SignedEvent::tags_as_vec(&self) -> alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>
+pub fn radroots_event::draft::SignedEvent::wire(&self) -> &Nip01EventWire
+impl serde_core::ser::Serialize for radroots_event::draft::SignedEvent
+pub fn radroots_event::draft::SignedEvent::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::draft::SignedEvent
+pub fn radroots_event::draft::SignedEvent::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+pub struct radroots_event::draft::SignedEventParts
+pub radroots_event::draft::SignedEventParts::content: alloc::string::String
+pub radroots_event::draft::SignedEventParts::created_at: u64
+pub radroots_event::draft::SignedEventParts::id: alloc::string::String
+pub radroots_event::draft::SignedEventParts::kind: u32
+pub radroots_event::draft::SignedEventParts::pubkey: alloc::string::String
+pub radroots_event::draft::SignedEventParts::raw_json: alloc::string::String
+pub radroots_event::draft::SignedEventParts::sig: alloc::string::String
+pub radroots_event::draft::SignedEventParts::tags: alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>
+pub fn radroots_event::draft::compute_nip01_event_id(&str, u64, u32, &[alloc::vec::Vec<alloc::string::String>], &str) -> core::result::Result<radroots_event::id::EventId, radroots_event::draft::DraftError>
+pub fn radroots_event::draft::nip01_event_id_preimage(&str, u64, u32, &[alloc::vec::Vec<alloc::string::String>], &str) -> core::result::Result<alloc::string::String, radroots_event::draft::DraftError>
+pub fn radroots_event::draft::validate_signed_nostr_event_matches_draft(&radroots_event::draft::SignedEvent, &radroots_event::draft::EventDraft) -> core::result::Result<(), radroots_event::draft::DraftError>
pub mod radroots_event::envelope
pub mod radroots_event::envelope::event_head
pub mod radroots_event::envelope::kind
@@ -730,299 +730,299 @@ pub const fn radroots_event::envelope::kind::request_kind_for_result_kind(u32) -
pub const fn radroots_event::envelope::kind::result_kind_for_request_kind(u32) -> core::option::Option<u32>
pub const fn radroots_event::envelope::kind::trade_validation_service_request_kind_for_result(u32) -> core::option::Option<u32>
pub const fn radroots_event::envelope::kind::trade_validation_service_result_kind_for_request(u32) -> core::option::Option<u32>
-pub enum radroots_event::envelope::RadrootsEventEnvelopeError
-pub radroots_event::envelope::RadrootsEventEnvelopeError::ContentTooLarge
-pub radroots_event::envelope::RadrootsEventEnvelopeError::ContentTooLarge::actual: usize
-pub radroots_event::envelope::RadrootsEventEnvelopeError::ContentTooLarge::max: usize
-pub radroots_event::envelope::RadrootsEventEnvelopeError::ControlCharacterTagKey
-pub radroots_event::envelope::RadrootsEventEnvelopeError::ControlCharacterTagKey::index: usize
-pub radroots_event::envelope::RadrootsEventEnvelopeError::EmptyTag
-pub radroots_event::envelope::RadrootsEventEnvelopeError::EmptyTag::index: usize
-pub radroots_event::envelope::RadrootsEventEnvelopeError::EmptyTagKey
-pub radroots_event::envelope::RadrootsEventEnvelopeError::EmptyTagKey::index: usize
-pub radroots_event::envelope::RadrootsEventEnvelopeError::InvalidAuthor(radroots_event::id::RadrootsIdParseError)
-pub radroots_event::envelope::RadrootsEventEnvelopeError::InvalidId(radroots_event::id::RadrootsIdParseError)
-pub radroots_event::envelope::RadrootsEventEnvelopeError::InvalidSignature(radroots_event::id::RadrootsIdParseError)
-pub radroots_event::envelope::RadrootsEventEnvelopeError::NonCanonicalAuthor
-pub radroots_event::envelope::RadrootsEventEnvelopeError::NonCanonicalId
-pub radroots_event::envelope::RadrootsEventEnvelopeError::NonCanonicalSignature
-pub radroots_event::envelope::RadrootsEventEnvelopeError::TagElementTooLarge
-pub radroots_event::envelope::RadrootsEventEnvelopeError::TagElementTooLarge::actual: usize
-pub radroots_event::envelope::RadrootsEventEnvelopeError::TagElementTooLarge::element_index: usize
-pub radroots_event::envelope::RadrootsEventEnvelopeError::TagElementTooLarge::max: usize
-pub radroots_event::envelope::RadrootsEventEnvelopeError::TagElementTooLarge::tag_index: usize
-pub radroots_event::envelope::RadrootsEventEnvelopeError::TagsTooLarge
-pub radroots_event::envelope::RadrootsEventEnvelopeError::TagsTooLarge::actual: usize
-pub radroots_event::envelope::RadrootsEventEnvelopeError::TagsTooLarge::max: usize
-pub radroots_event::envelope::RadrootsEventEnvelopeError::TooManyTagElements
-pub radroots_event::envelope::RadrootsEventEnvelopeError::TooManyTagElements::actual: usize
-pub radroots_event::envelope::RadrootsEventEnvelopeError::TooManyTagElements::max: usize
-pub radroots_event::envelope::RadrootsEventEnvelopeError::TooManyTags
-pub radroots_event::envelope::RadrootsEventEnvelopeError::TooManyTags::actual: usize
-pub radroots_event::envelope::RadrootsEventEnvelopeError::TooManyTags::max: usize
-impl core::convert::From<radroots_event::envelope::RadrootsEventEnvelopeError> for radroots_event::draft::RadrootsDraftError
-pub fn radroots_event::draft::RadrootsDraftError::from(radroots_event::envelope::RadrootsEventEnvelopeError) -> Self
-impl core::convert::From<radroots_event::envelope::RadrootsEventEnvelopeError> for radroots_event::draft::RadrootsSignedEventError
-pub fn radroots_event::draft::RadrootsSignedEventError::from(radroots_event::envelope::RadrootsEventEnvelopeError) -> Self
-impl core::error::Error for radroots_event::envelope::RadrootsEventEnvelopeError
-impl core::fmt::Display for radroots_event::envelope::RadrootsEventEnvelopeError
-pub fn radroots_event::envelope::RadrootsEventEnvelopeError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub enum radroots_event::envelope::RadrootsEventKindClass
-pub radroots_event::envelope::RadrootsEventKindClass::Addressable
-pub radroots_event::envelope::RadrootsEventKindClass::Ephemeral
-pub radroots_event::envelope::RadrootsEventKindClass::Regular
-pub radroots_event::envelope::RadrootsEventKindClass::Replaceable
-pub struct radroots_event::envelope::RadrootsEventEnvelope
-impl radroots_event::envelope::RadrootsEventEnvelope
-pub fn radroots_event::envelope::RadrootsEventEnvelope::author(&self) -> &radroots_identity::key::PublicKey
-pub fn radroots_event::envelope::RadrootsEventEnvelope::content(&self) -> &str
-pub fn radroots_event::envelope::RadrootsEventEnvelope::created_at(&self) -> radroots_event::envelope::RadrootsEventTimestamp
-pub fn radroots_event::envelope::RadrootsEventEnvelope::created_at_u64(&self) -> u64
-pub fn radroots_event::envelope::RadrootsEventEnvelope::id(&self) -> &radroots_event::id::RadrootsEventId
-pub fn radroots_event::envelope::RadrootsEventEnvelope::id_hex(&self) -> alloc::string::String
-pub fn radroots_event::envelope::RadrootsEventEnvelope::kind(&self) -> radroots_event::envelope::RadrootsEventKind
-pub fn radroots_event::envelope::RadrootsEventEnvelope::kind_class(&self) -> radroots_event::envelope::RadrootsEventKindClass
-pub fn radroots_event::envelope::RadrootsEventEnvelope::kind_u32(&self) -> u32
-pub fn radroots_event::envelope::RadrootsEventEnvelope::new(radroots_event::envelope::RadrootsEventEnvelopeParts) -> core::result::Result<Self, radroots_event::envelope::RadrootsEventEnvelopeError>
-pub fn radroots_event::envelope::RadrootsEventEnvelope::new_with_limits(radroots_event::envelope::RadrootsEventEnvelopeParts, radroots_event::envelope::RadrootsEventEnvelopeLimits) -> core::result::Result<Self, radroots_event::envelope::RadrootsEventEnvelopeError>
-pub fn radroots_event::envelope::RadrootsEventEnvelope::sig(&self) -> &radroots_event::id::RadrootsEventSignature
-pub fn radroots_event::envelope::RadrootsEventEnvelope::signature_hex(&self) -> alloc::string::String
-pub fn radroots_event::envelope::RadrootsEventEnvelope::tag_slices(&self) -> &[radroots_event::envelope::RadrootsEventTag]
-pub fn radroots_event::envelope::RadrootsEventEnvelope::tags(&self) -> &radroots_event::envelope::RadrootsEventTags
-pub fn radroots_event::envelope::RadrootsEventEnvelope::tags_as_vec(&self) -> alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>
-pub fn radroots_event::envelope::RadrootsEventEnvelope::to_nip01_wire(&self) -> RadrootsNip01EventWire
-pub struct radroots_event::envelope::RadrootsEventEnvelopeLimits
-pub radroots_event::envelope::RadrootsEventEnvelopeLimits::max_content_bytes: usize
-pub radroots_event::envelope::RadrootsEventEnvelopeLimits::max_tag_count: usize
-pub radroots_event::envelope::RadrootsEventEnvelopeLimits::max_tag_element_bytes: usize
-pub radroots_event::envelope::RadrootsEventEnvelopeLimits::max_total_tag_bytes: usize
-pub radroots_event::envelope::RadrootsEventEnvelopeLimits::max_total_tag_elements: usize
-impl core::default::Default for radroots_event::envelope::RadrootsEventEnvelopeLimits
-pub fn radroots_event::envelope::RadrootsEventEnvelopeLimits::default() -> Self
-pub struct radroots_event::envelope::RadrootsEventEnvelopeParts
-pub radroots_event::envelope::RadrootsEventEnvelopeParts::author: alloc::string::String
-pub radroots_event::envelope::RadrootsEventEnvelopeParts::content: alloc::string::String
-pub radroots_event::envelope::RadrootsEventEnvelopeParts::created_at: u64
-pub radroots_event::envelope::RadrootsEventEnvelopeParts::id: alloc::string::String
-pub radroots_event::envelope::RadrootsEventEnvelopeParts::kind: u32
-pub radroots_event::envelope::RadrootsEventEnvelopeParts::sig: alloc::string::String
-pub radroots_event::envelope::RadrootsEventEnvelopeParts::tags: alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>
-pub struct radroots_event::envelope::RadrootsEventKind(_)
-impl radroots_event::envelope::RadrootsEventKind
-pub const fn radroots_event::envelope::RadrootsEventKind::as_u32(self) -> u32
-pub const fn radroots_event::envelope::RadrootsEventKind::class(self) -> radroots_event::envelope::RadrootsEventKindClass
-pub const fn radroots_event::envelope::RadrootsEventKind::new(u32) -> Self
-impl core::convert::From<u32> for radroots_event::envelope::RadrootsEventKind
-pub fn radroots_event::envelope::RadrootsEventKind::from(u32) -> Self
-impl serde_core::ser::Serialize for radroots_event::envelope::RadrootsEventKind
-pub fn radroots_event::envelope::RadrootsEventKind::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::envelope::RadrootsEventKind
-pub fn radroots_event::envelope::RadrootsEventKind::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::envelope::RadrootsEventTag(_)
-impl radroots_event::envelope::RadrootsEventTag
-pub fn radroots_event::envelope::RadrootsEventTag::as_slice(&self) -> &[alloc::string::String]
-pub fn radroots_event::envelope::RadrootsEventTag::into_vec(self) -> alloc::vec::Vec<alloc::string::String>
-pub fn radroots_event::envelope::RadrootsEventTag::new(usize, alloc::vec::Vec<alloc::string::String>) -> core::result::Result<Self, radroots_event::envelope::RadrootsEventEnvelopeError>
-pub fn radroots_event::envelope::RadrootsEventTag::new_with_limits(usize, alloc::vec::Vec<alloc::string::String>, radroots_event::envelope::RadrootsEventEnvelopeLimits) -> core::result::Result<Self, radroots_event::envelope::RadrootsEventEnvelopeError>
-impl serde_core::ser::Serialize for radroots_event::envelope::RadrootsEventTag
-pub fn radroots_event::envelope::RadrootsEventTag::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::envelope::RadrootsEventTag
-pub fn radroots_event::envelope::RadrootsEventTag::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::envelope::RadrootsEventTags(_)
-impl radroots_event::envelope::RadrootsEventTags
-pub fn radroots_event::envelope::RadrootsEventTags::as_slice(&self) -> &[radroots_event::envelope::RadrootsEventTag]
-pub fn radroots_event::envelope::RadrootsEventTags::into_vec(self) -> alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>
-pub fn radroots_event::envelope::RadrootsEventTags::is_empty(&self) -> bool
-pub fn radroots_event::envelope::RadrootsEventTags::len(&self) -> usize
-pub fn radroots_event::envelope::RadrootsEventTags::new(alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>) -> core::result::Result<Self, radroots_event::envelope::RadrootsEventEnvelopeError>
-pub fn radroots_event::envelope::RadrootsEventTags::new_with_limits(alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>, radroots_event::envelope::RadrootsEventEnvelopeLimits) -> core::result::Result<Self, radroots_event::envelope::RadrootsEventEnvelopeError>
-pub fn radroots_event::envelope::RadrootsEventTags::to_vec(&self) -> alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>
-impl serde_core::ser::Serialize for radroots_event::envelope::RadrootsEventTags
-pub fn radroots_event::envelope::RadrootsEventTags::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::envelope::RadrootsEventTags
-pub fn radroots_event::envelope::RadrootsEventTags::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::envelope::RadrootsEventTimestamp(_)
-impl radroots_event::envelope::RadrootsEventTimestamp
-pub const fn radroots_event::envelope::RadrootsEventTimestamp::as_u64(self) -> u64
-pub const fn radroots_event::envelope::RadrootsEventTimestamp::new(u64) -> Self
-impl core::convert::From<u64> for radroots_event::envelope::RadrootsEventTimestamp
-pub fn radroots_event::envelope::RadrootsEventTimestamp::from(u64) -> Self
-impl serde_core::ser::Serialize for radroots_event::envelope::RadrootsEventTimestamp
-pub fn radroots_event::envelope::RadrootsEventTimestamp::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::envelope::RadrootsEventTimestamp
-pub fn radroots_event::envelope::RadrootsEventTimestamp::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+pub enum radroots_event::envelope::EventEnvelopeError
+pub radroots_event::envelope::EventEnvelopeError::ContentTooLarge
+pub radroots_event::envelope::EventEnvelopeError::ContentTooLarge::actual: usize
+pub radroots_event::envelope::EventEnvelopeError::ContentTooLarge::max: usize
+pub radroots_event::envelope::EventEnvelopeError::ControlCharacterTagKey
+pub radroots_event::envelope::EventEnvelopeError::ControlCharacterTagKey::index: usize
+pub radroots_event::envelope::EventEnvelopeError::EmptyTag
+pub radroots_event::envelope::EventEnvelopeError::EmptyTag::index: usize
+pub radroots_event::envelope::EventEnvelopeError::EmptyTagKey
+pub radroots_event::envelope::EventEnvelopeError::EmptyTagKey::index: usize
+pub radroots_event::envelope::EventEnvelopeError::InvalidAuthor(radroots_event::id::ParseError)
+pub radroots_event::envelope::EventEnvelopeError::InvalidId(radroots_event::id::ParseError)
+pub radroots_event::envelope::EventEnvelopeError::InvalidSignature(radroots_event::id::ParseError)
+pub radroots_event::envelope::EventEnvelopeError::NonCanonicalAuthor
+pub radroots_event::envelope::EventEnvelopeError::NonCanonicalId
+pub radroots_event::envelope::EventEnvelopeError::NonCanonicalSignature
+pub radroots_event::envelope::EventEnvelopeError::TagElementTooLarge
+pub radroots_event::envelope::EventEnvelopeError::TagElementTooLarge::actual: usize
+pub radroots_event::envelope::EventEnvelopeError::TagElementTooLarge::element_index: usize
+pub radroots_event::envelope::EventEnvelopeError::TagElementTooLarge::max: usize
+pub radroots_event::envelope::EventEnvelopeError::TagElementTooLarge::tag_index: usize
+pub radroots_event::envelope::EventEnvelopeError::TagsTooLarge
+pub radroots_event::envelope::EventEnvelopeError::TagsTooLarge::actual: usize
+pub radroots_event::envelope::EventEnvelopeError::TagsTooLarge::max: usize
+pub radroots_event::envelope::EventEnvelopeError::TooManyTagElements
+pub radroots_event::envelope::EventEnvelopeError::TooManyTagElements::actual: usize
+pub radroots_event::envelope::EventEnvelopeError::TooManyTagElements::max: usize
+pub radroots_event::envelope::EventEnvelopeError::TooManyTags
+pub radroots_event::envelope::EventEnvelopeError::TooManyTags::actual: usize
+pub radroots_event::envelope::EventEnvelopeError::TooManyTags::max: usize
+impl core::convert::From<radroots_event::envelope::EventEnvelopeError> for radroots_event::draft::DraftError
+pub fn radroots_event::draft::DraftError::from(radroots_event::envelope::EventEnvelopeError) -> Self
+impl core::convert::From<radroots_event::envelope::EventEnvelopeError> for radroots_event::draft::SignedEventError
+pub fn radroots_event::draft::SignedEventError::from(radroots_event::envelope::EventEnvelopeError) -> Self
+impl core::error::Error for radroots_event::envelope::EventEnvelopeError
+impl core::fmt::Display for radroots_event::envelope::EventEnvelopeError
+pub fn radroots_event::envelope::EventEnvelopeError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub enum radroots_event::envelope::EventKindClass
+pub radroots_event::envelope::EventKindClass::Addressable
+pub radroots_event::envelope::EventKindClass::Ephemeral
+pub radroots_event::envelope::EventKindClass::Regular
+pub radroots_event::envelope::EventKindClass::Replaceable
+pub struct radroots_event::envelope::EventEnvelope
+impl radroots_event::envelope::EventEnvelope
+pub fn radroots_event::envelope::EventEnvelope::author(&self) -> &radroots_identity::key::PublicKey
+pub fn radroots_event::envelope::EventEnvelope::content(&self) -> &str
+pub fn radroots_event::envelope::EventEnvelope::created_at(&self) -> radroots_event::envelope::EventTimestamp
+pub fn radroots_event::envelope::EventEnvelope::created_at_u64(&self) -> u64
+pub fn radroots_event::envelope::EventEnvelope::id(&self) -> &radroots_event::id::EventId
+pub fn radroots_event::envelope::EventEnvelope::id_hex(&self) -> alloc::string::String
+pub fn radroots_event::envelope::EventEnvelope::kind(&self) -> radroots_event::envelope::EventKind
+pub fn radroots_event::envelope::EventEnvelope::kind_class(&self) -> radroots_event::envelope::EventKindClass
+pub fn radroots_event::envelope::EventEnvelope::kind_u32(&self) -> u32
+pub fn radroots_event::envelope::EventEnvelope::new(radroots_event::envelope::EventEnvelopeParts) -> core::result::Result<Self, radroots_event::envelope::EventEnvelopeError>
+pub fn radroots_event::envelope::EventEnvelope::new_with_limits(radroots_event::envelope::EventEnvelopeParts, radroots_event::envelope::EventEnvelopeLimits) -> core::result::Result<Self, radroots_event::envelope::EventEnvelopeError>
+pub fn radroots_event::envelope::EventEnvelope::sig(&self) -> &radroots_event::id::EventSignature
+pub fn radroots_event::envelope::EventEnvelope::signature_hex(&self) -> alloc::string::String
+pub fn radroots_event::envelope::EventEnvelope::tag_slices(&self) -> &[radroots_event::envelope::EventTag]
+pub fn radroots_event::envelope::EventEnvelope::tags(&self) -> &radroots_event::envelope::EventTags
+pub fn radroots_event::envelope::EventEnvelope::tags_as_vec(&self) -> alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>
+pub fn radroots_event::envelope::EventEnvelope::to_nip01_wire(&self) -> Nip01EventWire
+pub struct radroots_event::envelope::EventEnvelopeLimits
+pub radroots_event::envelope::EventEnvelopeLimits::max_content_bytes: usize
+pub radroots_event::envelope::EventEnvelopeLimits::max_tag_count: usize
+pub radroots_event::envelope::EventEnvelopeLimits::max_tag_element_bytes: usize
+pub radroots_event::envelope::EventEnvelopeLimits::max_total_tag_bytes: usize
+pub radroots_event::envelope::EventEnvelopeLimits::max_total_tag_elements: usize
+impl core::default::Default for radroots_event::envelope::EventEnvelopeLimits
+pub fn radroots_event::envelope::EventEnvelopeLimits::default() -> Self
+pub struct radroots_event::envelope::EventEnvelopeParts
+pub radroots_event::envelope::EventEnvelopeParts::author: alloc::string::String
+pub radroots_event::envelope::EventEnvelopeParts::content: alloc::string::String
+pub radroots_event::envelope::EventEnvelopeParts::created_at: u64
+pub radroots_event::envelope::EventEnvelopeParts::id: alloc::string::String
+pub radroots_event::envelope::EventEnvelopeParts::kind: u32
+pub radroots_event::envelope::EventEnvelopeParts::sig: alloc::string::String
+pub radroots_event::envelope::EventEnvelopeParts::tags: alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>
+pub struct radroots_event::envelope::EventKind(_)
+impl radroots_event::envelope::EventKind
+pub const fn radroots_event::envelope::EventKind::as_u32(self) -> u32
+pub const fn radroots_event::envelope::EventKind::class(self) -> radroots_event::envelope::EventKindClass
+pub const fn radroots_event::envelope::EventKind::new(u32) -> Self
+impl core::convert::From<u32> for radroots_event::envelope::EventKind
+pub fn radroots_event::envelope::EventKind::from(u32) -> Self
+impl serde_core::ser::Serialize for radroots_event::envelope::EventKind
+pub fn radroots_event::envelope::EventKind::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::envelope::EventKind
+pub fn radroots_event::envelope::EventKind::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+pub struct radroots_event::envelope::EventTag(_)
+impl radroots_event::envelope::EventTag
+pub fn radroots_event::envelope::EventTag::as_slice(&self) -> &[alloc::string::String]
+pub fn radroots_event::envelope::EventTag::into_vec(self) -> alloc::vec::Vec<alloc::string::String>
+pub fn radroots_event::envelope::EventTag::new(usize, alloc::vec::Vec<alloc::string::String>) -> core::result::Result<Self, radroots_event::envelope::EventEnvelopeError>
+pub fn radroots_event::envelope::EventTag::new_with_limits(usize, alloc::vec::Vec<alloc::string::String>, radroots_event::envelope::EventEnvelopeLimits) -> core::result::Result<Self, radroots_event::envelope::EventEnvelopeError>
+impl serde_core::ser::Serialize for radroots_event::envelope::EventTag
+pub fn radroots_event::envelope::EventTag::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::envelope::EventTag
+pub fn radroots_event::envelope::EventTag::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+pub struct radroots_event::envelope::EventTags(_)
+impl radroots_event::envelope::EventTags
+pub fn radroots_event::envelope::EventTags::as_slice(&self) -> &[radroots_event::envelope::EventTag]
+pub fn radroots_event::envelope::EventTags::into_vec(self) -> alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>
+pub fn radroots_event::envelope::EventTags::is_empty(&self) -> bool
+pub fn radroots_event::envelope::EventTags::len(&self) -> usize
+pub fn radroots_event::envelope::EventTags::new(alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>) -> core::result::Result<Self, radroots_event::envelope::EventEnvelopeError>
+pub fn radroots_event::envelope::EventTags::new_with_limits(alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>, radroots_event::envelope::EventEnvelopeLimits) -> core::result::Result<Self, radroots_event::envelope::EventEnvelopeError>
+pub fn radroots_event::envelope::EventTags::to_vec(&self) -> alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>
+impl serde_core::ser::Serialize for radroots_event::envelope::EventTags
+pub fn radroots_event::envelope::EventTags::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::envelope::EventTags
+pub fn radroots_event::envelope::EventTags::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+pub struct radroots_event::envelope::EventTimestamp(_)
+impl radroots_event::envelope::EventTimestamp
+pub const fn radroots_event::envelope::EventTimestamp::as_u64(self) -> u64
+pub const fn radroots_event::envelope::EventTimestamp::new(u64) -> Self
+impl core::convert::From<u64> for radroots_event::envelope::EventTimestamp
+pub fn radroots_event::envelope::EventTimestamp::from(u64) -> Self
+impl serde_core::ser::Serialize for radroots_event::envelope::EventTimestamp
+pub fn radroots_event::envelope::EventTimestamp::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::envelope::EventTimestamp
+pub fn radroots_event::envelope::EventTimestamp::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
pub mod radroots_event::farm
pub mod radroots_event::farm::change_set
-pub struct radroots_event::farm::change_set::RadrootsGcsLocation
-pub radroots_event::farm::change_set::RadrootsGcsLocation::accuracy: core::option::Option<f64>
-pub radroots_event::farm::change_set::RadrootsGcsLocation::altitude: core::option::Option<f64>
-pub radroots_event::farm::change_set::RadrootsGcsLocation::area: core::option::Option<f64>
-pub radroots_event::farm::change_set::RadrootsGcsLocation::climate: core::option::Option<alloc::string::String>
-pub radroots_event::farm::change_set::RadrootsGcsLocation::elevation: core::option::Option<u32>
-pub radroots_event::farm::change_set::RadrootsGcsLocation::gc_admin1_id: core::option::Option<alloc::string::String>
-pub radroots_event::farm::change_set::RadrootsGcsLocation::gc_admin1_name: core::option::Option<alloc::string::String>
-pub radroots_event::farm::change_set::RadrootsGcsLocation::gc_country_id: core::option::Option<alloc::string::String>
-pub radroots_event::farm::change_set::RadrootsGcsLocation::gc_country_name: core::option::Option<alloc::string::String>
-pub radroots_event::farm::change_set::RadrootsGcsLocation::gc_id: core::option::Option<alloc::string::String>
-pub radroots_event::farm::change_set::RadrootsGcsLocation::gc_name: core::option::Option<alloc::string::String>
-pub radroots_event::farm::change_set::RadrootsGcsLocation::geohash: alloc::string::String
-pub radroots_event::farm::change_set::RadrootsGcsLocation::label: core::option::Option<alloc::string::String>
-pub radroots_event::farm::change_set::RadrootsGcsLocation::lat: f64
-pub radroots_event::farm::change_set::RadrootsGcsLocation::lng: f64
-pub radroots_event::farm::change_set::RadrootsGcsLocation::point: radroots_event::farm::change_set::RadrootsGeoJsonPoint
-pub radroots_event::farm::change_set::RadrootsGcsLocation::polygon: radroots_event::farm::change_set::RadrootsGeoJsonPolygon
-pub radroots_event::farm::change_set::RadrootsGcsLocation::soil: core::option::Option<alloc::string::String>
-pub radroots_event::farm::change_set::RadrootsGcsLocation::tag_0: core::option::Option<alloc::string::String>
-pub struct radroots_event::farm::change_set::RadrootsGeoJsonPoint
-pub radroots_event::farm::change_set::RadrootsGeoJsonPoint::coordinates: [f64; 2]
-pub radroots_event::farm::change_set::RadrootsGeoJsonPoint::type: alloc::string::String
-pub struct radroots_event::farm::change_set::RadrootsGeoJsonPolygon
-pub radroots_event::farm::change_set::RadrootsGeoJsonPolygon::coordinates: alloc::vec::Vec<alloc::vec::Vec<[f64; 2]>>
-pub radroots_event::farm::change_set::RadrootsGeoJsonPolygon::type: alloc::string::String
+pub struct radroots_event::farm::change_set::GcsLocation
+pub radroots_event::farm::change_set::GcsLocation::accuracy: core::option::Option<f64>
+pub radroots_event::farm::change_set::GcsLocation::altitude: core::option::Option<f64>
+pub radroots_event::farm::change_set::GcsLocation::area: core::option::Option<f64>
+pub radroots_event::farm::change_set::GcsLocation::climate: core::option::Option<alloc::string::String>
+pub radroots_event::farm::change_set::GcsLocation::elevation: core::option::Option<u32>
+pub radroots_event::farm::change_set::GcsLocation::gc_admin1_id: core::option::Option<alloc::string::String>
+pub radroots_event::farm::change_set::GcsLocation::gc_admin1_name: core::option::Option<alloc::string::String>
+pub radroots_event::farm::change_set::GcsLocation::gc_country_id: core::option::Option<alloc::string::String>
+pub radroots_event::farm::change_set::GcsLocation::gc_country_name: core::option::Option<alloc::string::String>
+pub radroots_event::farm::change_set::GcsLocation::gc_id: core::option::Option<alloc::string::String>
+pub radroots_event::farm::change_set::GcsLocation::gc_name: core::option::Option<alloc::string::String>
+pub radroots_event::farm::change_set::GcsLocation::geohash: alloc::string::String
+pub radroots_event::farm::change_set::GcsLocation::label: core::option::Option<alloc::string::String>
+pub radroots_event::farm::change_set::GcsLocation::lat: f64
+pub radroots_event::farm::change_set::GcsLocation::lng: f64
+pub radroots_event::farm::change_set::GcsLocation::point: radroots_event::farm::change_set::GeoJsonPoint
+pub radroots_event::farm::change_set::GcsLocation::polygon: radroots_event::farm::change_set::GeoJsonPolygon
+pub radroots_event::farm::change_set::GcsLocation::soil: core::option::Option<alloc::string::String>
+pub radroots_event::farm::change_set::GcsLocation::tag_0: core::option::Option<alloc::string::String>
+pub struct radroots_event::farm::change_set::GeoJsonPoint
+pub radroots_event::farm::change_set::GeoJsonPoint::coordinates: [f64; 2]
+pub radroots_event::farm::change_set::GeoJsonPoint::type: alloc::string::String
+pub struct radroots_event::farm::change_set::GeoJsonPolygon
+pub radroots_event::farm::change_set::GeoJsonPolygon::coordinates: alloc::vec::Vec<alloc::vec::Vec<[f64; 2]>>
+pub radroots_event::farm::change_set::GeoJsonPolygon::type: alloc::string::String
pub mod radroots_event::farm::coop
-pub struct radroots_event::farm::coop::RadrootsCoop
-pub radroots_event::farm::coop::RadrootsCoop::about: core::option::Option<alloc::string::String>
-pub radroots_event::farm::coop::RadrootsCoop::banner: core::option::Option<alloc::string::String>
-pub radroots_event::farm::coop::RadrootsCoop::d_tag: alloc::string::String
-pub radroots_event::farm::coop::RadrootsCoop::location: core::option::Option<radroots_event::farm::coop::RadrootsCoopLocation>
-pub radroots_event::farm::coop::RadrootsCoop::name: alloc::string::String
-pub radroots_event::farm::coop::RadrootsCoop::picture: core::option::Option<alloc::string::String>
-pub radroots_event::farm::coop::RadrootsCoop::tags: core::option::Option<alloc::vec::Vec<alloc::string::String>>
-pub radroots_event::farm::coop::RadrootsCoop::website: core::option::Option<alloc::string::String>
-pub struct radroots_event::farm::coop::RadrootsCoopLocation
-pub radroots_event::farm::coop::RadrootsCoopLocation::city: core::option::Option<alloc::string::String>
-pub radroots_event::farm::coop::RadrootsCoopLocation::country: core::option::Option<alloc::string::String>
-pub radroots_event::farm::coop::RadrootsCoopLocation::gcs: radroots_event::farm::change_set::RadrootsGcsLocation
-pub radroots_event::farm::coop::RadrootsCoopLocation::primary: core::option::Option<alloc::string::String>
-pub radroots_event::farm::coop::RadrootsCoopLocation::region: core::option::Option<alloc::string::String>
-pub struct radroots_event::farm::coop::RadrootsCoopRef
-pub radroots_event::farm::coop::RadrootsCoopRef::d_tag: alloc::string::String
-pub radroots_event::farm::coop::RadrootsCoopRef::pubkey: alloc::string::String
+pub struct radroots_event::farm::coop::Coop
+pub radroots_event::farm::coop::Coop::about: core::option::Option<alloc::string::String>
+pub radroots_event::farm::coop::Coop::banner: core::option::Option<alloc::string::String>
+pub radroots_event::farm::coop::Coop::d_tag: alloc::string::String
+pub radroots_event::farm::coop::Coop::location: core::option::Option<radroots_event::farm::coop::CoopLocation>
+pub radroots_event::farm::coop::Coop::name: alloc::string::String
+pub radroots_event::farm::coop::Coop::picture: core::option::Option<alloc::string::String>
+pub radroots_event::farm::coop::Coop::tags: core::option::Option<alloc::vec::Vec<alloc::string::String>>
+pub radroots_event::farm::coop::Coop::website: core::option::Option<alloc::string::String>
+pub struct radroots_event::farm::coop::CoopLocation
+pub radroots_event::farm::coop::CoopLocation::city: core::option::Option<alloc::string::String>
+pub radroots_event::farm::coop::CoopLocation::country: core::option::Option<alloc::string::String>
+pub radroots_event::farm::coop::CoopLocation::gcs: radroots_event::farm::change_set::GcsLocation
+pub radroots_event::farm::coop::CoopLocation::primary: core::option::Option<alloc::string::String>
+pub radroots_event::farm::coop::CoopLocation::region: core::option::Option<alloc::string::String>
+pub struct radroots_event::farm::coop::CoopRef
+pub radroots_event::farm::coop::CoopRef::d_tag: alloc::string::String
+pub radroots_event::farm::coop::CoopRef::pubkey: alloc::string::String
pub mod radroots_event::farm::crdt
-pub enum radroots_event::farm::crdt::RadrootsCrdtBackend
-pub radroots_event::farm::crdt::RadrootsCrdtBackend::Automerge
-pub radroots_event::farm::crdt::RadrootsCrdtBackend::Loro
-pub radroots_event::farm::crdt::RadrootsCrdtBackend::Yjs
-pub enum radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind
-pub radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind::FarmActivity
-pub radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind::FarmAttachment
-pub radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind::FarmCrop
-pub radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind::FarmCropCycle
-pub radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind::FarmCropVariety
-pub radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind::FarmHarvestRecord
-pub radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind::FarmInventoryItem
-pub radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind::FarmLocation
-pub radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind::FarmMediaAsset
-pub radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind::FarmMembership
-pub radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind::FarmObservation
-pub radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind::FarmPayPeriod
-pub radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind::FarmRolePolicy
-pub radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind::FarmTask
-pub radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind::FarmWorkSession
-pub radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind::Other
-pub radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind::Other::value: alloc::string::String
-impl radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind
-pub fn radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind::as_str(&self) -> &str
-impl core::convert::From<alloc::string::String> for radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind
-pub fn radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind::from(alloc::string::String) -> Self
-impl core::convert::From<radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind> for alloc::string::String
-pub fn alloc::string::String::from(radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind) -> Self
-pub enum radroots_event::farm::crdt::RadrootsFarmSemanticKind
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmActivityCreate
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmCropCreate
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmCropCycleCreate
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmCropVarietyCreate
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmHarvestAttachmentAttach
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmHarvestLineAdd
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmHarvestLineCorrect
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmHarvestLineVoid
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmHarvestRecordCreate
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmHarvestRecordUpdate
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmInventoryItemUpdate
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmLocationCreate
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmMediaAssetAttach
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmMemberApprove
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmMemberDeactivate
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmMemberInviteCreate
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmMemberRoleSet
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmNoteCreate
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmObservationCreate
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmPayPeriodClose
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmPayPeriodOpen
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmReportExportMark
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmTaskAssign
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmTaskAttachmentAttach
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmTaskChecklistItemAdd
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmTaskCommentAdd
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmTaskComplete
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmTaskCreate
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmTaskFollowUpCreate
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmTaskJoin
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmTaskStatusSet
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmTaskUpdate
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmWorkSessionApprove
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmWorkSessionCorrect
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmWorkSessionEnd
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmWorkSessionManualEntryCreate
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmWorkSessionReject
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmWorkSessionStart
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmWorkSessionStop
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmWorkSessionSubmit
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmWorkSessionUpdate
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::FarmWorkspaceUpdate
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::Other
-pub radroots_event::farm::crdt::RadrootsFarmSemanticKind::Other::value: alloc::string::String
-impl radroots_event::farm::crdt::RadrootsFarmSemanticKind
-pub fn radroots_event::farm::crdt::RadrootsFarmSemanticKind::as_str(&self) -> &str
-impl core::convert::From<alloc::string::String> for radroots_event::farm::crdt::RadrootsFarmSemanticKind
-pub fn radroots_event::farm::crdt::RadrootsFarmSemanticKind::from(alloc::string::String) -> Self
-impl core::convert::From<radroots_event::farm::crdt::RadrootsFarmSemanticKind> for alloc::string::String
-pub fn alloc::string::String::from(radroots_event::farm::crdt::RadrootsFarmSemanticKind) -> Self
-pub struct radroots_event::farm::crdt::RadrootsFarmCrdtChange
-pub radroots_event::farm::crdt::RadrootsFarmCrdtChange::actor_id: alloc::string::String
-pub radroots_event::farm::crdt::RadrootsFarmCrdtChange::app_version: core::option::Option<alloc::string::String>
-pub radroots_event::farm::crdt::RadrootsFarmCrdtChange::author_member_id: core::option::Option<alloc::string::String>
-pub radroots_event::farm::crdt::RadrootsFarmCrdtChange::business_time_ms: u64
-pub radroots_event::farm::crdt::RadrootsFarmCrdtChange::change_hash: alloc::string::String
-pub radroots_event::farm::crdt::RadrootsFarmCrdtChange::crdt_backend: radroots_event::farm::crdt::RadrootsCrdtBackend
-pub radroots_event::farm::crdt::RadrootsFarmCrdtChange::crdt_backend_version: core::option::Option<alloc::string::String>
-pub radroots_event::farm::crdt::RadrootsFarmCrdtChange::dependencies: alloc::vec::Vec<alloc::string::String>
-pub radroots_event::farm::crdt::RadrootsFarmCrdtChange::document_id: alloc::string::String
-pub radroots_event::farm::crdt::RadrootsFarmCrdtChange::document_kind: radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind
-pub radroots_event::farm::crdt::RadrootsFarmCrdtChange::encoded_change: alloc::string::String
-pub radroots_event::farm::crdt::RadrootsFarmCrdtChange::farm_group_id: alloc::string::String
-pub radroots_event::farm::crdt::RadrootsFarmCrdtChange::schema: alloc::string::String
-pub radroots_event::farm::crdt::RadrootsFarmCrdtChange::semantic_kind: radroots_event::farm::crdt::RadrootsFarmSemanticKind
-pub radroots_event::farm::crdt::RadrootsFarmCrdtChange::workspace: radroots_event::farm::workspace::RadrootsFarmWorkspaceRef
+pub enum radroots_event::farm::crdt::CrdtBackend
+pub radroots_event::farm::crdt::CrdtBackend::Automerge
+pub radroots_event::farm::crdt::CrdtBackend::Loro
+pub radroots_event::farm::crdt::CrdtBackend::Yjs
+pub enum radroots_event::farm::crdt::FarmCrdtDocumentKind
+pub radroots_event::farm::crdt::FarmCrdtDocumentKind::FarmActivity
+pub radroots_event::farm::crdt::FarmCrdtDocumentKind::FarmAttachment
+pub radroots_event::farm::crdt::FarmCrdtDocumentKind::FarmCrop
+pub radroots_event::farm::crdt::FarmCrdtDocumentKind::FarmCropCycle
+pub radroots_event::farm::crdt::FarmCrdtDocumentKind::FarmCropVariety
+pub radroots_event::farm::crdt::FarmCrdtDocumentKind::FarmHarvestRecord
+pub radroots_event::farm::crdt::FarmCrdtDocumentKind::FarmInventoryItem
+pub radroots_event::farm::crdt::FarmCrdtDocumentKind::FarmLocation
+pub radroots_event::farm::crdt::FarmCrdtDocumentKind::FarmMediaAsset
+pub radroots_event::farm::crdt::FarmCrdtDocumentKind::FarmMembership
+pub radroots_event::farm::crdt::FarmCrdtDocumentKind::FarmObservation
+pub radroots_event::farm::crdt::FarmCrdtDocumentKind::FarmPayPeriod
+pub radroots_event::farm::crdt::FarmCrdtDocumentKind::FarmRolePolicy
+pub radroots_event::farm::crdt::FarmCrdtDocumentKind::FarmTask
+pub radroots_event::farm::crdt::FarmCrdtDocumentKind::FarmWorkSession
+pub radroots_event::farm::crdt::FarmCrdtDocumentKind::Other
+pub radroots_event::farm::crdt::FarmCrdtDocumentKind::Other::value: alloc::string::String
+impl radroots_event::farm::crdt::FarmCrdtDocumentKind
+pub fn radroots_event::farm::crdt::FarmCrdtDocumentKind::as_str(&self) -> &str
+impl core::convert::From<alloc::string::String> for radroots_event::farm::crdt::FarmCrdtDocumentKind
+pub fn radroots_event::farm::crdt::FarmCrdtDocumentKind::from(alloc::string::String) -> Self
+impl core::convert::From<radroots_event::farm::crdt::FarmCrdtDocumentKind> for alloc::string::String
+pub fn alloc::string::String::from(radroots_event::farm::crdt::FarmCrdtDocumentKind) -> Self
+pub enum radroots_event::farm::crdt::FarmSemanticKind
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmActivityCreate
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmCropCreate
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmCropCycleCreate
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmCropVarietyCreate
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmHarvestAttachmentAttach
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmHarvestLineAdd
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmHarvestLineCorrect
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmHarvestLineVoid
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmHarvestRecordCreate
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmHarvestRecordUpdate
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmInventoryItemUpdate
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmLocationCreate
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmMediaAssetAttach
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmMemberApprove
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmMemberDeactivate
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmMemberInviteCreate
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmMemberRoleSet
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmNoteCreate
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmObservationCreate
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmPayPeriodClose
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmPayPeriodOpen
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmReportExportMark
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmTaskAssign
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmTaskAttachmentAttach
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmTaskChecklistItemAdd
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmTaskCommentAdd
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmTaskComplete
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmTaskCreate
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmTaskFollowUpCreate
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmTaskJoin
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmTaskStatusSet
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmTaskUpdate
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmWorkSessionApprove
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmWorkSessionCorrect
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmWorkSessionEnd
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmWorkSessionManualEntryCreate
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmWorkSessionReject
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmWorkSessionStart
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmWorkSessionStop
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmWorkSessionSubmit
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmWorkSessionUpdate
+pub radroots_event::farm::crdt::FarmSemanticKind::FarmWorkspaceUpdate
+pub radroots_event::farm::crdt::FarmSemanticKind::Other
+pub radroots_event::farm::crdt::FarmSemanticKind::Other::value: alloc::string::String
+impl radroots_event::farm::crdt::FarmSemanticKind
+pub fn radroots_event::farm::crdt::FarmSemanticKind::as_str(&self) -> &str
+impl core::convert::From<alloc::string::String> for radroots_event::farm::crdt::FarmSemanticKind
+pub fn radroots_event::farm::crdt::FarmSemanticKind::from(alloc::string::String) -> Self
+impl core::convert::From<radroots_event::farm::crdt::FarmSemanticKind> for alloc::string::String
+pub fn alloc::string::String::from(radroots_event::farm::crdt::FarmSemanticKind) -> Self
+pub struct radroots_event::farm::crdt::FarmCrdtChange
+pub radroots_event::farm::crdt::FarmCrdtChange::actor_id: alloc::string::String
+pub radroots_event::farm::crdt::FarmCrdtChange::app_version: core::option::Option<alloc::string::String>
+pub radroots_event::farm::crdt::FarmCrdtChange::author_member_id: core::option::Option<alloc::string::String>
+pub radroots_event::farm::crdt::FarmCrdtChange::business_time_ms: u64
+pub radroots_event::farm::crdt::FarmCrdtChange::change_hash: alloc::string::String
+pub radroots_event::farm::crdt::FarmCrdtChange::crdt_backend: radroots_event::farm::crdt::CrdtBackend
+pub radroots_event::farm::crdt::FarmCrdtChange::crdt_backend_version: core::option::Option<alloc::string::String>
+pub radroots_event::farm::crdt::FarmCrdtChange::dependencies: alloc::vec::Vec<alloc::string::String>
+pub radroots_event::farm::crdt::FarmCrdtChange::document_id: alloc::string::String
+pub radroots_event::farm::crdt::FarmCrdtChange::document_kind: radroots_event::farm::crdt::FarmCrdtDocumentKind
+pub radroots_event::farm::crdt::FarmCrdtChange::encoded_change: alloc::string::String
+pub radroots_event::farm::crdt::FarmCrdtChange::farm_group_id: alloc::string::String
+pub radroots_event::farm::crdt::FarmCrdtChange::schema: alloc::string::String
+pub radroots_event::farm::crdt::FarmCrdtChange::semantic_kind: radroots_event::farm::crdt::FarmSemanticKind
+pub radroots_event::farm::crdt::FarmCrdtChange::workspace: radroots_event::farm::workspace::FarmWorkspaceRef
pub const radroots_event::farm::crdt::KIND_FARM_CRDT_CHANGE: u32
pub const radroots_event::farm::crdt::RADROOTS_FARM_CRDT_CHANGE_SCHEMA: &str
pub const radroots_event::farm::crdt::RADROOTS_FARM_CRDT_TAG: &str
pub mod radroots_event::farm::file
-pub struct radroots_event::farm::file::RadrootsFarmFileDimensions
-pub radroots_event::farm::file::RadrootsFarmFileDimensions::h: u32
-pub radroots_event::farm::file::RadrootsFarmFileDimensions::w: u32
-pub struct radroots_event::farm::file::RadrootsFarmFileMetadata
-pub radroots_event::farm::file::RadrootsFarmFileMetadata::alt: core::option::Option<alloc::string::String>
-pub radroots_event::farm::file::RadrootsFarmFileMetadata::blurhash: core::option::Option<alloc::string::String>
-pub radroots_event::farm::file::RadrootsFarmFileMetadata::caption: core::option::Option<alloc::string::String>
-pub radroots_event::farm::file::RadrootsFarmFileMetadata::d_tag: alloc::string::String
-pub radroots_event::farm::file::RadrootsFarmFileMetadata::dimensions: core::option::Option<radroots_event::farm::file::RadrootsFarmFileDimensions>
-pub radroots_event::farm::file::RadrootsFarmFileMetadata::fallbacks: alloc::vec::Vec<alloc::string::String>
-pub radroots_event::farm::file::RadrootsFarmFileMetadata::farm_group_id: alloc::string::String
-pub radroots_event::farm::file::RadrootsFarmFileMetadata::image: core::option::Option<radroots_event::farm::file::RadrootsFarmFileSource>
-pub radroots_event::farm::file::RadrootsFarmFileMetadata::mime_type: alloc::string::String
-pub radroots_event::farm::file::RadrootsFarmFileMetadata::original_sha256: core::option::Option<alloc::string::String>
-pub radroots_event::farm::file::RadrootsFarmFileMetadata::owner_document_id: alloc::string::String
-pub radroots_event::farm::file::RadrootsFarmFileMetadata::owner_document_kind: radroots_event::farm::crdt::RadrootsFarmCrdtDocumentKind
-pub radroots_event::farm::file::RadrootsFarmFileMetadata::sha256: alloc::string::String
-pub radroots_event::farm::file::RadrootsFarmFileMetadata::size_bytes: core::option::Option<u64>
-pub radroots_event::farm::file::RadrootsFarmFileMetadata::thumb: core::option::Option<radroots_event::farm::file::RadrootsFarmFileSource>
-pub radroots_event::farm::file::RadrootsFarmFileMetadata::url: alloc::string::String
-pub radroots_event::farm::file::RadrootsFarmFileMetadata::workspace: radroots_event::farm::workspace::RadrootsFarmWorkspaceRef
-pub struct radroots_event::farm::file::RadrootsFarmFileSource
-pub radroots_event::farm::file::RadrootsFarmFileSource::dimensions: core::option::Option<radroots_event::farm::file::RadrootsFarmFileDimensions>
-pub radroots_event::farm::file::RadrootsFarmFileSource::mime_type: core::option::Option<alloc::string::String>
-pub radroots_event::farm::file::RadrootsFarmFileSource::url: alloc::string::String
+pub struct radroots_event::farm::file::FarmFileDimensions
+pub radroots_event::farm::file::FarmFileDimensions::h: u32
+pub radroots_event::farm::file::FarmFileDimensions::w: u32
+pub struct radroots_event::farm::file::FarmFileMetadata
+pub radroots_event::farm::file::FarmFileMetadata::alt: core::option::Option<alloc::string::String>
+pub radroots_event::farm::file::FarmFileMetadata::blurhash: core::option::Option<alloc::string::String>
+pub radroots_event::farm::file::FarmFileMetadata::caption: core::option::Option<alloc::string::String>
+pub radroots_event::farm::file::FarmFileMetadata::d_tag: alloc::string::String
+pub radroots_event::farm::file::FarmFileMetadata::dimensions: core::option::Option<radroots_event::farm::file::FarmFileDimensions>
+pub radroots_event::farm::file::FarmFileMetadata::fallbacks: alloc::vec::Vec<alloc::string::String>
+pub radroots_event::farm::file::FarmFileMetadata::farm_group_id: alloc::string::String
+pub radroots_event::farm::file::FarmFileMetadata::image: core::option::Option<radroots_event::farm::file::FarmFileSource>
+pub radroots_event::farm::file::FarmFileMetadata::mime_type: alloc::string::String
+pub radroots_event::farm::file::FarmFileMetadata::original_sha256: core::option::Option<alloc::string::String>
+pub radroots_event::farm::file::FarmFileMetadata::owner_document_id: alloc::string::String
+pub radroots_event::farm::file::FarmFileMetadata::owner_document_kind: radroots_event::farm::crdt::FarmCrdtDocumentKind
+pub radroots_event::farm::file::FarmFileMetadata::sha256: alloc::string::String
+pub radroots_event::farm::file::FarmFileMetadata::size_bytes: core::option::Option<u64>
+pub radroots_event::farm::file::FarmFileMetadata::thumb: core::option::Option<radroots_event::farm::file::FarmFileSource>
+pub radroots_event::farm::file::FarmFileMetadata::url: alloc::string::String
+pub radroots_event::farm::file::FarmFileMetadata::workspace: radroots_event::farm::workspace::FarmWorkspaceRef
+pub struct radroots_event::farm::file::FarmFileSource
+pub radroots_event::farm::file::FarmFileSource::dimensions: core::option::Option<radroots_event::farm::file::FarmFileDimensions>
+pub radroots_event::farm::file::FarmFileSource::mime_type: core::option::Option<alloc::string::String>
+pub radroots_event::farm::file::FarmFileSource::url: alloc::string::String
pub const radroots_event::farm::file::KIND_FARM_FILE_METADATA: u32
pub mod radroots_event::farm::location
pub const radroots_event::farm::location::RADROOTS_PUBLIC_GEOHASH_BASE32: &str
@@ -1030,274 +1030,274 @@ pub const radroots_event::farm::location::RADROOTS_PUBLIC_GEOHASH_PRECISION: usi
pub fn radroots_event::farm::location::has_textual_locality(&str, core::option::Option<&str>, core::option::Option<&str>, core::option::Option<&str>) -> bool
pub fn radroots_event::farm::location::is_public_geohash5(&str) -> bool
pub mod radroots_event::farm::plot
-pub struct radroots_event::farm::plot::RadrootsPlot
-pub radroots_event::farm::plot::RadrootsPlot::about: core::option::Option<alloc::string::String>
-pub radroots_event::farm::plot::RadrootsPlot::d_tag: alloc::string::String
-pub radroots_event::farm::plot::RadrootsPlot::farm: radroots_event::farm::RadrootsFarmRef
-pub radroots_event::farm::plot::RadrootsPlot::location: core::option::Option<radroots_event::farm::plot::RadrootsPlotLocation>
-pub radroots_event::farm::plot::RadrootsPlot::name: alloc::string::String
-pub radroots_event::farm::plot::RadrootsPlot::tags: core::option::Option<alloc::vec::Vec<alloc::string::String>>
-pub struct radroots_event::farm::plot::RadrootsPlotLocation
-pub radroots_event::farm::plot::RadrootsPlotLocation::city: core::option::Option<alloc::string::String>
-pub radroots_event::farm::plot::RadrootsPlotLocation::country: core::option::Option<alloc::string::String>
-pub radroots_event::farm::plot::RadrootsPlotLocation::gcs: radroots_event::farm::change_set::RadrootsGcsLocation
-pub radroots_event::farm::plot::RadrootsPlotLocation::primary: core::option::Option<alloc::string::String>
-pub radroots_event::farm::plot::RadrootsPlotLocation::region: core::option::Option<alloc::string::String>
-pub struct radroots_event::farm::plot::RadrootsPlotRef
-pub radroots_event::farm::plot::RadrootsPlotRef::d_tag: alloc::string::String
-pub radroots_event::farm::plot::RadrootsPlotRef::pubkey: alloc::string::String
+pub struct radroots_event::farm::plot::Plot
+pub radroots_event::farm::plot::Plot::about: core::option::Option<alloc::string::String>
+pub radroots_event::farm::plot::Plot::d_tag: alloc::string::String
+pub radroots_event::farm::plot::Plot::farm: radroots_event::farm::FarmRef
+pub radroots_event::farm::plot::Plot::location: core::option::Option<radroots_event::farm::plot::PlotLocation>
+pub radroots_event::farm::plot::Plot::name: alloc::string::String
+pub radroots_event::farm::plot::Plot::tags: core::option::Option<alloc::vec::Vec<alloc::string::String>>
+pub struct radroots_event::farm::plot::PlotLocation
+pub radroots_event::farm::plot::PlotLocation::city: core::option::Option<alloc::string::String>
+pub radroots_event::farm::plot::PlotLocation::country: core::option::Option<alloc::string::String>
+pub radroots_event::farm::plot::PlotLocation::gcs: radroots_event::farm::change_set::GcsLocation
+pub radroots_event::farm::plot::PlotLocation::primary: core::option::Option<alloc::string::String>
+pub radroots_event::farm::plot::PlotLocation::region: core::option::Option<alloc::string::String>
+pub struct radroots_event::farm::plot::PlotRef
+pub radroots_event::farm::plot::PlotRef::d_tag: alloc::string::String
+pub radroots_event::farm::plot::PlotRef::pubkey: alloc::string::String
pub mod radroots_event::farm::resource_area
-pub struct radroots_event::farm::resource_area::RadrootsResourceArea
-pub radroots_event::farm::resource_area::RadrootsResourceArea::about: core::option::Option<alloc::string::String>
-pub radroots_event::farm::resource_area::RadrootsResourceArea::d_tag: alloc::string::String
-pub radroots_event::farm::resource_area::RadrootsResourceArea::location: radroots_event::farm::resource_area::RadrootsResourceAreaLocation
-pub radroots_event::farm::resource_area::RadrootsResourceArea::name: alloc::string::String
-pub radroots_event::farm::resource_area::RadrootsResourceArea::tags: core::option::Option<alloc::vec::Vec<alloc::string::String>>
-pub struct radroots_event::farm::resource_area::RadrootsResourceAreaLocation
-pub radroots_event::farm::resource_area::RadrootsResourceAreaLocation::city: core::option::Option<alloc::string::String>
-pub radroots_event::farm::resource_area::RadrootsResourceAreaLocation::country: core::option::Option<alloc::string::String>
-pub radroots_event::farm::resource_area::RadrootsResourceAreaLocation::gcs: radroots_event::farm::change_set::RadrootsGcsLocation
-pub radroots_event::farm::resource_area::RadrootsResourceAreaLocation::primary: core::option::Option<alloc::string::String>
-pub radroots_event::farm::resource_area::RadrootsResourceAreaLocation::region: core::option::Option<alloc::string::String>
-pub struct radroots_event::farm::resource_area::RadrootsResourceAreaRef
-pub radroots_event::farm::resource_area::RadrootsResourceAreaRef::d_tag: alloc::string::String
-pub radroots_event::farm::resource_area::RadrootsResourceAreaRef::pubkey: alloc::string::String
+pub struct radroots_event::farm::resource_area::ResourceArea
+pub radroots_event::farm::resource_area::ResourceArea::about: core::option::Option<alloc::string::String>
+pub radroots_event::farm::resource_area::ResourceArea::d_tag: alloc::string::String
+pub radroots_event::farm::resource_area::ResourceArea::location: radroots_event::farm::resource_area::ResourceAreaLocation
+pub radroots_event::farm::resource_area::ResourceArea::name: alloc::string::String
+pub radroots_event::farm::resource_area::ResourceArea::tags: core::option::Option<alloc::vec::Vec<alloc::string::String>>
+pub struct radroots_event::farm::resource_area::ResourceAreaLocation
+pub radroots_event::farm::resource_area::ResourceAreaLocation::city: core::option::Option<alloc::string::String>
+pub radroots_event::farm::resource_area::ResourceAreaLocation::country: core::option::Option<alloc::string::String>
+pub radroots_event::farm::resource_area::ResourceAreaLocation::gcs: radroots_event::farm::change_set::GcsLocation
+pub radroots_event::farm::resource_area::ResourceAreaLocation::primary: core::option::Option<alloc::string::String>
+pub radroots_event::farm::resource_area::ResourceAreaLocation::region: core::option::Option<alloc::string::String>
+pub struct radroots_event::farm::resource_area::ResourceAreaRef
+pub radroots_event::farm::resource_area::ResourceAreaRef::d_tag: alloc::string::String
+pub radroots_event::farm::resource_area::ResourceAreaRef::pubkey: alloc::string::String
pub mod radroots_event::farm::resource_cap
-pub struct radroots_event::farm::resource_cap::RadrootsResourceHarvestCap
-pub radroots_event::farm::resource_cap::RadrootsResourceHarvestCap::cap_quantity: radroots_core::quantity::Quantity
-pub radroots_event::farm::resource_cap::RadrootsResourceHarvestCap::d_tag: alloc::string::String
-pub radroots_event::farm::resource_cap::RadrootsResourceHarvestCap::display_amount: core::option::Option<radroots_core::decimal::Decimal>
-pub radroots_event::farm::resource_cap::RadrootsResourceHarvestCap::display_label: core::option::Option<alloc::string::String>
-pub radroots_event::farm::resource_cap::RadrootsResourceHarvestCap::display_unit: core::option::Option<radroots_core::unit::Unit>
-pub radroots_event::farm::resource_cap::RadrootsResourceHarvestCap::end: u64
-pub radroots_event::farm::resource_cap::RadrootsResourceHarvestCap::product: radroots_event::farm::resource_cap::RadrootsResourceHarvestProduct
-pub radroots_event::farm::resource_cap::RadrootsResourceHarvestCap::resource_area: radroots_event::farm::resource_area::RadrootsResourceAreaRef
-pub radroots_event::farm::resource_cap::RadrootsResourceHarvestCap::start: u64
-pub radroots_event::farm::resource_cap::RadrootsResourceHarvestCap::tags: core::option::Option<alloc::vec::Vec<alloc::string::String>>
-pub struct radroots_event::farm::resource_cap::RadrootsResourceHarvestProduct
-pub radroots_event::farm::resource_cap::RadrootsResourceHarvestProduct::category: core::option::Option<alloc::string::String>
-pub radroots_event::farm::resource_cap::RadrootsResourceHarvestProduct::key: alloc::string::String
+pub struct radroots_event::farm::resource_cap::ResourceHarvestCap
+pub radroots_event::farm::resource_cap::ResourceHarvestCap::cap_quantity: radroots_core::quantity::Quantity
+pub radroots_event::farm::resource_cap::ResourceHarvestCap::d_tag: alloc::string::String
+pub radroots_event::farm::resource_cap::ResourceHarvestCap::display_amount: core::option::Option<radroots_core::decimal::Decimal>
+pub radroots_event::farm::resource_cap::ResourceHarvestCap::display_label: core::option::Option<alloc::string::String>
+pub radroots_event::farm::resource_cap::ResourceHarvestCap::display_unit: core::option::Option<radroots_core::unit::Unit>
+pub radroots_event::farm::resource_cap::ResourceHarvestCap::end: u64
+pub radroots_event::farm::resource_cap::ResourceHarvestCap::product: radroots_event::farm::resource_cap::ResourceHarvestProduct
+pub radroots_event::farm::resource_cap::ResourceHarvestCap::resource_area: radroots_event::farm::resource_area::ResourceAreaRef
+pub radroots_event::farm::resource_cap::ResourceHarvestCap::start: u64
+pub radroots_event::farm::resource_cap::ResourceHarvestCap::tags: core::option::Option<alloc::vec::Vec<alloc::string::String>>
+pub struct radroots_event::farm::resource_cap::ResourceHarvestProduct
+pub radroots_event::farm::resource_cap::ResourceHarvestProduct::category: core::option::Option<alloc::string::String>
+pub radroots_event::farm::resource_cap::ResourceHarvestProduct::key: alloc::string::String
pub mod radroots_event::farm::workspace
-pub enum radroots_event::farm::workspace::RadrootsFarmWorkspaceRelayMode
-pub radroots_event::farm::workspace::RadrootsFarmWorkspaceRelayMode::Read
-pub radroots_event::farm::workspace::RadrootsFarmWorkspaceRelayMode::ReadWrite
-pub radroots_event::farm::workspace::RadrootsFarmWorkspaceRelayMode::Write
-pub struct radroots_event::farm::workspace::RadrootsFarmWorkspaceManifest
-pub radroots_event::farm::workspace::RadrootsFarmWorkspaceManifest::created_at_ms: u64
-pub radroots_event::farm::workspace::RadrootsFarmWorkspaceManifest::d_tag: alloc::string::String
-pub radroots_event::farm::workspace::RadrootsFarmWorkspaceManifest::farm: core::option::Option<radroots_event::farm::RadrootsFarmRef>
-pub radroots_event::farm::workspace::RadrootsFarmWorkspaceManifest::farm_group_id: alloc::string::String
-pub radroots_event::farm::workspace::RadrootsFarmWorkspaceManifest::media_servers: alloc::vec::Vec<radroots_event::farm::workspace::RadrootsFarmWorkspaceMediaServer>
-pub radroots_event::farm::workspace::RadrootsFarmWorkspaceManifest::name: alloc::string::String
-pub radroots_event::farm::workspace::RadrootsFarmWorkspaceManifest::owner_pubkey: alloc::string::String
-pub radroots_event::farm::workspace::RadrootsFarmWorkspaceManifest::protocol_version: alloc::string::String
-pub radroots_event::farm::workspace::RadrootsFarmWorkspaceManifest::relays: alloc::vec::Vec<radroots_event::farm::workspace::RadrootsFarmWorkspaceRelay>
-pub radroots_event::farm::workspace::RadrootsFarmWorkspaceManifest::schema: alloc::string::String
-pub radroots_event::farm::workspace::RadrootsFarmWorkspaceManifest::supported_kinds: alloc::vec::Vec<u32>
-pub radroots_event::farm::workspace::RadrootsFarmWorkspaceManifest::updated_at_ms: core::option::Option<u64>
-pub struct radroots_event::farm::workspace::RadrootsFarmWorkspaceMediaServer
-pub radroots_event::farm::workspace::RadrootsFarmWorkspaceMediaServer::service: alloc::string::String
-pub radroots_event::farm::workspace::RadrootsFarmWorkspaceMediaServer::url: alloc::string::String
-pub struct radroots_event::farm::workspace::RadrootsFarmWorkspaceRef
-pub radroots_event::farm::workspace::RadrootsFarmWorkspaceRef::d_tag: alloc::string::String
-pub radroots_event::farm::workspace::RadrootsFarmWorkspaceRef::pubkey: alloc::string::String
-pub struct radroots_event::farm::workspace::RadrootsFarmWorkspaceRelay
-pub radroots_event::farm::workspace::RadrootsFarmWorkspaceRelay::mode: radroots_event::farm::workspace::RadrootsFarmWorkspaceRelayMode
-pub radroots_event::farm::workspace::RadrootsFarmWorkspaceRelay::url: alloc::string::String
+pub enum radroots_event::farm::workspace::FarmWorkspaceRelayMode
+pub radroots_event::farm::workspace::FarmWorkspaceRelayMode::Read
+pub radroots_event::farm::workspace::FarmWorkspaceRelayMode::ReadWrite
+pub radroots_event::farm::workspace::FarmWorkspaceRelayMode::Write
+pub struct radroots_event::farm::workspace::FarmWorkspaceManifest
+pub radroots_event::farm::workspace::FarmWorkspaceManifest::created_at_ms: u64
+pub radroots_event::farm::workspace::FarmWorkspaceManifest::d_tag: alloc::string::String
+pub radroots_event::farm::workspace::FarmWorkspaceManifest::farm: core::option::Option<radroots_event::farm::FarmRef>
+pub radroots_event::farm::workspace::FarmWorkspaceManifest::farm_group_id: alloc::string::String
+pub radroots_event::farm::workspace::FarmWorkspaceManifest::media_servers: alloc::vec::Vec<radroots_event::farm::workspace::FarmWorkspaceMediaServer>
+pub radroots_event::farm::workspace::FarmWorkspaceManifest::name: alloc::string::String
+pub radroots_event::farm::workspace::FarmWorkspaceManifest::owner_pubkey: alloc::string::String
+pub radroots_event::farm::workspace::FarmWorkspaceManifest::protocol_version: alloc::string::String
+pub radroots_event::farm::workspace::FarmWorkspaceManifest::relays: alloc::vec::Vec<radroots_event::farm::workspace::FarmWorkspaceRelay>
+pub radroots_event::farm::workspace::FarmWorkspaceManifest::schema: alloc::string::String
+pub radroots_event::farm::workspace::FarmWorkspaceManifest::supported_kinds: alloc::vec::Vec<u32>
+pub radroots_event::farm::workspace::FarmWorkspaceManifest::updated_at_ms: core::option::Option<u64>
+pub struct radroots_event::farm::workspace::FarmWorkspaceMediaServer
+pub radroots_event::farm::workspace::FarmWorkspaceMediaServer::service: alloc::string::String
+pub radroots_event::farm::workspace::FarmWorkspaceMediaServer::url: alloc::string::String
+pub struct radroots_event::farm::workspace::FarmWorkspaceRef
+pub radroots_event::farm::workspace::FarmWorkspaceRef::d_tag: alloc::string::String
+pub radroots_event::farm::workspace::FarmWorkspaceRef::pubkey: alloc::string::String
+pub struct radroots_event::farm::workspace::FarmWorkspaceRelay
+pub radroots_event::farm::workspace::FarmWorkspaceRelay::mode: radroots_event::farm::workspace::FarmWorkspaceRelayMode
+pub radroots_event::farm::workspace::FarmWorkspaceRelay::url: alloc::string::String
pub const radroots_event::farm::workspace::KIND_FARM_WORKSPACE_MANIFEST: u32
pub const radroots_event::farm::workspace::RADROOTS_FARM_WORKSPACE_PROTOCOL_VERSION: &str
pub const radroots_event::farm::workspace::RADROOTS_FARM_WORKSPACE_SCHEMA: &str
pub const radroots_event::farm::workspace::RADROOTS_FARM_WORKSPACE_TAG: &str
-pub struct radroots_event::farm::RadrootsFarm
-pub radroots_event::farm::RadrootsFarm::about: core::option::Option<alloc::string::String>
-pub radroots_event::farm::RadrootsFarm::banner: core::option::Option<alloc::string::String>
-pub radroots_event::farm::RadrootsFarm::d_tag: alloc::string::String
-pub radroots_event::farm::RadrootsFarm::location: core::option::Option<radroots_event::farm::RadrootsFarmPublicLocation>
-pub radroots_event::farm::RadrootsFarm::name: alloc::string::String
-pub radroots_event::farm::RadrootsFarm::picture: core::option::Option<alloc::string::String>
-pub radroots_event::farm::RadrootsFarm::tags: core::option::Option<alloc::vec::Vec<alloc::string::String>>
-pub radroots_event::farm::RadrootsFarm::website: core::option::Option<alloc::string::String>
-pub struct radroots_event::farm::RadrootsFarmPublicLocation
-pub radroots_event::farm::RadrootsFarmPublicLocation::city: core::option::Option<alloc::string::String>
-pub radroots_event::farm::RadrootsFarmPublicLocation::country: core::option::Option<alloc::string::String>
-pub radroots_event::farm::RadrootsFarmPublicLocation::geohash: alloc::string::String
-pub radroots_event::farm::RadrootsFarmPublicLocation::primary: alloc::string::String
-pub radroots_event::farm::RadrootsFarmPublicLocation::region: core::option::Option<alloc::string::String>
-pub struct radroots_event::farm::RadrootsFarmRef
-pub radroots_event::farm::RadrootsFarmRef::d_tag: alloc::string::String
-pub radroots_event::farm::RadrootsFarmRef::pubkey: alloc::string::String
+pub struct radroots_event::farm::Farm
+pub radroots_event::farm::Farm::about: core::option::Option<alloc::string::String>
+pub radroots_event::farm::Farm::banner: core::option::Option<alloc::string::String>
+pub radroots_event::farm::Farm::d_tag: alloc::string::String
+pub radroots_event::farm::Farm::location: core::option::Option<radroots_event::farm::FarmPublicLocation>
+pub radroots_event::farm::Farm::name: alloc::string::String
+pub radroots_event::farm::Farm::picture: core::option::Option<alloc::string::String>
+pub radroots_event::farm::Farm::tags: core::option::Option<alloc::vec::Vec<alloc::string::String>>
+pub radroots_event::farm::Farm::website: core::option::Option<alloc::string::String>
+pub struct radroots_event::farm::FarmPublicLocation
+pub radroots_event::farm::FarmPublicLocation::city: core::option::Option<alloc::string::String>
+pub radroots_event::farm::FarmPublicLocation::country: core::option::Option<alloc::string::String>
+pub radroots_event::farm::FarmPublicLocation::geohash: alloc::string::String
+pub radroots_event::farm::FarmPublicLocation::primary: alloc::string::String
+pub radroots_event::farm::FarmPublicLocation::region: core::option::Option<alloc::string::String>
+pub struct radroots_event::farm::FarmRef
+pub radroots_event::farm::FarmRef::d_tag: alloc::string::String
+pub radroots_event::farm::FarmRef::pubkey: alloc::string::String
pub mod radroots_event::food
pub mod radroots_event::food::availability
-#[non_exhaustive] pub enum radroots_event::food::availability::RadrootsFoodAvailabilityError
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::ContentMissing
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::ContentTooLarge
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::ContentTooLarge::actual: usize
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::ContentTooLarge::max: usize
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::IdentifierInvalid
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::IdentifierTooLarge
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::IdentifierTooLarge::actual: usize
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::IdentifierTooLarge::max: usize
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::ImageCountExceeded
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::ImageCountExceeded::actual: usize
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::ImageCountExceeded::max: usize
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::ImageDimensionsInvalid
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::ImageDuplicateDigest
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::ImageDuplicateUrl
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::PriceCurrencyInvalid
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::PriceInvalid
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::PriceUnitInvalid
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::PublishedAtFuture
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::PublishedAtFuture::created_at: u64
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::PublishedAtFuture::published_at: u64
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::PublishedAtInvalid
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::QuantityInvalid
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::QuantityZero
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::StatusInvalid
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::TextInvalid
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::TextTooLarge
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::TextTooLarge::actual: usize
-pub radroots_event::food::availability::RadrootsFoodAvailabilityError::TextTooLarge::max: usize
-impl radroots_event::food::availability::RadrootsFoodAvailabilityError
-pub const fn radroots_event::food::availability::RadrootsFoodAvailabilityError::code(&self) -> &'static str
-impl core::error::Error for radroots_event::food::availability::RadrootsFoodAvailabilityError
-impl core::fmt::Display for radroots_event::food::availability::RadrootsFoodAvailabilityError
-pub fn radroots_event::food::availability::RadrootsFoodAvailabilityError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub enum radroots_event::food::availability::RadrootsFoodAvailabilityStatus
-pub radroots_event::food::availability::RadrootsFoodAvailabilityStatus::Active
-pub radroots_event::food::availability::RadrootsFoodAvailabilityStatus::Sold
-impl radroots_event::food::availability::RadrootsFoodAvailabilityStatus
-pub const fn radroots_event::food::availability::RadrootsFoodAvailabilityStatus::as_str(self) -> &'static str
-pub fn radroots_event::food::availability::RadrootsFoodAvailabilityStatus::parse(&str) -> core::result::Result<Self, radroots_event::food::availability::RadrootsFoodAvailabilityError>
-impl core::fmt::Display for radroots_event::food::availability::RadrootsFoodAvailabilityStatus
-pub fn radroots_event::food::availability::RadrootsFoodAvailabilityStatus::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::food::availability::RadrootsFoodAvailabilityStatus
-pub type radroots_event::food::availability::RadrootsFoodAvailabilityStatus::Err = radroots_event::food::availability::RadrootsFoodAvailabilityError
-pub fn radroots_event::food::availability::RadrootsFoodAvailabilityStatus::from_str(&str) -> core::result::Result<Self, Self::Err>
-pub enum radroots_event::food::availability::RadrootsFoodUnit
-pub radroots_event::food::availability::RadrootsFoodUnit::Bag
-pub radroots_event::food::availability::RadrootsFoodUnit::Basket
-pub radroots_event::food::availability::RadrootsFoodUnit::Bunch
-pub radroots_event::food::availability::RadrootsFoodUnit::Dozen
-pub radroots_event::food::availability::RadrootsFoodUnit::Each
-pub radroots_event::food::availability::RadrootsFoodUnit::Gram
-pub radroots_event::food::availability::RadrootsFoodUnit::Kilogram
-pub radroots_event::food::availability::RadrootsFoodUnit::Ounce
-pub radroots_event::food::availability::RadrootsFoodUnit::Pound
-pub radroots_event::food::availability::RadrootsFoodUnit::Punnet
-impl radroots_event::food::availability::RadrootsFoodUnit
-pub const fn radroots_event::food::availability::RadrootsFoodUnit::as_str(self) -> &'static str
-pub fn radroots_event::food::availability::RadrootsFoodUnit::parse(&str) -> core::result::Result<Self, radroots_event::food::availability::RadrootsFoodAvailabilityError>
-impl core::fmt::Display for radroots_event::food::availability::RadrootsFoodUnit
-pub fn radroots_event::food::availability::RadrootsFoodUnit::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::food::availability::RadrootsFoodUnit
-pub type radroots_event::food::availability::RadrootsFoodUnit::Err = radroots_event::food::availability::RadrootsFoodAvailabilityError
-pub fn radroots_event::food::availability::RadrootsFoodUnit::from_str(&str) -> core::result::Result<Self, Self::Err>
-pub struct radroots_event::food::availability::RadrootsFoodAvailabilityDetails
-impl radroots_event::food::availability::RadrootsFoodAvailabilityDetails
-pub fn radroots_event::food::availability::RadrootsFoodAvailabilityDetails::content(&self) -> &radroots_event::food::availability::RadrootsFoodContent
-pub fn radroots_event::food::availability::RadrootsFoodAvailabilityDetails::identifier(&self) -> &radroots_event::food::availability::RadrootsFoodIdentifier
-pub fn radroots_event::food::availability::RadrootsFoodAvailabilityDetails::images(&self) -> &[radroots_event::food::availability::RadrootsFoodAvailabilityImage]
-pub fn radroots_event::food::availability::RadrootsFoodAvailabilityDetails::location(&self) -> &radroots_event::food::availability::RadrootsFoodText
-pub fn radroots_event::food::availability::RadrootsFoodAvailabilityDetails::new(radroots_event::food::availability::RadrootsFoodAvailabilityDetailsParts) -> core::result::Result<Self, radroots_event::food::availability::RadrootsFoodAvailabilityError>
-pub fn radroots_event::food::availability::RadrootsFoodAvailabilityDetails::price(&self) -> &radroots_event::food::availability::RadrootsFoodPrice
-pub const fn radroots_event::food::availability::RadrootsFoodAvailabilityDetails::published_at(&self) -> radroots_event::food::availability::RadrootsFoodPublishedAt
-pub fn radroots_event::food::availability::RadrootsFoodAvailabilityDetails::quantity(&self) -> core::option::Option<&radroots_event::food::availability::RadrootsFoodQuantity>
-pub const fn radroots_event::food::availability::RadrootsFoodAvailabilityDetails::status(&self) -> radroots_event::food::availability::RadrootsFoodAvailabilityStatus
-pub fn radroots_event::food::availability::RadrootsFoodAvailabilityDetails::summary(&self) -> &radroots_event::food::availability::RadrootsFoodText
-pub fn radroots_event::food::availability::RadrootsFoodAvailabilityDetails::title(&self) -> &radroots_event::food::availability::RadrootsFoodText
-pub fn radroots_event::food::availability::RadrootsFoodAvailabilityDetails::validate_created_at(&self, u64) -> core::result::Result<(), radroots_event::food::availability::RadrootsFoodAvailabilityError>
-pub struct radroots_event::food::availability::RadrootsFoodAvailabilityDetailsParts
-pub radroots_event::food::availability::RadrootsFoodAvailabilityDetailsParts::content: radroots_event::food::availability::RadrootsFoodContent
-pub radroots_event::food::availability::RadrootsFoodAvailabilityDetailsParts::identifier: radroots_event::food::availability::RadrootsFoodIdentifier
-pub radroots_event::food::availability::RadrootsFoodAvailabilityDetailsParts::images: alloc::vec::Vec<radroots_event::food::availability::RadrootsFoodAvailabilityImage>
-pub radroots_event::food::availability::RadrootsFoodAvailabilityDetailsParts::location: radroots_event::food::availability::RadrootsFoodText
-pub radroots_event::food::availability::RadrootsFoodAvailabilityDetailsParts::price: radroots_event::food::availability::RadrootsFoodPrice
-pub radroots_event::food::availability::RadrootsFoodAvailabilityDetailsParts::published_at: radroots_event::food::availability::RadrootsFoodPublishedAt
-pub radroots_event::food::availability::RadrootsFoodAvailabilityDetailsParts::quantity: core::option::Option<radroots_event::food::availability::RadrootsFoodQuantity>
-pub radroots_event::food::availability::RadrootsFoodAvailabilityDetailsParts::status: radroots_event::food::availability::RadrootsFoodAvailabilityStatus
-pub radroots_event::food::availability::RadrootsFoodAvailabilityDetailsParts::summary: radroots_event::food::availability::RadrootsFoodText
-pub radroots_event::food::availability::RadrootsFoodAvailabilityDetailsParts::title: radroots_event::food::availability::RadrootsFoodText
-pub struct radroots_event::food::availability::RadrootsFoodAvailabilityImage
-impl radroots_event::food::availability::RadrootsFoodAvailabilityImage
-pub const fn radroots_event::food::availability::RadrootsFoodAvailabilityImage::dimensions(&self) -> radroots_event::food::availability::RadrootsFoodImageDimensions
-pub fn radroots_event::food::availability::RadrootsFoodAvailabilityImage::image(&self) -> &radroots_event::media::RadrootsAuthoredImage
-pub const fn radroots_event::food::availability::RadrootsFoodAvailabilityImage::new(radroots_event::media::RadrootsAuthoredImage, radroots_event::food::availability::RadrootsFoodImageDimensions) -> Self
-pub fn radroots_event::food::availability::RadrootsFoodAvailabilityImage::url(&self) -> &str
-pub struct radroots_event::food::availability::RadrootsFoodContent(_)
-impl radroots_event::food::availability::RadrootsFoodContent
-pub fn radroots_event::food::availability::RadrootsFoodContent::as_str(&self) -> &str
-pub fn radroots_event::food::availability::RadrootsFoodContent::into_string(self) -> alloc::string::String
-pub fn radroots_event::food::availability::RadrootsFoodContent::new(impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::food::availability::RadrootsFoodAvailabilityError>
-impl core::convert::AsRef<str> for radroots_event::food::availability::RadrootsFoodContent
-pub fn radroots_event::food::availability::RadrootsFoodContent::as_ref(&self) -> &str
-impl core::fmt::Display for radroots_event::food::availability::RadrootsFoodContent
-pub fn radroots_event::food::availability::RadrootsFoodContent::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub struct radroots_event::food::availability::RadrootsFoodCurrency(_)
-impl radroots_event::food::availability::RadrootsFoodCurrency
-pub fn radroots_event::food::availability::RadrootsFoodCurrency::as_str(&self) -> &str
-pub fn radroots_event::food::availability::RadrootsFoodCurrency::into_string(self) -> alloc::string::String
-pub fn radroots_event::food::availability::RadrootsFoodCurrency::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::food::availability::RadrootsFoodAvailabilityError>
-impl core::convert::AsRef<str> for radroots_event::food::availability::RadrootsFoodCurrency
-pub fn radroots_event::food::availability::RadrootsFoodCurrency::as_ref(&self) -> &str
-impl core::fmt::Display for radroots_event::food::availability::RadrootsFoodCurrency
-pub fn radroots_event::food::availability::RadrootsFoodCurrency::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::food::availability::RadrootsFoodCurrency
-pub type radroots_event::food::availability::RadrootsFoodCurrency::Err = radroots_event::food::availability::RadrootsFoodAvailabilityError
-pub fn radroots_event::food::availability::RadrootsFoodCurrency::from_str(&str) -> core::result::Result<Self, Self::Err>
-pub struct radroots_event::food::availability::RadrootsFoodIdentifier(_)
-impl radroots_event::food::availability::RadrootsFoodIdentifier
-pub fn radroots_event::food::availability::RadrootsFoodIdentifier::as_str(&self) -> &str
-pub fn radroots_event::food::availability::RadrootsFoodIdentifier::into_string(self) -> alloc::string::String
-pub fn radroots_event::food::availability::RadrootsFoodIdentifier::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::food::availability::RadrootsFoodAvailabilityError>
-impl core::convert::AsRef<str> for radroots_event::food::availability::RadrootsFoodIdentifier
-pub fn radroots_event::food::availability::RadrootsFoodIdentifier::as_ref(&self) -> &str
-impl core::fmt::Display for radroots_event::food::availability::RadrootsFoodIdentifier
-pub fn radroots_event::food::availability::RadrootsFoodIdentifier::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::food::availability::RadrootsFoodIdentifier
-pub type radroots_event::food::availability::RadrootsFoodIdentifier::Err = radroots_event::food::availability::RadrootsFoodAvailabilityError
-pub fn radroots_event::food::availability::RadrootsFoodIdentifier::from_str(&str) -> core::result::Result<Self, Self::Err>
-pub struct radroots_event::food::availability::RadrootsFoodImageDimensions
-impl radroots_event::food::availability::RadrootsFoodImageDimensions
-pub const fn radroots_event::food::availability::RadrootsFoodImageDimensions::height(self) -> u32
-pub const fn radroots_event::food::availability::RadrootsFoodImageDimensions::new(u32, u32) -> core::result::Result<Self, radroots_event::food::availability::RadrootsFoodAvailabilityError>
-pub fn radroots_event::food::availability::RadrootsFoodImageDimensions::parse(&str) -> core::result::Result<Self, radroots_event::food::availability::RadrootsFoodAvailabilityError>
-pub const fn radroots_event::food::availability::RadrootsFoodImageDimensions::width(self) -> u32
-impl core::fmt::Display for radroots_event::food::availability::RadrootsFoodImageDimensions
-pub fn radroots_event::food::availability::RadrootsFoodImageDimensions::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::food::availability::RadrootsFoodImageDimensions
-pub type radroots_event::food::availability::RadrootsFoodImageDimensions::Err = radroots_event::food::availability::RadrootsFoodAvailabilityError
-pub fn radroots_event::food::availability::RadrootsFoodImageDimensions::from_str(&str) -> core::result::Result<Self, Self::Err>
-pub struct radroots_event::food::availability::RadrootsFoodPrice
-impl radroots_event::food::availability::RadrootsFoodPrice
-pub fn radroots_event::food::availability::RadrootsFoodPrice::amount(&self) -> &str
-pub fn radroots_event::food::availability::RadrootsFoodPrice::currency(&self) -> &radroots_event::food::availability::RadrootsFoodCurrency
-pub fn radroots_event::food::availability::RadrootsFoodPrice::new(impl core::convert::Into<alloc::string::String>, radroots_event::food::availability::RadrootsFoodCurrency, radroots_event::food::availability::RadrootsFoodUnit) -> core::result::Result<Self, radroots_event::food::availability::RadrootsFoodAvailabilityError>
-pub const fn radroots_event::food::availability::RadrootsFoodPrice::unit(&self) -> radroots_event::food::availability::RadrootsFoodUnit
-pub struct radroots_event::food::availability::RadrootsFoodPublishedAt(_)
-impl radroots_event::food::availability::RadrootsFoodPublishedAt
-pub const fn radroots_event::food::availability::RadrootsFoodPublishedAt::as_u64(self) -> u64
-pub const fn radroots_event::food::availability::RadrootsFoodPublishedAt::new(u64) -> core::result::Result<Self, radroots_event::food::availability::RadrootsFoodAvailabilityError>
-pub fn radroots_event::food::availability::RadrootsFoodPublishedAt::parse(&str) -> core::result::Result<Self, radroots_event::food::availability::RadrootsFoodAvailabilityError>
-pub const fn radroots_event::food::availability::RadrootsFoodPublishedAt::validate_created_at(self, u64) -> core::result::Result<(), radroots_event::food::availability::RadrootsFoodAvailabilityError>
-impl core::fmt::Display for radroots_event::food::availability::RadrootsFoodPublishedAt
-pub fn radroots_event::food::availability::RadrootsFoodPublishedAt::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::food::availability::RadrootsFoodPublishedAt
-pub type radroots_event::food::availability::RadrootsFoodPublishedAt::Err = radroots_event::food::availability::RadrootsFoodAvailabilityError
-pub fn radroots_event::food::availability::RadrootsFoodPublishedAt::from_str(&str) -> core::result::Result<Self, Self::Err>
-pub struct radroots_event::food::availability::RadrootsFoodQuantity
-impl radroots_event::food::availability::RadrootsFoodQuantity
-pub fn radroots_event::food::availability::RadrootsFoodQuantity::amount(&self) -> &str
-pub fn radroots_event::food::availability::RadrootsFoodQuantity::new(impl core::convert::Into<alloc::string::String>, radroots_event::food::availability::RadrootsFoodUnit) -> core::result::Result<Self, radroots_event::food::availability::RadrootsFoodAvailabilityError>
-pub const fn radroots_event::food::availability::RadrootsFoodQuantity::unit(&self) -> radroots_event::food::availability::RadrootsFoodUnit
-pub struct radroots_event::food::availability::RadrootsFoodText(_)
-impl radroots_event::food::availability::RadrootsFoodText
-pub fn radroots_event::food::availability::RadrootsFoodText::as_str(&self) -> &str
-pub fn radroots_event::food::availability::RadrootsFoodText::into_string(self) -> alloc::string::String
-pub fn radroots_event::food::availability::RadrootsFoodText::new(impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::food::availability::RadrootsFoodAvailabilityError>
-impl core::convert::AsRef<str> for radroots_event::food::availability::RadrootsFoodText
-pub fn radroots_event::food::availability::RadrootsFoodText::as_ref(&self) -> &str
-impl core::fmt::Display for radroots_event::food::availability::RadrootsFoodText
-pub fn radroots_event::food::availability::RadrootsFoodText::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+#[non_exhaustive] pub enum radroots_event::food::availability::FoodAvailabilityError
+pub radroots_event::food::availability::FoodAvailabilityError::ContentMissing
+pub radroots_event::food::availability::FoodAvailabilityError::ContentTooLarge
+pub radroots_event::food::availability::FoodAvailabilityError::ContentTooLarge::actual: usize
+pub radroots_event::food::availability::FoodAvailabilityError::ContentTooLarge::max: usize
+pub radroots_event::food::availability::FoodAvailabilityError::IdentifierInvalid
+pub radroots_event::food::availability::FoodAvailabilityError::IdentifierTooLarge
+pub radroots_event::food::availability::FoodAvailabilityError::IdentifierTooLarge::actual: usize
+pub radroots_event::food::availability::FoodAvailabilityError::IdentifierTooLarge::max: usize
+pub radroots_event::food::availability::FoodAvailabilityError::ImageCountExceeded
+pub radroots_event::food::availability::FoodAvailabilityError::ImageCountExceeded::actual: usize
+pub radroots_event::food::availability::FoodAvailabilityError::ImageCountExceeded::max: usize
+pub radroots_event::food::availability::FoodAvailabilityError::ImageDimensionsInvalid
+pub radroots_event::food::availability::FoodAvailabilityError::ImageDuplicateDigest
+pub radroots_event::food::availability::FoodAvailabilityError::ImageDuplicateUrl
+pub radroots_event::food::availability::FoodAvailabilityError::PriceCurrencyInvalid
+pub radroots_event::food::availability::FoodAvailabilityError::PriceInvalid
+pub radroots_event::food::availability::FoodAvailabilityError::PriceUnitInvalid
+pub radroots_event::food::availability::FoodAvailabilityError::PublishedAtFuture
+pub radroots_event::food::availability::FoodAvailabilityError::PublishedAtFuture::created_at: u64
+pub radroots_event::food::availability::FoodAvailabilityError::PublishedAtFuture::published_at: u64
+pub radroots_event::food::availability::FoodAvailabilityError::PublishedAtInvalid
+pub radroots_event::food::availability::FoodAvailabilityError::QuantityInvalid
+pub radroots_event::food::availability::FoodAvailabilityError::QuantityZero
+pub radroots_event::food::availability::FoodAvailabilityError::StatusInvalid
+pub radroots_event::food::availability::FoodAvailabilityError::TextInvalid
+pub radroots_event::food::availability::FoodAvailabilityError::TextTooLarge
+pub radroots_event::food::availability::FoodAvailabilityError::TextTooLarge::actual: usize
+pub radroots_event::food::availability::FoodAvailabilityError::TextTooLarge::max: usize
+impl radroots_event::food::availability::FoodAvailabilityError
+pub const fn radroots_event::food::availability::FoodAvailabilityError::code(&self) -> &'static str
+impl core::error::Error for radroots_event::food::availability::FoodAvailabilityError
+impl core::fmt::Display for radroots_event::food::availability::FoodAvailabilityError
+pub fn radroots_event::food::availability::FoodAvailabilityError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub enum radroots_event::food::availability::FoodAvailabilityStatus
+pub radroots_event::food::availability::FoodAvailabilityStatus::Active
+pub radroots_event::food::availability::FoodAvailabilityStatus::Sold
+impl radroots_event::food::availability::FoodAvailabilityStatus
+pub const fn radroots_event::food::availability::FoodAvailabilityStatus::as_str(self) -> &'static str
+pub fn radroots_event::food::availability::FoodAvailabilityStatus::parse(&str) -> core::result::Result<Self, radroots_event::food::availability::FoodAvailabilityError>
+impl core::fmt::Display for radroots_event::food::availability::FoodAvailabilityStatus
+pub fn radroots_event::food::availability::FoodAvailabilityStatus::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::food::availability::FoodAvailabilityStatus
+pub type radroots_event::food::availability::FoodAvailabilityStatus::Err = radroots_event::food::availability::FoodAvailabilityError
+pub fn radroots_event::food::availability::FoodAvailabilityStatus::from_str(&str) -> core::result::Result<Self, Self::Err>
+pub enum radroots_event::food::availability::FoodUnit
+pub radroots_event::food::availability::FoodUnit::Bag
+pub radroots_event::food::availability::FoodUnit::Basket
+pub radroots_event::food::availability::FoodUnit::Bunch
+pub radroots_event::food::availability::FoodUnit::Dozen
+pub radroots_event::food::availability::FoodUnit::Each
+pub radroots_event::food::availability::FoodUnit::Gram
+pub radroots_event::food::availability::FoodUnit::Kilogram
+pub radroots_event::food::availability::FoodUnit::Ounce
+pub radroots_event::food::availability::FoodUnit::Pound
+pub radroots_event::food::availability::FoodUnit::Punnet
+impl radroots_event::food::availability::FoodUnit
+pub const fn radroots_event::food::availability::FoodUnit::as_str(self) -> &'static str
+pub fn radroots_event::food::availability::FoodUnit::parse(&str) -> core::result::Result<Self, radroots_event::food::availability::FoodAvailabilityError>
+impl core::fmt::Display for radroots_event::food::availability::FoodUnit
+pub fn radroots_event::food::availability::FoodUnit::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::food::availability::FoodUnit
+pub type radroots_event::food::availability::FoodUnit::Err = radroots_event::food::availability::FoodAvailabilityError
+pub fn radroots_event::food::availability::FoodUnit::from_str(&str) -> core::result::Result<Self, Self::Err>
+pub struct radroots_event::food::availability::FoodAvailabilityDetails
+impl radroots_event::food::availability::FoodAvailabilityDetails
+pub fn radroots_event::food::availability::FoodAvailabilityDetails::content(&self) -> &radroots_event::food::availability::FoodContent
+pub fn radroots_event::food::availability::FoodAvailabilityDetails::identifier(&self) -> &radroots_event::food::availability::FoodIdentifier
+pub fn radroots_event::food::availability::FoodAvailabilityDetails::images(&self) -> &[radroots_event::food::availability::FoodAvailabilityImage]
+pub fn radroots_event::food::availability::FoodAvailabilityDetails::location(&self) -> &radroots_event::food::availability::FoodText
+pub fn radroots_event::food::availability::FoodAvailabilityDetails::new(radroots_event::food::availability::FoodAvailabilityDetailsParts) -> core::result::Result<Self, radroots_event::food::availability::FoodAvailabilityError>
+pub fn radroots_event::food::availability::FoodAvailabilityDetails::price(&self) -> &radroots_event::food::availability::FoodPrice
+pub const fn radroots_event::food::availability::FoodAvailabilityDetails::published_at(&self) -> radroots_event::food::availability::FoodPublishedAt
+pub fn radroots_event::food::availability::FoodAvailabilityDetails::quantity(&self) -> core::option::Option<&radroots_event::food::availability::FoodQuantity>
+pub const fn radroots_event::food::availability::FoodAvailabilityDetails::status(&self) -> radroots_event::food::availability::FoodAvailabilityStatus
+pub fn radroots_event::food::availability::FoodAvailabilityDetails::summary(&self) -> &radroots_event::food::availability::FoodText
+pub fn radroots_event::food::availability::FoodAvailabilityDetails::title(&self) -> &radroots_event::food::availability::FoodText
+pub fn radroots_event::food::availability::FoodAvailabilityDetails::validate_created_at(&self, u64) -> core::result::Result<(), radroots_event::food::availability::FoodAvailabilityError>
+pub struct radroots_event::food::availability::FoodAvailabilityDetailsParts
+pub radroots_event::food::availability::FoodAvailabilityDetailsParts::content: radroots_event::food::availability::FoodContent
+pub radroots_event::food::availability::FoodAvailabilityDetailsParts::identifier: radroots_event::food::availability::FoodIdentifier
+pub radroots_event::food::availability::FoodAvailabilityDetailsParts::images: alloc::vec::Vec<radroots_event::food::availability::FoodAvailabilityImage>
+pub radroots_event::food::availability::FoodAvailabilityDetailsParts::location: radroots_event::food::availability::FoodText
+pub radroots_event::food::availability::FoodAvailabilityDetailsParts::price: radroots_event::food::availability::FoodPrice
+pub radroots_event::food::availability::FoodAvailabilityDetailsParts::published_at: radroots_event::food::availability::FoodPublishedAt
+pub radroots_event::food::availability::FoodAvailabilityDetailsParts::quantity: core::option::Option<radroots_event::food::availability::FoodQuantity>
+pub radroots_event::food::availability::FoodAvailabilityDetailsParts::status: radroots_event::food::availability::FoodAvailabilityStatus
+pub radroots_event::food::availability::FoodAvailabilityDetailsParts::summary: radroots_event::food::availability::FoodText
+pub radroots_event::food::availability::FoodAvailabilityDetailsParts::title: radroots_event::food::availability::FoodText
+pub struct radroots_event::food::availability::FoodAvailabilityImage
+impl radroots_event::food::availability::FoodAvailabilityImage
+pub const fn radroots_event::food::availability::FoodAvailabilityImage::dimensions(&self) -> radroots_event::food::availability::FoodImageDimensions
+pub fn radroots_event::food::availability::FoodAvailabilityImage::image(&self) -> &radroots_event::media::AuthoredImage
+pub const fn radroots_event::food::availability::FoodAvailabilityImage::new(radroots_event::media::AuthoredImage, radroots_event::food::availability::FoodImageDimensions) -> Self
+pub fn radroots_event::food::availability::FoodAvailabilityImage::url(&self) -> &str
+pub struct radroots_event::food::availability::FoodContent(_)
+impl radroots_event::food::availability::FoodContent
+pub fn radroots_event::food::availability::FoodContent::as_str(&self) -> &str
+pub fn radroots_event::food::availability::FoodContent::into_string(self) -> alloc::string::String
+pub fn radroots_event::food::availability::FoodContent::new(impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::food::availability::FoodAvailabilityError>
+impl core::convert::AsRef<str> for radroots_event::food::availability::FoodContent
+pub fn radroots_event::food::availability::FoodContent::as_ref(&self) -> &str
+impl core::fmt::Display for radroots_event::food::availability::FoodContent
+pub fn radroots_event::food::availability::FoodContent::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub struct radroots_event::food::availability::FoodCurrency(_)
+impl radroots_event::food::availability::FoodCurrency
+pub fn radroots_event::food::availability::FoodCurrency::as_str(&self) -> &str
+pub fn radroots_event::food::availability::FoodCurrency::into_string(self) -> alloc::string::String
+pub fn radroots_event::food::availability::FoodCurrency::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::food::availability::FoodAvailabilityError>
+impl core::convert::AsRef<str> for radroots_event::food::availability::FoodCurrency
+pub fn radroots_event::food::availability::FoodCurrency::as_ref(&self) -> &str
+impl core::fmt::Display for radroots_event::food::availability::FoodCurrency
+pub fn radroots_event::food::availability::FoodCurrency::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::food::availability::FoodCurrency
+pub type radroots_event::food::availability::FoodCurrency::Err = radroots_event::food::availability::FoodAvailabilityError
+pub fn radroots_event::food::availability::FoodCurrency::from_str(&str) -> core::result::Result<Self, Self::Err>
+pub struct radroots_event::food::availability::FoodIdentifier(_)
+impl radroots_event::food::availability::FoodIdentifier
+pub fn radroots_event::food::availability::FoodIdentifier::as_str(&self) -> &str
+pub fn radroots_event::food::availability::FoodIdentifier::into_string(self) -> alloc::string::String
+pub fn radroots_event::food::availability::FoodIdentifier::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::food::availability::FoodAvailabilityError>
+impl core::convert::AsRef<str> for radroots_event::food::availability::FoodIdentifier
+pub fn radroots_event::food::availability::FoodIdentifier::as_ref(&self) -> &str
+impl core::fmt::Display for radroots_event::food::availability::FoodIdentifier
+pub fn radroots_event::food::availability::FoodIdentifier::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::food::availability::FoodIdentifier
+pub type radroots_event::food::availability::FoodIdentifier::Err = radroots_event::food::availability::FoodAvailabilityError
+pub fn radroots_event::food::availability::FoodIdentifier::from_str(&str) -> core::result::Result<Self, Self::Err>
+pub struct radroots_event::food::availability::FoodImageDimensions
+impl radroots_event::food::availability::FoodImageDimensions
+pub const fn radroots_event::food::availability::FoodImageDimensions::height(self) -> u32
+pub const fn radroots_event::food::availability::FoodImageDimensions::new(u32, u32) -> core::result::Result<Self, radroots_event::food::availability::FoodAvailabilityError>
+pub fn radroots_event::food::availability::FoodImageDimensions::parse(&str) -> core::result::Result<Self, radroots_event::food::availability::FoodAvailabilityError>
+pub const fn radroots_event::food::availability::FoodImageDimensions::width(self) -> u32
+impl core::fmt::Display for radroots_event::food::availability::FoodImageDimensions
+pub fn radroots_event::food::availability::FoodImageDimensions::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::food::availability::FoodImageDimensions
+pub type radroots_event::food::availability::FoodImageDimensions::Err = radroots_event::food::availability::FoodAvailabilityError
+pub fn radroots_event::food::availability::FoodImageDimensions::from_str(&str) -> core::result::Result<Self, Self::Err>
+pub struct radroots_event::food::availability::FoodPrice
+impl radroots_event::food::availability::FoodPrice
+pub fn radroots_event::food::availability::FoodPrice::amount(&self) -> &str
+pub fn radroots_event::food::availability::FoodPrice::currency(&self) -> &radroots_event::food::availability::FoodCurrency
+pub fn radroots_event::food::availability::FoodPrice::new(impl core::convert::Into<alloc::string::String>, radroots_event::food::availability::FoodCurrency, radroots_event::food::availability::FoodUnit) -> core::result::Result<Self, radroots_event::food::availability::FoodAvailabilityError>
+pub const fn radroots_event::food::availability::FoodPrice::unit(&self) -> radroots_event::food::availability::FoodUnit
+pub struct radroots_event::food::availability::FoodPublishedAt(_)
+impl radroots_event::food::availability::FoodPublishedAt
+pub const fn radroots_event::food::availability::FoodPublishedAt::as_u64(self) -> u64
+pub const fn radroots_event::food::availability::FoodPublishedAt::new(u64) -> core::result::Result<Self, radroots_event::food::availability::FoodAvailabilityError>
+pub fn radroots_event::food::availability::FoodPublishedAt::parse(&str) -> core::result::Result<Self, radroots_event::food::availability::FoodAvailabilityError>
+pub const fn radroots_event::food::availability::FoodPublishedAt::validate_created_at(self, u64) -> core::result::Result<(), radroots_event::food::availability::FoodAvailabilityError>
+impl core::fmt::Display for radroots_event::food::availability::FoodPublishedAt
+pub fn radroots_event::food::availability::FoodPublishedAt::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::food::availability::FoodPublishedAt
+pub type radroots_event::food::availability::FoodPublishedAt::Err = radroots_event::food::availability::FoodAvailabilityError
+pub fn radroots_event::food::availability::FoodPublishedAt::from_str(&str) -> core::result::Result<Self, Self::Err>
+pub struct radroots_event::food::availability::FoodQuantity
+impl radroots_event::food::availability::FoodQuantity
+pub fn radroots_event::food::availability::FoodQuantity::amount(&self) -> &str
+pub fn radroots_event::food::availability::FoodQuantity::new(impl core::convert::Into<alloc::string::String>, radroots_event::food::availability::FoodUnit) -> core::result::Result<Self, radroots_event::food::availability::FoodAvailabilityError>
+pub const fn radroots_event::food::availability::FoodQuantity::unit(&self) -> radroots_event::food::availability::FoodUnit
+pub struct radroots_event::food::availability::FoodText(_)
+impl radroots_event::food::availability::FoodText
+pub fn radroots_event::food::availability::FoodText::as_str(&self) -> &str
+pub fn radroots_event::food::availability::FoodText::into_string(self) -> alloc::string::String
+pub fn radroots_event::food::availability::FoodText::new(impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::food::availability::FoodAvailabilityError>
+impl core::convert::AsRef<str> for radroots_event::food::availability::FoodText
+pub fn radroots_event::food::availability::FoodText::as_ref(&self) -> &str
+impl core::fmt::Display for radroots_event::food::availability::FoodText
+pub fn radroots_event::food::availability::FoodText::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
pub const radroots_event::food::availability::RADROOTS_FOOD_AVAILABILITY_CONTRACT_ID: &str
pub const radroots_event::food::availability::RADROOTS_FOOD_CONTENT_MAX_BYTES: usize
pub const radroots_event::food::availability::RADROOTS_FOOD_DECIMAL_MAX_DIGITS: usize
@@ -1312,16 +1312,16 @@ pub radroots_event::id::Nip01CoordinateParseError::Empty
pub radroots_event::id::Nip01CoordinateParseError::IdentifierMustBeEmpty
pub radroots_event::id::Nip01CoordinateParseError::IdentifierMustBeEmpty::kind: u32
pub radroots_event::id::Nip01CoordinateParseError::InvalidFormat
-pub radroots_event::id::Nip01CoordinateParseError::Pubkey(radroots_event::id::RadrootsIdParseError)
+pub radroots_event::id::Nip01CoordinateParseError::Pubkey(radroots_event::id::ParseError)
pub radroots_event::id::Nip01CoordinateParseError::TooLong
pub radroots_event::id::Nip01CoordinateParseError::TooLong::actual: usize
pub radroots_event::id::Nip01CoordinateParseError::TooLong::max: usize
pub radroots_event::id::Nip01CoordinateParseError::UnsupportedKind
pub radroots_event::id::Nip01CoordinateParseError::UnsupportedKind::actual: u32
-impl core::error::Error for radroots_event::id::RadrootsNip01CoordinateParseError
-pub fn radroots_event::id::RadrootsNip01CoordinateParseError::source(&self) -> core::option::Option<&(dyn core::error::Error + 'static)>
-impl core::fmt::Display for radroots_event::id::RadrootsNip01CoordinateParseError
-pub fn radroots_event::id::RadrootsNip01CoordinateParseError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::error::Error for radroots_event::id::Nip01CoordinateParseError
+pub fn radroots_event::id::Nip01CoordinateParseError::source(&self) -> core::option::Option<&(dyn core::error::Error + 'static)>
+impl core::fmt::Display for radroots_event::id::Nip01CoordinateParseError
+pub fn radroots_event::id::Nip01CoordinateParseError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
pub enum radroots_event::id::ParseError
pub radroots_event::id::ParseError::Empty
pub radroots_event::id::ParseError::InvalidCharacter
@@ -1336,941 +1336,615 @@ pub radroots_event::id::ParseError::TooLong::max: usize
pub radroots_event::id::ParseError::UnexpectedKind
pub radroots_event::id::ParseError::UnexpectedKind::actual: u32
pub radroots_event::id::ParseError::UnexpectedKind::expected: u32
-impl core::convert::From<radroots_event::id::RadrootsIdParseError> for radroots_event::draft::RadrootsDraftError
-pub fn radroots_event::draft::RadrootsDraftError::from(radroots_event::id::RadrootsIdParseError) -> Self
-impl core::error::Error for radroots_event::id::RadrootsIdParseError
-impl core::fmt::Display for radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsIdParseError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub enum radroots_event::id::RadrootsIdParseError
-pub radroots_event::id::RadrootsIdParseError::Empty
-pub radroots_event::id::RadrootsIdParseError::InvalidCharacter
-pub radroots_event::id::RadrootsIdParseError::InvalidFormat
-pub radroots_event::id::RadrootsIdParseError::InvalidLength
-pub radroots_event::id::RadrootsIdParseError::InvalidLength::actual: usize
-pub radroots_event::id::RadrootsIdParseError::InvalidLength::expected: usize
-pub radroots_event::id::RadrootsIdParseError::InvalidPublicKey
-pub radroots_event::id::RadrootsIdParseError::TooLong
-pub radroots_event::id::RadrootsIdParseError::TooLong::actual: usize
-pub radroots_event::id::RadrootsIdParseError::TooLong::max: usize
-pub radroots_event::id::RadrootsIdParseError::UnexpectedKind
-pub radroots_event::id::RadrootsIdParseError::UnexpectedKind::actual: u32
-pub radroots_event::id::RadrootsIdParseError::UnexpectedKind::expected: u32
-impl core::convert::From<radroots_event::id::RadrootsIdParseError> for radroots_event::draft::RadrootsDraftError
-pub fn radroots_event::draft::RadrootsDraftError::from(radroots_event::id::RadrootsIdParseError) -> Self
-impl core::error::Error for radroots_event::id::RadrootsIdParseError
-impl core::fmt::Display for radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsIdParseError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-#[non_exhaustive] pub enum radroots_event::id::RadrootsNip01CoordinateParseError
-pub radroots_event::id::RadrootsNip01CoordinateParseError::Empty
-pub radroots_event::id::RadrootsNip01CoordinateParseError::IdentifierMustBeEmpty
-pub radroots_event::id::RadrootsNip01CoordinateParseError::IdentifierMustBeEmpty::kind: u32
-pub radroots_event::id::RadrootsNip01CoordinateParseError::InvalidFormat
-pub radroots_event::id::RadrootsNip01CoordinateParseError::Pubkey(radroots_event::id::RadrootsIdParseError)
-pub radroots_event::id::RadrootsNip01CoordinateParseError::TooLong
-pub radroots_event::id::RadrootsNip01CoordinateParseError::TooLong::actual: usize
-pub radroots_event::id::RadrootsNip01CoordinateParseError::TooLong::max: usize
-pub radroots_event::id::RadrootsNip01CoordinateParseError::UnsupportedKind
-pub radroots_event::id::RadrootsNip01CoordinateParseError::UnsupportedKind::actual: u32
-impl core::error::Error for radroots_event::id::RadrootsNip01CoordinateParseError
-pub fn radroots_event::id::RadrootsNip01CoordinateParseError::source(&self) -> core::option::Option<&(dyn core::error::Error + 'static)>
-impl core::fmt::Display for radroots_event::id::RadrootsNip01CoordinateParseError
-pub fn radroots_event::id::RadrootsNip01CoordinateParseError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::convert::From<radroots_event::id::ParseError> for radroots_event::draft::DraftError
+pub fn radroots_event::draft::DraftError::from(radroots_event::id::ParseError) -> Self
+impl core::error::Error for radroots_event::id::ParseError
+impl core::fmt::Display for radroots_event::id::ParseError
+pub fn radroots_event::id::ParseError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
pub struct radroots_event::id::AddressableCoordinate(_)
-impl radroots_event::id::RadrootsAddressableCoordinate
-pub fn radroots_event::id::RadrootsAddressableCoordinate::as_str(&self) -> &str
-pub fn radroots_event::id::RadrootsAddressableCoordinate::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsAddressableCoordinate::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-impl core::convert::AsRef<str> for radroots_event::id::RadrootsAddressableCoordinate
-pub fn radroots_event::id::RadrootsAddressableCoordinate::as_ref(&self) -> &str
-impl core::convert::From<radroots_event::id::RadrootsAddressableCoordinate> for alloc::string::String
-pub fn alloc::string::String::from(radroots_event::id::RadrootsAddressableCoordinate) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsAddressableCoordinate
-pub type radroots_event::id::RadrootsAddressableCoordinate::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsAddressableCoordinate::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsAddressableCoordinate
-pub type radroots_event::id::RadrootsAddressableCoordinate::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsAddressableCoordinate::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsAddressableCoordinate
-pub fn radroots_event::id::RadrootsAddressableCoordinate::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsAddressableCoordinate
-pub type radroots_event::id::RadrootsAddressableCoordinate::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsAddressableCoordinate::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsAddressableCoordinate
-pub fn radroots_event::id::RadrootsAddressableCoordinate::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsAddressableCoordinate
-pub fn radroots_event::id::RadrootsAddressableCoordinate::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+impl radroots_event::id::AddressableCoordinate
+pub fn radroots_event::id::AddressableCoordinate::as_str(&self) -> &str
+pub fn radroots_event::id::AddressableCoordinate::into_string(self) -> alloc::string::String
+pub fn radroots_event::id::AddressableCoordinate::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::ParseError>
+impl core::convert::AsRef<str> for radroots_event::id::AddressableCoordinate
+pub fn radroots_event::id::AddressableCoordinate::as_ref(&self) -> &str
+impl core::convert::From<radroots_event::id::AddressableCoordinate> for alloc::string::String
+pub fn alloc::string::String::from(radroots_event::id::AddressableCoordinate) -> Self
+impl core::convert::TryFrom<&str> for radroots_event::id::AddressableCoordinate
+pub type radroots_event::id::AddressableCoordinate::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::AddressableCoordinate::try_from(&str) -> core::result::Result<Self, Self::Error>
+impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::AddressableCoordinate
+pub type radroots_event::id::AddressableCoordinate::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::AddressableCoordinate::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
+impl core::fmt::Display for radroots_event::id::AddressableCoordinate
+pub fn radroots_event::id::AddressableCoordinate::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::id::AddressableCoordinate
+pub type radroots_event::id::AddressableCoordinate::Err = radroots_event::id::ParseError
+pub fn radroots_event::id::AddressableCoordinate::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::id::AddressableCoordinate
+pub fn radroots_event::id::AddressableCoordinate::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::AddressableCoordinate
+pub fn radroots_event::id::AddressableCoordinate::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
pub struct radroots_event::id::AddressableCoordinateParts
-pub radroots_event::id::AddressableCoordinateParts::d_tag: radroots_event::id::RadrootsDTag
+pub radroots_event::id::AddressableCoordinateParts::d_tag: radroots_event::id::DTag
pub radroots_event::id::AddressableCoordinateParts::kind: u32
pub radroots_event::id::AddressableCoordinateParts::pubkey: radroots_identity::key::PublicKey
-impl radroots_event::id::RadrootsAddressableCoordinateParts
-pub fn radroots_event::id::RadrootsAddressableCoordinateParts::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
+impl radroots_event::id::AddressableCoordinateParts
+pub fn radroots_event::id::AddressableCoordinateParts::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::ParseError>
pub struct radroots_event::id::CandidateId(_)
-impl radroots_event::id::RadrootsTradeCandidateId
-pub const fn radroots_event::id::RadrootsTradeCandidateId::as_bytes(&self) -> &[u8; 32]
-pub const fn radroots_event::id::RadrootsTradeCandidateId::from_bytes([u8; 32]) -> Self
-pub const fn radroots_event::id::RadrootsTradeCandidateId::into_bytes(self) -> [u8; 32]
-pub fn radroots_event::id::RadrootsTradeCandidateId::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsTradeCandidateId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-pub fn radroots_event::id::RadrootsTradeCandidateId::to_hex(&self) -> alloc::string::String
-impl core::convert::AsRef<[u8]> for radroots_event::id::RadrootsTradeCandidateId
-pub fn radroots_event::id::RadrootsTradeCandidateId::as_ref(&self) -> &[u8]
-impl core::convert::From<[u8; 32]> for radroots_event::id::RadrootsTradeCandidateId
-pub fn radroots_event::id::RadrootsTradeCandidateId::from([u8; 32]) -> Self
-impl core::convert::From<radroots_event::id::RadrootsTradeCandidateId> for [u8; 32]
-pub fn [u8; 32]::from(radroots_event::id::RadrootsTradeCandidateId) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsTradeCandidateId
-pub type radroots_event::id::RadrootsTradeCandidateId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeCandidateId::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsTradeCandidateId
-pub type radroots_event::id::RadrootsTradeCandidateId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeCandidateId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsTradeCandidateId
-pub fn radroots_event::id::RadrootsTradeCandidateId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsTradeCandidateId
-pub type radroots_event::id::RadrootsTradeCandidateId::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeCandidateId::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsTradeCandidateId
-pub fn radroots_event::id::RadrootsTradeCandidateId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsTradeCandidateId
-pub fn radroots_event::id::RadrootsTradeCandidateId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+impl radroots_event::id::CandidateId
+pub const fn radroots_event::id::CandidateId::as_bytes(&self) -> &[u8; 32]
+pub const fn radroots_event::id::CandidateId::from_bytes([u8; 32]) -> Self
+pub const fn radroots_event::id::CandidateId::into_bytes(self) -> [u8; 32]
+pub fn radroots_event::id::CandidateId::into_string(self) -> alloc::string::String
+pub fn radroots_event::id::CandidateId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::ParseError>
+pub fn radroots_event::id::CandidateId::to_hex(&self) -> alloc::string::String
+impl core::convert::AsRef<[u8]> for radroots_event::id::CandidateId
+pub fn radroots_event::id::CandidateId::as_ref(&self) -> &[u8]
+impl core::convert::From<[u8; 32]> for radroots_event::id::CandidateId
+pub fn radroots_event::id::CandidateId::from([u8; 32]) -> Self
+impl core::convert::From<radroots_event::id::CandidateId> for [u8; 32]
+pub fn [u8; 32]::from(radroots_event::id::CandidateId) -> Self
+impl core::convert::TryFrom<&str> for radroots_event::id::CandidateId
+pub type radroots_event::id::CandidateId::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::CandidateId::try_from(&str) -> core::result::Result<Self, Self::Error>
+impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::CandidateId
+pub type radroots_event::id::CandidateId::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::CandidateId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
+impl core::fmt::Display for radroots_event::id::CandidateId
+pub fn radroots_event::id::CandidateId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::id::CandidateId
+pub type radroots_event::id::CandidateId::Err = radroots_event::id::ParseError
+pub fn radroots_event::id::CandidateId::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::id::CandidateId
+pub fn radroots_event::id::CandidateId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::CandidateId
+pub fn radroots_event::id::CandidateId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
pub struct radroots_event::id::ClassifiedListingAddress(_)
-impl radroots_event::id::RadrootsClassifiedListingAddress
-pub fn radroots_event::id::RadrootsClassifiedListingAddress::as_str(&self) -> &str
-pub fn radroots_event::id::RadrootsClassifiedListingAddress::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsClassifiedListingAddress::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-impl core::convert::AsRef<str> for radroots_event::id::RadrootsClassifiedListingAddress
-pub fn radroots_event::id::RadrootsClassifiedListingAddress::as_ref(&self) -> &str
-impl core::convert::From<radroots_event::id::RadrootsClassifiedListingAddress> for alloc::string::String
-pub fn alloc::string::String::from(radroots_event::id::RadrootsClassifiedListingAddress) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsClassifiedListingAddress
-pub type radroots_event::id::RadrootsClassifiedListingAddress::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsClassifiedListingAddress::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsClassifiedListingAddress
-pub type radroots_event::id::RadrootsClassifiedListingAddress::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsClassifiedListingAddress::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsClassifiedListingAddress
-pub fn radroots_event::id::RadrootsClassifiedListingAddress::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsClassifiedListingAddress
-pub type radroots_event::id::RadrootsClassifiedListingAddress::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsClassifiedListingAddress::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsClassifiedListingAddress
-pub fn radroots_event::id::RadrootsClassifiedListingAddress::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsClassifiedListingAddress
-pub fn radroots_event::id::RadrootsClassifiedListingAddress::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+impl radroots_event::id::ClassifiedListingAddress
+pub fn radroots_event::id::ClassifiedListingAddress::as_str(&self) -> &str
+pub fn radroots_event::id::ClassifiedListingAddress::into_string(self) -> alloc::string::String
+pub fn radroots_event::id::ClassifiedListingAddress::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::ParseError>
+impl core::convert::AsRef<str> for radroots_event::id::ClassifiedListingAddress
+pub fn radroots_event::id::ClassifiedListingAddress::as_ref(&self) -> &str
+impl core::convert::From<radroots_event::id::ClassifiedListingAddress> for alloc::string::String
+pub fn alloc::string::String::from(radroots_event::id::ClassifiedListingAddress) -> Self
+impl core::convert::TryFrom<&str> for radroots_event::id::ClassifiedListingAddress
+pub type radroots_event::id::ClassifiedListingAddress::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::ClassifiedListingAddress::try_from(&str) -> core::result::Result<Self, Self::Error>
+impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::ClassifiedListingAddress
+pub type radroots_event::id::ClassifiedListingAddress::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::ClassifiedListingAddress::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
+impl core::fmt::Display for radroots_event::id::ClassifiedListingAddress
+pub fn radroots_event::id::ClassifiedListingAddress::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::id::ClassifiedListingAddress
+pub type radroots_event::id::ClassifiedListingAddress::Err = radroots_event::id::ParseError
+pub fn radroots_event::id::ClassifiedListingAddress::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::id::ClassifiedListingAddress
+pub fn radroots_event::id::ClassifiedListingAddress::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::ClassifiedListingAddress
+pub fn radroots_event::id::ClassifiedListingAddress::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
pub struct radroots_event::id::DTag(_)
-impl radroots_event::id::RadrootsDTag
-pub fn radroots_event::id::RadrootsDTag::as_str(&self) -> &str
-pub fn radroots_event::id::RadrootsDTag::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsDTag::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-impl core::convert::AsRef<str> for radroots_event::id::RadrootsDTag
-pub fn radroots_event::id::RadrootsDTag::as_ref(&self) -> &str
-impl core::convert::From<radroots_event::id::RadrootsDTag> for alloc::string::String
-pub fn alloc::string::String::from(radroots_event::id::RadrootsDTag) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsDTag
-pub type radroots_event::id::RadrootsDTag::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsDTag::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsDTag
-pub type radroots_event::id::RadrootsDTag::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsDTag::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsDTag
-pub fn radroots_event::id::RadrootsDTag::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsDTag
-pub type radroots_event::id::RadrootsDTag::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsDTag::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsDTag
-pub fn radroots_event::id::RadrootsDTag::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsDTag
-pub fn radroots_event::id::RadrootsDTag::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+impl radroots_event::id::DTag
+pub fn radroots_event::id::DTag::as_str(&self) -> &str
+pub fn radroots_event::id::DTag::into_string(self) -> alloc::string::String
+pub fn radroots_event::id::DTag::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::ParseError>
+impl core::convert::AsRef<str> for radroots_event::id::DTag
+pub fn radroots_event::id::DTag::as_ref(&self) -> &str
+impl core::convert::From<radroots_event::id::DTag> for alloc::string::String
+pub fn alloc::string::String::from(radroots_event::id::DTag) -> Self
+impl core::convert::TryFrom<&str> for radroots_event::id::DTag
+pub type radroots_event::id::DTag::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::DTag::try_from(&str) -> core::result::Result<Self, Self::Error>
+impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::DTag
+pub type radroots_event::id::DTag::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::DTag::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
+impl core::fmt::Display for radroots_event::id::DTag
+pub fn radroots_event::id::DTag::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::id::DTag
+pub type radroots_event::id::DTag::Err = radroots_event::id::ParseError
+pub fn radroots_event::id::DTag::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::id::DTag
+pub fn radroots_event::id::DTag::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::DTag
+pub fn radroots_event::id::DTag::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+pub struct radroots_event::id::EconomicsDigest(_)
+impl radroots_event::id::EconomicsDigest
+pub fn radroots_event::id::EconomicsDigest::as_str(&self) -> &str
+pub fn radroots_event::id::EconomicsDigest::into_string(self) -> alloc::string::String
+pub fn radroots_event::id::EconomicsDigest::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::ParseError>
+impl core::convert::AsRef<str> for radroots_event::id::EconomicsDigest
+pub fn radroots_event::id::EconomicsDigest::as_ref(&self) -> &str
+impl core::convert::From<radroots_event::id::EconomicsDigest> for alloc::string::String
+pub fn alloc::string::String::from(radroots_event::id::EconomicsDigest) -> Self
+impl core::convert::TryFrom<&str> for radroots_event::id::EconomicsDigest
+pub type radroots_event::id::EconomicsDigest::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::EconomicsDigest::try_from(&str) -> core::result::Result<Self, Self::Error>
+impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::EconomicsDigest
+pub type radroots_event::id::EconomicsDigest::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::EconomicsDigest::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
+impl core::fmt::Display for radroots_event::id::EconomicsDigest
+pub fn radroots_event::id::EconomicsDigest::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::id::EconomicsDigest
+pub type radroots_event::id::EconomicsDigest::Err = radroots_event::id::ParseError
+pub fn radroots_event::id::EconomicsDigest::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::id::EconomicsDigest
+pub fn radroots_event::id::EconomicsDigest::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::EconomicsDigest
+pub fn radroots_event::id::EconomicsDigest::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
pub struct radroots_event::id::EventEnvelopePointer
-pub radroots_event::id::EventEnvelopePointer::event_id: radroots_event::id::RadrootsEventId
+pub radroots_event::id::EventEnvelopePointer::event_id: radroots_event::id::EventId
pub radroots_event::id::EventEnvelopePointer::relays: alloc::vec::Vec<alloc::string::String>
-impl radroots_event::id::RadrootsEventEnvelopePointer
-pub fn radroots_event::id::RadrootsEventEnvelopePointer::new<I, S>(radroots_event::id::RadrootsEventId, I) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError> where I: core::iter::traits::collect::IntoIterator<Item = S>, S: core::convert::Into<alloc::string::String>
+impl radroots_event::id::EventEnvelopePointer
+pub fn radroots_event::id::EventEnvelopePointer::new<I, S>(radroots_event::id::EventId, I) -> core::result::Result<Self, radroots_event::id::ParseError> where I: core::iter::traits::collect::IntoIterator<Item = S>, S: core::convert::Into<alloc::string::String>
pub struct radroots_event::id::EventId(_)
-impl radroots_event::id::RadrootsEventId
-pub const fn radroots_event::id::RadrootsEventId::as_bytes(&self) -> &[u8; 32]
-pub const fn radroots_event::id::RadrootsEventId::from_bytes([u8; 32]) -> Self
-pub const fn radroots_event::id::RadrootsEventId::into_bytes(self) -> [u8; 32]
-pub fn radroots_event::id::RadrootsEventId::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsEventId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-pub fn radroots_event::id::RadrootsEventId::to_hex(&self) -> alloc::string::String
-impl core::convert::AsRef<[u8]> for radroots_event::id::RadrootsEventId
-pub fn radroots_event::id::RadrootsEventId::as_ref(&self) -> &[u8]
-impl core::convert::From<[u8; 32]> for radroots_event::id::RadrootsEventId
-pub fn radroots_event::id::RadrootsEventId::from([u8; 32]) -> Self
-impl core::convert::From<radroots_event::id::RadrootsEventId> for [u8; 32]
-pub fn [u8; 32]::from(radroots_event::id::RadrootsEventId) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsEventId
-pub type radroots_event::id::RadrootsEventId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEventId::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsEventId
-pub type radroots_event::id::RadrootsEventId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEventId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsEventId
-pub fn radroots_event::id::RadrootsEventId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsEventId
-pub type radroots_event::id::RadrootsEventId::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEventId::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsEventId
-pub fn radroots_event::id::RadrootsEventId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsEventId
-pub fn radroots_event::id::RadrootsEventId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+impl radroots_event::id::EventId
+pub const fn radroots_event::id::EventId::as_bytes(&self) -> &[u8; 32]
+pub const fn radroots_event::id::EventId::from_bytes([u8; 32]) -> Self
+pub const fn radroots_event::id::EventId::into_bytes(self) -> [u8; 32]
+pub fn radroots_event::id::EventId::into_string(self) -> alloc::string::String
+pub fn radroots_event::id::EventId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::ParseError>
+pub fn radroots_event::id::EventId::to_hex(&self) -> alloc::string::String
+impl core::convert::AsRef<[u8]> for radroots_event::id::EventId
+pub fn radroots_event::id::EventId::as_ref(&self) -> &[u8]
+impl core::convert::From<[u8; 32]> for radroots_event::id::EventId
+pub fn radroots_event::id::EventId::from([u8; 32]) -> Self
+impl core::convert::From<radroots_event::id::EventId> for [u8; 32]
+pub fn [u8; 32]::from(radroots_event::id::EventId) -> Self
+impl core::convert::TryFrom<&str> for radroots_event::id::EventId
+pub type radroots_event::id::EventId::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::EventId::try_from(&str) -> core::result::Result<Self, Self::Error>
+impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::EventId
+pub type radroots_event::id::EventId::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::EventId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
+impl core::fmt::Display for radroots_event::id::EventId
+pub fn radroots_event::id::EventId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::id::EventId
+pub type radroots_event::id::EventId::Err = radroots_event::id::ParseError
+pub fn radroots_event::id::EventId::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::id::EventId
+pub fn radroots_event::id::EventId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::EventId
+pub fn radroots_event::id::EventId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
pub struct radroots_event::id::EventPointer(_)
-impl radroots_event::id::RadrootsEventPointer
-pub const fn radroots_event::id::RadrootsEventPointer::as_bytes(&self) -> &[u8; 32]
-pub const fn radroots_event::id::RadrootsEventPointer::from_bytes([u8; 32]) -> Self
-pub const fn radroots_event::id::RadrootsEventPointer::into_bytes(self) -> [u8; 32]
-pub fn radroots_event::id::RadrootsEventPointer::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsEventPointer::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-pub fn radroots_event::id::RadrootsEventPointer::to_hex(&self) -> alloc::string::String
-impl core::convert::AsRef<[u8]> for radroots_event::id::RadrootsEventPointer
-pub fn radroots_event::id::RadrootsEventPointer::as_ref(&self) -> &[u8]
-impl core::convert::From<[u8; 32]> for radroots_event::id::RadrootsEventPointer
-pub fn radroots_event::id::RadrootsEventPointer::from([u8; 32]) -> Self
-impl core::convert::From<radroots_event::id::RadrootsEventPointer> for [u8; 32]
-pub fn [u8; 32]::from(radroots_event::id::RadrootsEventPointer) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsEventPointer
-pub type radroots_event::id::RadrootsEventPointer::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEventPointer::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsEventPointer
-pub type radroots_event::id::RadrootsEventPointer::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEventPointer::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsEventPointer
-pub fn radroots_event::id::RadrootsEventPointer::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsEventPointer
-pub type radroots_event::id::RadrootsEventPointer::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEventPointer::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsEventPointer
-pub fn radroots_event::id::RadrootsEventPointer::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsEventPointer
-pub fn radroots_event::id::RadrootsEventPointer::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+impl radroots_event::id::EventPointer
+pub const fn radroots_event::id::EventPointer::as_bytes(&self) -> &[u8; 32]
+pub const fn radroots_event::id::EventPointer::from_bytes([u8; 32]) -> Self
+pub const fn radroots_event::id::EventPointer::into_bytes(self) -> [u8; 32]
+pub fn radroots_event::id::EventPointer::into_string(self) -> alloc::string::String
+pub fn radroots_event::id::EventPointer::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::ParseError>
+pub fn radroots_event::id::EventPointer::to_hex(&self) -> alloc::string::String
+impl core::convert::AsRef<[u8]> for radroots_event::id::EventPointer
+pub fn radroots_event::id::EventPointer::as_ref(&self) -> &[u8]
+impl core::convert::From<[u8; 32]> for radroots_event::id::EventPointer
+pub fn radroots_event::id::EventPointer::from([u8; 32]) -> Self
+impl core::convert::From<radroots_event::id::EventPointer> for [u8; 32]
+pub fn [u8; 32]::from(radroots_event::id::EventPointer) -> Self
+impl core::convert::TryFrom<&str> for radroots_event::id::EventPointer
+pub type radroots_event::id::EventPointer::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::EventPointer::try_from(&str) -> core::result::Result<Self, Self::Error>
+impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::EventPointer
+pub type radroots_event::id::EventPointer::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::EventPointer::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
+impl core::fmt::Display for radroots_event::id::EventPointer
+pub fn radroots_event::id::EventPointer::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::id::EventPointer
+pub type radroots_event::id::EventPointer::Err = radroots_event::id::ParseError
+pub fn radroots_event::id::EventPointer::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::id::EventPointer
+pub fn radroots_event::id::EventPointer::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::EventPointer
+pub fn radroots_event::id::EventPointer::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
pub struct radroots_event::id::EventSignature(_)
-impl radroots_event::id::RadrootsEventSignature
-pub const fn radroots_event::id::RadrootsEventSignature::as_bytes(&self) -> &[u8; 64]
-pub const fn radroots_event::id::RadrootsEventSignature::from_bytes([u8; 64]) -> Self
-pub const fn radroots_event::id::RadrootsEventSignature::into_bytes(self) -> [u8; 64]
-pub fn radroots_event::id::RadrootsEventSignature::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsEventSignature::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-pub fn radroots_event::id::RadrootsEventSignature::to_hex(&self) -> alloc::string::String
-impl core::convert::AsRef<[u8]> for radroots_event::id::RadrootsEventSignature
-pub fn radroots_event::id::RadrootsEventSignature::as_ref(&self) -> &[u8]
-impl core::convert::From<[u8; 64]> for radroots_event::id::RadrootsEventSignature
-pub fn radroots_event::id::RadrootsEventSignature::from([u8; 64]) -> Self
-impl core::convert::From<radroots_event::id::RadrootsEventSignature> for [u8; 64]
-pub fn [u8; 64]::from(radroots_event::id::RadrootsEventSignature) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsEventSignature
-pub type radroots_event::id::RadrootsEventSignature::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEventSignature::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsEventSignature
-pub type radroots_event::id::RadrootsEventSignature::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEventSignature::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsEventSignature
-pub fn radroots_event::id::RadrootsEventSignature::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsEventSignature
-pub type radroots_event::id::RadrootsEventSignature::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEventSignature::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsEventSignature
-pub fn radroots_event::id::RadrootsEventSignature::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsEventSignature
-pub fn radroots_event::id::RadrootsEventSignature::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+impl radroots_event::id::EventSignature
+pub const fn radroots_event::id::EventSignature::as_bytes(&self) -> &[u8; 64]
+pub const fn radroots_event::id::EventSignature::from_bytes([u8; 64]) -> Self
+pub const fn radroots_event::id::EventSignature::into_bytes(self) -> [u8; 64]
+pub fn radroots_event::id::EventSignature::into_string(self) -> alloc::string::String
+pub fn radroots_event::id::EventSignature::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::ParseError>
+pub fn radroots_event::id::EventSignature::to_hex(&self) -> alloc::string::String
+impl core::convert::AsRef<[u8]> for radroots_event::id::EventSignature
+pub fn radroots_event::id::EventSignature::as_ref(&self) -> &[u8]
+impl core::convert::From<[u8; 64]> for radroots_event::id::EventSignature
+pub fn radroots_event::id::EventSignature::from([u8; 64]) -> Self
+impl core::convert::From<radroots_event::id::EventSignature> for [u8; 64]
+pub fn [u8; 64]::from(radroots_event::id::EventSignature) -> Self
+impl core::convert::TryFrom<&str> for radroots_event::id::EventSignature
+pub type radroots_event::id::EventSignature::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::EventSignature::try_from(&str) -> core::result::Result<Self, Self::Error>
+impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::EventSignature
+pub type radroots_event::id::EventSignature::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::EventSignature::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
+impl core::fmt::Display for radroots_event::id::EventSignature
+pub fn radroots_event::id::EventSignature::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::id::EventSignature
+pub type radroots_event::id::EventSignature::Err = radroots_event::id::ParseError
+pub fn radroots_event::id::EventSignature::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::id::EventSignature
+pub fn radroots_event::id::EventSignature::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::EventSignature
+pub fn radroots_event::id::EventSignature::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+pub struct radroots_event::id::InventoryBinId(_)
+impl radroots_event::id::InventoryBinId
+pub fn radroots_event::id::InventoryBinId::as_str(&self) -> &str
+pub fn radroots_event::id::InventoryBinId::into_string(self) -> alloc::string::String
+pub fn radroots_event::id::InventoryBinId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::ParseError>
+impl core::convert::AsRef<str> for radroots_event::id::InventoryBinId
+pub fn radroots_event::id::InventoryBinId::as_ref(&self) -> &str
+impl core::convert::From<radroots_event::id::InventoryBinId> for alloc::string::String
+pub fn alloc::string::String::from(radroots_event::id::InventoryBinId) -> Self
+impl core::convert::TryFrom<&str> for radroots_event::id::InventoryBinId
+pub type radroots_event::id::InventoryBinId::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::InventoryBinId::try_from(&str) -> core::result::Result<Self, Self::Error>
+impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::InventoryBinId
+pub type radroots_event::id::InventoryBinId::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::InventoryBinId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
+impl core::fmt::Display for radroots_event::id::InventoryBinId
+pub fn radroots_event::id::InventoryBinId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::id::InventoryBinId
+pub type radroots_event::id::InventoryBinId::Err = radroots_event::id::ParseError
+pub fn radroots_event::id::InventoryBinId::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::id::InventoryBinId
+pub fn radroots_event::id::InventoryBinId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::InventoryBinId
+pub fn radroots_event::id::InventoryBinId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
pub struct radroots_event::id::MutationId(_)
-impl radroots_event::id::RadrootsTradeMutationId
-pub const fn radroots_event::id::RadrootsTradeMutationId::as_bytes(&self) -> &[u8; 32]
-pub const fn radroots_event::id::RadrootsTradeMutationId::from_bytes([u8; 32]) -> Self
-pub const fn radroots_event::id::RadrootsTradeMutationId::into_bytes(self) -> [u8; 32]
-pub fn radroots_event::id::RadrootsTradeMutationId::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsTradeMutationId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-pub fn radroots_event::id::RadrootsTradeMutationId::to_hex(&self) -> alloc::string::String
-impl core::convert::AsRef<[u8]> for radroots_event::id::RadrootsTradeMutationId
-pub fn radroots_event::id::RadrootsTradeMutationId::as_ref(&self) -> &[u8]
-impl core::convert::From<[u8; 32]> for radroots_event::id::RadrootsTradeMutationId
-pub fn radroots_event::id::RadrootsTradeMutationId::from([u8; 32]) -> Self
-impl core::convert::From<radroots_event::id::RadrootsTradeMutationId> for [u8; 32]
-pub fn [u8; 32]::from(radroots_event::id::RadrootsTradeMutationId) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsTradeMutationId
-pub type radroots_event::id::RadrootsTradeMutationId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeMutationId::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsTradeMutationId
-pub type radroots_event::id::RadrootsTradeMutationId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeMutationId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsTradeMutationId
-pub fn radroots_event::id::RadrootsTradeMutationId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsTradeMutationId
-pub type radroots_event::id::RadrootsTradeMutationId::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeMutationId::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsTradeMutationId
-pub fn radroots_event::id::RadrootsTradeMutationId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsTradeMutationId
-pub fn radroots_event::id::RadrootsTradeMutationId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+impl radroots_event::id::MutationId
+pub const fn radroots_event::id::MutationId::as_bytes(&self) -> &[u8; 32]
+pub const fn radroots_event::id::MutationId::from_bytes([u8; 32]) -> Self
+pub const fn radroots_event::id::MutationId::into_bytes(self) -> [u8; 32]
+pub fn radroots_event::id::MutationId::into_string(self) -> alloc::string::String
+pub fn radroots_event::id::MutationId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::ParseError>
+pub fn radroots_event::id::MutationId::to_hex(&self) -> alloc::string::String
+impl core::convert::AsRef<[u8]> for radroots_event::id::MutationId
+pub fn radroots_event::id::MutationId::as_ref(&self) -> &[u8]
+impl core::convert::From<[u8; 32]> for radroots_event::id::MutationId
+pub fn radroots_event::id::MutationId::from([u8; 32]) -> Self
+impl core::convert::From<radroots_event::id::MutationId> for [u8; 32]
+pub fn [u8; 32]::from(radroots_event::id::MutationId) -> Self
+impl core::convert::TryFrom<&str> for radroots_event::id::MutationId
+pub type radroots_event::id::MutationId::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::MutationId::try_from(&str) -> core::result::Result<Self, Self::Error>
+impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::MutationId
+pub type radroots_event::id::MutationId::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::MutationId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
+impl core::fmt::Display for radroots_event::id::MutationId
+pub fn radroots_event::id::MutationId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::id::MutationId
+pub type radroots_event::id::MutationId::Err = radroots_event::id::ParseError
+pub fn radroots_event::id::MutationId::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::id::MutationId
+pub fn radroots_event::id::MutationId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::MutationId
+pub fn radroots_event::id::MutationId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
pub struct radroots_event::id::Nip01Coordinate
-impl radroots_event::id::RadrootsNip01Coordinate
-pub fn radroots_event::id::RadrootsNip01Coordinate::as_str(&self) -> &str
-pub fn radroots_event::id::RadrootsNip01Coordinate::identifier(&self) -> &str
-pub fn radroots_event::id::RadrootsNip01Coordinate::into_parts(self) -> radroots_event::id::RadrootsNip01CoordinateParts
-pub fn radroots_event::id::RadrootsNip01Coordinate::into_string(self) -> alloc::string::String
-pub const fn radroots_event::id::RadrootsNip01Coordinate::kind(&self) -> u32
-pub fn radroots_event::id::RadrootsNip01Coordinate::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsNip01CoordinateParseError>
-pub fn radroots_event::id::RadrootsNip01Coordinate::parts(&self) -> radroots_event::id::RadrootsNip01CoordinateParts
-pub const fn radroots_event::id::RadrootsNip01Coordinate::pubkey(&self) -> &radroots_identity::key::PublicKey
-impl core::convert::AsRef<str> for radroots_event::id::RadrootsNip01Coordinate
-pub fn radroots_event::id::RadrootsNip01Coordinate::as_ref(&self) -> &str
-impl core::convert::From<radroots_event::id::RadrootsNip01Coordinate> for alloc::string::String
-pub fn alloc::string::String::from(radroots_event::id::RadrootsNip01Coordinate) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsNip01Coordinate
-pub type radroots_event::id::RadrootsNip01Coordinate::Error = radroots_event::id::RadrootsNip01CoordinateParseError
-pub fn radroots_event::id::RadrootsNip01Coordinate::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsNip01Coordinate
-pub type radroots_event::id::RadrootsNip01Coordinate::Error = radroots_event::id::RadrootsNip01CoordinateParseError
-pub fn radroots_event::id::RadrootsNip01Coordinate::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsNip01Coordinate
-pub fn radroots_event::id::RadrootsNip01Coordinate::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsNip01Coordinate
-pub type radroots_event::id::RadrootsNip01Coordinate::Err = radroots_event::id::RadrootsNip01CoordinateParseError
-pub fn radroots_event::id::RadrootsNip01Coordinate::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsNip01Coordinate
-pub fn radroots_event::id::RadrootsNip01Coordinate::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsNip01Coordinate
-pub fn radroots_event::id::RadrootsNip01Coordinate::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+impl radroots_event::id::Nip01Coordinate
+pub fn radroots_event::id::Nip01Coordinate::as_str(&self) -> &str
+pub fn radroots_event::id::Nip01Coordinate::identifier(&self) -> &str
+pub fn radroots_event::id::Nip01Coordinate::into_parts(self) -> radroots_event::id::Nip01CoordinateParts
+pub fn radroots_event::id::Nip01Coordinate::into_string(self) -> alloc::string::String
+pub const fn radroots_event::id::Nip01Coordinate::kind(&self) -> u32
+pub fn radroots_event::id::Nip01Coordinate::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::Nip01CoordinateParseError>
+pub fn radroots_event::id::Nip01Coordinate::parts(&self) -> radroots_event::id::Nip01CoordinateParts
+pub const fn radroots_event::id::Nip01Coordinate::pubkey(&self) -> &radroots_identity::key::PublicKey
+impl core::convert::AsRef<str> for radroots_event::id::Nip01Coordinate
+pub fn radroots_event::id::Nip01Coordinate::as_ref(&self) -> &str
+impl core::convert::From<radroots_event::id::Nip01Coordinate> for alloc::string::String
+pub fn alloc::string::String::from(radroots_event::id::Nip01Coordinate) -> Self
+impl core::convert::TryFrom<&str> for radroots_event::id::Nip01Coordinate
+pub type radroots_event::id::Nip01Coordinate::Error = radroots_event::id::Nip01CoordinateParseError
+pub fn radroots_event::id::Nip01Coordinate::try_from(&str) -> core::result::Result<Self, Self::Error>
+impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::Nip01Coordinate
+pub type radroots_event::id::Nip01Coordinate::Error = radroots_event::id::Nip01CoordinateParseError
+pub fn radroots_event::id::Nip01Coordinate::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
+impl core::fmt::Display for radroots_event::id::Nip01Coordinate
+pub fn radroots_event::id::Nip01Coordinate::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::id::Nip01Coordinate
+pub type radroots_event::id::Nip01Coordinate::Err = radroots_event::id::Nip01CoordinateParseError
+pub fn radroots_event::id::Nip01Coordinate::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::id::Nip01Coordinate
+pub fn radroots_event::id::Nip01Coordinate::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::Nip01Coordinate
+pub fn radroots_event::id::Nip01Coordinate::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
pub struct radroots_event::id::Nip01CoordinateParts
pub radroots_event::id::Nip01CoordinateParts::identifier: alloc::string::String
pub radroots_event::id::Nip01CoordinateParts::kind: u32
pub radroots_event::id::Nip01CoordinateParts::pubkey: radroots_identity::key::PublicKey
-impl radroots_event::id::RadrootsNip01CoordinateParts
-pub fn radroots_event::id::RadrootsNip01CoordinateParts::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsNip01CoordinateParseError>
-pub struct radroots_event::id::RadrootsAddressableCoordinate(_)
-impl radroots_event::id::RadrootsAddressableCoordinate
-pub fn radroots_event::id::RadrootsAddressableCoordinate::as_str(&self) -> &str
-pub fn radroots_event::id::RadrootsAddressableCoordinate::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsAddressableCoordinate::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-impl core::convert::AsRef<str> for radroots_event::id::RadrootsAddressableCoordinate
-pub fn radroots_event::id::RadrootsAddressableCoordinate::as_ref(&self) -> &str
-impl core::convert::From<radroots_event::id::RadrootsAddressableCoordinate> for alloc::string::String
-pub fn alloc::string::String::from(radroots_event::id::RadrootsAddressableCoordinate) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsAddressableCoordinate
-pub type radroots_event::id::RadrootsAddressableCoordinate::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsAddressableCoordinate::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsAddressableCoordinate
-pub type radroots_event::id::RadrootsAddressableCoordinate::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsAddressableCoordinate::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsAddressableCoordinate
-pub fn radroots_event::id::RadrootsAddressableCoordinate::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsAddressableCoordinate
-pub type radroots_event::id::RadrootsAddressableCoordinate::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsAddressableCoordinate::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsAddressableCoordinate
-pub fn radroots_event::id::RadrootsAddressableCoordinate::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsAddressableCoordinate
-pub fn radroots_event::id::RadrootsAddressableCoordinate::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::id::RadrootsAddressableCoordinateParts
-pub radroots_event::id::RadrootsAddressableCoordinateParts::d_tag: radroots_event::id::RadrootsDTag
-pub radroots_event::id::RadrootsAddressableCoordinateParts::kind: u32
-pub radroots_event::id::RadrootsAddressableCoordinateParts::pubkey: radroots_identity::key::PublicKey
-impl radroots_event::id::RadrootsAddressableCoordinateParts
-pub fn radroots_event::id::RadrootsAddressableCoordinateParts::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-pub struct radroots_event::id::RadrootsClassifiedListingAddress(_)
-impl radroots_event::id::RadrootsClassifiedListingAddress
-pub fn radroots_event::id::RadrootsClassifiedListingAddress::as_str(&self) -> &str
-pub fn radroots_event::id::RadrootsClassifiedListingAddress::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsClassifiedListingAddress::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-impl core::convert::AsRef<str> for radroots_event::id::RadrootsClassifiedListingAddress
-pub fn radroots_event::id::RadrootsClassifiedListingAddress::as_ref(&self) -> &str
-impl core::convert::From<radroots_event::id::RadrootsClassifiedListingAddress> for alloc::string::String
-pub fn alloc::string::String::from(radroots_event::id::RadrootsClassifiedListingAddress) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsClassifiedListingAddress
-pub type radroots_event::id::RadrootsClassifiedListingAddress::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsClassifiedListingAddress::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsClassifiedListingAddress
-pub type radroots_event::id::RadrootsClassifiedListingAddress::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsClassifiedListingAddress::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsClassifiedListingAddress
-pub fn radroots_event::id::RadrootsClassifiedListingAddress::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsClassifiedListingAddress
-pub type radroots_event::id::RadrootsClassifiedListingAddress::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsClassifiedListingAddress::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsClassifiedListingAddress
-pub fn radroots_event::id::RadrootsClassifiedListingAddress::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsClassifiedListingAddress
-pub fn radroots_event::id::RadrootsClassifiedListingAddress::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::id::RadrootsDTag(_)
-impl radroots_event::id::RadrootsDTag
-pub fn radroots_event::id::RadrootsDTag::as_str(&self) -> &str
-pub fn radroots_event::id::RadrootsDTag::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsDTag::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-impl core::convert::AsRef<str> for radroots_event::id::RadrootsDTag
-pub fn radroots_event::id::RadrootsDTag::as_ref(&self) -> &str
-impl core::convert::From<radroots_event::id::RadrootsDTag> for alloc::string::String
-pub fn alloc::string::String::from(radroots_event::id::RadrootsDTag) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsDTag
-pub type radroots_event::id::RadrootsDTag::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsDTag::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsDTag
-pub type radroots_event::id::RadrootsDTag::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsDTag::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsDTag
-pub fn radroots_event::id::RadrootsDTag::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsDTag
-pub type radroots_event::id::RadrootsDTag::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsDTag::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsDTag
-pub fn radroots_event::id::RadrootsDTag::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsDTag
-pub fn radroots_event::id::RadrootsDTag::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::id::RadrootsEconomicsDigest(_)
-impl radroots_event::id::RadrootsEconomicsDigest
-pub fn radroots_event::id::RadrootsEconomicsDigest::as_str(&self) -> &str
-pub fn radroots_event::id::RadrootsEconomicsDigest::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsEconomicsDigest::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-impl core::convert::AsRef<str> for radroots_event::id::RadrootsEconomicsDigest
-pub fn radroots_event::id::RadrootsEconomicsDigest::as_ref(&self) -> &str
-impl core::convert::From<radroots_event::id::RadrootsEconomicsDigest> for alloc::string::String
-pub fn alloc::string::String::from(radroots_event::id::RadrootsEconomicsDigest) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsEconomicsDigest
-pub type radroots_event::id::RadrootsEconomicsDigest::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEconomicsDigest::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsEconomicsDigest
-pub type radroots_event::id::RadrootsEconomicsDigest::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEconomicsDigest::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsEconomicsDigest
-pub fn radroots_event::id::RadrootsEconomicsDigest::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsEconomicsDigest
-pub type radroots_event::id::RadrootsEconomicsDigest::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEconomicsDigest::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsEconomicsDigest
-pub fn radroots_event::id::RadrootsEconomicsDigest::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsEconomicsDigest
-pub fn radroots_event::id::RadrootsEconomicsDigest::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::id::RadrootsEventEnvelopePointer
-pub radroots_event::id::RadrootsEventEnvelopePointer::event_id: radroots_event::id::RadrootsEventId
-pub radroots_event::id::RadrootsEventEnvelopePointer::relays: alloc::vec::Vec<alloc::string::String>
-impl radroots_event::id::RadrootsEventEnvelopePointer
-pub fn radroots_event::id::RadrootsEventEnvelopePointer::new<I, S>(radroots_event::id::RadrootsEventId, I) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError> where I: core::iter::traits::collect::IntoIterator<Item = S>, S: core::convert::Into<alloc::string::String>
-pub struct radroots_event::id::RadrootsEventId(_)
-impl radroots_event::id::RadrootsEventId
-pub const fn radroots_event::id::RadrootsEventId::as_bytes(&self) -> &[u8; 32]
-pub const fn radroots_event::id::RadrootsEventId::from_bytes([u8; 32]) -> Self
-pub const fn radroots_event::id::RadrootsEventId::into_bytes(self) -> [u8; 32]
-pub fn radroots_event::id::RadrootsEventId::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsEventId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-pub fn radroots_event::id::RadrootsEventId::to_hex(&self) -> alloc::string::String
-impl core::convert::AsRef<[u8]> for radroots_event::id::RadrootsEventId
-pub fn radroots_event::id::RadrootsEventId::as_ref(&self) -> &[u8]
-impl core::convert::From<[u8; 32]> for radroots_event::id::RadrootsEventId
-pub fn radroots_event::id::RadrootsEventId::from([u8; 32]) -> Self
-impl core::convert::From<radroots_event::id::RadrootsEventId> for [u8; 32]
-pub fn [u8; 32]::from(radroots_event::id::RadrootsEventId) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsEventId
-pub type radroots_event::id::RadrootsEventId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEventId::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsEventId
-pub type radroots_event::id::RadrootsEventId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEventId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsEventId
-pub fn radroots_event::id::RadrootsEventId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsEventId
-pub type radroots_event::id::RadrootsEventId::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEventId::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsEventId
-pub fn radroots_event::id::RadrootsEventId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsEventId
-pub fn radroots_event::id::RadrootsEventId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::id::RadrootsEventPointer(_)
-impl radroots_event::id::RadrootsEventPointer
-pub const fn radroots_event::id::RadrootsEventPointer::as_bytes(&self) -> &[u8; 32]
-pub const fn radroots_event::id::RadrootsEventPointer::from_bytes([u8; 32]) -> Self
-pub const fn radroots_event::id::RadrootsEventPointer::into_bytes(self) -> [u8; 32]
-pub fn radroots_event::id::RadrootsEventPointer::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsEventPointer::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-pub fn radroots_event::id::RadrootsEventPointer::to_hex(&self) -> alloc::string::String
-impl core::convert::AsRef<[u8]> for radroots_event::id::RadrootsEventPointer
-pub fn radroots_event::id::RadrootsEventPointer::as_ref(&self) -> &[u8]
-impl core::convert::From<[u8; 32]> for radroots_event::id::RadrootsEventPointer
-pub fn radroots_event::id::RadrootsEventPointer::from([u8; 32]) -> Self
-impl core::convert::From<radroots_event::id::RadrootsEventPointer> for [u8; 32]
-pub fn [u8; 32]::from(radroots_event::id::RadrootsEventPointer) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsEventPointer
-pub type radroots_event::id::RadrootsEventPointer::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEventPointer::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsEventPointer
-pub type radroots_event::id::RadrootsEventPointer::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEventPointer::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsEventPointer
-pub fn radroots_event::id::RadrootsEventPointer::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsEventPointer
-pub type radroots_event::id::RadrootsEventPointer::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEventPointer::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsEventPointer
-pub fn radroots_event::id::RadrootsEventPointer::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsEventPointer
-pub fn radroots_event::id::RadrootsEventPointer::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::id::RadrootsEventSignature(_)
-impl radroots_event::id::RadrootsEventSignature
-pub const fn radroots_event::id::RadrootsEventSignature::as_bytes(&self) -> &[u8; 64]
-pub const fn radroots_event::id::RadrootsEventSignature::from_bytes([u8; 64]) -> Self
-pub const fn radroots_event::id::RadrootsEventSignature::into_bytes(self) -> [u8; 64]
-pub fn radroots_event::id::RadrootsEventSignature::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsEventSignature::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-pub fn radroots_event::id::RadrootsEventSignature::to_hex(&self) -> alloc::string::String
-impl core::convert::AsRef<[u8]> for radroots_event::id::RadrootsEventSignature
-pub fn radroots_event::id::RadrootsEventSignature::as_ref(&self) -> &[u8]
-impl core::convert::From<[u8; 64]> for radroots_event::id::RadrootsEventSignature
-pub fn radroots_event::id::RadrootsEventSignature::from([u8; 64]) -> Self
-impl core::convert::From<radroots_event::id::RadrootsEventSignature> for [u8; 64]
-pub fn [u8; 64]::from(radroots_event::id::RadrootsEventSignature) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsEventSignature
-pub type radroots_event::id::RadrootsEventSignature::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEventSignature::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsEventSignature
-pub type radroots_event::id::RadrootsEventSignature::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEventSignature::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsEventSignature
-pub fn radroots_event::id::RadrootsEventSignature::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsEventSignature
-pub type radroots_event::id::RadrootsEventSignature::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEventSignature::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsEventSignature
-pub fn radroots_event::id::RadrootsEventSignature::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsEventSignature
-pub fn radroots_event::id::RadrootsEventSignature::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::id::RadrootsInventoryBinId(_)
-impl radroots_event::id::RadrootsInventoryBinId
-pub fn radroots_event::id::RadrootsInventoryBinId::as_str(&self) -> &str
-pub fn radroots_event::id::RadrootsInventoryBinId::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsInventoryBinId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-impl core::convert::AsRef<str> for radroots_event::id::RadrootsInventoryBinId
-pub fn radroots_event::id::RadrootsInventoryBinId::as_ref(&self) -> &str
-impl core::convert::From<radroots_event::id::RadrootsInventoryBinId> for alloc::string::String
-pub fn alloc::string::String::from(radroots_event::id::RadrootsInventoryBinId) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsInventoryBinId
-pub type radroots_event::id::RadrootsInventoryBinId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsInventoryBinId::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsInventoryBinId
-pub type radroots_event::id::RadrootsInventoryBinId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsInventoryBinId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsInventoryBinId
-pub fn radroots_event::id::RadrootsInventoryBinId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsInventoryBinId
-pub type radroots_event::id::RadrootsInventoryBinId::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsInventoryBinId::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsInventoryBinId
-pub fn radroots_event::id::RadrootsInventoryBinId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsInventoryBinId
-pub fn radroots_event::id::RadrootsInventoryBinId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::id::RadrootsNip01Coordinate
-impl radroots_event::id::RadrootsNip01Coordinate
-pub fn radroots_event::id::RadrootsNip01Coordinate::as_str(&self) -> &str
-pub fn radroots_event::id::RadrootsNip01Coordinate::identifier(&self) -> &str
-pub fn radroots_event::id::RadrootsNip01Coordinate::into_parts(self) -> radroots_event::id::RadrootsNip01CoordinateParts
-pub fn radroots_event::id::RadrootsNip01Coordinate::into_string(self) -> alloc::string::String
-pub const fn radroots_event::id::RadrootsNip01Coordinate::kind(&self) -> u32
-pub fn radroots_event::id::RadrootsNip01Coordinate::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsNip01CoordinateParseError>
-pub fn radroots_event::id::RadrootsNip01Coordinate::parts(&self) -> radroots_event::id::RadrootsNip01CoordinateParts
-pub const fn radroots_event::id::RadrootsNip01Coordinate::pubkey(&self) -> &radroots_identity::key::PublicKey
-impl core::convert::AsRef<str> for radroots_event::id::RadrootsNip01Coordinate
-pub fn radroots_event::id::RadrootsNip01Coordinate::as_ref(&self) -> &str
-impl core::convert::From<radroots_event::id::RadrootsNip01Coordinate> for alloc::string::String
-pub fn alloc::string::String::from(radroots_event::id::RadrootsNip01Coordinate) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsNip01Coordinate
-pub type radroots_event::id::RadrootsNip01Coordinate::Error = radroots_event::id::RadrootsNip01CoordinateParseError
-pub fn radroots_event::id::RadrootsNip01Coordinate::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsNip01Coordinate
-pub type radroots_event::id::RadrootsNip01Coordinate::Error = radroots_event::id::RadrootsNip01CoordinateParseError
-pub fn radroots_event::id::RadrootsNip01Coordinate::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsNip01Coordinate
-pub fn radroots_event::id::RadrootsNip01Coordinate::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsNip01Coordinate
-pub type radroots_event::id::RadrootsNip01Coordinate::Err = radroots_event::id::RadrootsNip01CoordinateParseError
-pub fn radroots_event::id::RadrootsNip01Coordinate::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsNip01Coordinate
-pub fn radroots_event::id::RadrootsNip01Coordinate::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsNip01Coordinate
-pub fn radroots_event::id::RadrootsNip01Coordinate::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::id::RadrootsNip01CoordinateParts
-pub radroots_event::id::RadrootsNip01CoordinateParts::identifier: alloc::string::String
-pub radroots_event::id::RadrootsNip01CoordinateParts::kind: u32
-pub radroots_event::id::RadrootsNip01CoordinateParts::pubkey: radroots_identity::key::PublicKey
-impl radroots_event::id::RadrootsNip01CoordinateParts
-pub fn radroots_event::id::RadrootsNip01CoordinateParts::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsNip01CoordinateParseError>
-pub struct radroots_event::id::RadrootsOrderId(_)
-impl radroots_event::id::RadrootsOrderId
-pub fn radroots_event::id::RadrootsOrderId::as_str(&self) -> &str
-pub fn radroots_event::id::RadrootsOrderId::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsOrderId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-impl core::convert::AsRef<str> for radroots_event::id::RadrootsOrderId
-pub fn radroots_event::id::RadrootsOrderId::as_ref(&self) -> &str
-impl core::convert::From<radroots_event::id::RadrootsOrderId> for alloc::string::String
-pub fn alloc::string::String::from(radroots_event::id::RadrootsOrderId) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsOrderId
-pub type radroots_event::id::RadrootsOrderId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsOrderId::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsOrderId
-pub type radroots_event::id::RadrootsOrderId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsOrderId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsOrderId
-pub fn radroots_event::id::RadrootsOrderId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsOrderId
-pub type radroots_event::id::RadrootsOrderId::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsOrderId::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsOrderId
-pub fn radroots_event::id::RadrootsOrderId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsOrderId
-pub fn radroots_event::id::RadrootsOrderId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::id::RadrootsOrderQuoteId(_)
-impl radroots_event::id::RadrootsOrderQuoteId
-pub fn radroots_event::id::RadrootsOrderQuoteId::as_str(&self) -> &str
-pub fn radroots_event::id::RadrootsOrderQuoteId::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsOrderQuoteId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-impl core::convert::AsRef<str> for radroots_event::id::RadrootsOrderQuoteId
-pub fn radroots_event::id::RadrootsOrderQuoteId::as_ref(&self) -> &str
-impl core::convert::From<radroots_event::id::RadrootsOrderQuoteId> for alloc::string::String
-pub fn alloc::string::String::from(radroots_event::id::RadrootsOrderQuoteId) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsOrderQuoteId
-pub type radroots_event::id::RadrootsOrderQuoteId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsOrderQuoteId::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsOrderQuoteId
-pub type radroots_event::id::RadrootsOrderQuoteId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsOrderQuoteId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsOrderQuoteId
-pub fn radroots_event::id::RadrootsOrderQuoteId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsOrderQuoteId
-pub type radroots_event::id::RadrootsOrderQuoteId::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsOrderQuoteId::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsOrderQuoteId
-pub fn radroots_event::id::RadrootsOrderQuoteId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsOrderQuoteId
-pub fn radroots_event::id::RadrootsOrderQuoteId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::id::RadrootsRelayUrl(_)
-impl radroots_event::id::RadrootsRelayUrl
-pub fn radroots_event::id::RadrootsRelayUrl::as_str(&self) -> &str
-pub fn radroots_event::id::RadrootsRelayUrl::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsRelayUrl::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-impl core::convert::AsRef<str> for radroots_event::id::RadrootsRelayUrl
-pub fn radroots_event::id::RadrootsRelayUrl::as_ref(&self) -> &str
-impl core::convert::From<radroots_event::id::RadrootsRelayUrl> for alloc::string::String
-pub fn alloc::string::String::from(radroots_event::id::RadrootsRelayUrl) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsRelayUrl
-pub type radroots_event::id::RadrootsRelayUrl::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsRelayUrl::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsRelayUrl
-pub type radroots_event::id::RadrootsRelayUrl::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsRelayUrl::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsRelayUrl
-pub fn radroots_event::id::RadrootsRelayUrl::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsRelayUrl
-pub type radroots_event::id::RadrootsRelayUrl::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsRelayUrl::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsRelayUrl
-pub fn radroots_event::id::RadrootsRelayUrl::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsRelayUrl
-pub fn radroots_event::id::RadrootsRelayUrl::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::id::RadrootsTradeCandidateId(_)
-impl radroots_event::id::RadrootsTradeCandidateId
-pub const fn radroots_event::id::RadrootsTradeCandidateId::as_bytes(&self) -> &[u8; 32]
-pub const fn radroots_event::id::RadrootsTradeCandidateId::from_bytes([u8; 32]) -> Self
-pub const fn radroots_event::id::RadrootsTradeCandidateId::into_bytes(self) -> [u8; 32]
-pub fn radroots_event::id::RadrootsTradeCandidateId::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsTradeCandidateId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-pub fn radroots_event::id::RadrootsTradeCandidateId::to_hex(&self) -> alloc::string::String
-impl core::convert::AsRef<[u8]> for radroots_event::id::RadrootsTradeCandidateId
-pub fn radroots_event::id::RadrootsTradeCandidateId::as_ref(&self) -> &[u8]
-impl core::convert::From<[u8; 32]> for radroots_event::id::RadrootsTradeCandidateId
-pub fn radroots_event::id::RadrootsTradeCandidateId::from([u8; 32]) -> Self
-impl core::convert::From<radroots_event::id::RadrootsTradeCandidateId> for [u8; 32]
-pub fn [u8; 32]::from(radroots_event::id::RadrootsTradeCandidateId) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsTradeCandidateId
-pub type radroots_event::id::RadrootsTradeCandidateId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeCandidateId::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsTradeCandidateId
-pub type radroots_event::id::RadrootsTradeCandidateId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeCandidateId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsTradeCandidateId
-pub fn radroots_event::id::RadrootsTradeCandidateId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsTradeCandidateId
-pub type radroots_event::id::RadrootsTradeCandidateId::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeCandidateId::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsTradeCandidateId
-pub fn radroots_event::id::RadrootsTradeCandidateId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsTradeCandidateId
-pub fn radroots_event::id::RadrootsTradeCandidateId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::id::RadrootsTradeId(_)
-impl radroots_event::id::RadrootsTradeId
-pub const fn radroots_event::id::RadrootsTradeId::as_bytes(&self) -> &[u8; 16]
-pub const fn radroots_event::id::RadrootsTradeId::from_bytes([u8; 16]) -> Self
-pub const fn radroots_event::id::RadrootsTradeId::into_bytes(self) -> [u8; 16]
-pub fn radroots_event::id::RadrootsTradeId::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsTradeId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-pub fn radroots_event::id::RadrootsTradeId::to_hex(&self) -> alloc::string::String
-impl core::convert::AsRef<[u8]> for radroots_event::id::RadrootsTradeId
-pub fn radroots_event::id::RadrootsTradeId::as_ref(&self) -> &[u8]
-impl core::convert::From<[u8; 16]> for radroots_event::id::RadrootsTradeId
-pub fn radroots_event::id::RadrootsTradeId::from([u8; 16]) -> Self
-impl core::convert::From<radroots_event::id::RadrootsTradeId> for [u8; 16]
-pub fn [u8; 16]::from(radroots_event::id::RadrootsTradeId) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsTradeId
-pub type radroots_event::id::RadrootsTradeId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeId::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsTradeId
-pub type radroots_event::id::RadrootsTradeId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsTradeId
-pub fn radroots_event::id::RadrootsTradeId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsTradeId
-pub type radroots_event::id::RadrootsTradeId::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeId::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsTradeId
-pub fn radroots_event::id::RadrootsTradeId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsTradeId
-pub fn radroots_event::id::RadrootsTradeId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::id::RadrootsTradeMutationId(_)
-impl radroots_event::id::RadrootsTradeMutationId
-pub const fn radroots_event::id::RadrootsTradeMutationId::as_bytes(&self) -> &[u8; 32]
-pub const fn radroots_event::id::RadrootsTradeMutationId::from_bytes([u8; 32]) -> Self
-pub const fn radroots_event::id::RadrootsTradeMutationId::into_bytes(self) -> [u8; 32]
-pub fn radroots_event::id::RadrootsTradeMutationId::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsTradeMutationId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-pub fn radroots_event::id::RadrootsTradeMutationId::to_hex(&self) -> alloc::string::String
-impl core::convert::AsRef<[u8]> for radroots_event::id::RadrootsTradeMutationId
-pub fn radroots_event::id::RadrootsTradeMutationId::as_ref(&self) -> &[u8]
-impl core::convert::From<[u8; 32]> for radroots_event::id::RadrootsTradeMutationId
-pub fn radroots_event::id::RadrootsTradeMutationId::from([u8; 32]) -> Self
-impl core::convert::From<radroots_event::id::RadrootsTradeMutationId> for [u8; 32]
-pub fn [u8; 32]::from(radroots_event::id::RadrootsTradeMutationId) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsTradeMutationId
-pub type radroots_event::id::RadrootsTradeMutationId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeMutationId::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsTradeMutationId
-pub type radroots_event::id::RadrootsTradeMutationId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeMutationId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsTradeMutationId
-pub fn radroots_event::id::RadrootsTradeMutationId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsTradeMutationId
-pub type radroots_event::id::RadrootsTradeMutationId::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeMutationId::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsTradeMutationId
-pub fn radroots_event::id::RadrootsTradeMutationId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsTradeMutationId
-pub fn radroots_event::id::RadrootsTradeMutationId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+impl radroots_event::id::Nip01CoordinateParts
+pub fn radroots_event::id::Nip01CoordinateParts::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::Nip01CoordinateParseError>
+pub struct radroots_event::id::OrderId(_)
+impl radroots_event::id::OrderId
+pub fn radroots_event::id::OrderId::as_str(&self) -> &str
+pub fn radroots_event::id::OrderId::into_string(self) -> alloc::string::String
+pub fn radroots_event::id::OrderId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::ParseError>
+impl core::convert::AsRef<str> for radroots_event::id::OrderId
+pub fn radroots_event::id::OrderId::as_ref(&self) -> &str
+impl core::convert::From<radroots_event::id::OrderId> for alloc::string::String
+pub fn alloc::string::String::from(radroots_event::id::OrderId) -> Self
+impl core::convert::TryFrom<&str> for radroots_event::id::OrderId
+pub type radroots_event::id::OrderId::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::OrderId::try_from(&str) -> core::result::Result<Self, Self::Error>
+impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::OrderId
+pub type radroots_event::id::OrderId::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::OrderId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
+impl core::fmt::Display for radroots_event::id::OrderId
+pub fn radroots_event::id::OrderId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::id::OrderId
+pub type radroots_event::id::OrderId::Err = radroots_event::id::ParseError
+pub fn radroots_event::id::OrderId::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::id::OrderId
+pub fn radroots_event::id::OrderId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::OrderId
+pub fn radroots_event::id::OrderId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+pub struct radroots_event::id::OrderQuoteId(_)
+impl radroots_event::id::OrderQuoteId
+pub fn radroots_event::id::OrderQuoteId::as_str(&self) -> &str
+pub fn radroots_event::id::OrderQuoteId::into_string(self) -> alloc::string::String
+pub fn radroots_event::id::OrderQuoteId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::ParseError>
+impl core::convert::AsRef<str> for radroots_event::id::OrderQuoteId
+pub fn radroots_event::id::OrderQuoteId::as_ref(&self) -> &str
+impl core::convert::From<radroots_event::id::OrderQuoteId> for alloc::string::String
+pub fn alloc::string::String::from(radroots_event::id::OrderQuoteId) -> Self
+impl core::convert::TryFrom<&str> for radroots_event::id::OrderQuoteId
+pub type radroots_event::id::OrderQuoteId::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::OrderQuoteId::try_from(&str) -> core::result::Result<Self, Self::Error>
+impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::OrderQuoteId
+pub type radroots_event::id::OrderQuoteId::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::OrderQuoteId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
+impl core::fmt::Display for radroots_event::id::OrderQuoteId
+pub fn radroots_event::id::OrderQuoteId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::id::OrderQuoteId
+pub type radroots_event::id::OrderQuoteId::Err = radroots_event::id::ParseError
+pub fn radroots_event::id::OrderQuoteId::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::id::OrderQuoteId
+pub fn radroots_event::id::OrderQuoteId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::OrderQuoteId
+pub fn radroots_event::id::OrderQuoteId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+pub struct radroots_event::id::RelayUrl(_)
+impl radroots_event::id::RelayUrl
+pub fn radroots_event::id::RelayUrl::as_str(&self) -> &str
+pub fn radroots_event::id::RelayUrl::into_string(self) -> alloc::string::String
+pub fn radroots_event::id::RelayUrl::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::ParseError>
+impl core::convert::AsRef<str> for radroots_event::id::RelayUrl
+pub fn radroots_event::id::RelayUrl::as_ref(&self) -> &str
+impl core::convert::From<radroots_event::id::RelayUrl> for alloc::string::String
+pub fn alloc::string::String::from(radroots_event::id::RelayUrl) -> Self
+impl core::convert::TryFrom<&str> for radroots_event::id::RelayUrl
+pub type radroots_event::id::RelayUrl::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::RelayUrl::try_from(&str) -> core::result::Result<Self, Self::Error>
+impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RelayUrl
+pub type radroots_event::id::RelayUrl::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::RelayUrl::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
+impl core::fmt::Display for radroots_event::id::RelayUrl
+pub fn radroots_event::id::RelayUrl::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::id::RelayUrl
+pub type radroots_event::id::RelayUrl::Err = radroots_event::id::ParseError
+pub fn radroots_event::id::RelayUrl::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::id::RelayUrl
+pub fn radroots_event::id::RelayUrl::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RelayUrl
+pub fn radroots_event::id::RelayUrl::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
pub struct radroots_event::id::TradeId(_)
-impl radroots_event::id::RadrootsTradeId
-pub const fn radroots_event::id::RadrootsTradeId::as_bytes(&self) -> &[u8; 16]
-pub const fn radroots_event::id::RadrootsTradeId::from_bytes([u8; 16]) -> Self
-pub const fn radroots_event::id::RadrootsTradeId::into_bytes(self) -> [u8; 16]
-pub fn radroots_event::id::RadrootsTradeId::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsTradeId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-pub fn radroots_event::id::RadrootsTradeId::to_hex(&self) -> alloc::string::String
-impl core::convert::AsRef<[u8]> for radroots_event::id::RadrootsTradeId
-pub fn radroots_event::id::RadrootsTradeId::as_ref(&self) -> &[u8]
-impl core::convert::From<[u8; 16]> for radroots_event::id::RadrootsTradeId
-pub fn radroots_event::id::RadrootsTradeId::from([u8; 16]) -> Self
-impl core::convert::From<radroots_event::id::RadrootsTradeId> for [u8; 16]
-pub fn [u8; 16]::from(radroots_event::id::RadrootsTradeId) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsTradeId
-pub type radroots_event::id::RadrootsTradeId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeId::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsTradeId
-pub type radroots_event::id::RadrootsTradeId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsTradeId
-pub fn radroots_event::id::RadrootsTradeId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsTradeId
-pub type radroots_event::id::RadrootsTradeId::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeId::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsTradeId
-pub fn radroots_event::id::RadrootsTradeId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsTradeId
-pub fn radroots_event::id::RadrootsTradeId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+impl radroots_event::id::TradeId
+pub const fn radroots_event::id::TradeId::as_bytes(&self) -> &[u8; 16]
+pub const fn radroots_event::id::TradeId::from_bytes([u8; 16]) -> Self
+pub const fn radroots_event::id::TradeId::into_bytes(self) -> [u8; 16]
+pub fn radroots_event::id::TradeId::into_string(self) -> alloc::string::String
+pub fn radroots_event::id::TradeId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::ParseError>
+pub fn radroots_event::id::TradeId::to_hex(&self) -> alloc::string::String
+impl core::convert::AsRef<[u8]> for radroots_event::id::TradeId
+pub fn radroots_event::id::TradeId::as_ref(&self) -> &[u8]
+impl core::convert::From<[u8; 16]> for radroots_event::id::TradeId
+pub fn radroots_event::id::TradeId::from([u8; 16]) -> Self
+impl core::convert::From<radroots_event::id::TradeId> for [u8; 16]
+pub fn [u8; 16]::from(radroots_event::id::TradeId) -> Self
+impl core::convert::TryFrom<&str> for radroots_event::id::TradeId
+pub type radroots_event::id::TradeId::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::TradeId::try_from(&str) -> core::result::Result<Self, Self::Error>
+impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::TradeId
+pub type radroots_event::id::TradeId::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::TradeId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
+impl core::fmt::Display for radroots_event::id::TradeId
+pub fn radroots_event::id::TradeId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::id::TradeId
+pub type radroots_event::id::TradeId::Err = radroots_event::id::ParseError
+pub fn radroots_event::id::TradeId::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::id::TradeId
+pub fn radroots_event::id::TradeId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::TradeId
+pub fn radroots_event::id::TradeId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
pub const radroots_event::id::RADROOTS_NIP01_COORDINATE_MAX_BYTES: usize
pub fn radroots_event::id::relay_url_is_valid(&str) -> bool
pub mod radroots_event::knowledge
-pub enum radroots_event::knowledge::RadrootsKnowledgeLocationPrecision
-pub radroots_event::knowledge::RadrootsKnowledgeLocationPrecision::CoarseGeohash
-pub radroots_event::knowledge::RadrootsKnowledgeLocationPrecision::ExactPrivateReference
-pub radroots_event::knowledge::RadrootsKnowledgeLocationPrecision::ExactPublic
-pub radroots_event::knowledge::RadrootsKnowledgeLocationPrecision::Locality
-pub radroots_event::knowledge::RadrootsKnowledgeLocationPrecision::None
-pub radroots_event::knowledge::RadrootsKnowledgeLocationPrecision::Region
-pub enum radroots_event::knowledge::RadrootsKnowledgeReviewScope
-pub radroots_event::knowledge::RadrootsKnowledgeReviewScope::AddressableCoordinateAtPublishedAt
-pub radroots_event::knowledge::RadrootsKnowledgeReviewScope::PolicyLatest
-pub radroots_event::knowledge::RadrootsKnowledgeReviewScope::SpecificVersion
-pub enum radroots_event::knowledge::RadrootsKnowledgeValidationError
-pub radroots_event::knowledge::RadrootsKnowledgeValidationError::EmptyField(&'static str)
-pub radroots_event::knowledge::RadrootsKnowledgeValidationError::InvalidField(&'static str)
-impl radroots_event::knowledge::RadrootsKnowledgeValidationError
-pub const fn radroots_event::knowledge::RadrootsKnowledgeValidationError::code(self) -> &'static str
-pub const fn radroots_event::knowledge::RadrootsKnowledgeValidationError::field(self) -> &'static str
-impl core::error::Error for radroots_event::knowledge::RadrootsKnowledgeValidationError
-impl core::fmt::Display for radroots_event::knowledge::RadrootsKnowledgeValidationError
-pub fn radroots_event::knowledge::RadrootsKnowledgeValidationError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub enum radroots_event::knowledge::RadrootsWikiDTagError
-pub radroots_event::knowledge::RadrootsWikiDTagError::Empty
-pub radroots_event::knowledge::RadrootsWikiDTagError::NotNormalized
-pub radroots_event::knowledge::RadrootsWikiDTagError::NotNormalized::normalized: alloc::string::String
-pub radroots_event::knowledge::RadrootsWikiDTagError::TooLong
-pub radroots_event::knowledge::RadrootsWikiDTagError::TooLong::actual: usize
-pub radroots_event::knowledge::RadrootsWikiDTagError::TooLong::max: usize
-impl radroots_event::knowledge::RadrootsWikiDTagError
-pub const fn radroots_event::knowledge::RadrootsWikiDTagError::code(&self) -> &'static str
-impl core::error::Error for radroots_event::knowledge::RadrootsWikiDTagError
-impl core::fmt::Display for radroots_event::knowledge::RadrootsWikiDTagError
-pub fn radroots_event::knowledge::RadrootsWikiDTagError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub struct radroots_event::knowledge::RadrootsAddressableRef
-pub radroots_event::knowledge::RadrootsAddressableRef::d_tag: alloc::string::String
-pub radroots_event::knowledge::RadrootsAddressableRef::kind: u32
-pub radroots_event::knowledge::RadrootsAddressableRef::pubkey: alloc::string::String
-pub radroots_event::knowledge::RadrootsAddressableRef::relays: alloc::vec::Vec<alloc::string::String>
-pub struct radroots_event::knowledge::RadrootsContributionAttestation
-pub radroots_event::knowledge::RadrootsContributionAttestation::contribution_type: alloc::string::String
-pub radroots_event::knowledge::RadrootsContributionAttestation::contributor_pubkey: alloc::string::String
-pub radroots_event::knowledge::RadrootsContributionAttestation::evidence_refs: alloc::vec::Vec<radroots_event::tag::RadrootsEventRef>
-pub radroots_event::knowledge::RadrootsContributionAttestation::schema: alloc::string::String
-pub radroots_event::knowledge::RadrootsContributionAttestation::schema_version: u16
-pub radroots_event::knowledge::RadrootsContributionAttestation::subject_refs: alloc::vec::Vec<radroots_event::tag::RadrootsEventRef>
-pub radroots_event::knowledge::RadrootsContributionAttestation::summary: alloc::string::String
-pub struct radroots_event::knowledge::RadrootsEvidenceBounty
-pub radroots_event::knowledge::RadrootsEvidenceBounty::closes_at: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsEvidenceBounty::d_tag: alloc::string::String
-pub radroots_event::knowledge::RadrootsEvidenceBounty::reward_note: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsEvidenceBounty::schema: alloc::string::String
-pub radroots_event::knowledge::RadrootsEvidenceBounty::schema_version: u16
-pub radroots_event::knowledge::RadrootsEvidenceBounty::summary: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsEvidenceBounty::target_refs: alloc::vec::Vec<radroots_event::tag::RadrootsEventRef>
-pub radroots_event::knowledge::RadrootsEvidenceBounty::title: alloc::string::String
-pub radroots_event::knowledge::RadrootsEvidenceBounty::topics: alloc::vec::Vec<alloc::string::String>
-pub struct radroots_event::knowledge::RadrootsKnowledgeChangeProposal
-pub radroots_event::knowledge::RadrootsKnowledgeChangeProposal::evidence_refs: alloc::vec::Vec<radroots_event::tag::RadrootsEventRef>
-pub radroots_event::knowledge::RadrootsKnowledgeChangeProposal::proposal_type: alloc::string::String
-pub radroots_event::knowledge::RadrootsKnowledgeChangeProposal::rationale: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeChangeProposal::schema: alloc::string::String
-pub radroots_event::knowledge::RadrootsKnowledgeChangeProposal::schema_version: u16
-pub radroots_event::knowledge::RadrootsKnowledgeChangeProposal::summary: alloc::string::String
-pub radroots_event::knowledge::RadrootsKnowledgeChangeProposal::supersedes: alloc::vec::Vec<radroots_event::tag::RadrootsEventRef>
-pub radroots_event::knowledge::RadrootsKnowledgeChangeProposal::target: radroots_event::tag::RadrootsEventRef
-pub struct radroots_event::knowledge::RadrootsKnowledgeCitationSpan
-pub radroots_event::knowledge::RadrootsKnowledgeCitationSpan::artifact_ref: core::option::Option<radroots_event::tag::RadrootsEventRef>
-pub radroots_event::knowledge::RadrootsKnowledgeCitationSpan::chunk_id: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeCitationSpan::page_end: core::option::Option<u32>
-pub radroots_event::knowledge::RadrootsKnowledgeCitationSpan::page_start: core::option::Option<u32>
-pub radroots_event::knowledge::RadrootsKnowledgeCitationSpan::quote_hash: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeCitationSpan::section_path: alloc::vec::Vec<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeCitationSpan::source_ref: radroots_event::tag::RadrootsEventRef
-pub struct radroots_event::knowledge::RadrootsKnowledgeClaim
-pub radroots_event::knowledge::RadrootsKnowledgeClaim::applies_to: alloc::vec::Vec<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeClaim::author_asserted_confidence: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeClaim::citation_spans: alloc::vec::Vec<radroots_event::knowledge::RadrootsKnowledgeCitationSpan>
-pub radroots_event::knowledge::RadrootsKnowledgeClaim::claim_type: alloc::string::String
-pub radroots_event::knowledge::RadrootsKnowledgeClaim::schema: alloc::string::String
-pub radroots_event::knowledge::RadrootsKnowledgeClaim::schema_version: u16
-pub radroots_event::knowledge::RadrootsKnowledgeClaim::supersedes: alloc::vec::Vec<radroots_event::tag::RadrootsEventRef>
-pub radroots_event::knowledge::RadrootsKnowledgeClaim::text: alloc::string::String
-pub radroots_event::knowledge::RadrootsKnowledgeClaim::topics: alloc::vec::Vec<alloc::string::String>
-pub struct radroots_event::knowledge::RadrootsKnowledgeFieldContext
-pub radroots_event::knowledge::RadrootsKnowledgeFieldContext::context_tags: alloc::vec::Vec<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeFieldContext::location_precision: radroots_event::knowledge::RadrootsKnowledgeLocationPrecision
-pub radroots_event::knowledge::RadrootsKnowledgeFieldContext::private_location_ref: core::option::Option<radroots_event::tag::RadrootsEventRef>
-pub radroots_event::knowledge::RadrootsKnowledgeFieldContext::public_location: core::option::Option<radroots_event::knowledge::RadrootsKnowledgeLocation>
-pub radroots_event::knowledge::RadrootsKnowledgeFieldContext::topics: alloc::vec::Vec<alloc::string::String>
-pub struct radroots_event::knowledge::RadrootsKnowledgeFieldReport
-pub radroots_event::knowledge::RadrootsKnowledgeFieldReport::artifact_refs: alloc::vec::Vec<radroots_event::tag::RadrootsEventRef>
-pub radroots_event::knowledge::RadrootsKnowledgeFieldReport::context: radroots_event::knowledge::RadrootsKnowledgeFieldContext
-pub radroots_event::knowledge::RadrootsKnowledgeFieldReport::limitations: alloc::vec::Vec<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeFieldReport::observations: alloc::vec::Vec<radroots_event::knowledge::RadrootsKnowledgeObservation>
-pub radroots_event::knowledge::RadrootsKnowledgeFieldReport::related_refs: alloc::vec::Vec<radroots_event::tag::RadrootsEventRef>
-pub radroots_event::knowledge::RadrootsKnowledgeFieldReport::report_type: alloc::string::String
-pub radroots_event::knowledge::RadrootsKnowledgeFieldReport::schema: alloc::string::String
-pub radroots_event::knowledge::RadrootsKnowledgeFieldReport::schema_version: u16
-pub radroots_event::knowledge::RadrootsKnowledgeFieldReport::summary: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeFieldReport::title: alloc::string::String
-pub struct radroots_event::knowledge::RadrootsKnowledgeLocation
-pub radroots_event::knowledge::RadrootsKnowledgeLocation::geohash: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeLocation::label: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeLocation::locality: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeLocation::region: core::option::Option<alloc::string::String>
-pub struct radroots_event::knowledge::RadrootsKnowledgeNodeRef
-pub radroots_event::knowledge::RadrootsKnowledgeNodeRef::address_ref: core::option::Option<radroots_event::knowledge::RadrootsAddressableRef>
-pub radroots_event::knowledge::RadrootsKnowledgeNodeRef::event_ref: core::option::Option<radroots_event::tag::RadrootsEventRef>
-pub radroots_event::knowledge::RadrootsKnowledgeNodeRef::external_id: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeNodeRef::label: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeNodeRef::node_type: alloc::string::String
-pub struct radroots_event::knowledge::RadrootsKnowledgeObservation
-pub radroots_event::knowledge::RadrootsKnowledgeObservation::observation_type: alloc::string::String
-pub radroots_event::knowledge::RadrootsKnowledgeObservation::observed_at: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeObservation::text: alloc::string::String
-pub radroots_event::knowledge::RadrootsKnowledgeObservation::values: alloc::vec::Vec<radroots_event::knowledge::RadrootsKnowledgeObservationValue>
-pub struct radroots_event::knowledge::RadrootsKnowledgeObservationValue
-pub radroots_event::knowledge::RadrootsKnowledgeObservationValue::key: alloc::string::String
-pub radroots_event::knowledge::RadrootsKnowledgeObservationValue::unit: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeObservationValue::value: alloc::string::String
-pub struct radroots_event::knowledge::RadrootsKnowledgeRelation
-pub radroots_event::knowledge::RadrootsKnowledgeRelation::author_asserted_confidence: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeRelation::object: radroots_event::knowledge::RadrootsKnowledgeNodeRef
-pub radroots_event::knowledge::RadrootsKnowledgeRelation::predicate: alloc::string::String
-pub radroots_event::knowledge::RadrootsKnowledgeRelation::schema: alloc::string::String
-pub radroots_event::knowledge::RadrootsKnowledgeRelation::schema_version: u16
-pub radroots_event::knowledge::RadrootsKnowledgeRelation::subject: radroots_event::knowledge::RadrootsKnowledgeNodeRef
-pub radroots_event::knowledge::RadrootsKnowledgeRelation::supersedes: alloc::vec::Vec<radroots_event::tag::RadrootsEventRef>
-pub radroots_event::knowledge::RadrootsKnowledgeRelation::support_refs: alloc::vec::Vec<radroots_event::tag::RadrootsEventRef>
-pub struct radroots_event::knowledge::RadrootsKnowledgeReview
-pub radroots_event::knowledge::RadrootsKnowledgeReview::evidence_refs: alloc::vec::Vec<radroots_event::tag::RadrootsEventRef>
-pub radroots_event::knowledge::RadrootsKnowledgeReview::notes: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeReview::reviewer_role: alloc::string::String
-pub radroots_event::knowledge::RadrootsKnowledgeReview::schema: alloc::string::String
-pub radroots_event::knowledge::RadrootsKnowledgeReview::schema_version: u16
-pub radroots_event::knowledge::RadrootsKnowledgeReview::scores: alloc::vec::Vec<radroots_event::knowledge::RadrootsKnowledgeReviewScore>
-pub radroots_event::knowledge::RadrootsKnowledgeReview::target: radroots_event::knowledge::RadrootsKnowledgeReviewTarget
-pub radroots_event::knowledge::RadrootsKnowledgeReview::verdict: alloc::string::String
-pub struct radroots_event::knowledge::RadrootsKnowledgeReviewScore
-pub radroots_event::knowledge::RadrootsKnowledgeReviewScore::dimension: alloc::string::String
-pub radroots_event::knowledge::RadrootsKnowledgeReviewScore::note: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeReviewScore::value: alloc::string::String
-pub struct radroots_event::knowledge::RadrootsKnowledgeReviewTarget
-pub radroots_event::knowledge::RadrootsKnowledgeReviewTarget::address: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeReviewTarget::author_pubkey: alloc::string::String
-pub radroots_event::knowledge::RadrootsKnowledgeReviewTarget::event_id: alloc::string::String
-pub radroots_event::knowledge::RadrootsKnowledgeReviewTarget::kind: u32
-pub radroots_event::knowledge::RadrootsKnowledgeReviewTarget::relays: alloc::vec::Vec<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeReviewTarget::review_scope: radroots_event::knowledge::RadrootsKnowledgeReviewScope
-pub struct radroots_event::knowledge::RadrootsKnowledgeSource
-pub radroots_event::knowledge::RadrootsKnowledgeSource::artifact_refs: alloc::vec::Vec<radroots_event::tag::RadrootsEventRef>
-pub radroots_event::knowledge::RadrootsKnowledgeSource::author_asserted_rights: core::option::Option<radroots_event::knowledge::RadrootsRightsAssertion>
-pub radroots_event::knowledge::RadrootsKnowledgeSource::authors: alloc::vec::Vec<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeSource::canonical_url: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeSource::d_tag: alloc::string::String
-pub radroots_event::knowledge::RadrootsKnowledgeSource::edition: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeSource::publication_year: core::option::Option<u16>
-pub radroots_event::knowledge::RadrootsKnowledgeSource::publisher: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeSource::schema: alloc::string::String
-pub radroots_event::knowledge::RadrootsKnowledgeSource::schema_version: u16
-pub radroots_event::knowledge::RadrootsKnowledgeSource::source_type: alloc::string::String
-pub radroots_event::knowledge::RadrootsKnowledgeSource::summary: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsKnowledgeSource::title: alloc::string::String
-pub radroots_event::knowledge::RadrootsKnowledgeSource::topics: alloc::vec::Vec<alloc::string::String>
-pub struct radroots_event::knowledge::RadrootsRightsAssertion
-pub radroots_event::knowledge::RadrootsRightsAssertion::assertion: alloc::string::String
-pub radroots_event::knowledge::RadrootsRightsAssertion::holder: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsRightsAssertion::license: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsRightsAssertion::url: core::option::Option<alloc::string::String>
-pub struct radroots_event::knowledge::RadrootsWikiArticle
-pub radroots_event::knowledge::RadrootsWikiArticle::content_djot: alloc::string::String
-pub radroots_event::knowledge::RadrootsWikiArticle::d_tag: alloc::string::String
-pub radroots_event::knowledge::RadrootsWikiArticle::deferred_to: core::option::Option<radroots_event::knowledge::RadrootsWikiArticleVersionRef>
-pub radroots_event::knowledge::RadrootsWikiArticle::forked_from: alloc::vec::Vec<radroots_event::knowledge::RadrootsWikiArticleVersionRef>
-pub radroots_event::knowledge::RadrootsWikiArticle::references: alloc::vec::Vec<radroots_event::tag::RadrootsEventRef>
-pub radroots_event::knowledge::RadrootsWikiArticle::summary: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsWikiArticle::title: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsWikiArticle::topics: alloc::vec::Vec<alloc::string::String>
-pub struct radroots_event::knowledge::RadrootsWikiArticleVersionRef
-pub radroots_event::knowledge::RadrootsWikiArticleVersionRef::address_ref: radroots_event::knowledge::RadrootsAddressableRef
-pub radroots_event::knowledge::RadrootsWikiArticleVersionRef::event_id: alloc::string::String
-pub struct radroots_event::knowledge::RadrootsWikiMergeRequest
-pub radroots_event::knowledge::RadrootsWikiMergeRequest::base_version_event_id: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsWikiMergeRequest::destination_pubkey: alloc::string::String
-pub radroots_event::knowledge::RadrootsWikiMergeRequest::explanation: core::option::Option<alloc::string::String>
-pub radroots_event::knowledge::RadrootsWikiMergeRequest::source_version_event_id: alloc::string::String
-pub radroots_event::knowledge::RadrootsWikiMergeRequest::target_article: radroots_event::knowledge::RadrootsAddressableRef
-pub struct radroots_event::knowledge::RadrootsWikiRedirect
-pub radroots_event::knowledge::RadrootsWikiRedirect::d_tag: alloc::string::String
-pub radroots_event::knowledge::RadrootsWikiRedirect::target: radroots_event::knowledge::RadrootsAddressableRef
+pub enum radroots_event::knowledge::KnowledgeLocationPrecision
+pub radroots_event::knowledge::KnowledgeLocationPrecision::CoarseGeohash
+pub radroots_event::knowledge::KnowledgeLocationPrecision::ExactPrivateReference
+pub radroots_event::knowledge::KnowledgeLocationPrecision::ExactPublic
+pub radroots_event::knowledge::KnowledgeLocationPrecision::Locality
+pub radroots_event::knowledge::KnowledgeLocationPrecision::None
+pub radroots_event::knowledge::KnowledgeLocationPrecision::Region
+pub enum radroots_event::knowledge::KnowledgeReviewScope
+pub radroots_event::knowledge::KnowledgeReviewScope::AddressableCoordinateAtPublishedAt
+pub radroots_event::knowledge::KnowledgeReviewScope::PolicyLatest
+pub radroots_event::knowledge::KnowledgeReviewScope::SpecificVersion
+pub enum radroots_event::knowledge::KnowledgeValidationError
+pub radroots_event::knowledge::KnowledgeValidationError::EmptyField(&'static str)
+pub radroots_event::knowledge::KnowledgeValidationError::InvalidField(&'static str)
+impl radroots_event::knowledge::KnowledgeValidationError
+pub const fn radroots_event::knowledge::KnowledgeValidationError::code(self) -> &'static str
+pub const fn radroots_event::knowledge::KnowledgeValidationError::field(self) -> &'static str
+impl core::error::Error for radroots_event::knowledge::KnowledgeValidationError
+impl core::fmt::Display for radroots_event::knowledge::KnowledgeValidationError
+pub fn radroots_event::knowledge::KnowledgeValidationError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub enum radroots_event::knowledge::WikiDTagError
+pub radroots_event::knowledge::WikiDTagError::Empty
+pub radroots_event::knowledge::WikiDTagError::NotNormalized
+pub radroots_event::knowledge::WikiDTagError::NotNormalized::normalized: alloc::string::String
+pub radroots_event::knowledge::WikiDTagError::TooLong
+pub radroots_event::knowledge::WikiDTagError::TooLong::actual: usize
+pub radroots_event::knowledge::WikiDTagError::TooLong::max: usize
+impl radroots_event::knowledge::WikiDTagError
+pub const fn radroots_event::knowledge::WikiDTagError::code(&self) -> &'static str
+impl core::error::Error for radroots_event::knowledge::WikiDTagError
+impl core::fmt::Display for radroots_event::knowledge::WikiDTagError
+pub fn radroots_event::knowledge::WikiDTagError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub struct radroots_event::knowledge::AddressableRef
+pub radroots_event::knowledge::AddressableRef::d_tag: alloc::string::String
+pub radroots_event::knowledge::AddressableRef::kind: u32
+pub radroots_event::knowledge::AddressableRef::pubkey: alloc::string::String
+pub radroots_event::knowledge::AddressableRef::relays: alloc::vec::Vec<alloc::string::String>
+pub struct radroots_event::knowledge::ContributionAttestation
+pub radroots_event::knowledge::ContributionAttestation::contribution_type: alloc::string::String
+pub radroots_event::knowledge::ContributionAttestation::contributor_pubkey: alloc::string::String
+pub radroots_event::knowledge::ContributionAttestation::evidence_refs: alloc::vec::Vec<radroots_event::tag::EventRef>
+pub radroots_event::knowledge::ContributionAttestation::schema: alloc::string::String
+pub radroots_event::knowledge::ContributionAttestation::schema_version: u16
+pub radroots_event::knowledge::ContributionAttestation::subject_refs: alloc::vec::Vec<radroots_event::tag::EventRef>
+pub radroots_event::knowledge::ContributionAttestation::summary: alloc::string::String
+pub struct radroots_event::knowledge::EvidenceBounty
+pub radroots_event::knowledge::EvidenceBounty::closes_at: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::EvidenceBounty::d_tag: alloc::string::String
+pub radroots_event::knowledge::EvidenceBounty::reward_note: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::EvidenceBounty::schema: alloc::string::String
+pub radroots_event::knowledge::EvidenceBounty::schema_version: u16
+pub radroots_event::knowledge::EvidenceBounty::summary: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::EvidenceBounty::target_refs: alloc::vec::Vec<radroots_event::tag::EventRef>
+pub radroots_event::knowledge::EvidenceBounty::title: alloc::string::String
+pub radroots_event::knowledge::EvidenceBounty::topics: alloc::vec::Vec<alloc::string::String>
+pub struct radroots_event::knowledge::KnowledgeChangeProposal
+pub radroots_event::knowledge::KnowledgeChangeProposal::evidence_refs: alloc::vec::Vec<radroots_event::tag::EventRef>
+pub radroots_event::knowledge::KnowledgeChangeProposal::proposal_type: alloc::string::String
+pub radroots_event::knowledge::KnowledgeChangeProposal::rationale: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeChangeProposal::schema: alloc::string::String
+pub radroots_event::knowledge::KnowledgeChangeProposal::schema_version: u16
+pub radroots_event::knowledge::KnowledgeChangeProposal::summary: alloc::string::String
+pub radroots_event::knowledge::KnowledgeChangeProposal::supersedes: alloc::vec::Vec<radroots_event::tag::EventRef>
+pub radroots_event::knowledge::KnowledgeChangeProposal::target: radroots_event::tag::EventRef
+pub struct radroots_event::knowledge::KnowledgeCitationSpan
+pub radroots_event::knowledge::KnowledgeCitationSpan::artifact_ref: core::option::Option<radroots_event::tag::EventRef>
+pub radroots_event::knowledge::KnowledgeCitationSpan::chunk_id: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeCitationSpan::page_end: core::option::Option<u32>
+pub radroots_event::knowledge::KnowledgeCitationSpan::page_start: core::option::Option<u32>
+pub radroots_event::knowledge::KnowledgeCitationSpan::quote_hash: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeCitationSpan::section_path: alloc::vec::Vec<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeCitationSpan::source_ref: radroots_event::tag::EventRef
+pub struct radroots_event::knowledge::KnowledgeClaim
+pub radroots_event::knowledge::KnowledgeClaim::applies_to: alloc::vec::Vec<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeClaim::author_asserted_confidence: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeClaim::citation_spans: alloc::vec::Vec<radroots_event::knowledge::KnowledgeCitationSpan>
+pub radroots_event::knowledge::KnowledgeClaim::claim_type: alloc::string::String
+pub radroots_event::knowledge::KnowledgeClaim::schema: alloc::string::String
+pub radroots_event::knowledge::KnowledgeClaim::schema_version: u16
+pub radroots_event::knowledge::KnowledgeClaim::supersedes: alloc::vec::Vec<radroots_event::tag::EventRef>
+pub radroots_event::knowledge::KnowledgeClaim::text: alloc::string::String
+pub radroots_event::knowledge::KnowledgeClaim::topics: alloc::vec::Vec<alloc::string::String>
+pub struct radroots_event::knowledge::KnowledgeFieldContext
+pub radroots_event::knowledge::KnowledgeFieldContext::context_tags: alloc::vec::Vec<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeFieldContext::location_precision: radroots_event::knowledge::KnowledgeLocationPrecision
+pub radroots_event::knowledge::KnowledgeFieldContext::private_location_ref: core::option::Option<radroots_event::tag::EventRef>
+pub radroots_event::knowledge::KnowledgeFieldContext::public_location: core::option::Option<radroots_event::knowledge::KnowledgeLocation>
+pub radroots_event::knowledge::KnowledgeFieldContext::topics: alloc::vec::Vec<alloc::string::String>
+pub struct radroots_event::knowledge::KnowledgeFieldReport
+pub radroots_event::knowledge::KnowledgeFieldReport::artifact_refs: alloc::vec::Vec<radroots_event::tag::EventRef>
+pub radroots_event::knowledge::KnowledgeFieldReport::context: radroots_event::knowledge::KnowledgeFieldContext
+pub radroots_event::knowledge::KnowledgeFieldReport::limitations: alloc::vec::Vec<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeFieldReport::observations: alloc::vec::Vec<radroots_event::knowledge::KnowledgeObservation>
+pub radroots_event::knowledge::KnowledgeFieldReport::related_refs: alloc::vec::Vec<radroots_event::tag::EventRef>
+pub radroots_event::knowledge::KnowledgeFieldReport::report_type: alloc::string::String
+pub radroots_event::knowledge::KnowledgeFieldReport::schema: alloc::string::String
+pub radroots_event::knowledge::KnowledgeFieldReport::schema_version: u16
+pub radroots_event::knowledge::KnowledgeFieldReport::summary: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeFieldReport::title: alloc::string::String
+pub struct radroots_event::knowledge::KnowledgeLocation
+pub radroots_event::knowledge::KnowledgeLocation::geohash: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeLocation::label: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeLocation::locality: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeLocation::region: core::option::Option<alloc::string::String>
+pub struct radroots_event::knowledge::KnowledgeNodeRef
+pub radroots_event::knowledge::KnowledgeNodeRef::address_ref: core::option::Option<radroots_event::knowledge::AddressableRef>
+pub radroots_event::knowledge::KnowledgeNodeRef::event_ref: core::option::Option<radroots_event::tag::EventRef>
+pub radroots_event::knowledge::KnowledgeNodeRef::external_id: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeNodeRef::label: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeNodeRef::node_type: alloc::string::String
+pub struct radroots_event::knowledge::KnowledgeObservation
+pub radroots_event::knowledge::KnowledgeObservation::observation_type: alloc::string::String
+pub radroots_event::knowledge::KnowledgeObservation::observed_at: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeObservation::text: alloc::string::String
+pub radroots_event::knowledge::KnowledgeObservation::values: alloc::vec::Vec<radroots_event::knowledge::KnowledgeObservationValue>
+pub struct radroots_event::knowledge::KnowledgeObservationValue
+pub radroots_event::knowledge::KnowledgeObservationValue::key: alloc::string::String
+pub radroots_event::knowledge::KnowledgeObservationValue::unit: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeObservationValue::value: alloc::string::String
+pub struct radroots_event::knowledge::KnowledgeRelation
+pub radroots_event::knowledge::KnowledgeRelation::author_asserted_confidence: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeRelation::object: radroots_event::knowledge::KnowledgeNodeRef
+pub radroots_event::knowledge::KnowledgeRelation::predicate: alloc::string::String
+pub radroots_event::knowledge::KnowledgeRelation::schema: alloc::string::String
+pub radroots_event::knowledge::KnowledgeRelation::schema_version: u16
+pub radroots_event::knowledge::KnowledgeRelation::subject: radroots_event::knowledge::KnowledgeNodeRef
+pub radroots_event::knowledge::KnowledgeRelation::supersedes: alloc::vec::Vec<radroots_event::tag::EventRef>
+pub radroots_event::knowledge::KnowledgeRelation::support_refs: alloc::vec::Vec<radroots_event::tag::EventRef>
+pub struct radroots_event::knowledge::KnowledgeReview
+pub radroots_event::knowledge::KnowledgeReview::evidence_refs: alloc::vec::Vec<radroots_event::tag::EventRef>
+pub radroots_event::knowledge::KnowledgeReview::notes: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeReview::reviewer_role: alloc::string::String
+pub radroots_event::knowledge::KnowledgeReview::schema: alloc::string::String
+pub radroots_event::knowledge::KnowledgeReview::schema_version: u16
+pub radroots_event::knowledge::KnowledgeReview::scores: alloc::vec::Vec<radroots_event::knowledge::KnowledgeReviewScore>
+pub radroots_event::knowledge::KnowledgeReview::target: radroots_event::knowledge::KnowledgeReviewTarget
+pub radroots_event::knowledge::KnowledgeReview::verdict: alloc::string::String
+pub struct radroots_event::knowledge::KnowledgeReviewScore
+pub radroots_event::knowledge::KnowledgeReviewScore::dimension: alloc::string::String
+pub radroots_event::knowledge::KnowledgeReviewScore::note: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeReviewScore::value: alloc::string::String
+pub struct radroots_event::knowledge::KnowledgeReviewTarget
+pub radroots_event::knowledge::KnowledgeReviewTarget::address: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeReviewTarget::author_pubkey: alloc::string::String
+pub radroots_event::knowledge::KnowledgeReviewTarget::event_id: alloc::string::String
+pub radroots_event::knowledge::KnowledgeReviewTarget::kind: u32
+pub radroots_event::knowledge::KnowledgeReviewTarget::relays: alloc::vec::Vec<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeReviewTarget::review_scope: radroots_event::knowledge::KnowledgeReviewScope
+pub struct radroots_event::knowledge::KnowledgeSource
+pub radroots_event::knowledge::KnowledgeSource::artifact_refs: alloc::vec::Vec<radroots_event::tag::EventRef>
+pub radroots_event::knowledge::KnowledgeSource::author_asserted_rights: core::option::Option<radroots_event::knowledge::RightsAssertion>
+pub radroots_event::knowledge::KnowledgeSource::authors: alloc::vec::Vec<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeSource::canonical_url: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeSource::d_tag: alloc::string::String
+pub radroots_event::knowledge::KnowledgeSource::edition: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeSource::publication_year: core::option::Option<u16>
+pub radroots_event::knowledge::KnowledgeSource::publisher: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeSource::schema: alloc::string::String
+pub radroots_event::knowledge::KnowledgeSource::schema_version: u16
+pub radroots_event::knowledge::KnowledgeSource::source_type: alloc::string::String
+pub radroots_event::knowledge::KnowledgeSource::summary: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::KnowledgeSource::title: alloc::string::String
+pub radroots_event::knowledge::KnowledgeSource::topics: alloc::vec::Vec<alloc::string::String>
+pub struct radroots_event::knowledge::RightsAssertion
+pub radroots_event::knowledge::RightsAssertion::assertion: alloc::string::String
+pub radroots_event::knowledge::RightsAssertion::holder: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::RightsAssertion::license: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::RightsAssertion::url: core::option::Option<alloc::string::String>
+pub struct radroots_event::knowledge::WikiArticle
+pub radroots_event::knowledge::WikiArticle::content_djot: alloc::string::String
+pub radroots_event::knowledge::WikiArticle::d_tag: alloc::string::String
+pub radroots_event::knowledge::WikiArticle::deferred_to: core::option::Option<radroots_event::knowledge::WikiArticleVersionRef>
+pub radroots_event::knowledge::WikiArticle::forked_from: alloc::vec::Vec<radroots_event::knowledge::WikiArticleVersionRef>
+pub radroots_event::knowledge::WikiArticle::references: alloc::vec::Vec<radroots_event::tag::EventRef>
+pub radroots_event::knowledge::WikiArticle::summary: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::WikiArticle::title: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::WikiArticle::topics: alloc::vec::Vec<alloc::string::String>
+pub struct radroots_event::knowledge::WikiArticleVersionRef
+pub radroots_event::knowledge::WikiArticleVersionRef::address_ref: radroots_event::knowledge::AddressableRef
+pub radroots_event::knowledge::WikiArticleVersionRef::event_id: alloc::string::String
+pub struct radroots_event::knowledge::WikiMergeRequest
+pub radroots_event::knowledge::WikiMergeRequest::base_version_event_id: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::WikiMergeRequest::destination_pubkey: alloc::string::String
+pub radroots_event::knowledge::WikiMergeRequest::explanation: core::option::Option<alloc::string::String>
+pub radroots_event::knowledge::WikiMergeRequest::source_version_event_id: alloc::string::String
+pub radroots_event::knowledge::WikiMergeRequest::target_article: radroots_event::knowledge::AddressableRef
+pub struct radroots_event::knowledge::WikiRedirect
+pub radroots_event::knowledge::WikiRedirect::d_tag: alloc::string::String
+pub radroots_event::knowledge::WikiRedirect::target: radroots_event::knowledge::AddressableRef
pub const radroots_event::knowledge::RADROOTS_CONTRIBUTION_ATTESTATION_SCHEMA: &str
pub const radroots_event::knowledge::RADROOTS_EVIDENCE_BOUNTY_SCHEMA: &str
pub const radroots_event::knowledge::RADROOTS_KNOWLEDGE_CHANGE_PROPOSAL_SCHEMA: &str
@@ -2283,260 +1957,260 @@ pub const radroots_event::knowledge::RADROOTS_KNOWLEDGE_SOURCE_SCHEMA: &str
pub const radroots_event::knowledge::RADROOTS_WIKI_D_TAG_MAX_LEN: usize
pub fn radroots_event::knowledge::is_uncited_knowledge_claim_type(&str) -> bool
pub fn radroots_event::knowledge::normalize_wiki_d_tag(&str) -> alloc::string::String
-pub fn radroots_event::knowledge::validate_contribution_attestation(&radroots_event::knowledge::RadrootsContributionAttestation) -> core::result::Result<(), radroots_event::knowledge::RadrootsKnowledgeValidationError>
-pub fn radroots_event::knowledge::validate_evidence_bounty(&radroots_event::knowledge::RadrootsEvidenceBounty) -> core::result::Result<(), radroots_event::knowledge::RadrootsKnowledgeValidationError>
-pub fn radroots_event::knowledge::validate_knowledge_change_proposal(&radroots_event::knowledge::RadrootsKnowledgeChangeProposal) -> core::result::Result<(), radroots_event::knowledge::RadrootsKnowledgeValidationError>
-pub fn radroots_event::knowledge::validate_knowledge_claim(&radroots_event::knowledge::RadrootsKnowledgeClaim) -> core::result::Result<(), radroots_event::knowledge::RadrootsKnowledgeValidationError>
-pub fn radroots_event::knowledge::validate_knowledge_field_report(&radroots_event::knowledge::RadrootsKnowledgeFieldReport) -> core::result::Result<(), radroots_event::knowledge::RadrootsKnowledgeValidationError>
-pub fn radroots_event::knowledge::validate_knowledge_relation(&radroots_event::knowledge::RadrootsKnowledgeRelation) -> core::result::Result<(), radroots_event::knowledge::RadrootsKnowledgeValidationError>
-pub fn radroots_event::knowledge::validate_knowledge_review(&radroots_event::knowledge::RadrootsKnowledgeReview) -> core::result::Result<(), radroots_event::knowledge::RadrootsKnowledgeValidationError>
-pub fn radroots_event::knowledge::validate_knowledge_source(&radroots_event::knowledge::RadrootsKnowledgeSource) -> core::result::Result<(), radroots_event::knowledge::RadrootsKnowledgeValidationError>
-pub fn radroots_event::knowledge::validate_wiki_article(&radroots_event::knowledge::RadrootsWikiArticle) -> core::result::Result<(), radroots_event::knowledge::RadrootsKnowledgeValidationError>
-pub fn radroots_event::knowledge::validate_wiki_d_tag(&str) -> core::result::Result<(), radroots_event::knowledge::RadrootsWikiDTagError>
-pub fn radroots_event::knowledge::validate_wiki_merge_request(&radroots_event::knowledge::RadrootsWikiMergeRequest) -> core::result::Result<(), radroots_event::knowledge::RadrootsKnowledgeValidationError>
-pub fn radroots_event::knowledge::validate_wiki_redirect(&radroots_event::knowledge::RadrootsWikiRedirect) -> core::result::Result<(), radroots_event::knowledge::RadrootsKnowledgeValidationError>
+pub fn radroots_event::knowledge::validate_contribution_attestation(&radroots_event::knowledge::ContributionAttestation) -> core::result::Result<(), radroots_event::knowledge::KnowledgeValidationError>
+pub fn radroots_event::knowledge::validate_evidence_bounty(&radroots_event::knowledge::EvidenceBounty) -> core::result::Result<(), radroots_event::knowledge::KnowledgeValidationError>
+pub fn radroots_event::knowledge::validate_knowledge_change_proposal(&radroots_event::knowledge::KnowledgeChangeProposal) -> core::result::Result<(), radroots_event::knowledge::KnowledgeValidationError>
+pub fn radroots_event::knowledge::validate_knowledge_claim(&radroots_event::knowledge::KnowledgeClaim) -> core::result::Result<(), radroots_event::knowledge::KnowledgeValidationError>
+pub fn radroots_event::knowledge::validate_knowledge_field_report(&radroots_event::knowledge::KnowledgeFieldReport) -> core::result::Result<(), radroots_event::knowledge::KnowledgeValidationError>
+pub fn radroots_event::knowledge::validate_knowledge_relation(&radroots_event::knowledge::KnowledgeRelation) -> core::result::Result<(), radroots_event::knowledge::KnowledgeValidationError>
+pub fn radroots_event::knowledge::validate_knowledge_review(&radroots_event::knowledge::KnowledgeReview) -> core::result::Result<(), radroots_event::knowledge::KnowledgeValidationError>
+pub fn radroots_event::knowledge::validate_knowledge_source(&radroots_event::knowledge::KnowledgeSource) -> core::result::Result<(), radroots_event::knowledge::KnowledgeValidationError>
+pub fn radroots_event::knowledge::validate_wiki_article(&radroots_event::knowledge::WikiArticle) -> core::result::Result<(), radroots_event::knowledge::KnowledgeValidationError>
+pub fn radroots_event::knowledge::validate_wiki_d_tag(&str) -> core::result::Result<(), radroots_event::knowledge::WikiDTagError>
+pub fn radroots_event::knowledge::validate_wiki_merge_request(&radroots_event::knowledge::WikiMergeRequest) -> core::result::Result<(), radroots_event::knowledge::KnowledgeValidationError>
+pub fn radroots_event::knowledge::validate_wiki_redirect(&radroots_event::knowledge::WikiRedirect) -> core::result::Result<(), radroots_event::knowledge::KnowledgeValidationError>
pub mod radroots_event::listing
pub mod radroots_event::listing::classified
-pub enum radroots_event::listing::classified::RadrootsClassifiedListingPartition
-pub radroots_event::listing::classified::RadrootsClassifiedListingPartition::Ambiguous
-pub radroots_event::listing::classified::RadrootsClassifiedListingPartition::FocusedFoodAvailability
-pub radroots_event::listing::classified::RadrootsClassifiedListingPartition::GenericNip99
-pub radroots_event::listing::classified::RadrootsClassifiedListingPartition::OperationalListing
+pub enum radroots_event::listing::classified::ClassifiedListingPartition
+pub radroots_event::listing::classified::ClassifiedListingPartition::Ambiguous
+pub radroots_event::listing::classified::ClassifiedListingPartition::FocusedFoodAvailability
+pub radroots_event::listing::classified::ClassifiedListingPartition::GenericNip99
+pub radroots_event::listing::classified::ClassifiedListingPartition::OperationalListing
pub const radroots_event::listing::classified::TAG_RADROOTS_BIN: &str
pub const radroots_event::listing::classified::TAG_RADROOTS_PRICE: &str
pub const radroots_event::listing::classified::TAG_RADROOTS_PRICE_UNIT: &str
pub const radroots_event::listing::classified::TAG_RADROOTS_PRIMARY_BIN: &str
pub const radroots_event::listing::classified::TAG_RADROOTS_QUANTITY: &str
-pub fn radroots_event::listing::classified::classify_classified_listing_marker_names<'a>(impl core::iter::traits::collect::IntoIterator<Item = core::option::Option<&'a str>>) -> radroots_event::listing::classified::RadrootsClassifiedListingPartition
-pub fn radroots_event::listing::classified::classify_classified_listing_tag_slice(&[radroots_event::envelope::RadrootsEventTag]) -> radroots_event::listing::classified::RadrootsClassifiedListingPartition
-pub fn radroots_event::listing::classified::classify_classified_listing_tags(&radroots_event::envelope::RadrootsEventTags) -> radroots_event::listing::classified::RadrootsClassifiedListingPartition
+pub fn radroots_event::listing::classified::classify_classified_listing_marker_names<'a>(impl core::iter::traits::collect::IntoIterator<Item = core::option::Option<&'a str>>) -> radroots_event::listing::classified::ClassifiedListingPartition
+pub fn radroots_event::listing::classified::classify_classified_listing_tag_slice(&[radroots_event::envelope::EventTag]) -> radroots_event::listing::classified::ClassifiedListingPartition
+pub fn radroots_event::listing::classified::classify_classified_listing_tags(&radroots_event::envelope::EventTags) -> radroots_event::listing::classified::ClassifiedListingPartition
pub mod radroots_event::listing::operational
-pub enum radroots_event::listing::operational::RadrootsOperationalListingAvailability
-pub radroots_event::listing::operational::RadrootsOperationalListingAvailability::Status
-pub radroots_event::listing::operational::RadrootsOperationalListingAvailability::Status::status: radroots_event::listing::operational::RadrootsOperationalListingStatus
-pub radroots_event::listing::operational::RadrootsOperationalListingAvailability::Window
-pub radroots_event::listing::operational::RadrootsOperationalListingAvailability::Window::end: core::option::Option<u64>
-pub radroots_event::listing::operational::RadrootsOperationalListingAvailability::Window::start: core::option::Option<u64>
-pub enum radroots_event::listing::operational::RadrootsOperationalListingDeliveryMethod
-pub radroots_event::listing::operational::RadrootsOperationalListingDeliveryMethod::LocalDelivery
-pub radroots_event::listing::operational::RadrootsOperationalListingDeliveryMethod::Other
-pub radroots_event::listing::operational::RadrootsOperationalListingDeliveryMethod::Other::method: alloc::string::String
-pub radroots_event::listing::operational::RadrootsOperationalListingDeliveryMethod::Pickup
-pub radroots_event::listing::operational::RadrootsOperationalListingDeliveryMethod::Shipping
-pub enum radroots_event::listing::operational::RadrootsOperationalListingParseError
-pub radroots_event::listing::operational::RadrootsOperationalListingParseError::InvalidCurrency
-pub radroots_event::listing::operational::RadrootsOperationalListingParseError::InvalidDiscount(alloc::string::String)
-pub radroots_event::listing::operational::RadrootsOperationalListingParseError::InvalidJson(alloc::string::String)
-pub radroots_event::listing::operational::RadrootsOperationalListingParseError::InvalidKind(u32)
-pub radroots_event::listing::operational::RadrootsOperationalListingParseError::InvalidNumber(alloc::string::String)
-pub radroots_event::listing::operational::RadrootsOperationalListingParseError::InvalidTag(alloc::string::String)
-pub radroots_event::listing::operational::RadrootsOperationalListingParseError::InvalidUnit
-pub radroots_event::listing::operational::RadrootsOperationalListingParseError::MissingTag(alloc::string::String)
-impl core::error::Error for radroots_event::listing::operational::RadrootsOperationalListingParseError
-impl core::fmt::Display for radroots_event::listing::operational::RadrootsOperationalListingParseError
-pub fn radroots_event::listing::operational::RadrootsOperationalListingParseError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub enum radroots_event::listing::operational::RadrootsOperationalListingStatus
-pub radroots_event::listing::operational::RadrootsOperationalListingStatus::Active
-pub radroots_event::listing::operational::RadrootsOperationalListingStatus::Other
-pub radroots_event::listing::operational::RadrootsOperationalListingStatus::Other::value: alloc::string::String
-pub radroots_event::listing::operational::RadrootsOperationalListingStatus::Sold
-pub struct radroots_event::listing::operational::RadrootsOperationalListing
-pub radroots_event::listing::operational::RadrootsOperationalListing::availability: core::option::Option<radroots_event::listing::operational::RadrootsOperationalListingAvailability>
-pub radroots_event::listing::operational::RadrootsOperationalListing::bins: alloc::vec::Vec<radroots_event::listing::operational::RadrootsOperationalListingBin>
-pub radroots_event::listing::operational::RadrootsOperationalListing::d_tag: radroots_event::id::RadrootsDTag
-pub radroots_event::listing::operational::RadrootsOperationalListing::delivery_method: core::option::Option<radroots_event::listing::operational::RadrootsOperationalListingDeliveryMethod>
-pub radroots_event::listing::operational::RadrootsOperationalListing::discounts: core::option::Option<alloc::vec::Vec<radroots_core::discount::Discount>>
-pub radroots_event::listing::operational::RadrootsOperationalListing::farm: radroots_event::farm::RadrootsFarmRef
-pub radroots_event::listing::operational::RadrootsOperationalListing::images: core::option::Option<alloc::vec::Vec<radroots_event::listing::operational::RadrootsOperationalListingImage>>
-pub radroots_event::listing::operational::RadrootsOperationalListing::inventory_available: core::option::Option<radroots_core::decimal::Decimal>
-pub radroots_event::listing::operational::RadrootsOperationalListing::location: core::option::Option<radroots_event::listing::operational::RadrootsOperationalListingPublicLocation>
-pub radroots_event::listing::operational::RadrootsOperationalListing::plot: core::option::Option<radroots_event::farm::plot::RadrootsPlotRef>
-pub radroots_event::listing::operational::RadrootsOperationalListing::primary_bin_id: radroots_event::id::RadrootsInventoryBinId
-pub radroots_event::listing::operational::RadrootsOperationalListing::product: radroots_event::listing::operational::RadrootsOperationalListingProduct
-pub radroots_event::listing::operational::RadrootsOperationalListing::published_at: core::option::Option<u64>
-pub radroots_event::listing::operational::RadrootsOperationalListing::resource_area: core::option::Option<radroots_event::farm::resource_area::RadrootsResourceAreaRef>
-pub struct radroots_event::listing::operational::RadrootsOperationalListingBin
-pub radroots_event::listing::operational::RadrootsOperationalListingBin::bin_id: radroots_event::id::RadrootsInventoryBinId
-pub radroots_event::listing::operational::RadrootsOperationalListingBin::display_amount: core::option::Option<radroots_core::decimal::Decimal>
-pub radroots_event::listing::operational::RadrootsOperationalListingBin::display_label: core::option::Option<alloc::string::String>
-pub radroots_event::listing::operational::RadrootsOperationalListingBin::display_price: core::option::Option<radroots_core::money::Money>
-pub radroots_event::listing::operational::RadrootsOperationalListingBin::display_price_unit: core::option::Option<radroots_core::unit::Unit>
-pub radroots_event::listing::operational::RadrootsOperationalListingBin::display_unit: core::option::Option<radroots_core::unit::Unit>
-pub radroots_event::listing::operational::RadrootsOperationalListingBin::price_per_canonical_unit: radroots_core::quantity_price::QuantityPrice
-pub radroots_event::listing::operational::RadrootsOperationalListingBin::quantity: radroots_core::quantity::Quantity
-pub struct radroots_event::listing::operational::RadrootsOperationalListingImage
-pub radroots_event::listing::operational::RadrootsOperationalListingImage::size: core::option::Option<radroots_event::listing::operational::RadrootsOperationalListingImageSize>
-pub radroots_event::listing::operational::RadrootsOperationalListingImage::url: alloc::string::String
-pub struct radroots_event::listing::operational::RadrootsOperationalListingImageSize
-pub radroots_event::listing::operational::RadrootsOperationalListingImageSize::h: u32
-pub radroots_event::listing::operational::RadrootsOperationalListingImageSize::w: u32
-pub struct radroots_event::listing::operational::RadrootsOperationalListingProduct
-pub radroots_event::listing::operational::RadrootsOperationalListingProduct::category: alloc::string::String
-pub radroots_event::listing::operational::RadrootsOperationalListingProduct::key: alloc::string::String
-pub radroots_event::listing::operational::RadrootsOperationalListingProduct::location: core::option::Option<alloc::string::String>
-pub radroots_event::listing::operational::RadrootsOperationalListingProduct::lot: core::option::Option<alloc::string::String>
-pub radroots_event::listing::operational::RadrootsOperationalListingProduct::process: core::option::Option<alloc::string::String>
-pub radroots_event::listing::operational::RadrootsOperationalListingProduct::profile: core::option::Option<alloc::string::String>
-pub radroots_event::listing::operational::RadrootsOperationalListingProduct::summary: core::option::Option<alloc::string::String>
-pub radroots_event::listing::operational::RadrootsOperationalListingProduct::title: alloc::string::String
-pub radroots_event::listing::operational::RadrootsOperationalListingProduct::year: core::option::Option<alloc::string::String>
-pub struct radroots_event::listing::operational::RadrootsOperationalListingProductTagKeys
-pub struct radroots_event::listing::operational::RadrootsOperationalListingPublicLocation
-pub radroots_event::listing::operational::RadrootsOperationalListingPublicLocation::city: core::option::Option<alloc::string::String>
-pub radroots_event::listing::operational::RadrootsOperationalListingPublicLocation::country: core::option::Option<alloc::string::String>
-pub radroots_event::listing::operational::RadrootsOperationalListingPublicLocation::geohash: alloc::string::String
-pub radroots_event::listing::operational::RadrootsOperationalListingPublicLocation::primary: alloc::string::String
-pub radroots_event::listing::operational::RadrootsOperationalListingPublicLocation::region: core::option::Option<alloc::string::String>
+pub enum radroots_event::listing::operational::OperationalListingAvailability
+pub radroots_event::listing::operational::OperationalListingAvailability::Status
+pub radroots_event::listing::operational::OperationalListingAvailability::Status::status: radroots_event::listing::operational::OperationalListingStatus
+pub radroots_event::listing::operational::OperationalListingAvailability::Window
+pub radroots_event::listing::operational::OperationalListingAvailability::Window::end: core::option::Option<u64>
+pub radroots_event::listing::operational::OperationalListingAvailability::Window::start: core::option::Option<u64>
+pub enum radroots_event::listing::operational::OperationalListingDeliveryMethod
+pub radroots_event::listing::operational::OperationalListingDeliveryMethod::LocalDelivery
+pub radroots_event::listing::operational::OperationalListingDeliveryMethod::Other
+pub radroots_event::listing::operational::OperationalListingDeliveryMethod::Other::method: alloc::string::String
+pub radroots_event::listing::operational::OperationalListingDeliveryMethod::Pickup
+pub radroots_event::listing::operational::OperationalListingDeliveryMethod::Shipping
+pub enum radroots_event::listing::operational::OperationalListingParseError
+pub radroots_event::listing::operational::OperationalListingParseError::InvalidCurrency
+pub radroots_event::listing::operational::OperationalListingParseError::InvalidDiscount(alloc::string::String)
+pub radroots_event::listing::operational::OperationalListingParseError::InvalidJson(alloc::string::String)
+pub radroots_event::listing::operational::OperationalListingParseError::InvalidKind(u32)
+pub radroots_event::listing::operational::OperationalListingParseError::InvalidNumber(alloc::string::String)
+pub radroots_event::listing::operational::OperationalListingParseError::InvalidTag(alloc::string::String)
+pub radroots_event::listing::operational::OperationalListingParseError::InvalidUnit
+pub radroots_event::listing::operational::OperationalListingParseError::MissingTag(alloc::string::String)
+impl core::error::Error for radroots_event::listing::operational::OperationalListingParseError
+impl core::fmt::Display for radroots_event::listing::operational::OperationalListingParseError
+pub fn radroots_event::listing::operational::OperationalListingParseError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub enum radroots_event::listing::operational::OperationalListingStatus
+pub radroots_event::listing::operational::OperationalListingStatus::Active
+pub radroots_event::listing::operational::OperationalListingStatus::Other
+pub radroots_event::listing::operational::OperationalListingStatus::Other::value: alloc::string::String
+pub radroots_event::listing::operational::OperationalListingStatus::Sold
+pub struct radroots_event::listing::operational::OperationalListing
+pub radroots_event::listing::operational::OperationalListing::availability: core::option::Option<radroots_event::listing::operational::OperationalListingAvailability>
+pub radroots_event::listing::operational::OperationalListing::bins: alloc::vec::Vec<radroots_event::listing::operational::OperationalListingBin>
+pub radroots_event::listing::operational::OperationalListing::d_tag: radroots_event::id::DTag
+pub radroots_event::listing::operational::OperationalListing::delivery_method: core::option::Option<radroots_event::listing::operational::OperationalListingDeliveryMethod>
+pub radroots_event::listing::operational::OperationalListing::discounts: core::option::Option<alloc::vec::Vec<radroots_core::discount::Discount>>
+pub radroots_event::listing::operational::OperationalListing::farm: radroots_event::farm::FarmRef
+pub radroots_event::listing::operational::OperationalListing::images: core::option::Option<alloc::vec::Vec<radroots_event::listing::operational::OperationalListingImage>>
+pub radroots_event::listing::operational::OperationalListing::inventory_available: core::option::Option<radroots_core::decimal::Decimal>
+pub radroots_event::listing::operational::OperationalListing::location: core::option::Option<radroots_event::listing::operational::OperationalListingPublicLocation>
+pub radroots_event::listing::operational::OperationalListing::plot: core::option::Option<radroots_event::farm::plot::PlotRef>
+pub radroots_event::listing::operational::OperationalListing::primary_bin_id: radroots_event::id::InventoryBinId
+pub radroots_event::listing::operational::OperationalListing::product: radroots_event::listing::operational::OperationalListingProduct
+pub radroots_event::listing::operational::OperationalListing::published_at: core::option::Option<u64>
+pub radroots_event::listing::operational::OperationalListing::resource_area: core::option::Option<radroots_event::farm::resource_area::ResourceAreaRef>
+pub struct radroots_event::listing::operational::OperationalListingBin
+pub radroots_event::listing::operational::OperationalListingBin::bin_id: radroots_event::id::InventoryBinId
+pub radroots_event::listing::operational::OperationalListingBin::display_amount: core::option::Option<radroots_core::decimal::Decimal>
+pub radroots_event::listing::operational::OperationalListingBin::display_label: core::option::Option<alloc::string::String>
+pub radroots_event::listing::operational::OperationalListingBin::display_price: core::option::Option<radroots_core::money::Money>
+pub radroots_event::listing::operational::OperationalListingBin::display_price_unit: core::option::Option<radroots_core::unit::Unit>
+pub radroots_event::listing::operational::OperationalListingBin::display_unit: core::option::Option<radroots_core::unit::Unit>
+pub radroots_event::listing::operational::OperationalListingBin::price_per_canonical_unit: radroots_core::quantity_price::QuantityPrice
+pub radroots_event::listing::operational::OperationalListingBin::quantity: radroots_core::quantity::Quantity
+pub struct radroots_event::listing::operational::OperationalListingImage
+pub radroots_event::listing::operational::OperationalListingImage::size: core::option::Option<radroots_event::listing::operational::OperationalListingImageSize>
+pub radroots_event::listing::operational::OperationalListingImage::url: alloc::string::String
+pub struct radroots_event::listing::operational::OperationalListingImageSize
+pub radroots_event::listing::operational::OperationalListingImageSize::h: u32
+pub radroots_event::listing::operational::OperationalListingImageSize::w: u32
+pub struct radroots_event::listing::operational::OperationalListingProduct
+pub radroots_event::listing::operational::OperationalListingProduct::category: alloc::string::String
+pub radroots_event::listing::operational::OperationalListingProduct::key: alloc::string::String
+pub radroots_event::listing::operational::OperationalListingProduct::location: core::option::Option<alloc::string::String>
+pub radroots_event::listing::operational::OperationalListingProduct::lot: core::option::Option<alloc::string::String>
+pub radroots_event::listing::operational::OperationalListingProduct::process: core::option::Option<alloc::string::String>
+pub radroots_event::listing::operational::OperationalListingProduct::profile: core::option::Option<alloc::string::String>
+pub radroots_event::listing::operational::OperationalListingProduct::summary: core::option::Option<alloc::string::String>
+pub radroots_event::listing::operational::OperationalListingProduct::title: alloc::string::String
+pub radroots_event::listing::operational::OperationalListingProduct::year: core::option::Option<alloc::string::String>
+pub struct radroots_event::listing::operational::OperationalListingProductTagKeys
+pub struct radroots_event::listing::operational::OperationalListingPublicLocation
+pub radroots_event::listing::operational::OperationalListingPublicLocation::city: core::option::Option<alloc::string::String>
+pub radroots_event::listing::operational::OperationalListingPublicLocation::country: core::option::Option<alloc::string::String>
+pub radroots_event::listing::operational::OperationalListingPublicLocation::geohash: alloc::string::String
+pub radroots_event::listing::operational::OperationalListingPublicLocation::primary: alloc::string::String
+pub radroots_event::listing::operational::OperationalListingPublicLocation::region: core::option::Option<alloc::string::String>
pub const radroots_event::listing::operational::RADROOTS_OPERATIONAL_LISTING_PRODUCT_TAG_KEYS: [&str; 9]
pub mod radroots_event::media
pub mod radroots_event::media::file_metadata
-pub struct radroots_event::media::file_metadata::RadrootsFileMetadata
-pub radroots_event::media::file_metadata::RadrootsFileMetadata::alt: core::option::Option<alloc::string::String>
-pub radroots_event::media::file_metadata::RadrootsFileMetadata::blurhash: core::option::Option<alloc::string::String>
-pub radroots_event::media::file_metadata::RadrootsFileMetadata::content: core::option::Option<alloc::string::String>
-pub radroots_event::media::file_metadata::RadrootsFileMetadata::content_hashes: core::option::Option<alloc::vec::Vec<alloc::string::String>>
-pub radroots_event::media::file_metadata::RadrootsFileMetadata::dimensions: core::option::Option<radroots_event::social::RadrootsSocialMediaDimensions>
-pub radroots_event::media::file_metadata::RadrootsFileMetadata::fallback: core::option::Option<alloc::string::String>
-pub radroots_event::media::file_metadata::RadrootsFileMetadata::magnet: core::option::Option<alloc::string::String>
-pub radroots_event::media::file_metadata::RadrootsFileMetadata::mime_type: alloc::string::String
-pub radroots_event::media::file_metadata::RadrootsFileMetadata::original_sha256: core::option::Option<alloc::string::String>
-pub radroots_event::media::file_metadata::RadrootsFileMetadata::services: core::option::Option<alloc::vec::Vec<alloc::string::String>>
-pub radroots_event::media::file_metadata::RadrootsFileMetadata::sha256: alloc::string::String
-pub radroots_event::media::file_metadata::RadrootsFileMetadata::size: core::option::Option<u64>
-pub radroots_event::media::file_metadata::RadrootsFileMetadata::summary: core::option::Option<alloc::string::String>
-pub radroots_event::media::file_metadata::RadrootsFileMetadata::thumbnails: core::option::Option<alloc::vec::Vec<radroots_event::social::RadrootsSocialMediaThumbnail>>
-pub radroots_event::media::file_metadata::RadrootsFileMetadata::url: alloc::string::String
-#[non_exhaustive] pub enum radroots_event::media::RadrootsAuthoredImageError
-pub radroots_event::media::RadrootsAuthoredImageError::MediaTypeNotImage
-impl radroots_event::media::RadrootsAuthoredImageError
-pub const fn radroots_event::media::RadrootsAuthoredImageError::code(&self) -> &'static str
-impl core::error::Error for radroots_event::media::RadrootsAuthoredImageError
-impl core::fmt::Display for radroots_event::media::RadrootsAuthoredImageError
-pub fn radroots_event::media::RadrootsAuthoredImageError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub struct radroots_event::media::RadrootsAuthoredImage(_)
-impl radroots_event::media::RadrootsAuthoredImage
-pub fn radroots_event::media::RadrootsAuthoredImage::descriptor(&self) -> &radroots_blossom::descriptor::ByteVerifiedDescriptor
-pub fn radroots_event::media::RadrootsAuthoredImage::try_from_verified_descriptor(radroots_blossom::descriptor::ByteVerifiedDescriptor) -> core::result::Result<Self, radroots_event::media::RadrootsAuthoredImageError>
-impl core::convert::TryFrom<radroots_blossom::descriptor::ByteVerifiedDescriptor> for radroots_event::media::RadrootsAuthoredImage
-pub type radroots_event::media::RadrootsAuthoredImage::Error = radroots_event::media::RadrootsAuthoredImageError
-pub fn radroots_event::media::RadrootsAuthoredImage::try_from(radroots_blossom::descriptor::ByteVerifiedDescriptor) -> core::result::Result<Self, Self::Error>
+pub struct radroots_event::media::file_metadata::FileMetadata
+pub radroots_event::media::file_metadata::FileMetadata::alt: core::option::Option<alloc::string::String>
+pub radroots_event::media::file_metadata::FileMetadata::blurhash: core::option::Option<alloc::string::String>
+pub radroots_event::media::file_metadata::FileMetadata::content: core::option::Option<alloc::string::String>
+pub radroots_event::media::file_metadata::FileMetadata::content_hashes: core::option::Option<alloc::vec::Vec<alloc::string::String>>
+pub radroots_event::media::file_metadata::FileMetadata::dimensions: core::option::Option<radroots_event::social::SocialMediaDimensions>
+pub radroots_event::media::file_metadata::FileMetadata::fallback: core::option::Option<alloc::string::String>
+pub radroots_event::media::file_metadata::FileMetadata::magnet: core::option::Option<alloc::string::String>
+pub radroots_event::media::file_metadata::FileMetadata::mime_type: alloc::string::String
+pub radroots_event::media::file_metadata::FileMetadata::original_sha256: core::option::Option<alloc::string::String>
+pub radroots_event::media::file_metadata::FileMetadata::services: core::option::Option<alloc::vec::Vec<alloc::string::String>>
+pub radroots_event::media::file_metadata::FileMetadata::sha256: alloc::string::String
+pub radroots_event::media::file_metadata::FileMetadata::size: core::option::Option<u64>
+pub radroots_event::media::file_metadata::FileMetadata::summary: core::option::Option<alloc::string::String>
+pub radroots_event::media::file_metadata::FileMetadata::thumbnails: core::option::Option<alloc::vec::Vec<radroots_event::social::SocialMediaThumbnail>>
+pub radroots_event::media::file_metadata::FileMetadata::url: alloc::string::String
+#[non_exhaustive] pub enum radroots_event::media::AuthoredImageError
+pub radroots_event::media::AuthoredImageError::MediaTypeNotImage
+impl radroots_event::media::AuthoredImageError
+pub const fn radroots_event::media::AuthoredImageError::code(&self) -> &'static str
+impl core::error::Error for radroots_event::media::AuthoredImageError
+impl core::fmt::Display for radroots_event::media::AuthoredImageError
+pub fn radroots_event::media::AuthoredImageError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub struct radroots_event::media::AuthoredImage(_)
+impl radroots_event::media::AuthoredImage
+pub fn radroots_event::media::AuthoredImage::descriptor(&self) -> &radroots_blossom::descriptor::ByteVerifiedDescriptor
+pub fn radroots_event::media::AuthoredImage::try_from_verified_descriptor(radroots_blossom::descriptor::ByteVerifiedDescriptor) -> core::result::Result<Self, radroots_event::media::AuthoredImageError>
+impl core::convert::TryFrom<radroots_blossom::descriptor::ByteVerifiedDescriptor> for radroots_event::media::AuthoredImage
+pub type radroots_event::media::AuthoredImage::Error = radroots_event::media::AuthoredImageError
+pub fn radroots_event::media::AuthoredImage::try_from(radroots_blossom::descriptor::ByteVerifiedDescriptor) -> core::result::Result<Self, Self::Error>
pub mod radroots_event::post
pub mod radroots_event::post::article
-pub struct radroots_event::post::article::RadrootsArticle
-pub radroots_event::post::article::RadrootsArticle::content: alloc::string::String
-pub radroots_event::post::article::RadrootsArticle::d_tag: alloc::string::String
-pub radroots_event::post::article::RadrootsArticle::farm: core::option::Option<radroots_event::social::RadrootsSocialFarmAnchor>
-pub radroots_event::post::article::RadrootsArticle::image: core::option::Option<alloc::string::String>
-pub radroots_event::post::article::RadrootsArticle::location: core::option::Option<radroots_event::social::RadrootsSocialLocation>
-pub radroots_event::post::article::RadrootsArticle::published_at: core::option::Option<u64>
-pub radroots_event::post::article::RadrootsArticle::summary: core::option::Option<alloc::string::String>
-pub radroots_event::post::article::RadrootsArticle::title: alloc::string::String
-pub radroots_event::post::article::RadrootsArticle::topics: core::option::Option<alloc::vec::Vec<alloc::string::String>>
+pub struct radroots_event::post::article::Article
+pub radroots_event::post::article::Article::content: alloc::string::String
+pub radroots_event::post::article::Article::d_tag: alloc::string::String
+pub radroots_event::post::article::Article::farm: core::option::Option<radroots_event::social::SocialFarmAnchor>
+pub radroots_event::post::article::Article::image: core::option::Option<alloc::string::String>
+pub radroots_event::post::article::Article::location: core::option::Option<radroots_event::social::SocialLocation>
+pub radroots_event::post::article::Article::published_at: core::option::Option<u64>
+pub radroots_event::post::article::Article::summary: core::option::Option<alloc::string::String>
+pub radroots_event::post::article::Article::title: alloc::string::String
+pub radroots_event::post::article::Article::topics: core::option::Option<alloc::vec::Vec<alloc::string::String>>
pub mod radroots_event::post::comment
-#[non_exhaustive] pub enum radroots_event::post::comment::RadrootsNip22CommentError
-pub radroots_event::post::comment::RadrootsNip22CommentError::ContentMissing
-pub radroots_event::post::comment::RadrootsNip22CommentError::ContentTooLarge
-pub radroots_event::post::comment::RadrootsNip22CommentError::ContentTooLarge::actual: usize
-pub radroots_event::post::comment::RadrootsNip22CommentError::ContentTooLarge::max: usize
-pub radroots_event::post::comment::RadrootsNip22CommentError::EventWireTooLarge
-pub radroots_event::post::comment::RadrootsNip22CommentError::EventWireTooLarge::actual: usize
-pub radroots_event::post::comment::RadrootsNip22CommentError::EventWireTooLarge::max: usize
-pub radroots_event::post::comment::RadrootsNip22CommentError::ParentAuthorInvalid(radroots_event::id::RadrootsIdParseError)
-pub radroots_event::post::comment::RadrootsNip22CommentError::ParentEventIdInvalid(radroots_event::id::RadrootsIdParseError)
-pub radroots_event::post::comment::RadrootsNip22CommentError::ParentReferenceMismatch
-pub radroots_event::post::comment::RadrootsNip22CommentError::RelayInvalid(radroots_event::id::RadrootsIdParseError)
-pub radroots_event::post::comment::RadrootsNip22CommentError::RevisionEventIdInvalid(radroots_event::id::RadrootsIdParseError)
-pub radroots_event::post::comment::RadrootsNip22CommentError::RootAuthorInvalid(radroots_event::id::RadrootsIdParseError)
-pub radroots_event::post::comment::RadrootsNip22CommentError::RootCoordinateInvalid(radroots_event::id::RadrootsIdParseError)
-pub radroots_event::post::comment::RadrootsNip22CommentError::RootEventIdInvalid(radroots_event::id::RadrootsIdParseError)
-pub radroots_event::post::comment::RadrootsNip22CommentError::RootKindUnsupported
-pub radroots_event::post::comment::RadrootsNip22CommentError::RootKindUnsupported::actual: u32
-pub radroots_event::post::comment::RadrootsNip22CommentError::TagBytesExceeded
-pub radroots_event::post::comment::RadrootsNip22CommentError::TagBytesExceeded::actual: usize
-pub radroots_event::post::comment::RadrootsNip22CommentError::TagBytesExceeded::max: usize
-pub radroots_event::post::comment::RadrootsNip22CommentError::TagCountExceeded
-pub radroots_event::post::comment::RadrootsNip22CommentError::TagCountExceeded::actual: usize
-pub radroots_event::post::comment::RadrootsNip22CommentError::TagCountExceeded::max: usize
-pub radroots_event::post::comment::RadrootsNip22CommentError::TagElementCountExceeded
-pub radroots_event::post::comment::RadrootsNip22CommentError::TagElementCountExceeded::actual: usize
-pub radroots_event::post::comment::RadrootsNip22CommentError::TagElementCountExceeded::max: usize
-pub radroots_event::post::comment::RadrootsNip22CommentError::TagElementTooLarge
-pub radroots_event::post::comment::RadrootsNip22CommentError::TagElementTooLarge::actual: usize
-pub radroots_event::post::comment::RadrootsNip22CommentError::TagElementTooLarge::max: usize
-impl radroots_event::post::comment::RadrootsNip22CommentError
-pub const fn radroots_event::post::comment::RadrootsNip22CommentError::code(&self) -> &'static str
-impl core::error::Error for radroots_event::post::comment::RadrootsNip22CommentError
-pub fn radroots_event::post::comment::RadrootsNip22CommentError::source(&self) -> core::option::Option<&(dyn core::error::Error + 'static)>
-impl core::fmt::Display for radroots_event::post::comment::RadrootsNip22CommentError
-pub fn radroots_event::post::comment::RadrootsNip22CommentError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub enum radroots_event::post::comment::RadrootsNip22CommentPosition
-pub radroots_event::post::comment::RadrootsNip22CommentPosition::Nested
-pub radroots_event::post::comment::RadrootsNip22CommentPosition::Nested::parent: radroots_event::post::comment::RadrootsNip22CommentParentReference
-pub radroots_event::post::comment::RadrootsNip22CommentPosition::TopLevelAddress
-pub radroots_event::post::comment::RadrootsNip22CommentPosition::TopLevelAddress::current_revision: radroots_event::id::RadrootsEventId
-pub radroots_event::post::comment::RadrootsNip22CommentPosition::TopLevelEvent
-pub enum radroots_event::post::comment::RadrootsNip22CommentRoot
-pub radroots_event::post::comment::RadrootsNip22CommentRoot::Address(radroots_event::post::comment::RadrootsNip22AddressRootReference)
-pub radroots_event::post::comment::RadrootsNip22CommentRoot::Event(radroots_event::post::comment::RadrootsNip22EventRootReference)
-impl radroots_event::post::comment::RadrootsNip22CommentRoot
-pub const fn radroots_event::post::comment::RadrootsNip22CommentRoot::author(&self) -> &radroots_identity::key::PublicKey
-pub const fn radroots_event::post::comment::RadrootsNip22CommentRoot::kind(&self) -> radroots_event::post::comment::RadrootsNip22CommentRootKind
-pub const fn radroots_event::post::comment::RadrootsNip22CommentRoot::relay(&self) -> core::option::Option<&radroots_event::tag::relay_hint::RadrootsNostrRelayHint>
-impl core::convert::From<radroots_event::post::comment::RadrootsNip22AddressRootReference> for radroots_event::post::comment::RadrootsNip22CommentRoot
-pub fn radroots_event::post::comment::RadrootsNip22CommentRoot::from(radroots_event::post::comment::RadrootsNip22AddressRootReference) -> Self
-impl core::convert::From<radroots_event::post::comment::RadrootsNip22EventRootReference> for radroots_event::post::comment::RadrootsNip22CommentRoot
-pub fn radroots_event::post::comment::RadrootsNip22CommentRoot::from(radroots_event::post::comment::RadrootsNip22EventRootReference) -> Self
-pub enum radroots_event::post::comment::RadrootsNip22CommentRootKind
-pub radroots_event::post::comment::RadrootsNip22CommentRootKind::CalendarDateEvent
-pub radroots_event::post::comment::RadrootsNip22CommentRootKind::CalendarTimeEvent
-pub radroots_event::post::comment::RadrootsNip22CommentRootKind::ClassifiedListing
-impl radroots_event::post::comment::RadrootsNip22CommentRootKind
-pub const fn radroots_event::post::comment::RadrootsNip22CommentRootKind::as_u32(self) -> u32
-pub const fn radroots_event::post::comment::RadrootsNip22CommentRootKind::parse(u32) -> core::result::Result<Self, radroots_event::post::comment::RadrootsNip22CommentError>
-impl core::convert::From<radroots_event::post::comment::RadrootsNip22CommentRootKind> for u32
-pub fn u32::from(radroots_event::post::comment::RadrootsNip22CommentRootKind) -> Self
-impl core::convert::TryFrom<u32> for radroots_event::post::comment::RadrootsNip22CommentRootKind
-pub type radroots_event::post::comment::RadrootsNip22CommentRootKind::Error = radroots_event::post::comment::RadrootsNip22CommentError
-pub fn radroots_event::post::comment::RadrootsNip22CommentRootKind::try_from(u32) -> core::result::Result<Self, Self::Error>
-pub struct radroots_event::post::comment::RadrootsAuthoredNip22Comment
-impl radroots_event::post::comment::RadrootsAuthoredNip22Comment
-pub fn radroots_event::post::comment::RadrootsAuthoredNip22Comment::content(&self) -> &str
-pub fn radroots_event::post::comment::RadrootsAuthoredNip22Comment::nested(impl core::convert::Into<alloc::string::String>, impl core::convert::Into<radroots_event::post::comment::RadrootsNip22CommentRoot>, radroots_event::post::comment::RadrootsNip22CommentParentReference) -> core::result::Result<Self, radroots_event::post::comment::RadrootsNip22CommentError>
-pub fn radroots_event::post::comment::RadrootsAuthoredNip22Comment::parse_top_level_address(impl core::convert::Into<alloc::string::String>, radroots_event::post::comment::RadrootsNip22AddressRootReference, impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::post::comment::RadrootsNip22CommentError>
-pub const fn radroots_event::post::comment::RadrootsAuthoredNip22Comment::position(&self) -> &radroots_event::post::comment::RadrootsNip22CommentPosition
-pub const fn radroots_event::post::comment::RadrootsAuthoredNip22Comment::root(&self) -> &radroots_event::post::comment::RadrootsNip22CommentRoot
-pub fn radroots_event::post::comment::RadrootsAuthoredNip22Comment::top_level_address(impl core::convert::Into<alloc::string::String>, radroots_event::post::comment::RadrootsNip22AddressRootReference, radroots_event::id::RadrootsEventId) -> core::result::Result<Self, radroots_event::post::comment::RadrootsNip22CommentError>
-pub fn radroots_event::post::comment::RadrootsAuthoredNip22Comment::top_level_event(impl core::convert::Into<alloc::string::String>, radroots_event::post::comment::RadrootsNip22EventRootReference) -> core::result::Result<Self, radroots_event::post::comment::RadrootsNip22CommentError>
-pub struct radroots_event::post::comment::RadrootsNip22AddressRootReference
-impl radroots_event::post::comment::RadrootsNip22AddressRootReference
-pub const fn radroots_event::post::comment::RadrootsNip22AddressRootReference::author(&self) -> &radroots_identity::key::PublicKey
-pub const fn radroots_event::post::comment::RadrootsNip22AddressRootReference::coordinate(&self) -> &radroots_event::id::RadrootsAddressableCoordinate
-pub const fn radroots_event::post::comment::RadrootsNip22AddressRootReference::kind(&self) -> radroots_event::post::comment::RadrootsNip22CommentRootKind
-pub fn radroots_event::post::comment::RadrootsNip22AddressRootReference::new(radroots_event::id::RadrootsAddressableCoordinate, core::option::Option<radroots_event::tag::relay_hint::RadrootsNostrRelayHint>) -> core::result::Result<Self, radroots_event::post::comment::RadrootsNip22CommentError>
-pub fn radroots_event::post::comment::RadrootsNip22AddressRootReference::parse(impl core::convert::AsRef<str>, core::option::Option<&str>) -> core::result::Result<Self, radroots_event::post::comment::RadrootsNip22CommentError>
-pub const fn radroots_event::post::comment::RadrootsNip22AddressRootReference::relay(&self) -> core::option::Option<&radroots_event::tag::relay_hint::RadrootsNostrRelayHint>
-pub fn radroots_event::post::comment::RadrootsNip22AddressRootReference::relay_or_empty(&self) -> &str
-impl core::convert::From<radroots_event::post::comment::RadrootsNip22AddressRootReference> for radroots_event::post::comment::RadrootsNip22CommentRoot
-pub fn radroots_event::post::comment::RadrootsNip22CommentRoot::from(radroots_event::post::comment::RadrootsNip22AddressRootReference) -> Self
-pub struct radroots_event::post::comment::RadrootsNip22CommentParentReference
-impl radroots_event::post::comment::RadrootsNip22CommentParentReference
-pub const fn radroots_event::post::comment::RadrootsNip22CommentParentReference::author(&self) -> &radroots_identity::key::PublicKey
-pub const fn radroots_event::post::comment::RadrootsNip22CommentParentReference::event_id(&self) -> &radroots_event::id::RadrootsEventId
-pub fn radroots_event::post::comment::RadrootsNip22CommentParentReference::new(radroots_event::id::RadrootsEventId, radroots_identity::key::PublicKey, core::option::Option<radroots_event::tag::relay_hint::RadrootsNostrRelayHint>) -> core::result::Result<Self, radroots_event::post::comment::RadrootsNip22CommentError>
-pub fn radroots_event::post::comment::RadrootsNip22CommentParentReference::parse(impl core::convert::AsRef<str>, impl core::convert::AsRef<str>, core::option::Option<&str>) -> core::result::Result<Self, radroots_event::post::comment::RadrootsNip22CommentError>
-pub const fn radroots_event::post::comment::RadrootsNip22CommentParentReference::relay(&self) -> core::option::Option<&radroots_event::tag::relay_hint::RadrootsNostrRelayHint>
-pub fn radroots_event::post::comment::RadrootsNip22CommentParentReference::relay_or_empty(&self) -> &str
-pub struct radroots_event::post::comment::RadrootsNip22EventRootReference
-impl radroots_event::post::comment::RadrootsNip22EventRootReference
-pub const fn radroots_event::post::comment::RadrootsNip22EventRootReference::author(&self) -> &radroots_identity::key::PublicKey
-pub const fn radroots_event::post::comment::RadrootsNip22EventRootReference::event_id(&self) -> &radroots_event::id::RadrootsEventId
-pub const fn radroots_event::post::comment::RadrootsNip22EventRootReference::kind(&self) -> radroots_event::post::comment::RadrootsNip22CommentRootKind
-pub fn radroots_event::post::comment::RadrootsNip22EventRootReference::new(radroots_event::id::RadrootsEventId, radroots_identity::key::PublicKey, radroots_event::post::comment::RadrootsNip22CommentRootKind, core::option::Option<radroots_event::tag::relay_hint::RadrootsNostrRelayHint>) -> core::result::Result<Self, radroots_event::post::comment::RadrootsNip22CommentError>
-pub fn radroots_event::post::comment::RadrootsNip22EventRootReference::parse(impl core::convert::AsRef<str>, impl core::convert::AsRef<str>, u32, core::option::Option<&str>) -> core::result::Result<Self, radroots_event::post::comment::RadrootsNip22CommentError>
-pub const fn radroots_event::post::comment::RadrootsNip22EventRootReference::relay(&self) -> core::option::Option<&radroots_event::tag::relay_hint::RadrootsNostrRelayHint>
-pub fn radroots_event::post::comment::RadrootsNip22EventRootReference::relay_or_empty(&self) -> &str
-impl core::convert::From<radroots_event::post::comment::RadrootsNip22EventRootReference> for radroots_event::post::comment::RadrootsNip22CommentRoot
-pub fn radroots_event::post::comment::RadrootsNip22CommentRoot::from(radroots_event::post::comment::RadrootsNip22EventRootReference) -> Self
+#[non_exhaustive] pub enum radroots_event::post::comment::Nip22CommentError
+pub radroots_event::post::comment::Nip22CommentError::ContentMissing
+pub radroots_event::post::comment::Nip22CommentError::ContentTooLarge
+pub radroots_event::post::comment::Nip22CommentError::ContentTooLarge::actual: usize
+pub radroots_event::post::comment::Nip22CommentError::ContentTooLarge::max: usize
+pub radroots_event::post::comment::Nip22CommentError::EventWireTooLarge
+pub radroots_event::post::comment::Nip22CommentError::EventWireTooLarge::actual: usize
+pub radroots_event::post::comment::Nip22CommentError::EventWireTooLarge::max: usize
+pub radroots_event::post::comment::Nip22CommentError::ParentAuthorInvalid(radroots_event::id::ParseError)
+pub radroots_event::post::comment::Nip22CommentError::ParentEventIdInvalid(radroots_event::id::ParseError)
+pub radroots_event::post::comment::Nip22CommentError::ParentReferenceMismatch
+pub radroots_event::post::comment::Nip22CommentError::RelayInvalid(radroots_event::id::ParseError)
+pub radroots_event::post::comment::Nip22CommentError::RevisionEventIdInvalid(radroots_event::id::ParseError)
+pub radroots_event::post::comment::Nip22CommentError::RootAuthorInvalid(radroots_event::id::ParseError)
+pub radroots_event::post::comment::Nip22CommentError::RootCoordinateInvalid(radroots_event::id::ParseError)
+pub radroots_event::post::comment::Nip22CommentError::RootEventIdInvalid(radroots_event::id::ParseError)
+pub radroots_event::post::comment::Nip22CommentError::RootKindUnsupported
+pub radroots_event::post::comment::Nip22CommentError::RootKindUnsupported::actual: u32
+pub radroots_event::post::comment::Nip22CommentError::TagBytesExceeded
+pub radroots_event::post::comment::Nip22CommentError::TagBytesExceeded::actual: usize
+pub radroots_event::post::comment::Nip22CommentError::TagBytesExceeded::max: usize
+pub radroots_event::post::comment::Nip22CommentError::TagCountExceeded
+pub radroots_event::post::comment::Nip22CommentError::TagCountExceeded::actual: usize
+pub radroots_event::post::comment::Nip22CommentError::TagCountExceeded::max: usize
+pub radroots_event::post::comment::Nip22CommentError::TagElementCountExceeded
+pub radroots_event::post::comment::Nip22CommentError::TagElementCountExceeded::actual: usize
+pub radroots_event::post::comment::Nip22CommentError::TagElementCountExceeded::max: usize
+pub radroots_event::post::comment::Nip22CommentError::TagElementTooLarge
+pub radroots_event::post::comment::Nip22CommentError::TagElementTooLarge::actual: usize
+pub radroots_event::post::comment::Nip22CommentError::TagElementTooLarge::max: usize
+impl radroots_event::post::comment::Nip22CommentError
+pub const fn radroots_event::post::comment::Nip22CommentError::code(&self) -> &'static str
+impl core::error::Error for radroots_event::post::comment::Nip22CommentError
+pub fn radroots_event::post::comment::Nip22CommentError::source(&self) -> core::option::Option<&(dyn core::error::Error + 'static)>
+impl core::fmt::Display for radroots_event::post::comment::Nip22CommentError
+pub fn radroots_event::post::comment::Nip22CommentError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub enum radroots_event::post::comment::Nip22CommentPosition
+pub radroots_event::post::comment::Nip22CommentPosition::Nested
+pub radroots_event::post::comment::Nip22CommentPosition::Nested::parent: radroots_event::post::comment::Nip22CommentParentReference
+pub radroots_event::post::comment::Nip22CommentPosition::TopLevelAddress
+pub radroots_event::post::comment::Nip22CommentPosition::TopLevelAddress::current_revision: radroots_event::id::EventId
+pub radroots_event::post::comment::Nip22CommentPosition::TopLevelEvent
+pub enum radroots_event::post::comment::Nip22CommentRoot
+pub radroots_event::post::comment::Nip22CommentRoot::Address(radroots_event::post::comment::Nip22AddressRootReference)
+pub radroots_event::post::comment::Nip22CommentRoot::Event(radroots_event::post::comment::Nip22EventRootReference)
+impl radroots_event::post::comment::Nip22CommentRoot
+pub const fn radroots_event::post::comment::Nip22CommentRoot::author(&self) -> &radroots_identity::key::PublicKey
+pub const fn radroots_event::post::comment::Nip22CommentRoot::kind(&self) -> radroots_event::post::comment::Nip22CommentRootKind
+pub const fn radroots_event::post::comment::Nip22CommentRoot::relay(&self) -> core::option::Option<&radroots_event::tag::relay_hint::NostrRelayHint>
+impl core::convert::From<radroots_event::post::comment::Nip22AddressRootReference> for radroots_event::post::comment::Nip22CommentRoot
+pub fn radroots_event::post::comment::Nip22CommentRoot::from(radroots_event::post::comment::Nip22AddressRootReference) -> Self
+impl core::convert::From<radroots_event::post::comment::Nip22EventRootReference> for radroots_event::post::comment::Nip22CommentRoot
+pub fn radroots_event::post::comment::Nip22CommentRoot::from(radroots_event::post::comment::Nip22EventRootReference) -> Self
+pub enum radroots_event::post::comment::Nip22CommentRootKind
+pub radroots_event::post::comment::Nip22CommentRootKind::CalendarDateEvent
+pub radroots_event::post::comment::Nip22CommentRootKind::CalendarTimeEvent
+pub radroots_event::post::comment::Nip22CommentRootKind::ClassifiedListing
+impl radroots_event::post::comment::Nip22CommentRootKind
+pub const fn radroots_event::post::comment::Nip22CommentRootKind::as_u32(self) -> u32
+pub const fn radroots_event::post::comment::Nip22CommentRootKind::parse(u32) -> core::result::Result<Self, radroots_event::post::comment::Nip22CommentError>
+impl core::convert::From<radroots_event::post::comment::Nip22CommentRootKind> for u32
+pub fn u32::from(radroots_event::post::comment::Nip22CommentRootKind) -> Self
+impl core::convert::TryFrom<u32> for radroots_event::post::comment::Nip22CommentRootKind
+pub type radroots_event::post::comment::Nip22CommentRootKind::Error = radroots_event::post::comment::Nip22CommentError
+pub fn radroots_event::post::comment::Nip22CommentRootKind::try_from(u32) -> core::result::Result<Self, Self::Error>
+pub struct radroots_event::post::comment::AuthoredNip22Comment
+impl radroots_event::post::comment::AuthoredNip22Comment
+pub fn radroots_event::post::comment::AuthoredNip22Comment::content(&self) -> &str
+pub fn radroots_event::post::comment::AuthoredNip22Comment::nested(impl core::convert::Into<alloc::string::String>, impl core::convert::Into<radroots_event::post::comment::Nip22CommentRoot>, radroots_event::post::comment::Nip22CommentParentReference) -> core::result::Result<Self, radroots_event::post::comment::Nip22CommentError>
+pub fn radroots_event::post::comment::AuthoredNip22Comment::parse_top_level_address(impl core::convert::Into<alloc::string::String>, radroots_event::post::comment::Nip22AddressRootReference, impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::post::comment::Nip22CommentError>
+pub const fn radroots_event::post::comment::AuthoredNip22Comment::position(&self) -> &radroots_event::post::comment::Nip22CommentPosition
+pub const fn radroots_event::post::comment::AuthoredNip22Comment::root(&self) -> &radroots_event::post::comment::Nip22CommentRoot
+pub fn radroots_event::post::comment::AuthoredNip22Comment::top_level_address(impl core::convert::Into<alloc::string::String>, radroots_event::post::comment::Nip22AddressRootReference, radroots_event::id::EventId) -> core::result::Result<Self, radroots_event::post::comment::Nip22CommentError>
+pub fn radroots_event::post::comment::AuthoredNip22Comment::top_level_event(impl core::convert::Into<alloc::string::String>, radroots_event::post::comment::Nip22EventRootReference) -> core::result::Result<Self, radroots_event::post::comment::Nip22CommentError>
+pub struct radroots_event::post::comment::Nip22AddressRootReference
+impl radroots_event::post::comment::Nip22AddressRootReference
+pub const fn radroots_event::post::comment::Nip22AddressRootReference::author(&self) -> &radroots_identity::key::PublicKey
+pub const fn radroots_event::post::comment::Nip22AddressRootReference::coordinate(&self) -> &radroots_event::id::AddressableCoordinate
+pub const fn radroots_event::post::comment::Nip22AddressRootReference::kind(&self) -> radroots_event::post::comment::Nip22CommentRootKind
+pub fn radroots_event::post::comment::Nip22AddressRootReference::new(radroots_event::id::AddressableCoordinate, core::option::Option<radroots_event::tag::relay_hint::NostrRelayHint>) -> core::result::Result<Self, radroots_event::post::comment::Nip22CommentError>
+pub fn radroots_event::post::comment::Nip22AddressRootReference::parse(impl core::convert::AsRef<str>, core::option::Option<&str>) -> core::result::Result<Self, radroots_event::post::comment::Nip22CommentError>
+pub const fn radroots_event::post::comment::Nip22AddressRootReference::relay(&self) -> core::option::Option<&radroots_event::tag::relay_hint::NostrRelayHint>
+pub fn radroots_event::post::comment::Nip22AddressRootReference::relay_or_empty(&self) -> &str
+impl core::convert::From<radroots_event::post::comment::Nip22AddressRootReference> for radroots_event::post::comment::Nip22CommentRoot
+pub fn radroots_event::post::comment::Nip22CommentRoot::from(radroots_event::post::comment::Nip22AddressRootReference) -> Self
+pub struct radroots_event::post::comment::Nip22CommentParentReference
+impl radroots_event::post::comment::Nip22CommentParentReference
+pub const fn radroots_event::post::comment::Nip22CommentParentReference::author(&self) -> &radroots_identity::key::PublicKey
+pub const fn radroots_event::post::comment::Nip22CommentParentReference::event_id(&self) -> &radroots_event::id::EventId
+pub fn radroots_event::post::comment::Nip22CommentParentReference::new(radroots_event::id::EventId, radroots_identity::key::PublicKey, core::option::Option<radroots_event::tag::relay_hint::NostrRelayHint>) -> core::result::Result<Self, radroots_event::post::comment::Nip22CommentError>
+pub fn radroots_event::post::comment::Nip22CommentParentReference::parse(impl core::convert::AsRef<str>, impl core::convert::AsRef<str>, core::option::Option<&str>) -> core::result::Result<Self, radroots_event::post::comment::Nip22CommentError>
+pub const fn radroots_event::post::comment::Nip22CommentParentReference::relay(&self) -> core::option::Option<&radroots_event::tag::relay_hint::NostrRelayHint>
+pub fn radroots_event::post::comment::Nip22CommentParentReference::relay_or_empty(&self) -> &str
+pub struct radroots_event::post::comment::Nip22EventRootReference
+impl radroots_event::post::comment::Nip22EventRootReference
+pub const fn radroots_event::post::comment::Nip22EventRootReference::author(&self) -> &radroots_identity::key::PublicKey
+pub const fn radroots_event::post::comment::Nip22EventRootReference::event_id(&self) -> &radroots_event::id::EventId
+pub const fn radroots_event::post::comment::Nip22EventRootReference::kind(&self) -> radroots_event::post::comment::Nip22CommentRootKind
+pub fn radroots_event::post::comment::Nip22EventRootReference::new(radroots_event::id::EventId, radroots_identity::key::PublicKey, radroots_event::post::comment::Nip22CommentRootKind, core::option::Option<radroots_event::tag::relay_hint::NostrRelayHint>) -> core::result::Result<Self, radroots_event::post::comment::Nip22CommentError>
+pub fn radroots_event::post::comment::Nip22EventRootReference::parse(impl core::convert::AsRef<str>, impl core::convert::AsRef<str>, u32, core::option::Option<&str>) -> core::result::Result<Self, radroots_event::post::comment::Nip22CommentError>
+pub const fn radroots_event::post::comment::Nip22EventRootReference::relay(&self) -> core::option::Option<&radroots_event::tag::relay_hint::NostrRelayHint>
+pub fn radroots_event::post::comment::Nip22EventRootReference::relay_or_empty(&self) -> &str
+impl core::convert::From<radroots_event::post::comment::Nip22EventRootReference> for radroots_event::post::comment::Nip22CommentRoot
+pub fn radroots_event::post::comment::Nip22CommentRoot::from(radroots_event::post::comment::Nip22EventRootReference) -> Self
pub const radroots_event::post::comment::RADROOTS_NIP22_COMMENT_CONTENT_MAX_BYTES: usize
pub const radroots_event::post::comment::RADROOTS_NIP22_COMMENT_EVENT_WIRE_MAX_BYTES: usize
pub const radroots_event::post::comment::RADROOTS_NIP22_COMMENT_TAG_ELEMENT_MAX_BYTES: usize
@@ -2544,59 +2218,59 @@ pub const radroots_event::post::comment::RADROOTS_NIP22_COMMENT_TAG_MAX_COUNT: u
pub const radroots_event::post::comment::RADROOTS_NIP22_COMMENT_TAG_TOTAL_ELEMENT_MAX_COUNT: usize
pub const radroots_event::post::comment::RADROOTS_NIP22_COMMENT_TAG_TOTAL_MAX_BYTES: usize
pub mod radroots_event::post::deletion
-#[non_exhaustive] pub enum radroots_event::post::deletion::RadrootsNip09DeletionError
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::ContentTooLarge
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::ContentTooLarge::actual: usize
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::ContentTooLarge::max: usize
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::CoordinateInvalid(radroots_event::id::RadrootsNip01CoordinateParseError)
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::DuplicateAddressTarget
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::DuplicateAddressTarget::coordinate: alloc::string::String
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::DuplicateEventTarget
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::DuplicateEventTarget::event_id: alloc::string::String
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::EventIdInvalid(radroots_event::id::RadrootsIdParseError)
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::EventWireTooLarge
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::EventWireTooLarge::actual: usize
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::EventWireTooLarge::max: usize
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::TagBytesExceeded
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::TagBytesExceeded::actual: usize
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::TagBytesExceeded::max: usize
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::TagCountExceeded
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::TagCountExceeded::actual: usize
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::TagCountExceeded::max: usize
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::TagElementTooLarge
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::TagElementTooLarge::actual: usize
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::TagElementTooLarge::max: usize
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::TargetKindOutOfRange
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::TargetKindOutOfRange::actual: u32
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::TargetKindOutOfRange::max: u32
-pub radroots_event::post::deletion::RadrootsNip09DeletionError::TargetMissing
-impl radroots_event::post::deletion::RadrootsNip09DeletionError
-pub const fn radroots_event::post::deletion::RadrootsNip09DeletionError::code(&self) -> &'static str
-impl core::error::Error for radroots_event::post::deletion::RadrootsNip09DeletionError
-pub fn radroots_event::post::deletion::RadrootsNip09DeletionError::source(&self) -> core::option::Option<&(dyn core::error::Error + 'static)>
-impl core::fmt::Display for radroots_event::post::deletion::RadrootsNip09DeletionError
-pub fn radroots_event::post::deletion::RadrootsNip09DeletionError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub struct radroots_event::post::deletion::RadrootsAuthoredNip09DeletionRequest
-impl radroots_event::post::deletion::RadrootsAuthoredNip09DeletionRequest
-pub fn radroots_event::post::deletion::RadrootsAuthoredNip09DeletionRequest::address_targets(&self) -> &[radroots_event::post::deletion::RadrootsNip09DeletionAddressTarget]
-pub fn radroots_event::post::deletion::RadrootsAuthoredNip09DeletionRequest::content(&self) -> &str
-pub fn radroots_event::post::deletion::RadrootsAuthoredNip09DeletionRequest::event_targets(&self) -> &[radroots_event::post::deletion::RadrootsNip09DeletionEventTarget]
-pub fn radroots_event::post::deletion::RadrootsAuthoredNip09DeletionRequest::kind_hints(&self) -> &[u32]
-pub const fn radroots_event::post::deletion::RadrootsAuthoredNip09DeletionRequest::maximum_signed_event_wire_bytes(&self) -> usize
-pub fn radroots_event::post::deletion::RadrootsAuthoredNip09DeletionRequest::new(impl core::convert::Into<alloc::string::String>, alloc::vec::Vec<radroots_event::post::deletion::RadrootsNip09DeletionEventTarget>, alloc::vec::Vec<radroots_event::post::deletion::RadrootsNip09DeletionAddressTarget>) -> core::result::Result<Self, radroots_event::post::deletion::RadrootsNip09DeletionError>
-pub fn radroots_event::post::deletion::RadrootsAuthoredNip09DeletionRequest::target_count(&self) -> usize
-pub struct radroots_event::post::deletion::RadrootsNip09DeletionAddressTarget
-impl radroots_event::post::deletion::RadrootsNip09DeletionAddressTarget
-pub const fn radroots_event::post::deletion::RadrootsNip09DeletionAddressTarget::coordinate(&self) -> &radroots_event::id::RadrootsNip01Coordinate
-pub const fn radroots_event::post::deletion::RadrootsNip09DeletionAddressTarget::kind_hint(&self) -> u32
-pub const fn radroots_event::post::deletion::RadrootsNip09DeletionAddressTarget::new(radroots_event::id::RadrootsNip01Coordinate) -> Self
-pub fn radroots_event::post::deletion::RadrootsNip09DeletionAddressTarget::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::post::deletion::RadrootsNip09DeletionError>
-pub struct radroots_event::post::deletion::RadrootsNip09DeletionEventTarget
-impl radroots_event::post::deletion::RadrootsNip09DeletionEventTarget
-pub const fn radroots_event::post::deletion::RadrootsNip09DeletionEventTarget::event_id(&self) -> &radroots_event::id::RadrootsEventId
-pub const fn radroots_event::post::deletion::RadrootsNip09DeletionEventTarget::kind_hint(&self) -> u32
-pub fn radroots_event::post::deletion::RadrootsNip09DeletionEventTarget::new(radroots_event::id::RadrootsEventId, u32) -> core::result::Result<Self, radroots_event::post::deletion::RadrootsNip09DeletionError>
-pub fn radroots_event::post::deletion::RadrootsNip09DeletionEventTarget::parse(impl core::convert::AsRef<str>, u32) -> core::result::Result<Self, radroots_event::post::deletion::RadrootsNip09DeletionError>
+#[non_exhaustive] pub enum radroots_event::post::deletion::Nip09DeletionError
+pub radroots_event::post::deletion::Nip09DeletionError::ContentTooLarge
+pub radroots_event::post::deletion::Nip09DeletionError::ContentTooLarge::actual: usize
+pub radroots_event::post::deletion::Nip09DeletionError::ContentTooLarge::max: usize
+pub radroots_event::post::deletion::Nip09DeletionError::CoordinateInvalid(radroots_event::id::Nip01CoordinateParseError)
+pub radroots_event::post::deletion::Nip09DeletionError::DuplicateAddressTarget
+pub radroots_event::post::deletion::Nip09DeletionError::DuplicateAddressTarget::coordinate: alloc::string::String
+pub radroots_event::post::deletion::Nip09DeletionError::DuplicateEventTarget
+pub radroots_event::post::deletion::Nip09DeletionError::DuplicateEventTarget::event_id: alloc::string::String
+pub radroots_event::post::deletion::Nip09DeletionError::EventIdInvalid(radroots_event::id::ParseError)
+pub radroots_event::post::deletion::Nip09DeletionError::EventWireTooLarge
+pub radroots_event::post::deletion::Nip09DeletionError::EventWireTooLarge::actual: usize
+pub radroots_event::post::deletion::Nip09DeletionError::EventWireTooLarge::max: usize
+pub radroots_event::post::deletion::Nip09DeletionError::TagBytesExceeded
+pub radroots_event::post::deletion::Nip09DeletionError::TagBytesExceeded::actual: usize
+pub radroots_event::post::deletion::Nip09DeletionError::TagBytesExceeded::max: usize
+pub radroots_event::post::deletion::Nip09DeletionError::TagCountExceeded
+pub radroots_event::post::deletion::Nip09DeletionError::TagCountExceeded::actual: usize
+pub radroots_event::post::deletion::Nip09DeletionError::TagCountExceeded::max: usize
+pub radroots_event::post::deletion::Nip09DeletionError::TagElementTooLarge
+pub radroots_event::post::deletion::Nip09DeletionError::TagElementTooLarge::actual: usize
+pub radroots_event::post::deletion::Nip09DeletionError::TagElementTooLarge::max: usize
+pub radroots_event::post::deletion::Nip09DeletionError::TargetKindOutOfRange
+pub radroots_event::post::deletion::Nip09DeletionError::TargetKindOutOfRange::actual: u32
+pub radroots_event::post::deletion::Nip09DeletionError::TargetKindOutOfRange::max: u32
+pub radroots_event::post::deletion::Nip09DeletionError::TargetMissing
+impl radroots_event::post::deletion::Nip09DeletionError
+pub const fn radroots_event::post::deletion::Nip09DeletionError::code(&self) -> &'static str
+impl core::error::Error for radroots_event::post::deletion::Nip09DeletionError
+pub fn radroots_event::post::deletion::Nip09DeletionError::source(&self) -> core::option::Option<&(dyn core::error::Error + 'static)>
+impl core::fmt::Display for radroots_event::post::deletion::Nip09DeletionError
+pub fn radroots_event::post::deletion::Nip09DeletionError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub struct radroots_event::post::deletion::AuthoredNip09DeletionRequest
+impl radroots_event::post::deletion::AuthoredNip09DeletionRequest
+pub fn radroots_event::post::deletion::AuthoredNip09DeletionRequest::address_targets(&self) -> &[radroots_event::post::deletion::Nip09DeletionAddressTarget]
+pub fn radroots_event::post::deletion::AuthoredNip09DeletionRequest::content(&self) -> &str
+pub fn radroots_event::post::deletion::AuthoredNip09DeletionRequest::event_targets(&self) -> &[radroots_event::post::deletion::Nip09DeletionEventTarget]
+pub fn radroots_event::post::deletion::AuthoredNip09DeletionRequest::kind_hints(&self) -> &[u32]
+pub const fn radroots_event::post::deletion::AuthoredNip09DeletionRequest::maximum_signed_event_wire_bytes(&self) -> usize
+pub fn radroots_event::post::deletion::AuthoredNip09DeletionRequest::new(impl core::convert::Into<alloc::string::String>, alloc::vec::Vec<radroots_event::post::deletion::Nip09DeletionEventTarget>, alloc::vec::Vec<radroots_event::post::deletion::Nip09DeletionAddressTarget>) -> core::result::Result<Self, radroots_event::post::deletion::Nip09DeletionError>
+pub fn radroots_event::post::deletion::AuthoredNip09DeletionRequest::target_count(&self) -> usize
+pub struct radroots_event::post::deletion::Nip09DeletionAddressTarget
+impl radroots_event::post::deletion::Nip09DeletionAddressTarget
+pub const fn radroots_event::post::deletion::Nip09DeletionAddressTarget::coordinate(&self) -> &radroots_event::id::Nip01Coordinate
+pub const fn radroots_event::post::deletion::Nip09DeletionAddressTarget::kind_hint(&self) -> u32
+pub const fn radroots_event::post::deletion::Nip09DeletionAddressTarget::new(radroots_event::id::Nip01Coordinate) -> Self
+pub fn radroots_event::post::deletion::Nip09DeletionAddressTarget::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::post::deletion::Nip09DeletionError>
+pub struct radroots_event::post::deletion::Nip09DeletionEventTarget
+impl radroots_event::post::deletion::Nip09DeletionEventTarget
+pub const fn radroots_event::post::deletion::Nip09DeletionEventTarget::event_id(&self) -> &radroots_event::id::EventId
+pub const fn radroots_event::post::deletion::Nip09DeletionEventTarget::kind_hint(&self) -> u32
+pub fn radroots_event::post::deletion::Nip09DeletionEventTarget::new(radroots_event::id::EventId, u32) -> core::result::Result<Self, radroots_event::post::deletion::Nip09DeletionError>
+pub fn radroots_event::post::deletion::Nip09DeletionEventTarget::parse(impl core::convert::AsRef<str>, u32) -> core::result::Result<Self, radroots_event::post::deletion::Nip09DeletionError>
pub const radroots_event::post::deletion::RADROOTS_NIP09_DELETION_CONTENT_MAX_BYTES: usize
pub const radroots_event::post::deletion::RADROOTS_NIP09_DELETION_EVENT_WIRE_MAX_BYTES: usize
pub const radroots_event::post::deletion::RADROOTS_NIP09_DELETION_TAG_ELEMENT_MAX_BYTES: usize
@@ -2605,149 +2279,141 @@ pub const radroots_event::post::deletion::RADROOTS_NIP09_DELETION_TAG_TOTAL_ELEM
pub const radroots_event::post::deletion::RADROOTS_NIP09_DELETION_TAG_TOTAL_MAX_BYTES: usize
pub const radroots_event::post::deletion::RADROOTS_NIP09_DELETION_TARGET_KIND_MAX: u32
pub mod radroots_event::post::document
-pub struct radroots_event::post::document::RadrootsDocument
-pub radroots_event::post::document::RadrootsDocument::body_markdown: core::option::Option<alloc::string::String>
-pub radroots_event::post::document::RadrootsDocument::d_tag: alloc::string::String
-pub radroots_event::post::document::RadrootsDocument::doc_type: alloc::string::String
-pub radroots_event::post::document::RadrootsDocument::effective_at: core::option::Option<u32>
-pub radroots_event::post::document::RadrootsDocument::subject: radroots_event::post::document::RadrootsDocumentSubject
-pub radroots_event::post::document::RadrootsDocument::summary: core::option::Option<alloc::string::String>
-pub radroots_event::post::document::RadrootsDocument::tags: core::option::Option<alloc::vec::Vec<alloc::string::String>>
-pub radroots_event::post::document::RadrootsDocument::title: alloc::string::String
-pub radroots_event::post::document::RadrootsDocument::version: alloc::string::String
-pub struct radroots_event::post::document::RadrootsDocumentSubject
-pub radroots_event::post::document::RadrootsDocumentSubject::address: core::option::Option<alloc::string::String>
-pub radroots_event::post::document::RadrootsDocumentSubject::pubkey: alloc::string::String
+pub struct radroots_event::post::document::Document
+pub radroots_event::post::document::Document::body_markdown: core::option::Option<alloc::string::String>
+pub radroots_event::post::document::Document::d_tag: alloc::string::String
+pub radroots_event::post::document::Document::doc_type: alloc::string::String
+pub radroots_event::post::document::Document::effective_at: core::option::Option<u32>
+pub radroots_event::post::document::Document::subject: radroots_event::post::document::DocumentSubject
+pub radroots_event::post::document::Document::summary: core::option::Option<alloc::string::String>
+pub radroots_event::post::document::Document::tags: core::option::Option<alloc::vec::Vec<alloc::string::String>>
+pub radroots_event::post::document::Document::title: alloc::string::String
+pub radroots_event::post::document::Document::version: alloc::string::String
+pub struct radroots_event::post::document::DocumentSubject
+pub radroots_event::post::document::DocumentSubject::address: core::option::Option<alloc::string::String>
+pub radroots_event::post::document::DocumentSubject::pubkey: alloc::string::String
pub mod radroots_event::post::reaction
-pub struct radroots_event::post::reaction::RadrootsReaction
-pub radroots_event::post::reaction::RadrootsReaction::content: alloc::string::String
-pub radroots_event::post::reaction::RadrootsReaction::target: radroots_event::social::RadrootsSocialTarget
+pub struct radroots_event::post::reaction::Reaction
+pub radroots_event::post::reaction::Reaction::content: alloc::string::String
+pub radroots_event::post::reaction::Reaction::target: radroots_event::social::SocialTarget
pub mod radroots_event::post::reply
-#[non_exhaustive] pub enum radroots_event::post::reply::RadrootsNip10ReplyError
-pub radroots_event::post::reply::RadrootsNip10ReplyError::AuthorInvalid(radroots_event::id::RadrootsIdParseError)
-pub radroots_event::post::reply::RadrootsNip10ReplyError::ContentMissing
-pub radroots_event::post::reply::RadrootsNip10ReplyError::ContentTooLarge
-pub radroots_event::post::reply::RadrootsNip10ReplyError::ContentTooLarge::actual: usize
-pub radroots_event::post::reply::RadrootsNip10ReplyError::ContentTooLarge::max: usize
-pub radroots_event::post::reply::RadrootsNip10ReplyError::EventIdInvalid(radroots_event::id::RadrootsIdParseError)
-pub radroots_event::post::reply::RadrootsNip10ReplyError::EventWireTooLarge
-pub radroots_event::post::reply::RadrootsNip10ReplyError::EventWireTooLarge::actual: usize
-pub radroots_event::post::reply::RadrootsNip10ReplyError::EventWireTooLarge::max: usize
-pub radroots_event::post::reply::RadrootsNip10ReplyError::NestedParentMatchesRoot
-pub radroots_event::post::reply::RadrootsNip10ReplyError::RelayInvalid(radroots_event::id::RadrootsIdParseError)
-pub radroots_event::post::reply::RadrootsNip10ReplyError::TagBytesExceeded
-pub radroots_event::post::reply::RadrootsNip10ReplyError::TagBytesExceeded::actual: usize
-pub radroots_event::post::reply::RadrootsNip10ReplyError::TagBytesExceeded::max: usize
-pub radroots_event::post::reply::RadrootsNip10ReplyError::TagElementTooLarge
-pub radroots_event::post::reply::RadrootsNip10ReplyError::TagElementTooLarge::actual: usize
-pub radroots_event::post::reply::RadrootsNip10ReplyError::TagElementTooLarge::max: usize
-impl radroots_event::post::reply::RadrootsNip10ReplyError
-pub const fn radroots_event::post::reply::RadrootsNip10ReplyError::code(&self) -> &'static str
-impl core::error::Error for radroots_event::post::reply::RadrootsNip10ReplyError
-pub fn radroots_event::post::reply::RadrootsNip10ReplyError::source(&self) -> core::option::Option<&(dyn core::error::Error + 'static)>
-impl core::fmt::Display for radroots_event::post::reply::RadrootsNip10ReplyError
-pub fn radroots_event::post::reply::RadrootsNip10ReplyError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub struct radroots_event::post::reply::RadrootsAuthoredNip10Reply
-impl radroots_event::post::reply::RadrootsAuthoredNip10Reply
-pub fn radroots_event::post::reply::RadrootsAuthoredNip10Reply::content(&self) -> &str
-pub fn radroots_event::post::reply::RadrootsAuthoredNip10Reply::direct(impl core::convert::Into<alloc::string::String>, radroots_event::post::reply::RadrootsNip10ReplyReference) -> core::result::Result<Self, radroots_event::post::reply::RadrootsNip10ReplyError>
-pub const fn radroots_event::post::reply::RadrootsAuthoredNip10Reply::is_direct(&self) -> bool
-pub fn radroots_event::post::reply::RadrootsAuthoredNip10Reply::nested(impl core::convert::Into<alloc::string::String>, radroots_event::post::reply::RadrootsNip10ReplyReference, radroots_event::post::reply::RadrootsNip10ReplyReference) -> core::result::Result<Self, radroots_event::post::reply::RadrootsNip10ReplyError>
-pub const fn radroots_event::post::reply::RadrootsAuthoredNip10Reply::parent(&self) -> core::option::Option<&radroots_event::post::reply::RadrootsNip10ReplyReference>
-pub const fn radroots_event::post::reply::RadrootsAuthoredNip10Reply::root(&self) -> &radroots_event::post::reply::RadrootsNip10ReplyReference
-pub struct radroots_event::post::reply::RadrootsNip10ReplyReference
-impl radroots_event::post::reply::RadrootsNip10ReplyReference
-pub const fn radroots_event::post::reply::RadrootsNip10ReplyReference::author(&self) -> &radroots_identity::key::PublicKey
-pub const fn radroots_event::post::reply::RadrootsNip10ReplyReference::event_id(&self) -> &radroots_event::id::RadrootsEventId
-pub fn radroots_event::post::reply::RadrootsNip10ReplyReference::new(radroots_event::id::RadrootsEventId, radroots_identity::key::PublicKey, core::option::Option<radroots_event::tag::relay_hint::RadrootsNostrRelayHint>) -> core::result::Result<Self, radroots_event::post::reply::RadrootsNip10ReplyError>
-pub fn radroots_event::post::reply::RadrootsNip10ReplyReference::parse(impl core::convert::AsRef<str>, impl core::convert::AsRef<str>, core::option::Option<&str>) -> core::result::Result<Self, radroots_event::post::reply::RadrootsNip10ReplyError>
-pub const fn radroots_event::post::reply::RadrootsNip10ReplyReference::relay(&self) -> core::option::Option<&radroots_event::tag::relay_hint::RadrootsNostrRelayHint>
-pub fn radroots_event::post::reply::RadrootsNip10ReplyReference::relay_or_empty(&self) -> &str
+#[non_exhaustive] pub enum radroots_event::post::reply::Nip10ReplyError
+pub radroots_event::post::reply::Nip10ReplyError::AuthorInvalid(radroots_event::id::ParseError)
+pub radroots_event::post::reply::Nip10ReplyError::ContentMissing
+pub radroots_event::post::reply::Nip10ReplyError::ContentTooLarge
+pub radroots_event::post::reply::Nip10ReplyError::ContentTooLarge::actual: usize
+pub radroots_event::post::reply::Nip10ReplyError::ContentTooLarge::max: usize
+pub radroots_event::post::reply::Nip10ReplyError::EventIdInvalid(radroots_event::id::ParseError)
+pub radroots_event::post::reply::Nip10ReplyError::EventWireTooLarge
+pub radroots_event::post::reply::Nip10ReplyError::EventWireTooLarge::actual: usize
+pub radroots_event::post::reply::Nip10ReplyError::EventWireTooLarge::max: usize
+pub radroots_event::post::reply::Nip10ReplyError::NestedParentMatchesRoot
+pub radroots_event::post::reply::Nip10ReplyError::RelayInvalid(radroots_event::id::ParseError)
+pub radroots_event::post::reply::Nip10ReplyError::TagBytesExceeded
+pub radroots_event::post::reply::Nip10ReplyError::TagBytesExceeded::actual: usize
+pub radroots_event::post::reply::Nip10ReplyError::TagBytesExceeded::max: usize
+pub radroots_event::post::reply::Nip10ReplyError::TagElementTooLarge
+pub radroots_event::post::reply::Nip10ReplyError::TagElementTooLarge::actual: usize
+pub radroots_event::post::reply::Nip10ReplyError::TagElementTooLarge::max: usize
+impl radroots_event::post::reply::Nip10ReplyError
+pub const fn radroots_event::post::reply::Nip10ReplyError::code(&self) -> &'static str
+impl core::error::Error for radroots_event::post::reply::Nip10ReplyError
+pub fn radroots_event::post::reply::Nip10ReplyError::source(&self) -> core::option::Option<&(dyn core::error::Error + 'static)>
+impl core::fmt::Display for radroots_event::post::reply::Nip10ReplyError
+pub fn radroots_event::post::reply::Nip10ReplyError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub struct radroots_event::post::reply::AuthoredNip10Reply
+impl radroots_event::post::reply::AuthoredNip10Reply
+pub fn radroots_event::post::reply::AuthoredNip10Reply::content(&self) -> &str
+pub fn radroots_event::post::reply::AuthoredNip10Reply::direct(impl core::convert::Into<alloc::string::String>, radroots_event::post::reply::Nip10ReplyReference) -> core::result::Result<Self, radroots_event::post::reply::Nip10ReplyError>
+pub const fn radroots_event::post::reply::AuthoredNip10Reply::is_direct(&self) -> bool
+pub fn radroots_event::post::reply::AuthoredNip10Reply::nested(impl core::convert::Into<alloc::string::String>, radroots_event::post::reply::Nip10ReplyReference, radroots_event::post::reply::Nip10ReplyReference) -> core::result::Result<Self, radroots_event::post::reply::Nip10ReplyError>
+pub const fn radroots_event::post::reply::AuthoredNip10Reply::parent(&self) -> core::option::Option<&radroots_event::post::reply::Nip10ReplyReference>
+pub const fn radroots_event::post::reply::AuthoredNip10Reply::root(&self) -> &radroots_event::post::reply::Nip10ReplyReference
+pub struct radroots_event::post::reply::Nip10ReplyReference
+impl radroots_event::post::reply::Nip10ReplyReference
+pub const fn radroots_event::post::reply::Nip10ReplyReference::author(&self) -> &radroots_identity::key::PublicKey
+pub const fn radroots_event::post::reply::Nip10ReplyReference::event_id(&self) -> &radroots_event::id::EventId
+pub fn radroots_event::post::reply::Nip10ReplyReference::new(radroots_event::id::EventId, radroots_identity::key::PublicKey, core::option::Option<radroots_event::tag::relay_hint::NostrRelayHint>) -> core::result::Result<Self, radroots_event::post::reply::Nip10ReplyError>
+pub fn radroots_event::post::reply::Nip10ReplyReference::parse(impl core::convert::AsRef<str>, impl core::convert::AsRef<str>, core::option::Option<&str>) -> core::result::Result<Self, radroots_event::post::reply::Nip10ReplyError>
+pub const fn radroots_event::post::reply::Nip10ReplyReference::relay(&self) -> core::option::Option<&radroots_event::tag::relay_hint::NostrRelayHint>
+pub fn radroots_event::post::reply::Nip10ReplyReference::relay_or_empty(&self) -> &str
pub mod radroots_event::post::report
-pub struct radroots_event::post::report::RadrootsReport
-pub radroots_event::post::report::RadrootsReport::content: core::option::Option<alloc::string::String>
-pub radroots_event::post::report::RadrootsReport::event: core::option::Option<radroots_event::social::RadrootsSocialTarget>
-pub radroots_event::post::report::RadrootsReport::file: core::option::Option<radroots_event::social::RadrootsReportFileTarget>
-pub radroots_event::post::report::RadrootsReport::report_type: radroots_event::social::RadrootsReportType
-pub radroots_event::post::report::RadrootsReport::reported_pubkey: alloc::string::String
+pub struct radroots_event::post::report::Report
+pub radroots_event::post::report::Report::content: core::option::Option<alloc::string::String>
+pub radroots_event::post::report::Report::event: core::option::Option<radroots_event::social::SocialTarget>
+pub radroots_event::post::report::Report::file: core::option::Option<radroots_event::social::ReportFileTarget>
+pub radroots_event::post::report::Report::report_type: radroots_event::social::ReportType
+pub radroots_event::post::report::Report::reported_pubkey: alloc::string::String
pub mod radroots_event::post::repost
-pub struct radroots_event::post::repost::RadrootsGenericRepost
-pub radroots_event::post::repost::RadrootsGenericRepost::content: core::option::Option<alloc::string::String>
-pub radroots_event::post::repost::RadrootsGenericRepost::target: radroots_event::social::RadrootsSocialTarget
-pub radroots_event::post::repost::RadrootsGenericRepost::target_kind: u32
-pub struct radroots_event::post::repost::RadrootsRepost
-pub radroots_event::post::repost::RadrootsRepost::content: core::option::Option<alloc::string::String>
-pub radroots_event::post::repost::RadrootsRepost::target: radroots_event::social::RadrootsSocialTarget
-#[non_exhaustive] pub enum radroots_event::post::RadrootsAuthoredPostError
-pub radroots_event::post::RadrootsAuthoredPostError::ContentMissing
-pub radroots_event::post::RadrootsAuthoredPostError::ContentTooLarge
-pub radroots_event::post::RadrootsAuthoredPostError::ContentTooLarge::actual: usize
-pub radroots_event::post::RadrootsAuthoredPostError::ContentTooLarge::max: usize
-pub radroots_event::post::RadrootsAuthoredPostError::DuplicateImageUrl
-pub radroots_event::post::RadrootsAuthoredPostError::EventWireTooLarge
-pub radroots_event::post::RadrootsAuthoredPostError::EventWireTooLarge::actual: usize
-pub radroots_event::post::RadrootsAuthoredPostError::EventWireTooLarge::max: usize
-pub radroots_event::post::RadrootsAuthoredPostError::ImageAltInvalid
-pub radroots_event::post::RadrootsAuthoredPostError::ImageAltTooLarge
-pub radroots_event::post::RadrootsAuthoredPostError::ImageAltTooLarge::actual: usize
-pub radroots_event::post::RadrootsAuthoredPostError::ImageAltTooLarge::max: usize
-pub radroots_event::post::RadrootsAuthoredPostError::ImageCountExceeded
-pub radroots_event::post::RadrootsAuthoredPostError::ImageCountExceeded::actual: usize
-pub radroots_event::post::RadrootsAuthoredPostError::ImageCountExceeded::max: usize
-pub radroots_event::post::RadrootsAuthoredPostError::ImageDimensionsInvalid
-pub radroots_event::post::RadrootsAuthoredPostError::ImageFallbackHashMismatch
-pub radroots_event::post::RadrootsAuthoredPostError::ImageMediaTypeInvalid
-pub radroots_event::post::RadrootsAuthoredPostError::ImageMissing
-pub radroots_event::post::RadrootsAuthoredPostError::ImageSizeInvalid
-pub radroots_event::post::RadrootsAuthoredPostError::ImageUrlMissingFromContent
-pub radroots_event::post::RadrootsAuthoredPostError::TagBytesExceeded
-pub radroots_event::post::RadrootsAuthoredPostError::TagBytesExceeded::actual: usize
-pub radroots_event::post::RadrootsAuthoredPostError::TagBytesExceeded::max: usize
-pub radroots_event::post::RadrootsAuthoredPostError::TagElementTooLarge
-pub radroots_event::post::RadrootsAuthoredPostError::TagElementTooLarge::actual: usize
-pub radroots_event::post::RadrootsAuthoredPostError::TagElementTooLarge::max: usize
-impl radroots_event::post::RadrootsAuthoredPostError
-pub const fn radroots_event::post::RadrootsAuthoredPostError::code(&self) -> &'static str
-impl core::error::Error for radroots_event::post::RadrootsAuthoredPostError
-impl core::fmt::Display for radroots_event::post::RadrootsAuthoredPostError
-pub fn radroots_event::post::RadrootsAuthoredPostError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub struct radroots_event::post::RadrootsAuthoredAsk
-impl radroots_event::post::RadrootsAuthoredAsk
-pub fn radroots_event::post::RadrootsAuthoredAsk::content(&self) -> &str
-pub fn radroots_event::post::RadrootsAuthoredAsk::images(&self) -> &[radroots_event::post::RadrootsAuthoredPostImage]
-pub fn radroots_event::post::RadrootsAuthoredAsk::new(impl core::convert::Into<alloc::string::String>, alloc::vec::Vec<radroots_event::post::RadrootsAuthoredPostImage>) -> core::result::Result<Self, radroots_event::post::RadrootsAuthoredPostError>
-pub struct radroots_event::post::RadrootsAuthoredPhotoUpdate
-impl radroots_event::post::RadrootsAuthoredPhotoUpdate
-pub fn radroots_event::post::RadrootsAuthoredPhotoUpdate::content(&self) -> &str
-pub fn radroots_event::post::RadrootsAuthoredPhotoUpdate::images(&self) -> &[radroots_event::post::RadrootsAuthoredPostImage]
-pub fn radroots_event::post::RadrootsAuthoredPhotoUpdate::new(impl core::convert::Into<alloc::string::String>, alloc::vec::Vec<radroots_event::post::RadrootsAuthoredPostImage>) -> core::result::Result<Self, radroots_event::post::RadrootsAuthoredPostError>
-pub struct radroots_event::post::RadrootsAuthoredPostImage
-impl radroots_event::post::RadrootsAuthoredPostImage
-pub fn radroots_event::post::RadrootsAuthoredPostImage::alt(&self) -> &str
-pub const fn radroots_event::post::RadrootsAuthoredPostImage::dimensions(&self) -> radroots_event::post::RadrootsPostImageDimensions
-pub fn radroots_event::post::RadrootsAuthoredPostImage::fallbacks(&self) -> &[radroots_blossom::url::ApprovedBlobUrl]
-pub fn radroots_event::post::RadrootsAuthoredPostImage::image(&self) -> &radroots_event::media::RadrootsAuthoredImage
-pub fn radroots_event::post::RadrootsAuthoredPostImage::imeta_tag(&self) -> &[alloc::string::String]
-pub fn radroots_event::post::RadrootsAuthoredPostImage::new(radroots_event::media::RadrootsAuthoredImage, radroots_event::post::RadrootsPostImageDimensions, impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::post::RadrootsAuthoredPostError>
-pub fn radroots_event::post::RadrootsAuthoredPostImage::try_with_fallback(self, radroots_blossom::url::ApprovedBlobUrl) -> core::result::Result<Self, radroots_event::post::RadrootsAuthoredPostError>
-pub fn radroots_event::post::RadrootsAuthoredPostImage::url(&self) -> &str
-pub struct radroots_event::post::RadrootsAuthoredUpdate
-impl radroots_event::post::RadrootsAuthoredUpdate
-pub fn radroots_event::post::RadrootsAuthoredUpdate::content(&self) -> &str
-pub fn radroots_event::post::RadrootsAuthoredUpdate::new(impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::post::RadrootsAuthoredPostError>
-pub struct radroots_event::post::RadrootsPost
-pub radroots_event::post::RadrootsPost::address_refs: core::option::Option<alloc::vec::Vec<radroots_event::social::RadrootsSocialTarget>>
-pub radroots_event::post::RadrootsPost::content: alloc::string::String
-pub radroots_event::post::RadrootsPost::farm: core::option::Option<radroots_event::social::RadrootsSocialFarmAnchor>
-pub radroots_event::post::RadrootsPost::location: core::option::Option<radroots_event::social::RadrootsSocialLocation>
-pub radroots_event::post::RadrootsPost::media: core::option::Option<alloc::vec::Vec<radroots_event::social::RadrootsSocialMediaMetadata>>
-pub radroots_event::post::RadrootsPost::quote_refs: core::option::Option<alloc::vec::Vec<radroots_event::social::RadrootsSocialTarget>>
-pub radroots_event::post::RadrootsPost::topics: core::option::Option<alloc::vec::Vec<alloc::string::String>>
-pub struct radroots_event::post::RadrootsPostImageDimensions
-impl radroots_event::post::RadrootsPostImageDimensions
-pub const fn radroots_event::post::RadrootsPostImageDimensions::height(self) -> u32
-pub const fn radroots_event::post::RadrootsPostImageDimensions::new(u32, u32) -> core::result::Result<Self, radroots_event::post::RadrootsAuthoredPostError>
-pub const fn radroots_event::post::RadrootsPostImageDimensions::width(self) -> u32
+pub struct radroots_event::post::repost::GenericRepost
+pub radroots_event::post::repost::GenericRepost::content: core::option::Option<alloc::string::String>
+pub radroots_event::post::repost::GenericRepost::target: radroots_event::social::SocialTarget
+pub radroots_event::post::repost::GenericRepost::target_kind: u32
+pub struct radroots_event::post::repost::Repost
+pub radroots_event::post::repost::Repost::content: core::option::Option<alloc::string::String>
+pub radroots_event::post::repost::Repost::target: radroots_event::social::SocialTarget
+#[non_exhaustive] pub enum radroots_event::post::AuthoredPostError
+pub radroots_event::post::AuthoredPostError::ContentMissing
+pub radroots_event::post::AuthoredPostError::ContentTooLarge
+pub radroots_event::post::AuthoredPostError::ContentTooLarge::actual: usize
+pub radroots_event::post::AuthoredPostError::ContentTooLarge::max: usize
+pub radroots_event::post::AuthoredPostError::DuplicateImageUrl
+pub radroots_event::post::AuthoredPostError::EventWireTooLarge
+pub radroots_event::post::AuthoredPostError::EventWireTooLarge::actual: usize
+pub radroots_event::post::AuthoredPostError::EventWireTooLarge::max: usize
+pub radroots_event::post::AuthoredPostError::ImageAltInvalid
+pub radroots_event::post::AuthoredPostError::ImageAltTooLarge
+pub radroots_event::post::AuthoredPostError::ImageAltTooLarge::actual: usize
+pub radroots_event::post::AuthoredPostError::ImageAltTooLarge::max: usize
+pub radroots_event::post::AuthoredPostError::ImageCountExceeded
+pub radroots_event::post::AuthoredPostError::ImageCountExceeded::actual: usize
+pub radroots_event::post::AuthoredPostError::ImageCountExceeded::max: usize
+pub radroots_event::post::AuthoredPostError::ImageDimensionsInvalid
+pub radroots_event::post::AuthoredPostError::ImageFallbackHashMismatch
+pub radroots_event::post::AuthoredPostError::ImageMediaTypeInvalid
+pub radroots_event::post::AuthoredPostError::ImageMissing
+pub radroots_event::post::AuthoredPostError::ImageSizeInvalid
+pub radroots_event::post::AuthoredPostError::ImageUrlMissingFromContent
+pub radroots_event::post::AuthoredPostError::TagBytesExceeded
+pub radroots_event::post::AuthoredPostError::TagBytesExceeded::actual: usize
+pub radroots_event::post::AuthoredPostError::TagBytesExceeded::max: usize
+pub radroots_event::post::AuthoredPostError::TagElementTooLarge
+pub radroots_event::post::AuthoredPostError::TagElementTooLarge::actual: usize
+pub radroots_event::post::AuthoredPostError::TagElementTooLarge::max: usize
+impl radroots_event::post::AuthoredPostError
+pub const fn radroots_event::post::AuthoredPostError::code(&self) -> &'static str
+impl core::error::Error for radroots_event::post::AuthoredPostError
+impl core::fmt::Display for radroots_event::post::AuthoredPostError
+pub fn radroots_event::post::AuthoredPostError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub struct radroots_event::post::AuthoredAsk
+impl radroots_event::post::AuthoredAsk
+pub fn radroots_event::post::AuthoredAsk::content(&self) -> &str
+pub fn radroots_event::post::AuthoredAsk::images(&self) -> &[radroots_event::post::AuthoredPostImage]
+pub fn radroots_event::post::AuthoredAsk::new(impl core::convert::Into<alloc::string::String>, alloc::vec::Vec<radroots_event::post::AuthoredPostImage>) -> core::result::Result<Self, radroots_event::post::AuthoredPostError>
+pub struct radroots_event::post::AuthoredPhotoUpdate
+impl radroots_event::post::AuthoredPhotoUpdate
+pub fn radroots_event::post::AuthoredPhotoUpdate::content(&self) -> &str
+pub fn radroots_event::post::AuthoredPhotoUpdate::images(&self) -> &[radroots_event::post::AuthoredPostImage]
+pub fn radroots_event::post::AuthoredPhotoUpdate::new(impl core::convert::Into<alloc::string::String>, alloc::vec::Vec<radroots_event::post::AuthoredPostImage>) -> core::result::Result<Self, radroots_event::post::AuthoredPostError>
+pub struct radroots_event::post::AuthoredPostImage
+impl radroots_event::post::AuthoredPostImage
+pub fn radroots_event::post::AuthoredPostImage::alt(&self) -> &str
+pub const fn radroots_event::post::AuthoredPostImage::dimensions(&self) -> radroots_event::post::PostImageDimensions
+pub fn radroots_event::post::AuthoredPostImage::fallbacks(&self) -> &[radroots_blossom::url::ApprovedBlobUrl]
+pub fn radroots_event::post::AuthoredPostImage::image(&self) -> &radroots_event::media::AuthoredImage
+pub fn radroots_event::post::AuthoredPostImage::imeta_tag(&self) -> &[alloc::string::String]
+pub fn radroots_event::post::AuthoredPostImage::new(radroots_event::media::AuthoredImage, radroots_event::post::PostImageDimensions, impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::post::AuthoredPostError>
+pub fn radroots_event::post::AuthoredPostImage::try_with_fallback(self, radroots_blossom::url::ApprovedBlobUrl) -> core::result::Result<Self, radroots_event::post::AuthoredPostError>
+pub fn radroots_event::post::AuthoredPostImage::url(&self) -> &str
+pub struct radroots_event::post::AuthoredUpdate
+impl radroots_event::post::AuthoredUpdate
+pub fn radroots_event::post::AuthoredUpdate::content(&self) -> &str
+pub fn radroots_event::post::AuthoredUpdate::new(impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::post::AuthoredPostError>
+pub struct radroots_event::post::PostImageDimensions
+impl radroots_event::post::PostImageDimensions
+pub const fn radroots_event::post::PostImageDimensions::height(self) -> u32
+pub const fn radroots_event::post::PostImageDimensions::new(u32, u32) -> core::result::Result<Self, radroots_event::post::AuthoredPostError>
+pub const fn radroots_event::post::PostImageDimensions::width(self) -> u32
pub const radroots_event::post::RADROOTS_ASK_MARKER_TAG_KEY: &str
pub const radroots_event::post::RADROOTS_ASK_MARKER_TAG_VALUE: &str
pub const radroots_event::post::RADROOTS_POST_ALT_MAX_BYTES: usize
@@ -2760,72 +2426,61 @@ pub fn radroots_event::post::post_image_media_type_is_valid(&str) -> bool
pub fn radroots_event::post::post_media_http_url_is_valid(&str) -> bool
pub mod radroots_event::profile
pub mod radroots_event::profile::account
-pub struct radroots_event::profile::account::RadrootsAccountClaim
-pub radroots_event::profile::account::RadrootsAccountClaim::nip05: core::option::Option<alloc::string::String>
-pub radroots_event::profile::account::RadrootsAccountClaim::pubkey: alloc::string::String
-pub radroots_event::profile::account::RadrootsAccountClaim::username: alloc::string::String
+pub struct radroots_event::profile::account::AccountClaim
+pub radroots_event::profile::account::AccountClaim::nip05: core::option::Option<alloc::string::String>
+pub radroots_event::profile::account::AccountClaim::pubkey: alloc::string::String
+pub radroots_event::profile::account::AccountClaim::username: alloc::string::String
pub const radroots_event::profile::account::KIND_ACCOUNT_CLAIM: u32
-#[non_exhaustive] pub enum radroots_event::profile::RadrootsAuthoredProfileError
-pub radroots_event::profile::RadrootsAuthoredProfileError::InvalidName
-impl radroots_event::profile::RadrootsAuthoredProfileError
-pub const fn radroots_event::profile::RadrootsAuthoredProfileError::code(&self) -> &'static str
-impl core::error::Error for radroots_event::profile::RadrootsAuthoredProfileError
-impl core::fmt::Display for radroots_event::profile::RadrootsAuthoredProfileError
-pub fn radroots_event::profile::RadrootsAuthoredProfileError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-#[non_exhaustive] pub enum radroots_event::profile::RadrootsNip05IdentifierError
-pub radroots_event::profile::RadrootsNip05IdentifierError::InvalidDomain
-pub radroots_event::profile::RadrootsNip05IdentifierError::InvalidLocalPart
-pub radroots_event::profile::RadrootsNip05IdentifierError::MissingSeparator
-pub radroots_event::profile::RadrootsNip05IdentifierError::MultipleSeparators
-impl radroots_event::profile::RadrootsNip05IdentifierError
-pub const fn radroots_event::profile::RadrootsNip05IdentifierError::code(&self) -> &'static str
-impl core::error::Error for radroots_event::profile::RadrootsNip05IdentifierError
-impl core::fmt::Display for radroots_event::profile::RadrootsNip05IdentifierError
-pub fn radroots_event::profile::RadrootsNip05IdentifierError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub enum radroots_event::profile::RadrootsProfileType
-pub radroots_event::profile::RadrootsProfileType::Any
-pub radroots_event::profile::RadrootsProfileType::Coop
-pub radroots_event::profile::RadrootsProfileType::Farm
-pub radroots_event::profile::RadrootsProfileType::Individual
-pub radroots_event::profile::RadrootsProfileType::Radrootsd
-pub struct radroots_event::profile::RadrootsAuthoredProfile
-impl radroots_event::profile::RadrootsAuthoredProfile
-pub fn radroots_event::profile::RadrootsAuthoredProfile::about(&self) -> core::option::Option<&str>
-pub fn radroots_event::profile::RadrootsAuthoredProfile::banner(&self) -> core::option::Option<&radroots_event::media::RadrootsAuthoredImage>
-pub const fn radroots_event::profile::RadrootsAuthoredProfile::bot(&self) -> core::option::Option<bool>
-pub fn radroots_event::profile::RadrootsAuthoredProfile::display_name(&self) -> core::option::Option<&str>
-pub fn radroots_event::profile::RadrootsAuthoredProfile::name(&self) -> &str
-pub fn radroots_event::profile::RadrootsAuthoredProfile::new(impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::profile::RadrootsAuthoredProfileError>
-pub fn radroots_event::profile::RadrootsAuthoredProfile::nip05(&self) -> core::option::Option<&radroots_event::profile::RadrootsNip05Identifier>
-pub fn radroots_event::profile::RadrootsAuthoredProfile::picture(&self) -> core::option::Option<&radroots_event::media::RadrootsAuthoredImage>
-pub fn radroots_event::profile::RadrootsAuthoredProfile::with_about(self, impl core::convert::Into<alloc::string::String>) -> Self
-pub fn radroots_event::profile::RadrootsAuthoredProfile::with_banner(self, radroots_event::media::RadrootsAuthoredImage) -> Self
-pub const fn radroots_event::profile::RadrootsAuthoredProfile::with_bot(self, bool) -> Self
-pub fn radroots_event::profile::RadrootsAuthoredProfile::with_display_name(self, impl core::convert::Into<alloc::string::String>) -> Self
-pub fn radroots_event::profile::RadrootsAuthoredProfile::with_nip05(self, radroots_event::profile::RadrootsNip05Identifier) -> Self
-pub fn radroots_event::profile::RadrootsAuthoredProfile::with_picture(self, radroots_event::media::RadrootsAuthoredImage) -> Self
-pub struct radroots_event::profile::RadrootsNip05Identifier(_)
-impl radroots_event::profile::RadrootsNip05Identifier
-pub fn radroots_event::profile::RadrootsNip05Identifier::as_str(&self) -> &str
-pub fn radroots_event::profile::RadrootsNip05Identifier::domain(&self) -> &str
-pub fn radroots_event::profile::RadrootsNip05Identifier::local_part(&self) -> &str
-pub fn radroots_event::profile::RadrootsNip05Identifier::parse(&str) -> core::result::Result<Self, radroots_event::profile::RadrootsNip05IdentifierError>
-impl core::fmt::Display for radroots_event::profile::RadrootsNip05Identifier
-pub fn radroots_event::profile::RadrootsNip05Identifier::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::profile::RadrootsNip05Identifier
-pub type radroots_event::profile::RadrootsNip05Identifier::Err = radroots_event::profile::RadrootsNip05IdentifierError
-pub fn radroots_event::profile::RadrootsNip05Identifier::from_str(&str) -> core::result::Result<Self, Self::Err>
-pub struct radroots_event::profile::RadrootsProfile
-pub radroots_event::profile::RadrootsProfile::about: core::option::Option<alloc::string::String>
-pub radroots_event::profile::RadrootsProfile::banner: core::option::Option<alloc::string::String>
-pub radroots_event::profile::RadrootsProfile::bot: core::option::Option<alloc::string::String>
-pub radroots_event::profile::RadrootsProfile::display_name: core::option::Option<alloc::string::String>
-pub radroots_event::profile::RadrootsProfile::lud06: core::option::Option<alloc::string::String>
-pub radroots_event::profile::RadrootsProfile::lud16: core::option::Option<alloc::string::String>
-pub radroots_event::profile::RadrootsProfile::name: alloc::string::String
-pub radroots_event::profile::RadrootsProfile::nip05: core::option::Option<alloc::string::String>
-pub radroots_event::profile::RadrootsProfile::picture: core::option::Option<alloc::string::String>
-pub radroots_event::profile::RadrootsProfile::website: core::option::Option<alloc::string::String>
+#[non_exhaustive] pub enum radroots_event::profile::AuthoredProfileError
+pub radroots_event::profile::AuthoredProfileError::InvalidName
+impl radroots_event::profile::AuthoredProfileError
+pub const fn radroots_event::profile::AuthoredProfileError::code(&self) -> &'static str
+impl core::error::Error for radroots_event::profile::AuthoredProfileError
+impl core::fmt::Display for radroots_event::profile::AuthoredProfileError
+pub fn radroots_event::profile::AuthoredProfileError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+#[non_exhaustive] pub enum radroots_event::profile::Nip05IdentifierError
+pub radroots_event::profile::Nip05IdentifierError::InvalidDomain
+pub radroots_event::profile::Nip05IdentifierError::InvalidLocalPart
+pub radroots_event::profile::Nip05IdentifierError::MissingSeparator
+pub radroots_event::profile::Nip05IdentifierError::MultipleSeparators
+impl radroots_event::profile::Nip05IdentifierError
+pub const fn radroots_event::profile::Nip05IdentifierError::code(&self) -> &'static str
+impl core::error::Error for radroots_event::profile::Nip05IdentifierError
+impl core::fmt::Display for radroots_event::profile::Nip05IdentifierError
+pub fn radroots_event::profile::Nip05IdentifierError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub enum radroots_event::profile::ProfileType
+pub radroots_event::profile::ProfileType::Any
+pub radroots_event::profile::ProfileType::Coop
+pub radroots_event::profile::ProfileType::Farm
+pub radroots_event::profile::ProfileType::Individual
+pub radroots_event::profile::ProfileType::Radrootsd
+pub struct radroots_event::profile::AuthoredProfile
+impl radroots_event::profile::AuthoredProfile
+pub fn radroots_event::profile::AuthoredProfile::about(&self) -> core::option::Option<&str>
+pub fn radroots_event::profile::AuthoredProfile::banner(&self) -> core::option::Option<&radroots_event::media::AuthoredImage>
+pub const fn radroots_event::profile::AuthoredProfile::bot(&self) -> core::option::Option<bool>
+pub fn radroots_event::profile::AuthoredProfile::display_name(&self) -> core::option::Option<&str>
+pub fn radroots_event::profile::AuthoredProfile::name(&self) -> &str
+pub fn radroots_event::profile::AuthoredProfile::new(impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::profile::AuthoredProfileError>
+pub fn radroots_event::profile::AuthoredProfile::nip05(&self) -> core::option::Option<&radroots_event::profile::Nip05Identifier>
+pub fn radroots_event::profile::AuthoredProfile::picture(&self) -> core::option::Option<&radroots_event::media::AuthoredImage>
+pub fn radroots_event::profile::AuthoredProfile::with_about(self, impl core::convert::Into<alloc::string::String>) -> Self
+pub fn radroots_event::profile::AuthoredProfile::with_banner(self, radroots_event::media::AuthoredImage) -> Self
+pub const fn radroots_event::profile::AuthoredProfile::with_bot(self, bool) -> Self
+pub fn radroots_event::profile::AuthoredProfile::with_display_name(self, impl core::convert::Into<alloc::string::String>) -> Self
+pub fn radroots_event::profile::AuthoredProfile::with_nip05(self, radroots_event::profile::Nip05Identifier) -> Self
+pub fn radroots_event::profile::AuthoredProfile::with_picture(self, radroots_event::media::AuthoredImage) -> Self
+pub struct radroots_event::profile::Nip05Identifier(_)
+impl radroots_event::profile::Nip05Identifier
+pub fn radroots_event::profile::Nip05Identifier::as_str(&self) -> &str
+pub fn radroots_event::profile::Nip05Identifier::domain(&self) -> &str
+pub fn radroots_event::profile::Nip05Identifier::local_part(&self) -> &str
+pub fn radroots_event::profile::Nip05Identifier::parse(&str) -> core::result::Result<Self, radroots_event::profile::Nip05IdentifierError>
+impl core::fmt::Display for radroots_event::profile::Nip05Identifier
+pub fn radroots_event::profile::Nip05Identifier::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::profile::Nip05Identifier
+pub type radroots_event::profile::Nip05Identifier::Err = radroots_event::profile::Nip05IdentifierError
+pub fn radroots_event::profile::Nip05Identifier::from_str(&str) -> core::result::Result<Self, Self::Err>
pub const radroots_event::profile::RADROOTS_PROFILE_METADATA_MAX_CONTENT_BYTES: usize
pub const radroots_event::profile::RADROOTS_PROFILE_TYPE_TAG_ANY: &str
pub const radroots_event::profile::RADROOTS_PROFILE_TYPE_TAG_COOP: &str
@@ -2833,103 +2488,103 @@ pub const radroots_event::profile::RADROOTS_PROFILE_TYPE_TAG_FARM: &str
pub const radroots_event::profile::RADROOTS_PROFILE_TYPE_TAG_INDIVIDUAL: &str
pub const radroots_event::profile::RADROOTS_PROFILE_TYPE_TAG_KEY: &str
pub const radroots_event::profile::RADROOTS_PROFILE_TYPE_TAG_RADROOTSD: &str
-pub fn radroots_event::profile::radroots_profile_type_from_tag_value(&str) -> core::option::Option<radroots_event::profile::RadrootsProfileType>
-pub fn radroots_event::profile::radroots_profile_type_tag_value(radroots_event::profile::RadrootsProfileType) -> &'static str
+pub fn radroots_event::profile::radroots_profile_type_from_tag_value(&str) -> core::option::Option<radroots_event::profile::ProfileType>
+pub fn radroots_event::profile::radroots_profile_type_tag_value(radroots_event::profile::ProfileType) -> &'static str
pub mod radroots_event::social
pub mod radroots_event::social::app_data
-pub struct radroots_event::social::app_data::RadrootsAppData
-pub radroots_event::social::app_data::RadrootsAppData::content: alloc::string::String
-pub radroots_event::social::app_data::RadrootsAppData::d_tag: alloc::string::String
+pub struct radroots_event::social::app_data::AppData
+pub radroots_event::social::app_data::AppData::content: alloc::string::String
+pub radroots_event::social::app_data::AppData::d_tag: alloc::string::String
pub const radroots_event::social::app_data::KIND_APP_DATA: u32
pub mod radroots_event::social::follow
-pub struct radroots_event::social::follow::RadrootsFollow
-pub radroots_event::social::follow::RadrootsFollow::list: alloc::vec::Vec<radroots_event::social::follow::RadrootsFollowProfile>
-pub struct radroots_event::social::follow::RadrootsFollowProfile
-pub radroots_event::social::follow::RadrootsFollowProfile::contact_name: core::option::Option<alloc::string::String>
-pub radroots_event::social::follow::RadrootsFollowProfile::public_key: alloc::string::String
-pub radroots_event::social::follow::RadrootsFollowProfile::published_at: u64
-pub radroots_event::social::follow::RadrootsFollowProfile::relay_url: core::option::Option<alloc::string::String>
+pub struct radroots_event::social::follow::Follow
+pub radroots_event::social::follow::Follow::list: alloc::vec::Vec<radroots_event::social::follow::FollowProfile>
+pub struct radroots_event::social::follow::FollowProfile
+pub radroots_event::social::follow::FollowProfile::contact_name: core::option::Option<alloc::string::String>
+pub radroots_event::social::follow::FollowProfile::public_key: alloc::string::String
+pub radroots_event::social::follow::FollowProfile::published_at: u64
+pub radroots_event::social::follow::FollowProfile::relay_url: core::option::Option<alloc::string::String>
pub mod radroots_event::social::geochat
-pub struct radroots_event::social::geochat::RadrootsGeoChat
-pub radroots_event::social::geochat::RadrootsGeoChat::content: alloc::string::String
-pub radroots_event::social::geochat::RadrootsGeoChat::geohash: alloc::string::String
-pub radroots_event::social::geochat::RadrootsGeoChat::nickname: core::option::Option<alloc::string::String>
-pub radroots_event::social::geochat::RadrootsGeoChat::teleported: bool
+pub struct radroots_event::social::geochat::GeoChat
+pub radroots_event::social::geochat::GeoChat::content: alloc::string::String
+pub radroots_event::social::geochat::GeoChat::geohash: alloc::string::String
+pub radroots_event::social::geochat::GeoChat::nickname: core::option::Option<alloc::string::String>
+pub radroots_event::social::geochat::GeoChat::teleported: bool
pub mod radroots_event::social::gift_wrap
-pub struct radroots_event::social::gift_wrap::RadrootsGiftWrap
-pub radroots_event::social::gift_wrap::RadrootsGiftWrap::content: alloc::string::String
-pub radroots_event::social::gift_wrap::RadrootsGiftWrap::expiration: core::option::Option<u32>
-pub radroots_event::social::gift_wrap::RadrootsGiftWrap::recipient: radroots_event::social::gift_wrap::RadrootsGiftWrapRecipient
-pub struct radroots_event::social::gift_wrap::RadrootsGiftWrapRecipient
-pub radroots_event::social::gift_wrap::RadrootsGiftWrapRecipient::public_key: alloc::string::String
-pub radroots_event::social::gift_wrap::RadrootsGiftWrapRecipient::relay_url: core::option::Option<alloc::string::String>
+pub struct radroots_event::social::gift_wrap::GiftWrap
+pub radroots_event::social::gift_wrap::GiftWrap::content: alloc::string::String
+pub radroots_event::social::gift_wrap::GiftWrap::expiration: core::option::Option<u32>
+pub radroots_event::social::gift_wrap::GiftWrap::recipient: radroots_event::social::gift_wrap::GiftWrapRecipient
+pub struct radroots_event::social::gift_wrap::GiftWrapRecipient
+pub radroots_event::social::gift_wrap::GiftWrapRecipient::public_key: alloc::string::String
+pub radroots_event::social::gift_wrap::GiftWrapRecipient::relay_url: core::option::Option<alloc::string::String>
pub mod radroots_event::social::group
-pub struct radroots_event::social::group::RadrootsGroupAdmins
-pub radroots_event::social::group::RadrootsGroupAdmins::admins: alloc::vec::Vec<radroots_event::social::group::RadrootsGroupUserRef>
-pub radroots_event::social::group::RadrootsGroupAdmins::d_tag: alloc::string::String
-pub radroots_event::social::group::RadrootsGroupAdmins::description: core::option::Option<alloc::string::String>
-pub struct radroots_event::social::group::RadrootsGroupCreateGroup
-pub radroots_event::social::group::RadrootsGroupCreateGroup::group_id: alloc::string::String
-pub radroots_event::social::group::RadrootsGroupCreateGroup::message: core::option::Option<alloc::string::String>
-pub radroots_event::social::group::RadrootsGroupCreateGroup::metadata: radroots_event::social::group::RadrootsGroupEditableMetadata
-pub struct radroots_event::social::group::RadrootsGroupCreateInvite
-pub radroots_event::social::group::RadrootsGroupCreateInvite::code: alloc::string::String
-pub radroots_event::social::group::RadrootsGroupCreateInvite::group_id: alloc::string::String
-pub radroots_event::social::group::RadrootsGroupCreateInvite::message: core::option::Option<alloc::string::String>
-pub struct radroots_event::social::group::RadrootsGroupDeleteEvent
-pub radroots_event::social::group::RadrootsGroupDeleteEvent::event_id: alloc::string::String
-pub radroots_event::social::group::RadrootsGroupDeleteEvent::group_id: alloc::string::String
-pub radroots_event::social::group::RadrootsGroupDeleteEvent::message: core::option::Option<alloc::string::String>
-pub struct radroots_event::social::group::RadrootsGroupDeleteGroup
-pub radroots_event::social::group::RadrootsGroupDeleteGroup::group_id: alloc::string::String
-pub radroots_event::social::group::RadrootsGroupDeleteGroup::message: core::option::Option<alloc::string::String>
-pub struct radroots_event::social::group::RadrootsGroupEditMetadata
-pub radroots_event::social::group::RadrootsGroupEditMetadata::group_id: alloc::string::String
-pub radroots_event::social::group::RadrootsGroupEditMetadata::message: core::option::Option<alloc::string::String>
-pub radroots_event::social::group::RadrootsGroupEditMetadata::metadata: radroots_event::social::group::RadrootsGroupEditableMetadata
-pub struct radroots_event::social::group::RadrootsGroupEditableMetadata
-pub radroots_event::social::group::RadrootsGroupEditableMetadata::about: core::option::Option<alloc::string::String>
-pub radroots_event::social::group::RadrootsGroupEditableMetadata::is_closed: bool
-pub radroots_event::social::group::RadrootsGroupEditableMetadata::is_hidden: bool
-pub radroots_event::social::group::RadrootsGroupEditableMetadata::is_private: bool
-pub radroots_event::social::group::RadrootsGroupEditableMetadata::is_restricted: bool
-pub radroots_event::social::group::RadrootsGroupEditableMetadata::name: core::option::Option<alloc::string::String>
-pub radroots_event::social::group::RadrootsGroupEditableMetadata::picture: core::option::Option<alloc::string::String>
-pub radroots_event::social::group::RadrootsGroupEditableMetadata::supported_kinds: core::option::Option<alloc::vec::Vec<u32>>
-pub struct radroots_event::social::group::RadrootsGroupJoinRequest
-pub radroots_event::social::group::RadrootsGroupJoinRequest::code: core::option::Option<alloc::string::String>
-pub radroots_event::social::group::RadrootsGroupJoinRequest::group_id: alloc::string::String
-pub radroots_event::social::group::RadrootsGroupJoinRequest::message: core::option::Option<alloc::string::String>
-pub struct radroots_event::social::group::RadrootsGroupLeaveRequest
-pub radroots_event::social::group::RadrootsGroupLeaveRequest::group_id: alloc::string::String
-pub radroots_event::social::group::RadrootsGroupLeaveRequest::message: core::option::Option<alloc::string::String>
-pub struct radroots_event::social::group::RadrootsGroupMembers
-pub radroots_event::social::group::RadrootsGroupMembers::d_tag: alloc::string::String
-pub radroots_event::social::group::RadrootsGroupMembers::description: core::option::Option<alloc::string::String>
-pub radroots_event::social::group::RadrootsGroupMembers::members: alloc::vec::Vec<radroots_event::social::group::RadrootsGroupUserRef>
-pub struct radroots_event::social::group::RadrootsGroupMetadata
-pub radroots_event::social::group::RadrootsGroupMetadata::d_tag: alloc::string::String
-pub radroots_event::social::group::RadrootsGroupMetadata::metadata: radroots_event::social::group::RadrootsGroupEditableMetadata
-pub struct radroots_event::social::group::RadrootsGroupPutUser
-pub radroots_event::social::group::RadrootsGroupPutUser::group_id: alloc::string::String
-pub radroots_event::social::group::RadrootsGroupPutUser::message: core::option::Option<alloc::string::String>
-pub radroots_event::social::group::RadrootsGroupPutUser::pubkey: alloc::string::String
-pub radroots_event::social::group::RadrootsGroupPutUser::roles: alloc::vec::Vec<alloc::string::String>
-pub struct radroots_event::social::group::RadrootsGroupRemoveUser
-pub radroots_event::social::group::RadrootsGroupRemoveUser::group_id: alloc::string::String
-pub radroots_event::social::group::RadrootsGroupRemoveUser::message: core::option::Option<alloc::string::String>
-pub radroots_event::social::group::RadrootsGroupRemoveUser::pubkey: alloc::string::String
-pub struct radroots_event::social::group::RadrootsGroupRole
-pub radroots_event::social::group::RadrootsGroupRole::description: core::option::Option<alloc::string::String>
-pub radroots_event::social::group::RadrootsGroupRole::name: alloc::string::String
-pub radroots_event::social::group::RadrootsGroupRole::permissions: alloc::vec::Vec<alloc::string::String>
-pub struct radroots_event::social::group::RadrootsGroupRoles
-pub radroots_event::social::group::RadrootsGroupRoles::d_tag: alloc::string::String
-pub radroots_event::social::group::RadrootsGroupRoles::description: core::option::Option<alloc::string::String>
-pub radroots_event::social::group::RadrootsGroupRoles::roles: alloc::vec::Vec<radroots_event::social::group::RadrootsGroupRole>
-pub struct radroots_event::social::group::RadrootsGroupUserRef
-pub radroots_event::social::group::RadrootsGroupUserRef::pubkey: alloc::string::String
-pub radroots_event::social::group::RadrootsGroupUserRef::roles: alloc::vec::Vec<alloc::string::String>
+pub struct radroots_event::social::group::GroupAdmins
+pub radroots_event::social::group::GroupAdmins::admins: alloc::vec::Vec<radroots_event::social::group::GroupUserRef>
+pub radroots_event::social::group::GroupAdmins::d_tag: alloc::string::String
+pub radroots_event::social::group::GroupAdmins::description: core::option::Option<alloc::string::String>
+pub struct radroots_event::social::group::GroupCreateGroup
+pub radroots_event::social::group::GroupCreateGroup::group_id: alloc::string::String
+pub radroots_event::social::group::GroupCreateGroup::message: core::option::Option<alloc::string::String>
+pub radroots_event::social::group::GroupCreateGroup::metadata: radroots_event::social::group::GroupEditableMetadata
+pub struct radroots_event::social::group::GroupCreateInvite
+pub radroots_event::social::group::GroupCreateInvite::code: alloc::string::String
+pub radroots_event::social::group::GroupCreateInvite::group_id: alloc::string::String
+pub radroots_event::social::group::GroupCreateInvite::message: core::option::Option<alloc::string::String>
+pub struct radroots_event::social::group::GroupDeleteEvent
+pub radroots_event::social::group::GroupDeleteEvent::event_id: alloc::string::String
+pub radroots_event::social::group::GroupDeleteEvent::group_id: alloc::string::String
+pub radroots_event::social::group::GroupDeleteEvent::message: core::option::Option<alloc::string::String>
+pub struct radroots_event::social::group::GroupDeleteGroup
+pub radroots_event::social::group::GroupDeleteGroup::group_id: alloc::string::String
+pub radroots_event::social::group::GroupDeleteGroup::message: core::option::Option<alloc::string::String>
+pub struct radroots_event::social::group::GroupEditMetadata
+pub radroots_event::social::group::GroupEditMetadata::group_id: alloc::string::String
+pub radroots_event::social::group::GroupEditMetadata::message: core::option::Option<alloc::string::String>
+pub radroots_event::social::group::GroupEditMetadata::metadata: radroots_event::social::group::GroupEditableMetadata
+pub struct radroots_event::social::group::GroupEditableMetadata
+pub radroots_event::social::group::GroupEditableMetadata::about: core::option::Option<alloc::string::String>
+pub radroots_event::social::group::GroupEditableMetadata::is_closed: bool
+pub radroots_event::social::group::GroupEditableMetadata::is_hidden: bool
+pub radroots_event::social::group::GroupEditableMetadata::is_private: bool
+pub radroots_event::social::group::GroupEditableMetadata::is_restricted: bool
+pub radroots_event::social::group::GroupEditableMetadata::name: core::option::Option<alloc::string::String>
+pub radroots_event::social::group::GroupEditableMetadata::picture: core::option::Option<alloc::string::String>
+pub radroots_event::social::group::GroupEditableMetadata::supported_kinds: core::option::Option<alloc::vec::Vec<u32>>
+pub struct radroots_event::social::group::GroupJoinRequest
+pub radroots_event::social::group::GroupJoinRequest::code: core::option::Option<alloc::string::String>
+pub radroots_event::social::group::GroupJoinRequest::group_id: alloc::string::String
+pub radroots_event::social::group::GroupJoinRequest::message: core::option::Option<alloc::string::String>
+pub struct radroots_event::social::group::GroupLeaveRequest
+pub radroots_event::social::group::GroupLeaveRequest::group_id: alloc::string::String
+pub radroots_event::social::group::GroupLeaveRequest::message: core::option::Option<alloc::string::String>
+pub struct radroots_event::social::group::GroupMembers
+pub radroots_event::social::group::GroupMembers::d_tag: alloc::string::String
+pub radroots_event::social::group::GroupMembers::description: core::option::Option<alloc::string::String>
+pub radroots_event::social::group::GroupMembers::members: alloc::vec::Vec<radroots_event::social::group::GroupUserRef>
+pub struct radroots_event::social::group::GroupMetadata
+pub radroots_event::social::group::GroupMetadata::d_tag: alloc::string::String
+pub radroots_event::social::group::GroupMetadata::metadata: radroots_event::social::group::GroupEditableMetadata
+pub struct radroots_event::social::group::GroupPutUser
+pub radroots_event::social::group::GroupPutUser::group_id: alloc::string::String
+pub radroots_event::social::group::GroupPutUser::message: core::option::Option<alloc::string::String>
+pub radroots_event::social::group::GroupPutUser::pubkey: alloc::string::String
+pub radroots_event::social::group::GroupPutUser::roles: alloc::vec::Vec<alloc::string::String>
+pub struct radroots_event::social::group::GroupRemoveUser
+pub radroots_event::social::group::GroupRemoveUser::group_id: alloc::string::String
+pub radroots_event::social::group::GroupRemoveUser::message: core::option::Option<alloc::string::String>
+pub radroots_event::social::group::GroupRemoveUser::pubkey: alloc::string::String
+pub struct radroots_event::social::group::GroupRole
+pub radroots_event::social::group::GroupRole::description: core::option::Option<alloc::string::String>
+pub radroots_event::social::group::GroupRole::name: alloc::string::String
+pub radroots_event::social::group::GroupRole::permissions: alloc::vec::Vec<alloc::string::String>
+pub struct radroots_event::social::group::GroupRoles
+pub radroots_event::social::group::GroupRoles::d_tag: alloc::string::String
+pub radroots_event::social::group::GroupRoles::description: core::option::Option<alloc::string::String>
+pub radroots_event::social::group::GroupRoles::roles: alloc::vec::Vec<radroots_event::social::group::GroupRole>
+pub struct radroots_event::social::group::GroupUserRef
+pub radroots_event::social::group::GroupUserRef::pubkey: alloc::string::String
+pub radroots_event::social::group::GroupUserRef::roles: alloc::vec::Vec<alloc::string::String>
pub const radroots_event::social::group::KIND_GROUP_ADMINS: u32
pub const radroots_event::social::group::KIND_GROUP_CREATE_GROUP: u32
pub const radroots_event::social::group::KIND_GROUP_CREATE_INVITE: u32
@@ -2944,10 +2599,10 @@ pub const radroots_event::social::group::KIND_GROUP_PUT_USER: u32
pub const radroots_event::social::group::KIND_GROUP_REMOVE_USER: u32
pub const radroots_event::social::group::KIND_GROUP_ROLES: u32
pub mod radroots_event::social::http_auth
-pub struct radroots_event::social::http_auth::RadrootsHttpAuth
-pub radroots_event::social::http_auth::RadrootsHttpAuth::method: alloc::string::String
-pub radroots_event::social::http_auth::RadrootsHttpAuth::payload_sha256: core::option::Option<alloc::string::String>
-pub radroots_event::social::http_auth::RadrootsHttpAuth::url: alloc::string::String
+pub struct radroots_event::social::http_auth::HttpAuth
+pub radroots_event::social::http_auth::HttpAuth::method: alloc::string::String
+pub radroots_event::social::http_auth::HttpAuth::payload_sha256: core::option::Option<alloc::string::String>
+pub radroots_event::social::http_auth::HttpAuth::url: alloc::string::String
pub const radroots_event::social::http_auth::KIND_HTTP_AUTH: u32
pub mod radroots_event::social::job
pub enum radroots_event::social::job::JobFeedbackStatus
@@ -2965,165 +2620,165 @@ pub struct radroots_event::social::job::JobPaymentRequest
pub radroots_event::social::job::JobPaymentRequest::amount_sat: u32
pub radroots_event::social::job::JobPaymentRequest::bolt11: core::option::Option<alloc::string::String>
pub mod radroots_event::social::job_feedback
-pub struct radroots_event::social::job_feedback::RadrootsJobFeedback
-pub radroots_event::social::job_feedback::RadrootsJobFeedback::content: core::option::Option<alloc::string::String>
-pub radroots_event::social::job_feedback::RadrootsJobFeedback::customer_pubkey: core::option::Option<alloc::string::String>
-pub radroots_event::social::job_feedback::RadrootsJobFeedback::encrypted: bool
-pub radroots_event::social::job_feedback::RadrootsJobFeedback::extra_info: core::option::Option<alloc::string::String>
-pub radroots_event::social::job_feedback::RadrootsJobFeedback::kind: u16
-pub radroots_event::social::job_feedback::RadrootsJobFeedback::payment: core::option::Option<radroots_event::social::job::JobPaymentRequest>
-pub radroots_event::social::job_feedback::RadrootsJobFeedback::request_event: radroots_event::tag::RadrootsEventPtr
-pub radroots_event::social::job_feedback::RadrootsJobFeedback::status: radroots_event::social::job::JobFeedbackStatus
+pub struct radroots_event::social::job_feedback::JobFeedback
+pub radroots_event::social::job_feedback::JobFeedback::content: core::option::Option<alloc::string::String>
+pub radroots_event::social::job_feedback::JobFeedback::customer_pubkey: core::option::Option<alloc::string::String>
+pub radroots_event::social::job_feedback::JobFeedback::encrypted: bool
+pub radroots_event::social::job_feedback::JobFeedback::extra_info: core::option::Option<alloc::string::String>
+pub radroots_event::social::job_feedback::JobFeedback::kind: u16
+pub radroots_event::social::job_feedback::JobFeedback::payment: core::option::Option<radroots_event::social::job::JobPaymentRequest>
+pub radroots_event::social::job_feedback::JobFeedback::request_event: radroots_event::tag::EventPtr
+pub radroots_event::social::job_feedback::JobFeedback::status: radroots_event::social::job::JobFeedbackStatus
pub mod radroots_event::social::job_request
-pub struct radroots_event::social::job_request::RadrootsJobInput
-pub radroots_event::social::job_request::RadrootsJobInput::data: alloc::string::String
-pub radroots_event::social::job_request::RadrootsJobInput::input_type: radroots_event::social::job::JobInputType
-pub radroots_event::social::job_request::RadrootsJobInput::marker: core::option::Option<alloc::string::String>
-pub radroots_event::social::job_request::RadrootsJobInput::relay: core::option::Option<alloc::string::String>
-pub struct radroots_event::social::job_request::RadrootsJobParam
-pub radroots_event::social::job_request::RadrootsJobParam::key: alloc::string::String
-pub radroots_event::social::job_request::RadrootsJobParam::value: alloc::string::String
-pub struct radroots_event::social::job_request::RadrootsJobRequest
-pub radroots_event::social::job_request::RadrootsJobRequest::bid_sat: core::option::Option<u32>
-pub radroots_event::social::job_request::RadrootsJobRequest::encrypted: bool
-pub radroots_event::social::job_request::RadrootsJobRequest::inputs: alloc::vec::Vec<radroots_event::social::job_request::RadrootsJobInput>
-pub radroots_event::social::job_request::RadrootsJobRequest::kind: u16
-pub radroots_event::social::job_request::RadrootsJobRequest::output: core::option::Option<alloc::string::String>
-pub radroots_event::social::job_request::RadrootsJobRequest::params: alloc::vec::Vec<radroots_event::social::job_request::RadrootsJobParam>
-pub radroots_event::social::job_request::RadrootsJobRequest::providers: alloc::vec::Vec<alloc::string::String>
-pub radroots_event::social::job_request::RadrootsJobRequest::relays: alloc::vec::Vec<alloc::string::String>
-pub radroots_event::social::job_request::RadrootsJobRequest::topics: alloc::vec::Vec<alloc::string::String>
+pub struct radroots_event::social::job_request::JobInput
+pub radroots_event::social::job_request::JobInput::data: alloc::string::String
+pub radroots_event::social::job_request::JobInput::input_type: radroots_event::social::job::JobInputType
+pub radroots_event::social::job_request::JobInput::marker: core::option::Option<alloc::string::String>
+pub radroots_event::social::job_request::JobInput::relay: core::option::Option<alloc::string::String>
+pub struct radroots_event::social::job_request::JobParam
+pub radroots_event::social::job_request::JobParam::key: alloc::string::String
+pub radroots_event::social::job_request::JobParam::value: alloc::string::String
+pub struct radroots_event::social::job_request::JobRequest
+pub radroots_event::social::job_request::JobRequest::bid_sat: core::option::Option<u32>
+pub radroots_event::social::job_request::JobRequest::encrypted: bool
+pub radroots_event::social::job_request::JobRequest::inputs: alloc::vec::Vec<radroots_event::social::job_request::JobInput>
+pub radroots_event::social::job_request::JobRequest::kind: u16
+pub radroots_event::social::job_request::JobRequest::output: core::option::Option<alloc::string::String>
+pub radroots_event::social::job_request::JobRequest::params: alloc::vec::Vec<radroots_event::social::job_request::JobParam>
+pub radroots_event::social::job_request::JobRequest::providers: alloc::vec::Vec<alloc::string::String>
+pub radroots_event::social::job_request::JobRequest::relays: alloc::vec::Vec<alloc::string::String>
+pub radroots_event::social::job_request::JobRequest::topics: alloc::vec::Vec<alloc::string::String>
pub mod radroots_event::social::job_result
-pub struct radroots_event::social::job_result::RadrootsJobResult
-pub radroots_event::social::job_result::RadrootsJobResult::content: core::option::Option<alloc::string::String>
-pub radroots_event::social::job_result::RadrootsJobResult::customer_pubkey: core::option::Option<alloc::string::String>
-pub radroots_event::social::job_result::RadrootsJobResult::encrypted: bool
-pub radroots_event::social::job_result::RadrootsJobResult::inputs: alloc::vec::Vec<radroots_event::social::job_request::RadrootsJobInput>
-pub radroots_event::social::job_result::RadrootsJobResult::kind: u16
-pub radroots_event::social::job_result::RadrootsJobResult::payment: core::option::Option<radroots_event::social::job::JobPaymentRequest>
-pub radroots_event::social::job_result::RadrootsJobResult::request_event: radroots_event::tag::RadrootsEventPtr
-pub radroots_event::social::job_result::RadrootsJobResult::request_json: core::option::Option<alloc::string::String>
+pub struct radroots_event::social::job_result::JobResult
+pub radroots_event::social::job_result::JobResult::content: core::option::Option<alloc::string::String>
+pub radroots_event::social::job_result::JobResult::customer_pubkey: core::option::Option<alloc::string::String>
+pub radroots_event::social::job_result::JobResult::encrypted: bool
+pub radroots_event::social::job_result::JobResult::inputs: alloc::vec::Vec<radroots_event::social::job_request::JobInput>
+pub radroots_event::social::job_result::JobResult::kind: u16
+pub radroots_event::social::job_result::JobResult::payment: core::option::Option<radroots_event::social::job::JobPaymentRequest>
+pub radroots_event::social::job_result::JobResult::request_event: radroots_event::tag::EventPtr
+pub radroots_event::social::job_result::JobResult::request_json: core::option::Option<alloc::string::String>
pub mod radroots_event::social::list
-pub struct radroots_event::social::list::RadrootsList
-pub radroots_event::social::list::RadrootsList::content: alloc::string::String
-pub radroots_event::social::list::RadrootsList::entries: alloc::vec::Vec<radroots_event::social::list::RadrootsListEntry>
-pub struct radroots_event::social::list::RadrootsListEntry
-pub radroots_event::social::list::RadrootsListEntry::tag: alloc::string::String
-pub radroots_event::social::list::RadrootsListEntry::values: alloc::vec::Vec<alloc::string::String>
+pub struct radroots_event::social::list::List
+pub radroots_event::social::list::List::content: alloc::string::String
+pub radroots_event::social::list::List::entries: alloc::vec::Vec<radroots_event::social::list::ListEntry>
+pub struct radroots_event::social::list::ListEntry
+pub radroots_event::social::list::ListEntry::tag: alloc::string::String
+pub radroots_event::social::list::ListEntry::values: alloc::vec::Vec<alloc::string::String>
pub mod radroots_event::social::list_set
-pub struct radroots_event::social::list_set::RadrootsListSet
-pub radroots_event::social::list_set::RadrootsListSet::content: alloc::string::String
-pub radroots_event::social::list_set::RadrootsListSet::d_tag: alloc::string::String
-pub radroots_event::social::list_set::RadrootsListSet::description: core::option::Option<alloc::string::String>
-pub radroots_event::social::list_set::RadrootsListSet::entries: alloc::vec::Vec<radroots_event::social::list::RadrootsListEntry>
-pub radroots_event::social::list_set::RadrootsListSet::image: core::option::Option<alloc::string::String>
-pub radroots_event::social::list_set::RadrootsListSet::title: core::option::Option<alloc::string::String>
+pub struct radroots_event::social::list_set::ListSet
+pub radroots_event::social::list_set::ListSet::content: alloc::string::String
+pub radroots_event::social::list_set::ListSet::d_tag: alloc::string::String
+pub radroots_event::social::list_set::ListSet::description: core::option::Option<alloc::string::String>
+pub radroots_event::social::list_set::ListSet::entries: alloc::vec::Vec<radroots_event::social::list::ListEntry>
+pub radroots_event::social::list_set::ListSet::image: core::option::Option<alloc::string::String>
+pub radroots_event::social::list_set::ListSet::title: core::option::Option<alloc::string::String>
pub mod radroots_event::social::message
-pub struct radroots_event::social::message::RadrootsMessage
-pub radroots_event::social::message::RadrootsMessage::content: alloc::string::String
-pub radroots_event::social::message::RadrootsMessage::recipients: alloc::vec::Vec<radroots_event::social::message::RadrootsMessageRecipient>
-pub radroots_event::social::message::RadrootsMessage::reply_to: core::option::Option<radroots_event::tag::RadrootsEventPtr>
-pub radroots_event::social::message::RadrootsMessage::subject: core::option::Option<alloc::string::String>
-pub struct radroots_event::social::message::RadrootsMessageRecipient
-pub radroots_event::social::message::RadrootsMessageRecipient::public_key: alloc::string::String
-pub radroots_event::social::message::RadrootsMessageRecipient::relay_url: core::option::Option<alloc::string::String>
+pub struct radroots_event::social::message::Message
+pub radroots_event::social::message::Message::content: alloc::string::String
+pub radroots_event::social::message::Message::recipients: alloc::vec::Vec<radroots_event::social::message::MessageRecipient>
+pub radroots_event::social::message::Message::reply_to: core::option::Option<radroots_event::tag::EventPtr>
+pub radroots_event::social::message::Message::subject: core::option::Option<alloc::string::String>
+pub struct radroots_event::social::message::MessageRecipient
+pub radroots_event::social::message::MessageRecipient::public_key: alloc::string::String
+pub radroots_event::social::message::MessageRecipient::relay_url: core::option::Option<alloc::string::String>
pub mod radroots_event::social::message_file
-pub struct radroots_event::social::message_file::RadrootsMessageFile
-pub radroots_event::social::message_file::RadrootsMessageFile::blurhash: core::option::Option<alloc::string::String>
-pub radroots_event::social::message_file::RadrootsMessageFile::decryption_key: alloc::string::String
-pub radroots_event::social::message_file::RadrootsMessageFile::decryption_nonce: alloc::string::String
-pub radroots_event::social::message_file::RadrootsMessageFile::dimensions: core::option::Option<radroots_event::social::message_file::RadrootsMessageFileDimensions>
-pub radroots_event::social::message_file::RadrootsMessageFile::encrypted_hash: alloc::string::String
-pub radroots_event::social::message_file::RadrootsMessageFile::encryption_algorithm: alloc::string::String
-pub radroots_event::social::message_file::RadrootsMessageFile::fallbacks: alloc::vec::Vec<alloc::string::String>
-pub radroots_event::social::message_file::RadrootsMessageFile::file_type: alloc::string::String
-pub radroots_event::social::message_file::RadrootsMessageFile::file_url: alloc::string::String
-pub radroots_event::social::message_file::RadrootsMessageFile::original_hash: core::option::Option<alloc::string::String>
-pub radroots_event::social::message_file::RadrootsMessageFile::recipients: alloc::vec::Vec<radroots_event::social::message::RadrootsMessageRecipient>
-pub radroots_event::social::message_file::RadrootsMessageFile::reply_to: core::option::Option<radroots_event::tag::RadrootsEventPtr>
-pub radroots_event::social::message_file::RadrootsMessageFile::size: core::option::Option<u64>
-pub radroots_event::social::message_file::RadrootsMessageFile::subject: core::option::Option<alloc::string::String>
-pub radroots_event::social::message_file::RadrootsMessageFile::thumb: core::option::Option<alloc::string::String>
-pub struct radroots_event::social::message_file::RadrootsMessageFileDimensions
-pub radroots_event::social::message_file::RadrootsMessageFileDimensions::h: u32
-pub radroots_event::social::message_file::RadrootsMessageFileDimensions::w: u32
+pub struct radroots_event::social::message_file::MessageFile
+pub radroots_event::social::message_file::MessageFile::blurhash: core::option::Option<alloc::string::String>
+pub radroots_event::social::message_file::MessageFile::decryption_key: alloc::string::String
+pub radroots_event::social::message_file::MessageFile::decryption_nonce: alloc::string::String
+pub radroots_event::social::message_file::MessageFile::dimensions: core::option::Option<radroots_event::social::message_file::MessageFileDimensions>
+pub radroots_event::social::message_file::MessageFile::encrypted_hash: alloc::string::String
+pub radroots_event::social::message_file::MessageFile::encryption_algorithm: alloc::string::String
+pub radroots_event::social::message_file::MessageFile::fallbacks: alloc::vec::Vec<alloc::string::String>
+pub radroots_event::social::message_file::MessageFile::file_type: alloc::string::String
+pub radroots_event::social::message_file::MessageFile::file_url: alloc::string::String
+pub radroots_event::social::message_file::MessageFile::original_hash: core::option::Option<alloc::string::String>
+pub radroots_event::social::message_file::MessageFile::recipients: alloc::vec::Vec<radroots_event::social::message::MessageRecipient>
+pub radroots_event::social::message_file::MessageFile::reply_to: core::option::Option<radroots_event::tag::EventPtr>
+pub radroots_event::social::message_file::MessageFile::size: core::option::Option<u64>
+pub radroots_event::social::message_file::MessageFile::subject: core::option::Option<alloc::string::String>
+pub radroots_event::social::message_file::MessageFile::thumb: core::option::Option<alloc::string::String>
+pub struct radroots_event::social::message_file::MessageFileDimensions
+pub radroots_event::social::message_file::MessageFileDimensions::h: u32
+pub radroots_event::social::message_file::MessageFileDimensions::w: u32
pub mod radroots_event::social::relay_auth
-pub struct radroots_event::social::relay_auth::RadrootsRelayAuth
-pub radroots_event::social::relay_auth::RadrootsRelayAuth::challenge: alloc::string::String
-pub radroots_event::social::relay_auth::RadrootsRelayAuth::relay: alloc::string::String
+pub struct radroots_event::social::relay_auth::RelayAuth
+pub radroots_event::social::relay_auth::RelayAuth::challenge: alloc::string::String
+pub radroots_event::social::relay_auth::RelayAuth::relay: alloc::string::String
pub const radroots_event::social::relay_auth::KIND_RELAY_AUTH: u32
pub mod radroots_event::social::relay_document
-pub struct radroots_event::social::relay_document::RadrootsRelayDocument
-pub radroots_event::social::relay_document::RadrootsRelayDocument::contact: core::option::Option<alloc::string::String>
-pub radroots_event::social::relay_document::RadrootsRelayDocument::description: core::option::Option<alloc::string::String>
-pub radroots_event::social::relay_document::RadrootsRelayDocument::name: core::option::Option<alloc::string::String>
-pub radroots_event::social::relay_document::RadrootsRelayDocument::pubkey: core::option::Option<alloc::string::String>
-pub radroots_event::social::relay_document::RadrootsRelayDocument::software: core::option::Option<alloc::string::String>
-pub radroots_event::social::relay_document::RadrootsRelayDocument::supported_nips: core::option::Option<alloc::vec::Vec<u16>>
-pub radroots_event::social::relay_document::RadrootsRelayDocument::version: core::option::Option<alloc::string::String>
+pub struct radroots_event::social::relay_document::RelayDocument
+pub radroots_event::social::relay_document::RelayDocument::contact: core::option::Option<alloc::string::String>
+pub radroots_event::social::relay_document::RelayDocument::description: core::option::Option<alloc::string::String>
+pub radroots_event::social::relay_document::RelayDocument::name: core::option::Option<alloc::string::String>
+pub radroots_event::social::relay_document::RelayDocument::pubkey: core::option::Option<alloc::string::String>
+pub radroots_event::social::relay_document::RelayDocument::software: core::option::Option<alloc::string::String>
+pub radroots_event::social::relay_document::RelayDocument::supported_nips: core::option::Option<alloc::vec::Vec<u16>>
+pub radroots_event::social::relay_document::RelayDocument::version: core::option::Option<alloc::string::String>
pub mod radroots_event::social::seal
-pub struct radroots_event::social::seal::RadrootsSeal
-pub radroots_event::social::seal::RadrootsSeal::content: alloc::string::String
-pub enum radroots_event::social::RadrootsReportType
-pub radroots_event::social::RadrootsReportType::Illegal
-pub radroots_event::social::RadrootsReportType::Impersonation
-pub radroots_event::social::RadrootsReportType::Malware
-pub radroots_event::social::RadrootsReportType::Nudity
-pub radroots_event::social::RadrootsReportType::Other
-pub radroots_event::social::RadrootsReportType::Profanity
-pub radroots_event::social::RadrootsReportType::Spam
-pub enum radroots_event::social::RadrootsSocialTarget
-pub radroots_event::social::RadrootsSocialTarget::Address
-pub radroots_event::social::RadrootsSocialTarget::Address::address: alloc::string::String
-pub radroots_event::social::RadrootsSocialTarget::Address::author: core::option::Option<alloc::string::String>
-pub radroots_event::social::RadrootsSocialTarget::Address::event_kind: core::option::Option<u32>
-pub radroots_event::social::RadrootsSocialTarget::Address::relays: core::option::Option<alloc::vec::Vec<alloc::string::String>>
-pub radroots_event::social::RadrootsSocialTarget::Event
-pub radroots_event::social::RadrootsSocialTarget::Event::author: core::option::Option<alloc::string::String>
-pub radroots_event::social::RadrootsSocialTarget::Event::event_kind: core::option::Option<u32>
-pub radroots_event::social::RadrootsSocialTarget::Event::id: alloc::string::String
-pub radroots_event::social::RadrootsSocialTarget::Event::relays: core::option::Option<alloc::vec::Vec<alloc::string::String>>
-pub radroots_event::social::RadrootsSocialTarget::External
-pub radroots_event::social::RadrootsSocialTarget::External::external_kind: alloc::string::String
-pub radroots_event::social::RadrootsSocialTarget::External::hint: core::option::Option<alloc::string::String>
-pub radroots_event::social::RadrootsSocialTarget::External::id: alloc::string::String
-pub struct radroots_event::social::RadrootsReportFileTarget
-pub radroots_event::social::RadrootsReportFileTarget::magnet: core::option::Option<alloc::string::String>
-pub radroots_event::social::RadrootsReportFileTarget::sha256: core::option::Option<alloc::string::String>
-pub radroots_event::social::RadrootsReportFileTarget::url: core::option::Option<alloc::string::String>
-pub struct radroots_event::social::RadrootsReportTarget
-pub radroots_event::social::RadrootsReportTarget::event: core::option::Option<radroots_event::social::RadrootsSocialTarget>
-pub radroots_event::social::RadrootsReportTarget::file: core::option::Option<radroots_event::social::RadrootsReportFileTarget>
-pub radroots_event::social::RadrootsReportTarget::reported_pubkey: alloc::string::String
-pub struct radroots_event::social::RadrootsSocialFarmAnchor
-pub radroots_event::social::RadrootsSocialFarmAnchor::farm: radroots_event::farm::RadrootsFarmRef
-pub radroots_event::social::RadrootsSocialFarmAnchor::relays: core::option::Option<alloc::vec::Vec<alloc::string::String>>
-pub struct radroots_event::social::RadrootsSocialLocation
-pub radroots_event::social::RadrootsSocialLocation::geohash: core::option::Option<alloc::string::String>
-pub radroots_event::social::RadrootsSocialLocation::name: core::option::Option<alloc::string::String>
-pub struct radroots_event::social::RadrootsSocialMediaDimensions
-pub radroots_event::social::RadrootsSocialMediaDimensions::height: u32
-pub radroots_event::social::RadrootsSocialMediaDimensions::width: u32
-pub struct radroots_event::social::RadrootsSocialMediaMetadata
-pub radroots_event::social::RadrootsSocialMediaMetadata::alt: core::option::Option<alloc::string::String>
-pub radroots_event::social::RadrootsSocialMediaMetadata::blurhash: core::option::Option<alloc::string::String>
-pub radroots_event::social::RadrootsSocialMediaMetadata::content_hashes: core::option::Option<alloc::vec::Vec<alloc::string::String>>
-pub radroots_event::social::RadrootsSocialMediaMetadata::dimensions: core::option::Option<radroots_event::social::RadrootsSocialMediaDimensions>
-pub radroots_event::social::RadrootsSocialMediaMetadata::fallback: core::option::Option<alloc::string::String>
-pub radroots_event::social::RadrootsSocialMediaMetadata::image: core::option::Option<alloc::string::String>
-pub radroots_event::social::RadrootsSocialMediaMetadata::imeta: core::option::Option<alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>>
-pub radroots_event::social::RadrootsSocialMediaMetadata::magnet: core::option::Option<alloc::string::String>
-pub radroots_event::social::RadrootsSocialMediaMetadata::mime_type: core::option::Option<alloc::string::String>
-pub radroots_event::social::RadrootsSocialMediaMetadata::original_sha256: core::option::Option<alloc::string::String>
-pub radroots_event::social::RadrootsSocialMediaMetadata::services: core::option::Option<alloc::vec::Vec<alloc::string::String>>
-pub radroots_event::social::RadrootsSocialMediaMetadata::sha256: core::option::Option<alloc::string::String>
-pub radroots_event::social::RadrootsSocialMediaMetadata::size: core::option::Option<u64>
-pub radroots_event::social::RadrootsSocialMediaMetadata::summary: core::option::Option<alloc::string::String>
-pub radroots_event::social::RadrootsSocialMediaMetadata::thumbnails: core::option::Option<alloc::vec::Vec<radroots_event::social::RadrootsSocialMediaThumbnail>>
-pub radroots_event::social::RadrootsSocialMediaMetadata::url: core::option::Option<alloc::string::String>
-pub struct radroots_event::social::RadrootsSocialMediaThumbnail
-pub radroots_event::social::RadrootsSocialMediaThumbnail::dimensions: core::option::Option<radroots_event::social::RadrootsSocialMediaDimensions>
-pub radroots_event::social::RadrootsSocialMediaThumbnail::url: alloc::string::String
+pub struct radroots_event::social::seal::Seal
+pub radroots_event::social::seal::Seal::content: alloc::string::String
+pub enum radroots_event::social::ReportType
+pub radroots_event::social::ReportType::Illegal
+pub radroots_event::social::ReportType::Impersonation
+pub radroots_event::social::ReportType::Malware
+pub radroots_event::social::ReportType::Nudity
+pub radroots_event::social::ReportType::Other
+pub radroots_event::social::ReportType::Profanity
+pub radroots_event::social::ReportType::Spam
+pub enum radroots_event::social::SocialTarget
+pub radroots_event::social::SocialTarget::Address
+pub radroots_event::social::SocialTarget::Address::address: alloc::string::String
+pub radroots_event::social::SocialTarget::Address::author: core::option::Option<alloc::string::String>
+pub radroots_event::social::SocialTarget::Address::event_kind: core::option::Option<u32>
+pub radroots_event::social::SocialTarget::Address::relays: core::option::Option<alloc::vec::Vec<alloc::string::String>>
+pub radroots_event::social::SocialTarget::Event
+pub radroots_event::social::SocialTarget::Event::author: core::option::Option<alloc::string::String>
+pub radroots_event::social::SocialTarget::Event::event_kind: core::option::Option<u32>
+pub radroots_event::social::SocialTarget::Event::id: alloc::string::String
+pub radroots_event::social::SocialTarget::Event::relays: core::option::Option<alloc::vec::Vec<alloc::string::String>>
+pub radroots_event::social::SocialTarget::External
+pub radroots_event::social::SocialTarget::External::external_kind: alloc::string::String
+pub radroots_event::social::SocialTarget::External::hint: core::option::Option<alloc::string::String>
+pub radroots_event::social::SocialTarget::External::id: alloc::string::String
+pub struct radroots_event::social::ReportFileTarget
+pub radroots_event::social::ReportFileTarget::magnet: core::option::Option<alloc::string::String>
+pub radroots_event::social::ReportFileTarget::sha256: core::option::Option<alloc::string::String>
+pub radroots_event::social::ReportFileTarget::url: core::option::Option<alloc::string::String>
+pub struct radroots_event::social::ReportTarget
+pub radroots_event::social::ReportTarget::event: core::option::Option<radroots_event::social::SocialTarget>
+pub radroots_event::social::ReportTarget::file: core::option::Option<radroots_event::social::ReportFileTarget>
+pub radroots_event::social::ReportTarget::reported_pubkey: alloc::string::String
+pub struct radroots_event::social::SocialFarmAnchor
+pub radroots_event::social::SocialFarmAnchor::farm: radroots_event::farm::FarmRef
+pub radroots_event::social::SocialFarmAnchor::relays: core::option::Option<alloc::vec::Vec<alloc::string::String>>
+pub struct radroots_event::social::SocialLocation
+pub radroots_event::social::SocialLocation::geohash: core::option::Option<alloc::string::String>
+pub radroots_event::social::SocialLocation::name: core::option::Option<alloc::string::String>
+pub struct radroots_event::social::SocialMediaDimensions
+pub radroots_event::social::SocialMediaDimensions::height: u32
+pub radroots_event::social::SocialMediaDimensions::width: u32
+pub struct radroots_event::social::SocialMediaMetadata
+pub radroots_event::social::SocialMediaMetadata::alt: core::option::Option<alloc::string::String>
+pub radroots_event::social::SocialMediaMetadata::blurhash: core::option::Option<alloc::string::String>
+pub radroots_event::social::SocialMediaMetadata::content_hashes: core::option::Option<alloc::vec::Vec<alloc::string::String>>
+pub radroots_event::social::SocialMediaMetadata::dimensions: core::option::Option<radroots_event::social::SocialMediaDimensions>
+pub radroots_event::social::SocialMediaMetadata::fallback: core::option::Option<alloc::string::String>
+pub radroots_event::social::SocialMediaMetadata::image: core::option::Option<alloc::string::String>
+pub radroots_event::social::SocialMediaMetadata::imeta: core::option::Option<alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>>
+pub radroots_event::social::SocialMediaMetadata::magnet: core::option::Option<alloc::string::String>
+pub radroots_event::social::SocialMediaMetadata::mime_type: core::option::Option<alloc::string::String>
+pub radroots_event::social::SocialMediaMetadata::original_sha256: core::option::Option<alloc::string::String>
+pub radroots_event::social::SocialMediaMetadata::services: core::option::Option<alloc::vec::Vec<alloc::string::String>>
+pub radroots_event::social::SocialMediaMetadata::sha256: core::option::Option<alloc::string::String>
+pub radroots_event::social::SocialMediaMetadata::size: core::option::Option<u64>
+pub radroots_event::social::SocialMediaMetadata::summary: core::option::Option<alloc::string::String>
+pub radroots_event::social::SocialMediaMetadata::thumbnails: core::option::Option<alloc::vec::Vec<radroots_event::social::SocialMediaThumbnail>>
+pub radroots_event::social::SocialMediaMetadata::url: core::option::Option<alloc::string::String>
+pub struct radroots_event::social::SocialMediaThumbnail
+pub radroots_event::social::SocialMediaThumbnail::dimensions: core::option::Option<radroots_event::social::SocialMediaDimensions>
+pub radroots_event::social::SocialMediaThumbnail::url: alloc::string::String
pub mod radroots_event::tag
pub mod radroots_event::tag::name
pub const radroots_event::tag::name::TAG_A: &str
@@ -3184,575 +2839,575 @@ pub const radroots_event::tag::name::TAG_U: &str
pub const radroots_event::tag::name::TAG_URL: &str
pub const radroots_event::tag::name::TAG_URL_AUTH: &str
pub mod radroots_event::tag::relay_hint
-pub struct radroots_event::tag::relay_hint::RadrootsNostrRelayHint(_)
-impl radroots_event::tag::relay_hint::RadrootsNostrRelayHint
-pub fn radroots_event::tag::relay_hint::RadrootsNostrRelayHint::as_str(&self) -> &str
-pub fn radroots_event::tag::relay_hint::RadrootsNostrRelayHint::into_string(self) -> alloc::string::String
-pub fn radroots_event::tag::relay_hint::RadrootsNostrRelayHint::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-impl core::convert::AsRef<str> for radroots_event::tag::relay_hint::RadrootsNostrRelayHint
-pub fn radroots_event::tag::relay_hint::RadrootsNostrRelayHint::as_ref(&self) -> &str
-impl core::convert::From<radroots_event::tag::relay_hint::RadrootsNostrRelayHint> for alloc::string::String
-pub fn alloc::string::String::from(radroots_event::tag::relay_hint::RadrootsNostrRelayHint) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::tag::relay_hint::RadrootsNostrRelayHint
-pub type radroots_event::tag::relay_hint::RadrootsNostrRelayHint::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::tag::relay_hint::RadrootsNostrRelayHint::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::tag::relay_hint::RadrootsNostrRelayHint
-pub type radroots_event::tag::relay_hint::RadrootsNostrRelayHint::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::tag::relay_hint::RadrootsNostrRelayHint::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::tag::relay_hint::RadrootsNostrRelayHint
-pub fn radroots_event::tag::relay_hint::RadrootsNostrRelayHint::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::tag::relay_hint::RadrootsNostrRelayHint
-pub type radroots_event::tag::relay_hint::RadrootsNostrRelayHint::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::tag::relay_hint::RadrootsNostrRelayHint::from_str(&str) -> core::result::Result<Self, Self::Err>
-pub struct radroots_event::tag::RadrootsEventPtr
-pub radroots_event::tag::RadrootsEventPtr::id: alloc::string::String
-pub radroots_event::tag::RadrootsEventPtr::relays: core::option::Option<alloc::string::String>
-pub struct radroots_event::tag::RadrootsEventRef
-pub radroots_event::tag::RadrootsEventRef::author: radroots_identity::key::PublicKey
-pub radroots_event::tag::RadrootsEventRef::d_tag: core::option::Option<alloc::string::String>
-pub radroots_event::tag::RadrootsEventRef::id: alloc::string::String
-pub radroots_event::tag::RadrootsEventRef::kind: u32
-pub radroots_event::tag::RadrootsEventRef::relays: core::option::Option<alloc::vec::Vec<alloc::string::String>>
+pub struct radroots_event::tag::relay_hint::NostrRelayHint(_)
+impl radroots_event::tag::relay_hint::NostrRelayHint
+pub fn radroots_event::tag::relay_hint::NostrRelayHint::as_str(&self) -> &str
+pub fn radroots_event::tag::relay_hint::NostrRelayHint::into_string(self) -> alloc::string::String
+pub fn radroots_event::tag::relay_hint::NostrRelayHint::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::ParseError>
+impl core::convert::AsRef<str> for radroots_event::tag::relay_hint::NostrRelayHint
+pub fn radroots_event::tag::relay_hint::NostrRelayHint::as_ref(&self) -> &str
+impl core::convert::From<radroots_event::tag::relay_hint::NostrRelayHint> for alloc::string::String
+pub fn alloc::string::String::from(radroots_event::tag::relay_hint::NostrRelayHint) -> Self
+impl core::convert::TryFrom<&str> for radroots_event::tag::relay_hint::NostrRelayHint
+pub type radroots_event::tag::relay_hint::NostrRelayHint::Error = radroots_event::id::ParseError
+pub fn radroots_event::tag::relay_hint::NostrRelayHint::try_from(&str) -> core::result::Result<Self, Self::Error>
+impl core::convert::TryFrom<alloc::string::String> for radroots_event::tag::relay_hint::NostrRelayHint
+pub type radroots_event::tag::relay_hint::NostrRelayHint::Error = radroots_event::id::ParseError
+pub fn radroots_event::tag::relay_hint::NostrRelayHint::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
+impl core::fmt::Display for radroots_event::tag::relay_hint::NostrRelayHint
+pub fn radroots_event::tag::relay_hint::NostrRelayHint::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::tag::relay_hint::NostrRelayHint
+pub type radroots_event::tag::relay_hint::NostrRelayHint::Err = radroots_event::id::ParseError
+pub fn radroots_event::tag::relay_hint::NostrRelayHint::from_str(&str) -> core::result::Result<Self, Self::Err>
+pub struct radroots_event::tag::EventPtr
+pub radroots_event::tag::EventPtr::id: alloc::string::String
+pub radroots_event::tag::EventPtr::relays: core::option::Option<alloc::string::String>
+pub struct radroots_event::tag::EventRef
+pub radroots_event::tag::EventRef::author: radroots_identity::key::PublicKey
+pub radroots_event::tag::EventRef::d_tag: core::option::Option<alloc::string::String>
+pub radroots_event::tag::EventRef::id: alloc::string::String
+pub radroots_event::tag::EventRef::kind: u32
+pub radroots_event::tag::EventRef::relays: core::option::Option<alloc::vec::Vec<alloc::string::String>>
pub mod radroots_event::trade
pub mod radroots_event::trade::order
-pub enum radroots_event::trade::order::RadrootsCommercialDomain
-pub radroots_event::trade::order::RadrootsCommercialDomain::Listing
-pub enum radroots_event::trade::order::RadrootsOrderDecisionOutcome
-pub radroots_event::trade::order::RadrootsOrderDecisionOutcome::Accepted
-pub radroots_event::trade::order::RadrootsOrderDecisionOutcome::Accepted::inventory_commitments: alloc::vec::Vec<radroots_event::trade::order::RadrootsOrderInventoryCommitment>
-pub radroots_event::trade::order::RadrootsOrderDecisionOutcome::Declined
-pub radroots_event::trade::order::RadrootsOrderDecisionOutcome::Declined::reason: alloc::string::String
-impl radroots_event::trade::order::RadrootsOrderDecisionOutcome
-pub fn radroots_event::trade::order::RadrootsOrderDecisionOutcome::validate(&self) -> core::result::Result<(), radroots_event::trade::order::RadrootsOrderPayloadError>
-pub enum radroots_event::trade::order::RadrootsOrderEconomicActor
-pub radroots_event::trade::order::RadrootsOrderEconomicActor::Buyer
-pub radroots_event::trade::order::RadrootsOrderEconomicActor::Seller
-pub enum radroots_event::trade::order::RadrootsOrderEconomicEffect
-pub radroots_event::trade::order::RadrootsOrderEconomicEffect::Decrease
-pub radroots_event::trade::order::RadrootsOrderEconomicEffect::Increase
-pub enum radroots_event::trade::order::RadrootsOrderEconomicLineKind
-pub radroots_event::trade::order::RadrootsOrderEconomicLineKind::BasketAdjustment
-pub radroots_event::trade::order::RadrootsOrderEconomicLineKind::ListingDiscount
-pub radroots_event::trade::order::RadrootsOrderEconomicLineKind::RevisionAdjustment
-pub enum radroots_event::trade::order::RadrootsOrderEnvelopeError
-pub radroots_event::trade::order::RadrootsOrderEnvelopeError::InvalidVersion
-pub radroots_event::trade::order::RadrootsOrderEnvelopeError::InvalidVersion::expected: u16
-pub radroots_event::trade::order::RadrootsOrderEnvelopeError::InvalidVersion::got: u16
-pub radroots_event::trade::order::RadrootsOrderEnvelopeError::MissingListingAddr
-pub radroots_event::trade::order::RadrootsOrderEnvelopeError::MissingOrderId
-impl core::error::Error for radroots_event::trade::order::RadrootsOrderEnvelopeError
-impl core::fmt::Display for radroots_event::trade::order::RadrootsOrderEnvelopeError
-pub fn radroots_event::trade::order::RadrootsOrderEnvelopeError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub enum radroots_event::trade::order::RadrootsOrderEventType
-pub radroots_event::trade::order::RadrootsOrderEventType::OrderCancelled
-pub radroots_event::trade::order::RadrootsOrderEventType::OrderDecision
-pub radroots_event::trade::order::RadrootsOrderEventType::OrderRequested
-impl radroots_event::trade::order::RadrootsOrderEventType
-pub const fn radroots_event::trade::order::RadrootsOrderEventType::from_kind(u32) -> core::option::Option<Self>
-pub const fn radroots_event::trade::order::RadrootsOrderEventType::kind(self) -> u32
-pub const fn radroots_event::trade::order::RadrootsOrderEventType::name(self) -> &'static str
-pub const fn radroots_event::trade::order::RadrootsOrderEventType::requires_listing_snapshot(self) -> bool
-pub const fn radroots_event::trade::order::RadrootsOrderEventType::requires_order_chain(self) -> bool
-pub enum radroots_event::trade::order::RadrootsOrderPayloadError
-pub radroots_event::trade::order::RadrootsOrderPayloadError::EmptyField(&'static str)
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicCurrency
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicCurrency::field: &'static str
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicItemBinCount
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicItemBinCount::index: usize
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicItemPrice
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicItemPrice::index: usize
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicItemQuantity
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicItemQuantity::index: usize
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicItemSubtotal
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicItemSubtotal::index: usize
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicLineAmount
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicLineAmount::field: &'static str
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicLineAmount::index: usize
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicLineEffect
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicLineEffect::field: &'static str
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicLineEffect::index: usize
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicLineKind
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicLineKind::field: &'static str
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicLineKind::index: usize
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicOrdering
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicOrdering::field: &'static str
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicTotal
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidEconomicTotal::field: &'static str
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidInventoryCommitmentCount
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidInventoryCommitmentCount::index: usize
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidItemBinCount
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidItemBinCount::index: usize
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidOrderEconomicsBinding
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidOrderEconomicsBinding::field: &'static str
-pub radroots_event::trade::order::RadrootsOrderPayloadError::InvalidQuoteVersion
-pub radroots_event::trade::order::RadrootsOrderPayloadError::MissingEconomicItems
-pub radroots_event::trade::order::RadrootsOrderPayloadError::MissingInventoryCommitments
-pub radroots_event::trade::order::RadrootsOrderPayloadError::MissingItems
-impl core::error::Error for radroots_event::trade::order::RadrootsOrderPayloadError
-impl core::fmt::Display for radroots_event::trade::order::RadrootsOrderPayloadError
-pub fn radroots_event::trade::order::RadrootsOrderPayloadError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub enum radroots_event::trade::order::RadrootsOrderPricingBasis
-pub radroots_event::trade::order::RadrootsOrderPricingBasis::ListingEvent
-pub struct radroots_event::trade::order::RadrootsOrderCancellation
-pub radroots_event::trade::order::RadrootsOrderCancellation::buyer_pubkey: radroots_identity::key::PublicKey
-pub radroots_event::trade::order::RadrootsOrderCancellation::listing_addr: radroots_event::id::RadrootsClassifiedListingAddress
-pub radroots_event::trade::order::RadrootsOrderCancellation::order_id: radroots_event::id::RadrootsOrderId
-pub radroots_event::trade::order::RadrootsOrderCancellation::reason: alloc::string::String
-pub radroots_event::trade::order::RadrootsOrderCancellation::seller_pubkey: radroots_identity::key::PublicKey
-impl radroots_event::trade::order::RadrootsOrderCancellation
-pub fn radroots_event::trade::order::RadrootsOrderCancellation::validate(&self) -> core::result::Result<(), radroots_event::trade::order::RadrootsOrderPayloadError>
-pub struct radroots_event::trade::order::RadrootsOrderDecision
-pub radroots_event::trade::order::RadrootsOrderDecision::buyer_pubkey: radroots_identity::key::PublicKey
-pub radroots_event::trade::order::RadrootsOrderDecision::decision: radroots_event::trade::order::RadrootsOrderDecisionOutcome
-pub radroots_event::trade::order::RadrootsOrderDecision::listing_addr: radroots_event::id::RadrootsClassifiedListingAddress
-pub radroots_event::trade::order::RadrootsOrderDecision::order_id: radroots_event::id::RadrootsOrderId
-pub radroots_event::trade::order::RadrootsOrderDecision::seller_pubkey: radroots_identity::key::PublicKey
-impl radroots_event::trade::order::RadrootsOrderDecision
-pub fn radroots_event::trade::order::RadrootsOrderDecision::validate(&self) -> core::result::Result<(), radroots_event::trade::order::RadrootsOrderPayloadError>
-pub struct radroots_event::trade::order::RadrootsOrderEconomicItem
-pub radroots_event::trade::order::RadrootsOrderEconomicItem::bin_count: u32
-pub radroots_event::trade::order::RadrootsOrderEconomicItem::bin_id: radroots_event::id::RadrootsInventoryBinId
-pub radroots_event::trade::order::RadrootsOrderEconomicItem::line_subtotal: radroots_core::money::Money
-pub radroots_event::trade::order::RadrootsOrderEconomicItem::quantity_amount: radroots_core::decimal::Decimal
-pub radroots_event::trade::order::RadrootsOrderEconomicItem::quantity_unit: radroots_core::unit::Unit
-pub radroots_event::trade::order::RadrootsOrderEconomicItem::unit_price_amount: radroots_core::decimal::Decimal
-pub radroots_event::trade::order::RadrootsOrderEconomicItem::unit_price_currency: radroots_core::currency::Currency
-pub struct radroots_event::trade::order::RadrootsOrderEconomicLine
-pub radroots_event::trade::order::RadrootsOrderEconomicLine::actor: radroots_event::trade::order::RadrootsOrderEconomicActor
-pub radroots_event::trade::order::RadrootsOrderEconomicLine::amount: radroots_core::money::Money
-pub radroots_event::trade::order::RadrootsOrderEconomicLine::effect: radroots_event::trade::order::RadrootsOrderEconomicEffect
-pub radroots_event::trade::order::RadrootsOrderEconomicLine::id: alloc::string::String
-pub radroots_event::trade::order::RadrootsOrderEconomicLine::kind: radroots_event::trade::order::RadrootsOrderEconomicLineKind
-pub radroots_event::trade::order::RadrootsOrderEconomicLine::reason: alloc::string::String
-pub struct radroots_event::trade::order::RadrootsOrderEconomicTotals
-pub radroots_event::trade::order::RadrootsOrderEconomicTotals::adjustment_total: radroots_core::money::Money
-pub radroots_event::trade::order::RadrootsOrderEconomicTotals::discount_total: radroots_core::money::Money
-pub radroots_event::trade::order::RadrootsOrderEconomicTotals::subtotal: radroots_core::money::Money
-pub radroots_event::trade::order::RadrootsOrderEconomicTotals::total: radroots_core::money::Money
-pub struct radroots_event::trade::order::RadrootsOrderEconomics
-pub radroots_event::trade::order::RadrootsOrderEconomics::adjustment_total: radroots_core::money::Money
-pub radroots_event::trade::order::RadrootsOrderEconomics::adjustments: alloc::vec::Vec<radroots_event::trade::order::RadrootsOrderEconomicLine>
-pub radroots_event::trade::order::RadrootsOrderEconomics::currency: radroots_core::currency::Currency
-pub radroots_event::trade::order::RadrootsOrderEconomics::discount_total: radroots_core::money::Money
-pub radroots_event::trade::order::RadrootsOrderEconomics::discounts: alloc::vec::Vec<radroots_event::trade::order::RadrootsOrderEconomicLine>
-pub radroots_event::trade::order::RadrootsOrderEconomics::items: alloc::vec::Vec<radroots_event::trade::order::RadrootsOrderEconomicItem>
-pub radroots_event::trade::order::RadrootsOrderEconomics::pricing_basis: radroots_event::trade::order::RadrootsOrderPricingBasis
-pub radroots_event::trade::order::RadrootsOrderEconomics::quote_id: radroots_event::id::RadrootsOrderQuoteId
-pub radroots_event::trade::order::RadrootsOrderEconomics::quote_version: u32
-pub radroots_event::trade::order::RadrootsOrderEconomics::subtotal: radroots_core::money::Money
-pub radroots_event::trade::order::RadrootsOrderEconomics::total: radroots_core::money::Money
-impl radroots_event::trade::order::RadrootsOrderEconomics
-pub fn radroots_event::trade::order::RadrootsOrderEconomics::canonicalize(&mut self)
-pub fn radroots_event::trade::order::RadrootsOrderEconomics::canonicalized(&self) -> Self
-pub fn radroots_event::trade::order::RadrootsOrderEconomics::derived_totals(&self) -> core::result::Result<radroots_event::trade::order::RadrootsOrderEconomicTotals, radroots_event::trade::order::RadrootsOrderPayloadError>
-pub fn radroots_event::trade::order::RadrootsOrderEconomics::validate(&self) -> core::result::Result<(), radroots_event::trade::order::RadrootsOrderPayloadError>
-pub struct radroots_event::trade::order::RadrootsOrderEnvelope<T>
-pub radroots_event::trade::order::RadrootsOrderEnvelope::domain: radroots_event::trade::order::RadrootsCommercialDomain
-pub radroots_event::trade::order::RadrootsOrderEnvelope::listing_addr: alloc::string::String
-pub radroots_event::trade::order::RadrootsOrderEnvelope::message_type: radroots_event::trade::order::RadrootsOrderEventType
-pub radroots_event::trade::order::RadrootsOrderEnvelope::order_id: alloc::string::String
-pub radroots_event::trade::order::RadrootsOrderEnvelope::payload: T
-pub radroots_event::trade::order::RadrootsOrderEnvelope::version: u16
-impl<T> radroots_event::trade::order::RadrootsOrderEnvelope<T>
-pub fn radroots_event::trade::order::RadrootsOrderEnvelope<T>::new(radroots_event::trade::order::RadrootsOrderEventType, impl core::convert::Into<alloc::string::String>, impl core::convert::Into<alloc::string::String>, T) -> Self
-pub fn radroots_event::trade::order::RadrootsOrderEnvelope<T>::validate(&self) -> core::result::Result<(), radroots_event::trade::order::RadrootsOrderEnvelopeError>
-pub struct radroots_event::trade::order::RadrootsOrderInventoryCommitment
-pub radroots_event::trade::order::RadrootsOrderInventoryCommitment::bin_count: u32
-pub radroots_event::trade::order::RadrootsOrderInventoryCommitment::bin_id: radroots_event::id::RadrootsInventoryBinId
-pub struct radroots_event::trade::order::RadrootsOrderItem
-pub radroots_event::trade::order::RadrootsOrderItem::bin_count: u32
-pub radroots_event::trade::order::RadrootsOrderItem::bin_id: radroots_event::id::RadrootsInventoryBinId
-pub struct radroots_event::trade::order::RadrootsOrderRequest
-pub radroots_event::trade::order::RadrootsOrderRequest::buyer_pubkey: radroots_identity::key::PublicKey
-pub radroots_event::trade::order::RadrootsOrderRequest::economics: radroots_event::trade::order::RadrootsOrderEconomics
-pub radroots_event::trade::order::RadrootsOrderRequest::items: alloc::vec::Vec<radroots_event::trade::order::RadrootsOrderItem>
-pub radroots_event::trade::order::RadrootsOrderRequest::listing_addr: radroots_event::id::RadrootsClassifiedListingAddress
-pub radroots_event::trade::order::RadrootsOrderRequest::order_id: radroots_event::id::RadrootsOrderId
-pub radroots_event::trade::order::RadrootsOrderRequest::seller_pubkey: radroots_identity::key::PublicKey
-impl radroots_event::trade::order::RadrootsOrderRequest
-pub fn radroots_event::trade::order::RadrootsOrderRequest::validate(&self) -> core::result::Result<(), radroots_event::trade::order::RadrootsOrderPayloadError>
+pub enum radroots_event::trade::order::CommercialDomain
+pub radroots_event::trade::order::CommercialDomain::Listing
+pub enum radroots_event::trade::order::OrderDecisionOutcome
+pub radroots_event::trade::order::OrderDecisionOutcome::Accepted
+pub radroots_event::trade::order::OrderDecisionOutcome::Accepted::inventory_commitments: alloc::vec::Vec<radroots_event::trade::order::OrderInventoryCommitment>
+pub radroots_event::trade::order::OrderDecisionOutcome::Declined
+pub radroots_event::trade::order::OrderDecisionOutcome::Declined::reason: alloc::string::String
+impl radroots_event::trade::order::OrderDecisionOutcome
+pub fn radroots_event::trade::order::OrderDecisionOutcome::validate(&self) -> core::result::Result<(), radroots_event::trade::order::OrderPayloadError>
+pub enum radroots_event::trade::order::OrderEconomicActor
+pub radroots_event::trade::order::OrderEconomicActor::Buyer
+pub radroots_event::trade::order::OrderEconomicActor::Seller
+pub enum radroots_event::trade::order::OrderEconomicEffect
+pub radroots_event::trade::order::OrderEconomicEffect::Decrease
+pub radroots_event::trade::order::OrderEconomicEffect::Increase
+pub enum radroots_event::trade::order::OrderEconomicLineKind
+pub radroots_event::trade::order::OrderEconomicLineKind::BasketAdjustment
+pub radroots_event::trade::order::OrderEconomicLineKind::ListingDiscount
+pub radroots_event::trade::order::OrderEconomicLineKind::RevisionAdjustment
+pub enum radroots_event::trade::order::OrderEnvelopeError
+pub radroots_event::trade::order::OrderEnvelopeError::InvalidVersion
+pub radroots_event::trade::order::OrderEnvelopeError::InvalidVersion::expected: u16
+pub radroots_event::trade::order::OrderEnvelopeError::InvalidVersion::got: u16
+pub radroots_event::trade::order::OrderEnvelopeError::MissingListingAddr
+pub radroots_event::trade::order::OrderEnvelopeError::MissingOrderId
+impl core::error::Error for radroots_event::trade::order::OrderEnvelopeError
+impl core::fmt::Display for radroots_event::trade::order::OrderEnvelopeError
+pub fn radroots_event::trade::order::OrderEnvelopeError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub enum radroots_event::trade::order::OrderEventType
+pub radroots_event::trade::order::OrderEventType::OrderCancelled
+pub radroots_event::trade::order::OrderEventType::OrderDecision
+pub radroots_event::trade::order::OrderEventType::OrderRequested
+impl radroots_event::trade::order::OrderEventType
+pub const fn radroots_event::trade::order::OrderEventType::from_kind(u32) -> core::option::Option<Self>
+pub const fn radroots_event::trade::order::OrderEventType::kind(self) -> u32
+pub const fn radroots_event::trade::order::OrderEventType::name(self) -> &'static str
+pub const fn radroots_event::trade::order::OrderEventType::requires_listing_snapshot(self) -> bool
+pub const fn radroots_event::trade::order::OrderEventType::requires_order_chain(self) -> bool
+pub enum radroots_event::trade::order::OrderPayloadError
+pub radroots_event::trade::order::OrderPayloadError::EmptyField(&'static str)
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicCurrency
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicCurrency::field: &'static str
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicItemBinCount
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicItemBinCount::index: usize
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicItemPrice
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicItemPrice::index: usize
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicItemQuantity
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicItemQuantity::index: usize
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicItemSubtotal
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicItemSubtotal::index: usize
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicLineAmount
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicLineAmount::field: &'static str
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicLineAmount::index: usize
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicLineEffect
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicLineEffect::field: &'static str
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicLineEffect::index: usize
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicLineKind
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicLineKind::field: &'static str
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicLineKind::index: usize
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicOrdering
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicOrdering::field: &'static str
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicTotal
+pub radroots_event::trade::order::OrderPayloadError::InvalidEconomicTotal::field: &'static str
+pub radroots_event::trade::order::OrderPayloadError::InvalidInventoryCommitmentCount
+pub radroots_event::trade::order::OrderPayloadError::InvalidInventoryCommitmentCount::index: usize
+pub radroots_event::trade::order::OrderPayloadError::InvalidItemBinCount
+pub radroots_event::trade::order::OrderPayloadError::InvalidItemBinCount::index: usize
+pub radroots_event::trade::order::OrderPayloadError::InvalidOrderEconomicsBinding
+pub radroots_event::trade::order::OrderPayloadError::InvalidOrderEconomicsBinding::field: &'static str
+pub radroots_event::trade::order::OrderPayloadError::InvalidQuoteVersion
+pub radroots_event::trade::order::OrderPayloadError::MissingEconomicItems
+pub radroots_event::trade::order::OrderPayloadError::MissingInventoryCommitments
+pub radroots_event::trade::order::OrderPayloadError::MissingItems
+impl core::error::Error for radroots_event::trade::order::OrderPayloadError
+impl core::fmt::Display for radroots_event::trade::order::OrderPayloadError
+pub fn radroots_event::trade::order::OrderPayloadError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub enum radroots_event::trade::order::OrderPricingBasis
+pub radroots_event::trade::order::OrderPricingBasis::ListingEvent
+pub struct radroots_event::trade::order::OrderCancellation
+pub radroots_event::trade::order::OrderCancellation::buyer_pubkey: radroots_identity::key::PublicKey
+pub radroots_event::trade::order::OrderCancellation::listing_addr: radroots_event::id::ClassifiedListingAddress
+pub radroots_event::trade::order::OrderCancellation::order_id: radroots_event::id::OrderId
+pub radroots_event::trade::order::OrderCancellation::reason: alloc::string::String
+pub radroots_event::trade::order::OrderCancellation::seller_pubkey: radroots_identity::key::PublicKey
+impl radroots_event::trade::order::OrderCancellation
+pub fn radroots_event::trade::order::OrderCancellation::validate(&self) -> core::result::Result<(), radroots_event::trade::order::OrderPayloadError>
+pub struct radroots_event::trade::order::OrderDecision
+pub radroots_event::trade::order::OrderDecision::buyer_pubkey: radroots_identity::key::PublicKey
+pub radroots_event::trade::order::OrderDecision::decision: radroots_event::trade::order::OrderDecisionOutcome
+pub radroots_event::trade::order::OrderDecision::listing_addr: radroots_event::id::ClassifiedListingAddress
+pub radroots_event::trade::order::OrderDecision::order_id: radroots_event::id::OrderId
+pub radroots_event::trade::order::OrderDecision::seller_pubkey: radroots_identity::key::PublicKey
+impl radroots_event::trade::order::OrderDecision
+pub fn radroots_event::trade::order::OrderDecision::validate(&self) -> core::result::Result<(), radroots_event::trade::order::OrderPayloadError>
+pub struct radroots_event::trade::order::OrderEconomicItem
+pub radroots_event::trade::order::OrderEconomicItem::bin_count: u32
+pub radroots_event::trade::order::OrderEconomicItem::bin_id: radroots_event::id::InventoryBinId
+pub radroots_event::trade::order::OrderEconomicItem::line_subtotal: radroots_core::money::Money
+pub radroots_event::trade::order::OrderEconomicItem::quantity_amount: radroots_core::decimal::Decimal
+pub radroots_event::trade::order::OrderEconomicItem::quantity_unit: radroots_core::unit::Unit
+pub radroots_event::trade::order::OrderEconomicItem::unit_price_amount: radroots_core::decimal::Decimal
+pub radroots_event::trade::order::OrderEconomicItem::unit_price_currency: radroots_core::currency::Currency
+pub struct radroots_event::trade::order::OrderEconomicLine
+pub radroots_event::trade::order::OrderEconomicLine::actor: radroots_event::trade::order::OrderEconomicActor
+pub radroots_event::trade::order::OrderEconomicLine::amount: radroots_core::money::Money
+pub radroots_event::trade::order::OrderEconomicLine::effect: radroots_event::trade::order::OrderEconomicEffect
+pub radroots_event::trade::order::OrderEconomicLine::id: alloc::string::String
+pub radroots_event::trade::order::OrderEconomicLine::kind: radroots_event::trade::order::OrderEconomicLineKind
+pub radroots_event::trade::order::OrderEconomicLine::reason: alloc::string::String
+pub struct radroots_event::trade::order::OrderEconomicTotals
+pub radroots_event::trade::order::OrderEconomicTotals::adjustment_total: radroots_core::money::Money
+pub radroots_event::trade::order::OrderEconomicTotals::discount_total: radroots_core::money::Money
+pub radroots_event::trade::order::OrderEconomicTotals::subtotal: radroots_core::money::Money
+pub radroots_event::trade::order::OrderEconomicTotals::total: radroots_core::money::Money
+pub struct radroots_event::trade::order::OrderEconomics
+pub radroots_event::trade::order::OrderEconomics::adjustment_total: radroots_core::money::Money
+pub radroots_event::trade::order::OrderEconomics::adjustments: alloc::vec::Vec<radroots_event::trade::order::OrderEconomicLine>
+pub radroots_event::trade::order::OrderEconomics::currency: radroots_core::currency::Currency
+pub radroots_event::trade::order::OrderEconomics::discount_total: radroots_core::money::Money
+pub radroots_event::trade::order::OrderEconomics::discounts: alloc::vec::Vec<radroots_event::trade::order::OrderEconomicLine>
+pub radroots_event::trade::order::OrderEconomics::items: alloc::vec::Vec<radroots_event::trade::order::OrderEconomicItem>
+pub radroots_event::trade::order::OrderEconomics::pricing_basis: radroots_event::trade::order::OrderPricingBasis
+pub radroots_event::trade::order::OrderEconomics::quote_id: radroots_event::id::OrderQuoteId
+pub radroots_event::trade::order::OrderEconomics::quote_version: u32
+pub radroots_event::trade::order::OrderEconomics::subtotal: radroots_core::money::Money
+pub radroots_event::trade::order::OrderEconomics::total: radroots_core::money::Money
+impl radroots_event::trade::order::OrderEconomics
+pub fn radroots_event::trade::order::OrderEconomics::canonicalize(&mut self)
+pub fn radroots_event::trade::order::OrderEconomics::canonicalized(&self) -> Self
+pub fn radroots_event::trade::order::OrderEconomics::derived_totals(&self) -> core::result::Result<radroots_event::trade::order::OrderEconomicTotals, radroots_event::trade::order::OrderPayloadError>
+pub fn radroots_event::trade::order::OrderEconomics::validate(&self) -> core::result::Result<(), radroots_event::trade::order::OrderPayloadError>
+pub struct radroots_event::trade::order::OrderEnvelope<T>
+pub radroots_event::trade::order::OrderEnvelope::domain: radroots_event::trade::order::CommercialDomain
+pub radroots_event::trade::order::OrderEnvelope::listing_addr: alloc::string::String
+pub radroots_event::trade::order::OrderEnvelope::message_type: radroots_event::trade::order::OrderEventType
+pub radroots_event::trade::order::OrderEnvelope::order_id: alloc::string::String
+pub radroots_event::trade::order::OrderEnvelope::payload: T
+pub radroots_event::trade::order::OrderEnvelope::version: u16
+impl<T> radroots_event::trade::order::OrderEnvelope<T>
+pub fn radroots_event::trade::order::OrderEnvelope<T>::new(radroots_event::trade::order::OrderEventType, impl core::convert::Into<alloc::string::String>, impl core::convert::Into<alloc::string::String>, T) -> Self
+pub fn radroots_event::trade::order::OrderEnvelope<T>::validate(&self) -> core::result::Result<(), radroots_event::trade::order::OrderEnvelopeError>
+pub struct radroots_event::trade::order::OrderInventoryCommitment
+pub radroots_event::trade::order::OrderInventoryCommitment::bin_count: u32
+pub radroots_event::trade::order::OrderInventoryCommitment::bin_id: radroots_event::id::InventoryBinId
+pub struct radroots_event::trade::order::OrderItem
+pub radroots_event::trade::order::OrderItem::bin_count: u32
+pub radroots_event::trade::order::OrderItem::bin_id: radroots_event::id::InventoryBinId
+pub struct radroots_event::trade::order::OrderRequest
+pub radroots_event::trade::order::OrderRequest::buyer_pubkey: radroots_identity::key::PublicKey
+pub radroots_event::trade::order::OrderRequest::economics: radroots_event::trade::order::OrderEconomics
+pub radroots_event::trade::order::OrderRequest::items: alloc::vec::Vec<radroots_event::trade::order::OrderItem>
+pub radroots_event::trade::order::OrderRequest::listing_addr: radroots_event::id::ClassifiedListingAddress
+pub radroots_event::trade::order::OrderRequest::order_id: radroots_event::id::OrderId
+pub radroots_event::trade::order::OrderRequest::seller_pubkey: radroots_identity::key::PublicKey
+impl radroots_event::trade::order::OrderRequest
+pub fn radroots_event::trade::order::OrderRequest::validate(&self) -> core::result::Result<(), radroots_event::trade::order::OrderPayloadError>
pub const radroots_event::trade::order::RADROOTS_COMMERCIAL_LISTING_DOMAIN: &str
pub const radroots_event::trade::order::RADROOTS_ORDER_ENVELOPE_VERSION: u16
pub mod radroots_event::trade::order_economics
-pub enum radroots_event::trade::order_economics::RadrootsOrderEconomicActor
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicActor::Buyer
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicActor::Seller
-pub enum radroots_event::trade::order_economics::RadrootsOrderEconomicEffect
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicEffect::Decrease
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicEffect::Increase
-pub enum radroots_event::trade::order_economics::RadrootsOrderEconomicLineKind
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicLineKind::BasketAdjustment
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicLineKind::ListingDiscount
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicLineKind::RevisionAdjustment
-pub enum radroots_event::trade::order_economics::RadrootsOrderPricingBasis
-pub radroots_event::trade::order_economics::RadrootsOrderPricingBasis::ListingEvent
-pub struct radroots_event::trade::order_economics::RadrootsOrderEconomicItem
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicItem::bin_count: u32
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicItem::bin_id: radroots_event::id::RadrootsInventoryBinId
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicItem::line_subtotal: radroots_core::money::Money
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicItem::quantity_amount: radroots_core::decimal::Decimal
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicItem::quantity_unit: radroots_core::unit::Unit
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicItem::unit_price_amount: radroots_core::decimal::Decimal
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicItem::unit_price_currency: radroots_core::currency::Currency
-pub struct radroots_event::trade::order_economics::RadrootsOrderEconomicLine
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicLine::actor: radroots_event::trade::order::RadrootsOrderEconomicActor
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicLine::amount: radroots_core::money::Money
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicLine::effect: radroots_event::trade::order::RadrootsOrderEconomicEffect
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicLine::id: alloc::string::String
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicLine::kind: radroots_event::trade::order::RadrootsOrderEconomicLineKind
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicLine::reason: alloc::string::String
-pub struct radroots_event::trade::order_economics::RadrootsOrderEconomicTotals
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicTotals::adjustment_total: radroots_core::money::Money
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicTotals::discount_total: radroots_core::money::Money
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicTotals::subtotal: radroots_core::money::Money
-pub radroots_event::trade::order_economics::RadrootsOrderEconomicTotals::total: radroots_core::money::Money
-pub struct radroots_event::trade::order_economics::RadrootsOrderEconomics
-pub radroots_event::trade::order_economics::RadrootsOrderEconomics::adjustment_total: radroots_core::money::Money
-pub radroots_event::trade::order_economics::RadrootsOrderEconomics::adjustments: alloc::vec::Vec<radroots_event::trade::order::RadrootsOrderEconomicLine>
-pub radroots_event::trade::order_economics::RadrootsOrderEconomics::currency: radroots_core::currency::Currency
-pub radroots_event::trade::order_economics::RadrootsOrderEconomics::discount_total: radroots_core::money::Money
-pub radroots_event::trade::order_economics::RadrootsOrderEconomics::discounts: alloc::vec::Vec<radroots_event::trade::order::RadrootsOrderEconomicLine>
-pub radroots_event::trade::order_economics::RadrootsOrderEconomics::items: alloc::vec::Vec<radroots_event::trade::order::RadrootsOrderEconomicItem>
-pub radroots_event::trade::order_economics::RadrootsOrderEconomics::pricing_basis: radroots_event::trade::order::RadrootsOrderPricingBasis
-pub radroots_event::trade::order_economics::RadrootsOrderEconomics::quote_id: radroots_event::id::RadrootsOrderQuoteId
-pub radroots_event::trade::order_economics::RadrootsOrderEconomics::quote_version: u32
-pub radroots_event::trade::order_economics::RadrootsOrderEconomics::subtotal: radroots_core::money::Money
-pub radroots_event::trade::order_economics::RadrootsOrderEconomics::total: radroots_core::money::Money
-impl radroots_event::trade::order::RadrootsOrderEconomics
-pub fn radroots_event::trade::order::RadrootsOrderEconomics::canonicalize(&mut self)
-pub fn radroots_event::trade::order::RadrootsOrderEconomics::canonicalized(&self) -> Self
-pub fn radroots_event::trade::order::RadrootsOrderEconomics::derived_totals(&self) -> core::result::Result<radroots_event::trade::order::RadrootsOrderEconomicTotals, radroots_event::trade::order::RadrootsOrderPayloadError>
-pub fn radroots_event::trade::order::RadrootsOrderEconomics::validate(&self) -> core::result::Result<(), radroots_event::trade::order::RadrootsOrderPayloadError>
-pub struct radroots_event::trade::order_economics::RadrootsOrderItem
-pub radroots_event::trade::order_economics::RadrootsOrderItem::bin_count: u32
-pub radroots_event::trade::order_economics::RadrootsOrderItem::bin_id: radroots_event::id::RadrootsInventoryBinId
+pub enum radroots_event::trade::order_economics::OrderEconomicActor
+pub radroots_event::trade::order_economics::OrderEconomicActor::Buyer
+pub radroots_event::trade::order_economics::OrderEconomicActor::Seller
+pub enum radroots_event::trade::order_economics::OrderEconomicEffect
+pub radroots_event::trade::order_economics::OrderEconomicEffect::Decrease
+pub radroots_event::trade::order_economics::OrderEconomicEffect::Increase
+pub enum radroots_event::trade::order_economics::OrderEconomicLineKind
+pub radroots_event::trade::order_economics::OrderEconomicLineKind::BasketAdjustment
+pub radroots_event::trade::order_economics::OrderEconomicLineKind::ListingDiscount
+pub radroots_event::trade::order_economics::OrderEconomicLineKind::RevisionAdjustment
+pub enum radroots_event::trade::order_economics::OrderPricingBasis
+pub radroots_event::trade::order_economics::OrderPricingBasis::ListingEvent
+pub struct radroots_event::trade::order_economics::OrderEconomicItem
+pub radroots_event::trade::order_economics::OrderEconomicItem::bin_count: u32
+pub radroots_event::trade::order_economics::OrderEconomicItem::bin_id: radroots_event::id::InventoryBinId
+pub radroots_event::trade::order_economics::OrderEconomicItem::line_subtotal: radroots_core::money::Money
+pub radroots_event::trade::order_economics::OrderEconomicItem::quantity_amount: radroots_core::decimal::Decimal
+pub radroots_event::trade::order_economics::OrderEconomicItem::quantity_unit: radroots_core::unit::Unit
+pub radroots_event::trade::order_economics::OrderEconomicItem::unit_price_amount: radroots_core::decimal::Decimal
+pub radroots_event::trade::order_economics::OrderEconomicItem::unit_price_currency: radroots_core::currency::Currency
+pub struct radroots_event::trade::order_economics::OrderEconomicLine
+pub radroots_event::trade::order_economics::OrderEconomicLine::actor: radroots_event::trade::order::OrderEconomicActor
+pub radroots_event::trade::order_economics::OrderEconomicLine::amount: radroots_core::money::Money
+pub radroots_event::trade::order_economics::OrderEconomicLine::effect: radroots_event::trade::order::OrderEconomicEffect
+pub radroots_event::trade::order_economics::OrderEconomicLine::id: alloc::string::String
+pub radroots_event::trade::order_economics::OrderEconomicLine::kind: radroots_event::trade::order::OrderEconomicLineKind
+pub radroots_event::trade::order_economics::OrderEconomicLine::reason: alloc::string::String
+pub struct radroots_event::trade::order_economics::OrderEconomicTotals
+pub radroots_event::trade::order_economics::OrderEconomicTotals::adjustment_total: radroots_core::money::Money
+pub radroots_event::trade::order_economics::OrderEconomicTotals::discount_total: radroots_core::money::Money
+pub radroots_event::trade::order_economics::OrderEconomicTotals::subtotal: radroots_core::money::Money
+pub radroots_event::trade::order_economics::OrderEconomicTotals::total: radroots_core::money::Money
+pub struct radroots_event::trade::order_economics::OrderEconomics
+pub radroots_event::trade::order_economics::OrderEconomics::adjustment_total: radroots_core::money::Money
+pub radroots_event::trade::order_economics::OrderEconomics::adjustments: alloc::vec::Vec<radroots_event::trade::order::OrderEconomicLine>
+pub radroots_event::trade::order_economics::OrderEconomics::currency: radroots_core::currency::Currency
+pub radroots_event::trade::order_economics::OrderEconomics::discount_total: radroots_core::money::Money
+pub radroots_event::trade::order_economics::OrderEconomics::discounts: alloc::vec::Vec<radroots_event::trade::order::OrderEconomicLine>
+pub radroots_event::trade::order_economics::OrderEconomics::items: alloc::vec::Vec<radroots_event::trade::order::OrderEconomicItem>
+pub radroots_event::trade::order_economics::OrderEconomics::pricing_basis: radroots_event::trade::order::OrderPricingBasis
+pub radroots_event::trade::order_economics::OrderEconomics::quote_id: radroots_event::id::OrderQuoteId
+pub radroots_event::trade::order_economics::OrderEconomics::quote_version: u32
+pub radroots_event::trade::order_economics::OrderEconomics::subtotal: radroots_core::money::Money
+pub radroots_event::trade::order_economics::OrderEconomics::total: radroots_core::money::Money
+impl radroots_event::trade::order::OrderEconomics
+pub fn radroots_event::trade::order::OrderEconomics::canonicalize(&mut self)
+pub fn radroots_event::trade::order::OrderEconomics::canonicalized(&self) -> Self
+pub fn radroots_event::trade::order::OrderEconomics::derived_totals(&self) -> core::result::Result<radroots_event::trade::order::OrderEconomicTotals, radroots_event::trade::order::OrderPayloadError>
+pub fn radroots_event::trade::order::OrderEconomics::validate(&self) -> core::result::Result<(), radroots_event::trade::order::OrderPayloadError>
+pub struct radroots_event::trade::order_economics::OrderItem
+pub radroots_event::trade::order_economics::OrderItem::bin_count: u32
+pub radroots_event::trade::order_economics::OrderItem::bin_id: radroots_event::id::InventoryBinId
pub mod radroots_event::trade::validation
-pub enum radroots_event::trade::validation::RadrootsOperationalListingValidationError
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::InvalidBin
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::InvalidInventory
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::InvalidKind
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::InvalidKind::kind: u32
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::InvalidLocationGeohash
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::InvalidPrice
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::InvalidProfile
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::InvalidSeller
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::ListingEventFetchFailed
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::ListingEventFetchFailed::listing_addr: alloc::string::String
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::ListingEventNotFound
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::ListingEventNotFound::listing_addr: alloc::string::String
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::MissingAvailability
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::MissingBins
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::MissingDeliveryMethod
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::MissingDescription
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::MissingFarmProfile
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::MissingFarmRecord
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::MissingInventory
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::MissingListingId
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::MissingLocation
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::MissingLocationGeohash
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::MissingLocationLocality
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::MissingPrice
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::MissingPrimaryBin
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::MissingProductType
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::MissingTitle
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::ParseError
-pub radroots_event::trade::validation::RadrootsOperationalListingValidationError::ParseError::error: radroots_event::listing::operational::RadrootsOperationalListingParseError
-impl core::error::Error for radroots_event::trade::validation::RadrootsOperationalListingValidationError
-impl core::fmt::Display for radroots_event::trade::validation::RadrootsOperationalListingValidationError
-pub fn radroots_event::trade::validation::RadrootsOperationalListingValidationError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub enum radroots_event::trade::RadrootsTradeDecisionV1
-pub radroots_event::trade::RadrootsTradeDecisionV1::Accepted
-pub radroots_event::trade::RadrootsTradeDecisionV1::Accepted::reservation_assertion: core::option::Option<radroots_event::trade::RadrootsSellerReservationAssertionV1>
-pub radroots_event::trade::RadrootsTradeDecisionV1::Declined
-pub radroots_event::trade::RadrootsTradeDecisionV1::Declined::reason: alloc::string::String
-impl radroots_event::trade::RadrootsTradeDecisionV1
-pub fn radroots_event::trade::RadrootsTradeDecisionV1::validate(&self) -> core::result::Result<(), radroots_event::trade::RadrootsTradeProtocolError>
-pub enum radroots_event::trade::RadrootsTradeMutationBodyV1
-pub radroots_event::trade::RadrootsTradeMutationBodyV1::Cancellation
-pub radroots_event::trade::RadrootsTradeMutationBodyV1::Cancellation::reason: alloc::string::String
-pub radroots_event::trade::RadrootsTradeMutationBodyV1::Cancellation::target_candidate_id: core::option::Option<radroots_event::id::RadrootsTradeCandidateId>
-pub radroots_event::trade::RadrootsTradeMutationBodyV1::Cancellation::target_claim_mutation_id: core::option::Option<radroots_event::id::RadrootsTradeMutationId>
-pub radroots_event::trade::RadrootsTradeMutationBodyV1::Decision
-pub radroots_event::trade::RadrootsTradeMutationBodyV1::Decision::candidate_id: radroots_event::id::RadrootsTradeCandidateId
-pub radroots_event::trade::RadrootsTradeMutationBodyV1::Decision::decision: radroots_event::trade::RadrootsTradeDecisionV1
-pub radroots_event::trade::RadrootsTradeMutationBodyV1::Decision::proposal_mutation_id: radroots_event::id::RadrootsTradeMutationId
-pub radroots_event::trade::RadrootsTradeMutationBodyV1::Proposal
-pub radroots_event::trade::RadrootsTradeMutationBodyV1::Proposal::candidate: radroots_event::trade::RadrootsTradeCandidateTermsV1
-pub radroots_event::trade::RadrootsTradeMutationBodyV1::RevisionDecision
-pub radroots_event::trade::RadrootsTradeMutationBodyV1::RevisionDecision::candidate_id: radroots_event::id::RadrootsTradeCandidateId
-pub radroots_event::trade::RadrootsTradeMutationBodyV1::RevisionDecision::decision: radroots_event::trade::RadrootsTradeDecisionV1
-pub radroots_event::trade::RadrootsTradeMutationBodyV1::RevisionDecision::proposal_mutation_id: radroots_event::id::RadrootsTradeMutationId
-pub radroots_event::trade::RadrootsTradeMutationBodyV1::RevisionProposal
-pub radroots_event::trade::RadrootsTradeMutationBodyV1::RevisionProposal::candidate: radroots_event::trade::RadrootsTradeCandidateTermsV1
-impl radroots_event::trade::RadrootsTradeMutationBodyV1
-pub const fn radroots_event::trade::RadrootsTradeMutationBodyV1::mutation_kind(&self) -> radroots_event::trade::RadrootsTradeMutationKindV1
-pub fn radroots_event::trade::RadrootsTradeMutationBodyV1::validate(&self) -> core::result::Result<(), radroots_event::trade::RadrootsTradeProtocolError>
-pub enum radroots_event::trade::RadrootsTradeMutationKindV1
-pub radroots_event::trade::RadrootsTradeMutationKindV1::Cancellation
-pub radroots_event::trade::RadrootsTradeMutationKindV1::Decision
-pub radroots_event::trade::RadrootsTradeMutationKindV1::Proposal
-pub radroots_event::trade::RadrootsTradeMutationKindV1::RevisionDecision
-pub radroots_event::trade::RadrootsTradeMutationKindV1::RevisionProposal
-impl radroots_event::trade::RadrootsTradeMutationKindV1
-pub const fn radroots_event::trade::RadrootsTradeMutationKindV1::contract_id(self) -> &'static str
-pub const fn radroots_event::trade::RadrootsTradeMutationKindV1::nostr_kind(self) -> u32
-pub enum radroots_event::trade::RadrootsTradeProtocolError
-pub radroots_event::trade::RadrootsTradeProtocolError::CandidateIdMismatch
-pub radroots_event::trade::RadrootsTradeProtocolError::CandidateIdMismatch::computed: alloc::string::String
-pub radroots_event::trade::RadrootsTradeProtocolError::CandidateIdMismatch::declared: alloc::string::String
-pub radroots_event::trade::RadrootsTradeProtocolError::ContentTooLarge
-pub radroots_event::trade::RadrootsTradeProtocolError::ContentTooLarge::actual: usize
-pub radroots_event::trade::RadrootsTradeProtocolError::ContentTooLarge::max: usize
-pub radroots_event::trade::RadrootsTradeProtocolError::ContractMismatch
-pub radroots_event::trade::RadrootsTradeProtocolError::ContractMismatch::actual: alloc::string::String
-pub radroots_event::trade::RadrootsTradeProtocolError::ContractMismatch::expected: &'static str
-pub radroots_event::trade::RadrootsTradeProtocolError::DuplicateKey(alloc::string::String)
-pub radroots_event::trade::RadrootsTradeProtocolError::DuplicateParent
-pub radroots_event::trade::RadrootsTradeProtocolError::EmptyField(&'static str)
-pub radroots_event::trade::RadrootsTradeProtocolError::InvalidField(&'static str)
-pub radroots_event::trade::RadrootsTradeProtocolError::InvalidIdentifier
-pub radroots_event::trade::RadrootsTradeProtocolError::InvalidIdentifier::error: radroots_event::id::RadrootsIdParseError
-pub radroots_event::trade::RadrootsTradeProtocolError::InvalidIdentifier::field: &'static str
-pub radroots_event::trade::RadrootsTradeProtocolError::InvalidInitialParents
-pub radroots_event::trade::RadrootsTradeProtocolError::InvalidJson(alloc::string::String)
-pub radroots_event::trade::RadrootsTradeProtocolError::InvalidSchemaVersion
-pub radroots_event::trade::RadrootsTradeProtocolError::InvalidSchemaVersion::actual: u16
-pub radroots_event::trade::RadrootsTradeProtocolError::InvalidSchemaVersion::expected: u16
-pub radroots_event::trade::RadrootsTradeProtocolError::InvalidTimeRange
-pub radroots_event::trade::RadrootsTradeProtocolError::MissingCancellationTarget
-pub radroots_event::trade::RadrootsTradeProtocolError::MissingLines
-pub radroots_event::trade::RadrootsTradeProtocolError::MissingParentMutation
-pub radroots_event::trade::RadrootsTradeProtocolError::MissingReservationCommitments
-pub radroots_event::trade::RadrootsTradeProtocolError::MutationIdMismatch
-pub radroots_event::trade::RadrootsTradeProtocolError::MutationIdMismatch::computed: alloc::string::String
-pub radroots_event::trade::RadrootsTradeProtocolError::MutationIdMismatch::declared: alloc::string::String
-pub radroots_event::trade::RadrootsTradeProtocolError::NonCanonicalJson
-pub radroots_event::trade::RadrootsTradeProtocolError::SelfParent
-pub radroots_event::trade::RadrootsTradeProtocolError::TooManyAdjustments
-pub radroots_event::trade::RadrootsTradeProtocolError::TooManyAdjustments::actual: usize
-pub radroots_event::trade::RadrootsTradeProtocolError::TooManyAdjustments::max: usize
-pub radroots_event::trade::RadrootsTradeProtocolError::TooManyLines
-pub radroots_event::trade::RadrootsTradeProtocolError::TooManyLines::actual: usize
-pub radroots_event::trade::RadrootsTradeProtocolError::TooManyLines::max: usize
-pub radroots_event::trade::RadrootsTradeProtocolError::TooManyParents
-pub radroots_event::trade::RadrootsTradeProtocolError::TooManyParents::actual: usize
-pub radroots_event::trade::RadrootsTradeProtocolError::TooManyParents::max: usize
-pub radroots_event::trade::RadrootsTradeProtocolError::UnsortedParents
-pub radroots_event::trade::RadrootsTradeProtocolError::UnsupportedNumber
-impl core::error::Error for radroots_event::trade::RadrootsTradeProtocolError
-impl core::fmt::Display for radroots_event::trade::RadrootsTradeProtocolError
-pub fn radroots_event::trade::RadrootsTradeProtocolError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub enum radroots_event::trade::validation::OperationalListingValidationError
+pub radroots_event::trade::validation::OperationalListingValidationError::InvalidBin
+pub radroots_event::trade::validation::OperationalListingValidationError::InvalidInventory
+pub radroots_event::trade::validation::OperationalListingValidationError::InvalidKind
+pub radroots_event::trade::validation::OperationalListingValidationError::InvalidKind::kind: u32
+pub radroots_event::trade::validation::OperationalListingValidationError::InvalidLocationGeohash
+pub radroots_event::trade::validation::OperationalListingValidationError::InvalidPrice
+pub radroots_event::trade::validation::OperationalListingValidationError::InvalidProfile
+pub radroots_event::trade::validation::OperationalListingValidationError::InvalidSeller
+pub radroots_event::trade::validation::OperationalListingValidationError::ListingEventFetchFailed
+pub radroots_event::trade::validation::OperationalListingValidationError::ListingEventFetchFailed::listing_addr: alloc::string::String
+pub radroots_event::trade::validation::OperationalListingValidationError::ListingEventNotFound
+pub radroots_event::trade::validation::OperationalListingValidationError::ListingEventNotFound::listing_addr: alloc::string::String
+pub radroots_event::trade::validation::OperationalListingValidationError::MissingAvailability
+pub radroots_event::trade::validation::OperationalListingValidationError::MissingBins
+pub radroots_event::trade::validation::OperationalListingValidationError::MissingDeliveryMethod
+pub radroots_event::trade::validation::OperationalListingValidationError::MissingDescription
+pub radroots_event::trade::validation::OperationalListingValidationError::MissingFarmProfile
+pub radroots_event::trade::validation::OperationalListingValidationError::MissingFarmRecord
+pub radroots_event::trade::validation::OperationalListingValidationError::MissingInventory
+pub radroots_event::trade::validation::OperationalListingValidationError::MissingListingId
+pub radroots_event::trade::validation::OperationalListingValidationError::MissingLocation
+pub radroots_event::trade::validation::OperationalListingValidationError::MissingLocationGeohash
+pub radroots_event::trade::validation::OperationalListingValidationError::MissingLocationLocality
+pub radroots_event::trade::validation::OperationalListingValidationError::MissingPrice
+pub radroots_event::trade::validation::OperationalListingValidationError::MissingPrimaryBin
+pub radroots_event::trade::validation::OperationalListingValidationError::MissingProductType
+pub radroots_event::trade::validation::OperationalListingValidationError::MissingTitle
+pub radroots_event::trade::validation::OperationalListingValidationError::ParseError
+pub radroots_event::trade::validation::OperationalListingValidationError::ParseError::error: radroots_event::listing::operational::OperationalListingParseError
+impl core::error::Error for radroots_event::trade::validation::OperationalListingValidationError
+impl core::fmt::Display for radroots_event::trade::validation::OperationalListingValidationError
+pub fn radroots_event::trade::validation::OperationalListingValidationError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub enum radroots_event::trade::TradeDecisionV1
+pub radroots_event::trade::TradeDecisionV1::Accepted
+pub radroots_event::trade::TradeDecisionV1::Accepted::reservation_assertion: core::option::Option<radroots_event::trade::SellerReservationAssertionV1>
+pub radroots_event::trade::TradeDecisionV1::Declined
+pub radroots_event::trade::TradeDecisionV1::Declined::reason: alloc::string::String
+impl radroots_event::trade::TradeDecisionV1
+pub fn radroots_event::trade::TradeDecisionV1::validate(&self) -> core::result::Result<(), radroots_event::trade::TradeProtocolError>
+pub enum radroots_event::trade::TradeMutationBodyV1
+pub radroots_event::trade::TradeMutationBodyV1::Cancellation
+pub radroots_event::trade::TradeMutationBodyV1::Cancellation::reason: alloc::string::String
+pub radroots_event::trade::TradeMutationBodyV1::Cancellation::target_candidate_id: core::option::Option<radroots_event::id::CandidateId>
+pub radroots_event::trade::TradeMutationBodyV1::Cancellation::target_claim_mutation_id: core::option::Option<radroots_event::id::MutationId>
+pub radroots_event::trade::TradeMutationBodyV1::Decision
+pub radroots_event::trade::TradeMutationBodyV1::Decision::candidate_id: radroots_event::id::CandidateId
+pub radroots_event::trade::TradeMutationBodyV1::Decision::decision: radroots_event::trade::TradeDecisionV1
+pub radroots_event::trade::TradeMutationBodyV1::Decision::proposal_mutation_id: radroots_event::id::MutationId
+pub radroots_event::trade::TradeMutationBodyV1::Proposal
+pub radroots_event::trade::TradeMutationBodyV1::Proposal::candidate: radroots_event::trade::TradeCandidateTermsV1
+pub radroots_event::trade::TradeMutationBodyV1::RevisionDecision
+pub radroots_event::trade::TradeMutationBodyV1::RevisionDecision::candidate_id: radroots_event::id::CandidateId
+pub radroots_event::trade::TradeMutationBodyV1::RevisionDecision::decision: radroots_event::trade::TradeDecisionV1
+pub radroots_event::trade::TradeMutationBodyV1::RevisionDecision::proposal_mutation_id: radroots_event::id::MutationId
+pub radroots_event::trade::TradeMutationBodyV1::RevisionProposal
+pub radroots_event::trade::TradeMutationBodyV1::RevisionProposal::candidate: radroots_event::trade::TradeCandidateTermsV1
+impl radroots_event::trade::TradeMutationBodyV1
+pub const fn radroots_event::trade::TradeMutationBodyV1::mutation_kind(&self) -> radroots_event::trade::TradeMutationKindV1
+pub fn radroots_event::trade::TradeMutationBodyV1::validate(&self) -> core::result::Result<(), radroots_event::trade::TradeProtocolError>
+pub enum radroots_event::trade::TradeMutationKindV1
+pub radroots_event::trade::TradeMutationKindV1::Cancellation
+pub radroots_event::trade::TradeMutationKindV1::Decision
+pub radroots_event::trade::TradeMutationKindV1::Proposal
+pub radroots_event::trade::TradeMutationKindV1::RevisionDecision
+pub radroots_event::trade::TradeMutationKindV1::RevisionProposal
+impl radroots_event::trade::TradeMutationKindV1
+pub const fn radroots_event::trade::TradeMutationKindV1::contract_id(self) -> &'static str
+pub const fn radroots_event::trade::TradeMutationKindV1::nostr_kind(self) -> u32
+pub enum radroots_event::trade::TradeProtocolError
+pub radroots_event::trade::TradeProtocolError::CandidateIdMismatch
+pub radroots_event::trade::TradeProtocolError::CandidateIdMismatch::computed: alloc::string::String
+pub radroots_event::trade::TradeProtocolError::CandidateIdMismatch::declared: alloc::string::String
+pub radroots_event::trade::TradeProtocolError::ContentTooLarge
+pub radroots_event::trade::TradeProtocolError::ContentTooLarge::actual: usize
+pub radroots_event::trade::TradeProtocolError::ContentTooLarge::max: usize
+pub radroots_event::trade::TradeProtocolError::ContractMismatch
+pub radroots_event::trade::TradeProtocolError::ContractMismatch::actual: alloc::string::String
+pub radroots_event::trade::TradeProtocolError::ContractMismatch::expected: &'static str
+pub radroots_event::trade::TradeProtocolError::DuplicateKey(alloc::string::String)
+pub radroots_event::trade::TradeProtocolError::DuplicateParent
+pub radroots_event::trade::TradeProtocolError::EmptyField(&'static str)
+pub radroots_event::trade::TradeProtocolError::InvalidField(&'static str)
+pub radroots_event::trade::TradeProtocolError::InvalidIdentifier
+pub radroots_event::trade::TradeProtocolError::InvalidIdentifier::error: radroots_event::id::ParseError
+pub radroots_event::trade::TradeProtocolError::InvalidIdentifier::field: &'static str
+pub radroots_event::trade::TradeProtocolError::InvalidInitialParents
+pub radroots_event::trade::TradeProtocolError::InvalidJson(alloc::string::String)
+pub radroots_event::trade::TradeProtocolError::InvalidSchemaVersion
+pub radroots_event::trade::TradeProtocolError::InvalidSchemaVersion::actual: u16
+pub radroots_event::trade::TradeProtocolError::InvalidSchemaVersion::expected: u16
+pub radroots_event::trade::TradeProtocolError::InvalidTimeRange
+pub radroots_event::trade::TradeProtocolError::MissingCancellationTarget
+pub radroots_event::trade::TradeProtocolError::MissingLines
+pub radroots_event::trade::TradeProtocolError::MissingParentMutation
+pub radroots_event::trade::TradeProtocolError::MissingReservationCommitments
+pub radroots_event::trade::TradeProtocolError::MutationIdMismatch
+pub radroots_event::trade::TradeProtocolError::MutationIdMismatch::computed: alloc::string::String
+pub radroots_event::trade::TradeProtocolError::MutationIdMismatch::declared: alloc::string::String
+pub radroots_event::trade::TradeProtocolError::NonCanonicalJson
+pub radroots_event::trade::TradeProtocolError::SelfParent
+pub radroots_event::trade::TradeProtocolError::TooManyAdjustments
+pub radroots_event::trade::TradeProtocolError::TooManyAdjustments::actual: usize
+pub radroots_event::trade::TradeProtocolError::TooManyAdjustments::max: usize
+pub radroots_event::trade::TradeProtocolError::TooManyLines
+pub radroots_event::trade::TradeProtocolError::TooManyLines::actual: usize
+pub radroots_event::trade::TradeProtocolError::TooManyLines::max: usize
+pub radroots_event::trade::TradeProtocolError::TooManyParents
+pub radroots_event::trade::TradeProtocolError::TooManyParents::actual: usize
+pub radroots_event::trade::TradeProtocolError::TooManyParents::max: usize
+pub radroots_event::trade::TradeProtocolError::UnsortedParents
+pub radroots_event::trade::TradeProtocolError::UnsupportedNumber
+impl core::error::Error for radroots_event::trade::TradeProtocolError
+impl core::fmt::Display for radroots_event::trade::TradeProtocolError
+pub fn radroots_event::trade::TradeProtocolError::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
pub struct radroots_event::trade::CandidateId(_)
-impl radroots_event::id::RadrootsTradeCandidateId
-pub const fn radroots_event::id::RadrootsTradeCandidateId::as_bytes(&self) -> &[u8; 32]
-pub const fn radroots_event::id::RadrootsTradeCandidateId::from_bytes([u8; 32]) -> Self
-pub const fn radroots_event::id::RadrootsTradeCandidateId::into_bytes(self) -> [u8; 32]
-pub fn radroots_event::id::RadrootsTradeCandidateId::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsTradeCandidateId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-pub fn radroots_event::id::RadrootsTradeCandidateId::to_hex(&self) -> alloc::string::String
-impl core::convert::AsRef<[u8]> for radroots_event::id::RadrootsTradeCandidateId
-pub fn radroots_event::id::RadrootsTradeCandidateId::as_ref(&self) -> &[u8]
-impl core::convert::From<[u8; 32]> for radroots_event::id::RadrootsTradeCandidateId
-pub fn radroots_event::id::RadrootsTradeCandidateId::from([u8; 32]) -> Self
-impl core::convert::From<radroots_event::id::RadrootsTradeCandidateId> for [u8; 32]
-pub fn [u8; 32]::from(radroots_event::id::RadrootsTradeCandidateId) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsTradeCandidateId
-pub type radroots_event::id::RadrootsTradeCandidateId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeCandidateId::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsTradeCandidateId
-pub type radroots_event::id::RadrootsTradeCandidateId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeCandidateId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsTradeCandidateId
-pub fn radroots_event::id::RadrootsTradeCandidateId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsTradeCandidateId
-pub type radroots_event::id::RadrootsTradeCandidateId::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeCandidateId::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsTradeCandidateId
-pub fn radroots_event::id::RadrootsTradeCandidateId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsTradeCandidateId
-pub fn radroots_event::id::RadrootsTradeCandidateId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+impl radroots_event::id::CandidateId
+pub const fn radroots_event::id::CandidateId::as_bytes(&self) -> &[u8; 32]
+pub const fn radroots_event::id::CandidateId::from_bytes([u8; 32]) -> Self
+pub const fn radroots_event::id::CandidateId::into_bytes(self) -> [u8; 32]
+pub fn radroots_event::id::CandidateId::into_string(self) -> alloc::string::String
+pub fn radroots_event::id::CandidateId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::ParseError>
+pub fn radroots_event::id::CandidateId::to_hex(&self) -> alloc::string::String
+impl core::convert::AsRef<[u8]> for radroots_event::id::CandidateId
+pub fn radroots_event::id::CandidateId::as_ref(&self) -> &[u8]
+impl core::convert::From<[u8; 32]> for radroots_event::id::CandidateId
+pub fn radroots_event::id::CandidateId::from([u8; 32]) -> Self
+impl core::convert::From<radroots_event::id::CandidateId> for [u8; 32]
+pub fn [u8; 32]::from(radroots_event::id::CandidateId) -> Self
+impl core::convert::TryFrom<&str> for radroots_event::id::CandidateId
+pub type radroots_event::id::CandidateId::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::CandidateId::try_from(&str) -> core::result::Result<Self, Self::Error>
+impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::CandidateId
+pub type radroots_event::id::CandidateId::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::CandidateId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
+impl core::fmt::Display for radroots_event::id::CandidateId
+pub fn radroots_event::id::CandidateId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::id::CandidateId
+pub type radroots_event::id::CandidateId::Err = radroots_event::id::ParseError
+pub fn radroots_event::id::CandidateId::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::id::CandidateId
+pub fn radroots_event::id::CandidateId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::CandidateId
+pub fn radroots_event::id::CandidateId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+pub struct radroots_event::trade::FulfillmentProfileV1
+pub radroots_event::trade::FulfillmentProfileV1::ends_at_unix_s: u64
+pub radroots_event::trade::FulfillmentProfileV1::fold: u8
+pub radroots_event::trade::FulfillmentProfileV1::location_class: alloc::string::String
+pub radroots_event::trade::FulfillmentProfileV1::method: alloc::string::String
+pub radroots_event::trade::FulfillmentProfileV1::profile_id: alloc::string::String
+pub radroots_event::trade::FulfillmentProfileV1::requires_private_terms: bool
+pub radroots_event::trade::FulfillmentProfileV1::starts_at_unix_s: u64
+pub radroots_event::trade::FulfillmentProfileV1::timezone: alloc::string::String
+pub radroots_event::trade::FulfillmentProfileV1::utc_offset_seconds: i32
+impl radroots_event::trade::FulfillmentProfileV1
+pub fn radroots_event::trade::FulfillmentProfileV1::validate(&self) -> core::result::Result<(), radroots_event::trade::TradeProtocolError>
pub struct radroots_event::trade::MutationId(_)
-impl radroots_event::id::RadrootsTradeMutationId
-pub const fn radroots_event::id::RadrootsTradeMutationId::as_bytes(&self) -> &[u8; 32]
-pub const fn radroots_event::id::RadrootsTradeMutationId::from_bytes([u8; 32]) -> Self
-pub const fn radroots_event::id::RadrootsTradeMutationId::into_bytes(self) -> [u8; 32]
-pub fn radroots_event::id::RadrootsTradeMutationId::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsTradeMutationId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-pub fn radroots_event::id::RadrootsTradeMutationId::to_hex(&self) -> alloc::string::String
-impl core::convert::AsRef<[u8]> for radroots_event::id::RadrootsTradeMutationId
-pub fn radroots_event::id::RadrootsTradeMutationId::as_ref(&self) -> &[u8]
-impl core::convert::From<[u8; 32]> for radroots_event::id::RadrootsTradeMutationId
-pub fn radroots_event::id::RadrootsTradeMutationId::from([u8; 32]) -> Self
-impl core::convert::From<radroots_event::id::RadrootsTradeMutationId> for [u8; 32]
-pub fn [u8; 32]::from(radroots_event::id::RadrootsTradeMutationId) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsTradeMutationId
-pub type radroots_event::id::RadrootsTradeMutationId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeMutationId::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsTradeMutationId
-pub type radroots_event::id::RadrootsTradeMutationId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeMutationId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsTradeMutationId
-pub fn radroots_event::id::RadrootsTradeMutationId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsTradeMutationId
-pub type radroots_event::id::RadrootsTradeMutationId::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeMutationId::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsTradeMutationId
-pub fn radroots_event::id::RadrootsTradeMutationId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsTradeMutationId
-pub fn radroots_event::id::RadrootsTradeMutationId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
-pub struct radroots_event::trade::RadrootsFulfillmentProfileV1
-pub radroots_event::trade::RadrootsFulfillmentProfileV1::ends_at_unix_s: u64
-pub radroots_event::trade::RadrootsFulfillmentProfileV1::fold: u8
-pub radroots_event::trade::RadrootsFulfillmentProfileV1::location_class: alloc::string::String
-pub radroots_event::trade::RadrootsFulfillmentProfileV1::method: alloc::string::String
-pub radroots_event::trade::RadrootsFulfillmentProfileV1::profile_id: alloc::string::String
-pub radroots_event::trade::RadrootsFulfillmentProfileV1::requires_private_terms: bool
-pub radroots_event::trade::RadrootsFulfillmentProfileV1::starts_at_unix_s: u64
-pub radroots_event::trade::RadrootsFulfillmentProfileV1::timezone: alloc::string::String
-pub radroots_event::trade::RadrootsFulfillmentProfileV1::utc_offset_seconds: i32
-impl radroots_event::trade::RadrootsFulfillmentProfileV1
-pub fn radroots_event::trade::RadrootsFulfillmentProfileV1::validate(&self) -> core::result::Result<(), radroots_event::trade::RadrootsTradeProtocolError>
-pub struct radroots_event::trade::RadrootsSellerReservationAssertionV1
-pub radroots_event::trade::RadrootsSellerReservationAssertionV1::assertion_commitment: alloc::string::String
-pub radroots_event::trade::RadrootsSellerReservationAssertionV1::candidate_id: radroots_event::id::RadrootsTradeCandidateId
-pub radroots_event::trade::RadrootsSellerReservationAssertionV1::commitments: alloc::vec::Vec<radroots_event::trade::RadrootsSellerReservationLineV1>
-pub radroots_event::trade::RadrootsSellerReservationAssertionV1::inventory_authority_id: radroots_identity::key::PublicKey
-pub radroots_event::trade::RadrootsSellerReservationAssertionV1::inventory_epoch: u64
-pub radroots_event::trade::RadrootsSellerReservationAssertionV1::reservation_expires_at_unix_s: u64
-pub radroots_event::trade::RadrootsSellerReservationAssertionV1::reservation_id: radroots_event::id::RadrootsDTag
-impl radroots_event::trade::RadrootsSellerReservationAssertionV1
-pub fn radroots_event::trade::RadrootsSellerReservationAssertionV1::validate(&self) -> core::result::Result<(), radroots_event::trade::RadrootsTradeProtocolError>
-pub struct radroots_event::trade::RadrootsSellerReservationLineV1
-pub radroots_event::trade::RadrootsSellerReservationLineV1::bin_id: radroots_event::id::RadrootsInventoryBinId
-pub radroots_event::trade::RadrootsSellerReservationLineV1::line_id: radroots_event::id::RadrootsDTag
-pub radroots_event::trade::RadrootsSellerReservationLineV1::quantity_mantissa: alloc::string::String
-pub radroots_event::trade::RadrootsSellerReservationLineV1::quantity_scale: u8
-pub radroots_event::trade::RadrootsSellerReservationLineV1::unit_code: alloc::string::String
-impl radroots_event::trade::RadrootsSellerReservationLineV1
-pub fn radroots_event::trade::RadrootsSellerReservationLineV1::validate(&self) -> core::result::Result<(), radroots_event::trade::RadrootsTradeProtocolError>
-pub struct radroots_event::trade::RadrootsTradeCancellationProfileV1
-pub radroots_event::trade::RadrootsTradeCancellationProfileV1::buyer_pre_agreement: bool
-pub radroots_event::trade::RadrootsTradeCancellationProfileV1::post_agreement_cutoff_unix_s: core::option::Option<u64>
-pub radroots_event::trade::RadrootsTradeCancellationProfileV1::profile_id: alloc::string::String
-impl radroots_event::trade::RadrootsTradeCancellationProfileV1
-pub fn radroots_event::trade::RadrootsTradeCancellationProfileV1::validate(&self) -> core::result::Result<(), radroots_event::trade::RadrootsTradeProtocolError>
-pub struct radroots_event::trade::RadrootsTradeCandidateLineV1
-pub radroots_event::trade::RadrootsTradeCandidateLineV1::bin_id: radroots_event::id::RadrootsInventoryBinId
-pub radroots_event::trade::RadrootsTradeCandidateLineV1::currency_code: alloc::string::String
-pub radroots_event::trade::RadrootsTradeCandidateLineV1::line_id: radroots_event::id::RadrootsDTag
-pub radroots_event::trade::RadrootsTradeCandidateLineV1::line_subtotal_mantissa: alloc::string::String
-pub radroots_event::trade::RadrootsTradeCandidateLineV1::listing_addr: radroots_event::id::RadrootsClassifiedListingAddress
-pub radroots_event::trade::RadrootsTradeCandidateLineV1::listing_event_id: radroots_event::id::RadrootsEventId
-pub radroots_event::trade::RadrootsTradeCandidateLineV1::listing_snapshot_sha256: alloc::string::String
-pub radroots_event::trade::RadrootsTradeCandidateLineV1::option_id: core::option::Option<alloc::string::String>
-pub radroots_event::trade::RadrootsTradeCandidateLineV1::product_id: alloc::string::String
-pub radroots_event::trade::RadrootsTradeCandidateLineV1::quantity_mantissa: alloc::string::String
-pub radroots_event::trade::RadrootsTradeCandidateLineV1::quantity_scale: u8
-pub radroots_event::trade::RadrootsTradeCandidateLineV1::replaces_line_id: core::option::Option<radroots_event::id::RadrootsDTag>
-pub radroots_event::trade::RadrootsTradeCandidateLineV1::unit_code: alloc::string::String
-pub radroots_event::trade::RadrootsTradeCandidateLineV1::unit_price_mantissa: alloc::string::String
-pub radroots_event::trade::RadrootsTradeCandidateLineV1::unit_profile: alloc::string::String
-impl radroots_event::trade::RadrootsTradeCandidateLineV1
-pub fn radroots_event::trade::RadrootsTradeCandidateLineV1::validate(&self) -> core::result::Result<(), radroots_event::trade::RadrootsTradeProtocolError>
-pub struct radroots_event::trade::RadrootsTradeCandidateTermsV1
-pub radroots_event::trade::RadrootsTradeCandidateTermsV1::base_candidate_id: core::option::Option<radroots_event::id::RadrootsTradeCandidateId>
-pub radroots_event::trade::RadrootsTradeCandidateTermsV1::buyer_pubkey: radroots_identity::key::PublicKey
-pub radroots_event::trade::RadrootsTradeCandidateTermsV1::cancellation: radroots_event::trade::RadrootsTradeCancellationProfileV1
-pub radroots_event::trade::RadrootsTradeCandidateTermsV1::candidate_id: core::option::Option<radroots_event::id::RadrootsTradeCandidateId>
-pub radroots_event::trade::RadrootsTradeCandidateTermsV1::economics: radroots_event::trade::RadrootsTradeEconomicsProfileV1
-pub radroots_event::trade::RadrootsTradeCandidateTermsV1::farm_id: radroots_event::id::RadrootsDTag
-pub radroots_event::trade::RadrootsTradeCandidateTermsV1::fulfillment: radroots_event::trade::RadrootsFulfillmentProfileV1
-pub radroots_event::trade::RadrootsTradeCandidateTermsV1::line_tombstones: alloc::vec::Vec<radroots_event::trade::RadrootsTradeLineTombstoneV1>
-pub radroots_event::trade::RadrootsTradeCandidateTermsV1::lines: alloc::vec::Vec<radroots_event::trade::RadrootsTradeCandidateLineV1>
-pub radroots_event::trade::RadrootsTradeCandidateTermsV1::private_terms: core::option::Option<radroots_event::trade::RadrootsTradePrivateTermsRefV1>
-pub radroots_event::trade::RadrootsTradeCandidateTermsV1::proposal_expires_at_unix_s: u64
-pub radroots_event::trade::RadrootsTradeCandidateTermsV1::schema_version: u16
-pub radroots_event::trade::RadrootsTradeCandidateTermsV1::seller_pubkey: radroots_identity::key::PublicKey
-pub radroots_event::trade::RadrootsTradeCandidateTermsV1::supersession_intent: core::option::Option<alloc::string::String>
-impl radroots_event::trade::RadrootsTradeCandidateTermsV1
-pub fn radroots_event::trade::RadrootsTradeCandidateTermsV1::validate(&self) -> core::result::Result<(), radroots_event::trade::RadrootsTradeProtocolError>
-pub struct radroots_event::trade::RadrootsTradeCanonicalMutationV1
-pub radroots_event::trade::RadrootsTradeCanonicalMutationV1::content: alloc::string::String
-pub radroots_event::trade::RadrootsTradeCanonicalMutationV1::envelope: radroots_event::trade::RadrootsTradeMutationEnvelopeV1
-pub radroots_event::trade::RadrootsTradeCanonicalMutationV1::mutation_id: radroots_event::id::RadrootsTradeMutationId
-pub struct radroots_event::trade::RadrootsTradeEconomicAdjustmentV1
-pub radroots_event::trade::RadrootsTradeEconomicAdjustmentV1::actor: alloc::string::String
-pub radroots_event::trade::RadrootsTradeEconomicAdjustmentV1::adjustment_id: radroots_event::id::RadrootsDTag
-pub radroots_event::trade::RadrootsTradeEconomicAdjustmentV1::amount_mantissa: alloc::string::String
-pub radroots_event::trade::RadrootsTradeEconomicAdjustmentV1::effect: alloc::string::String
-pub radroots_event::trade::RadrootsTradeEconomicAdjustmentV1::reason: alloc::string::String
-impl radroots_event::trade::RadrootsTradeEconomicAdjustmentV1
-pub fn radroots_event::trade::RadrootsTradeEconomicAdjustmentV1::validate(&self) -> core::result::Result<(), radroots_event::trade::RadrootsTradeProtocolError>
-pub struct radroots_event::trade::RadrootsTradeEconomicsProfileV1
-pub radroots_event::trade::RadrootsTradeEconomicsProfileV1::adjustment_total_mantissa: alloc::string::String
-pub radroots_event::trade::RadrootsTradeEconomicsProfileV1::adjustments: alloc::vec::Vec<radroots_event::trade::RadrootsTradeEconomicAdjustmentV1>
-pub radroots_event::trade::RadrootsTradeEconomicsProfileV1::currency_code: alloc::string::String
-pub radroots_event::trade::RadrootsTradeEconomicsProfileV1::currency_exponent: u8
-pub radroots_event::trade::RadrootsTradeEconomicsProfileV1::discount_total_mantissa: alloc::string::String
-pub radroots_event::trade::RadrootsTradeEconomicsProfileV1::profile_id: alloc::string::String
-pub radroots_event::trade::RadrootsTradeEconomicsProfileV1::rounding_profile: alloc::string::String
-pub radroots_event::trade::RadrootsTradeEconomicsProfileV1::subtotal_mantissa: alloc::string::String
-pub radroots_event::trade::RadrootsTradeEconomicsProfileV1::total_mantissa: alloc::string::String
-impl radroots_event::trade::RadrootsTradeEconomicsProfileV1
-pub fn radroots_event::trade::RadrootsTradeEconomicsProfileV1::validate(&self) -> core::result::Result<(), radroots_event::trade::RadrootsTradeProtocolError>
-pub struct radroots_event::trade::RadrootsTradeLineTombstoneV1
-pub radroots_event::trade::RadrootsTradeLineTombstoneV1::line_id: radroots_event::id::RadrootsDTag
-pub radroots_event::trade::RadrootsTradeLineTombstoneV1::reason: alloc::string::String
-impl radroots_event::trade::RadrootsTradeLineTombstoneV1
-pub fn radroots_event::trade::RadrootsTradeLineTombstoneV1::validate(&self) -> core::result::Result<(), radroots_event::trade::RadrootsTradeProtocolError>
-pub struct radroots_event::trade::RadrootsTradeMutationEnvelopeV1
-pub radroots_event::trade::RadrootsTradeMutationEnvelopeV1::author_pubkey: radroots_identity::key::PublicKey
-pub radroots_event::trade::RadrootsTradeMutationEnvelopeV1::authored_at_unix_s: u64
-pub radroots_event::trade::RadrootsTradeMutationEnvelopeV1::body: radroots_event::trade::RadrootsTradeMutationBodyV1
-pub radroots_event::trade::RadrootsTradeMutationEnvelopeV1::buyer_pubkey: radroots_identity::key::PublicKey
-pub radroots_event::trade::RadrootsTradeMutationEnvelopeV1::contract_id: alloc::string::String
-pub radroots_event::trade::RadrootsTradeMutationEnvelopeV1::counterparty_pubkey: radroots_identity::key::PublicKey
-pub radroots_event::trade::RadrootsTradeMutationEnvelopeV1::farm_id: radroots_event::id::RadrootsDTag
-pub radroots_event::trade::RadrootsTradeMutationEnvelopeV1::mutation_id: core::option::Option<radroots_event::id::RadrootsTradeMutationId>
-pub radroots_event::trade::RadrootsTradeMutationEnvelopeV1::parent_mutation_ids: alloc::vec::Vec<radroots_event::id::RadrootsTradeMutationId>
-pub radroots_event::trade::RadrootsTradeMutationEnvelopeV1::root_mutation_id: core::option::Option<radroots_event::id::RadrootsTradeMutationId>
-pub radroots_event::trade::RadrootsTradeMutationEnvelopeV1::schema_version: u16
-pub radroots_event::trade::RadrootsTradeMutationEnvelopeV1::seller_pubkey: radroots_identity::key::PublicKey
-pub radroots_event::trade::RadrootsTradeMutationEnvelopeV1::trade_id: radroots_event::id::RadrootsTradeId
-impl radroots_event::trade::RadrootsTradeMutationEnvelopeV1
-pub fn radroots_event::trade::RadrootsTradeMutationEnvelopeV1::mutation_kind(&self) -> radroots_event::trade::RadrootsTradeMutationKindV1
-pub fn radroots_event::trade::RadrootsTradeMutationEnvelopeV1::validate(&self) -> core::result::Result<(), radroots_event::trade::RadrootsTradeProtocolError>
-pub struct radroots_event::trade::RadrootsTradePrivateTermsRefV1
-pub radroots_event::trade::RadrootsTradePrivateTermsRefV1::artifact_id: alloc::string::String
-pub radroots_event::trade::RadrootsTradePrivateTermsRefV1::ciphertext_commitment: alloc::string::String
-pub radroots_event::trade::RadrootsTradePrivateTermsRefV1::required_acknowledgement: bool
-pub radroots_event::trade::RadrootsTradePrivateTermsRefV1::schema_id: alloc::string::String
-impl radroots_event::trade::RadrootsTradePrivateTermsRefV1
-pub fn radroots_event::trade::RadrootsTradePrivateTermsRefV1::validate(&self) -> core::result::Result<(), radroots_event::trade::RadrootsTradeProtocolError>
+impl radroots_event::id::MutationId
+pub const fn radroots_event::id::MutationId::as_bytes(&self) -> &[u8; 32]
+pub const fn radroots_event::id::MutationId::from_bytes([u8; 32]) -> Self
+pub const fn radroots_event::id::MutationId::into_bytes(self) -> [u8; 32]
+pub fn radroots_event::id::MutationId::into_string(self) -> alloc::string::String
+pub fn radroots_event::id::MutationId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::ParseError>
+pub fn radroots_event::id::MutationId::to_hex(&self) -> alloc::string::String
+impl core::convert::AsRef<[u8]> for radroots_event::id::MutationId
+pub fn radroots_event::id::MutationId::as_ref(&self) -> &[u8]
+impl core::convert::From<[u8; 32]> for radroots_event::id::MutationId
+pub fn radroots_event::id::MutationId::from([u8; 32]) -> Self
+impl core::convert::From<radroots_event::id::MutationId> for [u8; 32]
+pub fn [u8; 32]::from(radroots_event::id::MutationId) -> Self
+impl core::convert::TryFrom<&str> for radroots_event::id::MutationId
+pub type radroots_event::id::MutationId::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::MutationId::try_from(&str) -> core::result::Result<Self, Self::Error>
+impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::MutationId
+pub type radroots_event::id::MutationId::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::MutationId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
+impl core::fmt::Display for radroots_event::id::MutationId
+pub fn radroots_event::id::MutationId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::id::MutationId
+pub type radroots_event::id::MutationId::Err = radroots_event::id::ParseError
+pub fn radroots_event::id::MutationId::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::id::MutationId
+pub fn radroots_event::id::MutationId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::MutationId
+pub fn radroots_event::id::MutationId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+pub struct radroots_event::trade::SellerReservationAssertionV1
+pub radroots_event::trade::SellerReservationAssertionV1::assertion_commitment: alloc::string::String
+pub radroots_event::trade::SellerReservationAssertionV1::candidate_id: radroots_event::id::CandidateId
+pub radroots_event::trade::SellerReservationAssertionV1::commitments: alloc::vec::Vec<radroots_event::trade::SellerReservationLineV1>
+pub radroots_event::trade::SellerReservationAssertionV1::inventory_authority_id: radroots_identity::key::PublicKey
+pub radroots_event::trade::SellerReservationAssertionV1::inventory_epoch: u64
+pub radroots_event::trade::SellerReservationAssertionV1::reservation_expires_at_unix_s: u64
+pub radroots_event::trade::SellerReservationAssertionV1::reservation_id: radroots_event::id::DTag
+impl radroots_event::trade::SellerReservationAssertionV1
+pub fn radroots_event::trade::SellerReservationAssertionV1::validate(&self) -> core::result::Result<(), radroots_event::trade::TradeProtocolError>
+pub struct radroots_event::trade::SellerReservationLineV1
+pub radroots_event::trade::SellerReservationLineV1::bin_id: radroots_event::id::InventoryBinId
+pub radroots_event::trade::SellerReservationLineV1::line_id: radroots_event::id::DTag
+pub radroots_event::trade::SellerReservationLineV1::quantity_mantissa: alloc::string::String
+pub radroots_event::trade::SellerReservationLineV1::quantity_scale: u8
+pub radroots_event::trade::SellerReservationLineV1::unit_code: alloc::string::String
+impl radroots_event::trade::SellerReservationLineV1
+pub fn radroots_event::trade::SellerReservationLineV1::validate(&self) -> core::result::Result<(), radroots_event::trade::TradeProtocolError>
+pub struct radroots_event::trade::TradeCancellationProfileV1
+pub radroots_event::trade::TradeCancellationProfileV1::buyer_pre_agreement: bool
+pub radroots_event::trade::TradeCancellationProfileV1::post_agreement_cutoff_unix_s: core::option::Option<u64>
+pub radroots_event::trade::TradeCancellationProfileV1::profile_id: alloc::string::String
+impl radroots_event::trade::TradeCancellationProfileV1
+pub fn radroots_event::trade::TradeCancellationProfileV1::validate(&self) -> core::result::Result<(), radroots_event::trade::TradeProtocolError>
+pub struct radroots_event::trade::TradeCandidateLineV1
+pub radroots_event::trade::TradeCandidateLineV1::bin_id: radroots_event::id::InventoryBinId
+pub radroots_event::trade::TradeCandidateLineV1::currency_code: alloc::string::String
+pub radroots_event::trade::TradeCandidateLineV1::line_id: radroots_event::id::DTag
+pub radroots_event::trade::TradeCandidateLineV1::line_subtotal_mantissa: alloc::string::String
+pub radroots_event::trade::TradeCandidateLineV1::listing_addr: radroots_event::id::ClassifiedListingAddress
+pub radroots_event::trade::TradeCandidateLineV1::listing_event_id: radroots_event::id::EventId
+pub radroots_event::trade::TradeCandidateLineV1::listing_snapshot_sha256: alloc::string::String
+pub radroots_event::trade::TradeCandidateLineV1::option_id: core::option::Option<alloc::string::String>
+pub radroots_event::trade::TradeCandidateLineV1::product_id: alloc::string::String
+pub radroots_event::trade::TradeCandidateLineV1::quantity_mantissa: alloc::string::String
+pub radroots_event::trade::TradeCandidateLineV1::quantity_scale: u8
+pub radroots_event::trade::TradeCandidateLineV1::replaces_line_id: core::option::Option<radroots_event::id::DTag>
+pub radroots_event::trade::TradeCandidateLineV1::unit_code: alloc::string::String
+pub radroots_event::trade::TradeCandidateLineV1::unit_price_mantissa: alloc::string::String
+pub radroots_event::trade::TradeCandidateLineV1::unit_profile: alloc::string::String
+impl radroots_event::trade::TradeCandidateLineV1
+pub fn radroots_event::trade::TradeCandidateLineV1::validate(&self) -> core::result::Result<(), radroots_event::trade::TradeProtocolError>
+pub struct radroots_event::trade::TradeCandidateTermsV1
+pub radroots_event::trade::TradeCandidateTermsV1::base_candidate_id: core::option::Option<radroots_event::id::CandidateId>
+pub radroots_event::trade::TradeCandidateTermsV1::buyer_pubkey: radroots_identity::key::PublicKey
+pub radroots_event::trade::TradeCandidateTermsV1::cancellation: radroots_event::trade::TradeCancellationProfileV1
+pub radroots_event::trade::TradeCandidateTermsV1::candidate_id: core::option::Option<radroots_event::id::CandidateId>
+pub radroots_event::trade::TradeCandidateTermsV1::economics: radroots_event::trade::TradeEconomicsProfileV1
+pub radroots_event::trade::TradeCandidateTermsV1::farm_id: radroots_event::id::DTag
+pub radroots_event::trade::TradeCandidateTermsV1::fulfillment: radroots_event::trade::FulfillmentProfileV1
+pub radroots_event::trade::TradeCandidateTermsV1::line_tombstones: alloc::vec::Vec<radroots_event::trade::TradeLineTombstoneV1>
+pub radroots_event::trade::TradeCandidateTermsV1::lines: alloc::vec::Vec<radroots_event::trade::TradeCandidateLineV1>
+pub radroots_event::trade::TradeCandidateTermsV1::private_terms: core::option::Option<radroots_event::trade::TradePrivateTermsRefV1>
+pub radroots_event::trade::TradeCandidateTermsV1::proposal_expires_at_unix_s: u64
+pub radroots_event::trade::TradeCandidateTermsV1::schema_version: u16
+pub radroots_event::trade::TradeCandidateTermsV1::seller_pubkey: radroots_identity::key::PublicKey
+pub radroots_event::trade::TradeCandidateTermsV1::supersession_intent: core::option::Option<alloc::string::String>
+impl radroots_event::trade::TradeCandidateTermsV1
+pub fn radroots_event::trade::TradeCandidateTermsV1::validate(&self) -> core::result::Result<(), radroots_event::trade::TradeProtocolError>
+pub struct radroots_event::trade::TradeCanonicalMutationV1
+pub radroots_event::trade::TradeCanonicalMutationV1::content: alloc::string::String
+pub radroots_event::trade::TradeCanonicalMutationV1::envelope: radroots_event::trade::TradeMutationEnvelopeV1
+pub radroots_event::trade::TradeCanonicalMutationV1::mutation_id: radroots_event::id::MutationId
+pub struct radroots_event::trade::TradeEconomicAdjustmentV1
+pub radroots_event::trade::TradeEconomicAdjustmentV1::actor: alloc::string::String
+pub radroots_event::trade::TradeEconomicAdjustmentV1::adjustment_id: radroots_event::id::DTag
+pub radroots_event::trade::TradeEconomicAdjustmentV1::amount_mantissa: alloc::string::String
+pub radroots_event::trade::TradeEconomicAdjustmentV1::effect: alloc::string::String
+pub radroots_event::trade::TradeEconomicAdjustmentV1::reason: alloc::string::String
+impl radroots_event::trade::TradeEconomicAdjustmentV1
+pub fn radroots_event::trade::TradeEconomicAdjustmentV1::validate(&self) -> core::result::Result<(), radroots_event::trade::TradeProtocolError>
+pub struct radroots_event::trade::TradeEconomicsProfileV1
+pub radroots_event::trade::TradeEconomicsProfileV1::adjustment_total_mantissa: alloc::string::String
+pub radroots_event::trade::TradeEconomicsProfileV1::adjustments: alloc::vec::Vec<radroots_event::trade::TradeEconomicAdjustmentV1>
+pub radroots_event::trade::TradeEconomicsProfileV1::currency_code: alloc::string::String
+pub radroots_event::trade::TradeEconomicsProfileV1::currency_exponent: u8
+pub radroots_event::trade::TradeEconomicsProfileV1::discount_total_mantissa: alloc::string::String
+pub radroots_event::trade::TradeEconomicsProfileV1::profile_id: alloc::string::String
+pub radroots_event::trade::TradeEconomicsProfileV1::rounding_profile: alloc::string::String
+pub radroots_event::trade::TradeEconomicsProfileV1::subtotal_mantissa: alloc::string::String
+pub radroots_event::trade::TradeEconomicsProfileV1::total_mantissa: alloc::string::String
+impl radroots_event::trade::TradeEconomicsProfileV1
+pub fn radroots_event::trade::TradeEconomicsProfileV1::validate(&self) -> core::result::Result<(), radroots_event::trade::TradeProtocolError>
pub struct radroots_event::trade::TradeId(_)
-impl radroots_event::id::RadrootsTradeId
-pub const fn radroots_event::id::RadrootsTradeId::as_bytes(&self) -> &[u8; 16]
-pub const fn radroots_event::id::RadrootsTradeId::from_bytes([u8; 16]) -> Self
-pub const fn radroots_event::id::RadrootsTradeId::into_bytes(self) -> [u8; 16]
-pub fn radroots_event::id::RadrootsTradeId::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsTradeId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-pub fn radroots_event::id::RadrootsTradeId::to_hex(&self) -> alloc::string::String
-impl core::convert::AsRef<[u8]> for radroots_event::id::RadrootsTradeId
-pub fn radroots_event::id::RadrootsTradeId::as_ref(&self) -> &[u8]
-impl core::convert::From<[u8; 16]> for radroots_event::id::RadrootsTradeId
-pub fn radroots_event::id::RadrootsTradeId::from([u8; 16]) -> Self
-impl core::convert::From<radroots_event::id::RadrootsTradeId> for [u8; 16]
-pub fn [u8; 16]::from(radroots_event::id::RadrootsTradeId) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsTradeId
-pub type radroots_event::id::RadrootsTradeId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeId::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsTradeId
-pub type radroots_event::id::RadrootsTradeId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsTradeId
-pub fn radroots_event::id::RadrootsTradeId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsTradeId
-pub type radroots_event::id::RadrootsTradeId::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsTradeId::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsTradeId
-pub fn radroots_event::id::RadrootsTradeId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsTradeId
-pub fn radroots_event::id::RadrootsTradeId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+impl radroots_event::id::TradeId
+pub const fn radroots_event::id::TradeId::as_bytes(&self) -> &[u8; 16]
+pub const fn radroots_event::id::TradeId::from_bytes([u8; 16]) -> Self
+pub const fn radroots_event::id::TradeId::into_bytes(self) -> [u8; 16]
+pub fn radroots_event::id::TradeId::into_string(self) -> alloc::string::String
+pub fn radroots_event::id::TradeId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::ParseError>
+pub fn radroots_event::id::TradeId::to_hex(&self) -> alloc::string::String
+impl core::convert::AsRef<[u8]> for radroots_event::id::TradeId
+pub fn radroots_event::id::TradeId::as_ref(&self) -> &[u8]
+impl core::convert::From<[u8; 16]> for radroots_event::id::TradeId
+pub fn radroots_event::id::TradeId::from([u8; 16]) -> Self
+impl core::convert::From<radroots_event::id::TradeId> for [u8; 16]
+pub fn [u8; 16]::from(radroots_event::id::TradeId) -> Self
+impl core::convert::TryFrom<&str> for radroots_event::id::TradeId
+pub type radroots_event::id::TradeId::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::TradeId::try_from(&str) -> core::result::Result<Self, Self::Error>
+impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::TradeId
+pub type radroots_event::id::TradeId::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::TradeId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
+impl core::fmt::Display for radroots_event::id::TradeId
+pub fn radroots_event::id::TradeId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::id::TradeId
+pub type radroots_event::id::TradeId::Err = radroots_event::id::ParseError
+pub fn radroots_event::id::TradeId::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::id::TradeId
+pub fn radroots_event::id::TradeId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::TradeId
+pub fn radroots_event::id::TradeId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+pub struct radroots_event::trade::TradeLineTombstoneV1
+pub radroots_event::trade::TradeLineTombstoneV1::line_id: radroots_event::id::DTag
+pub radroots_event::trade::TradeLineTombstoneV1::reason: alloc::string::String
+impl radroots_event::trade::TradeLineTombstoneV1
+pub fn radroots_event::trade::TradeLineTombstoneV1::validate(&self) -> core::result::Result<(), radroots_event::trade::TradeProtocolError>
+pub struct radroots_event::trade::TradeMutationEnvelopeV1
+pub radroots_event::trade::TradeMutationEnvelopeV1::author_pubkey: radroots_identity::key::PublicKey
+pub radroots_event::trade::TradeMutationEnvelopeV1::authored_at_unix_s: u64
+pub radroots_event::trade::TradeMutationEnvelopeV1::body: radroots_event::trade::TradeMutationBodyV1
+pub radroots_event::trade::TradeMutationEnvelopeV1::buyer_pubkey: radroots_identity::key::PublicKey
+pub radroots_event::trade::TradeMutationEnvelopeV1::contract_id: alloc::string::String
+pub radroots_event::trade::TradeMutationEnvelopeV1::counterparty_pubkey: radroots_identity::key::PublicKey
+pub radroots_event::trade::TradeMutationEnvelopeV1::farm_id: radroots_event::id::DTag
+pub radroots_event::trade::TradeMutationEnvelopeV1::mutation_id: core::option::Option<radroots_event::id::MutationId>
+pub radroots_event::trade::TradeMutationEnvelopeV1::parent_mutation_ids: alloc::vec::Vec<radroots_event::id::MutationId>
+pub radroots_event::trade::TradeMutationEnvelopeV1::root_mutation_id: core::option::Option<radroots_event::id::MutationId>
+pub radroots_event::trade::TradeMutationEnvelopeV1::schema_version: u16
+pub radroots_event::trade::TradeMutationEnvelopeV1::seller_pubkey: radroots_identity::key::PublicKey
+pub radroots_event::trade::TradeMutationEnvelopeV1::trade_id: radroots_event::id::TradeId
+impl radroots_event::trade::TradeMutationEnvelopeV1
+pub fn radroots_event::trade::TradeMutationEnvelopeV1::mutation_kind(&self) -> radroots_event::trade::TradeMutationKindV1
+pub fn radroots_event::trade::TradeMutationEnvelopeV1::validate(&self) -> core::result::Result<(), radroots_event::trade::TradeProtocolError>
+pub struct radroots_event::trade::TradePrivateTermsRefV1
+pub radroots_event::trade::TradePrivateTermsRefV1::artifact_id: alloc::string::String
+pub radroots_event::trade::TradePrivateTermsRefV1::ciphertext_commitment: alloc::string::String
+pub radroots_event::trade::TradePrivateTermsRefV1::required_acknowledgement: bool
+pub radroots_event::trade::TradePrivateTermsRefV1::schema_id: alloc::string::String
+impl radroots_event::trade::TradePrivateTermsRefV1
+pub fn radroots_event::trade::TradePrivateTermsRefV1::validate(&self) -> core::result::Result<(), radroots_event::trade::TradeProtocolError>
pub const radroots_event::trade::RADROOTS_TRADE_CANCELLATION_CONTRACT_ID: &str
pub const radroots_event::trade::RADROOTS_TRADE_CANDIDATE_DOMAIN: &[u8]
pub const radroots_event::trade::RADROOTS_TRADE_DECISION_CONTRACT_ID: &str
@@ -3768,18 +3423,18 @@ pub const radroots_event::trade::RADROOTS_TRADE_REVISION_DECISION_CONTRACT_ID: &
pub const radroots_event::trade::RADROOTS_TRADE_REVISION_PROPOSAL_CONTRACT_ID: &str
pub const radroots_event::trade::RADROOTS_TRADE_SCHEMA_VERSION: u16
pub const radroots_event::trade::RADROOTS_TRADE_SELLER_RESERVATION_ASSERTION_CONTRACT_ID: &str
-pub fn radroots_event::trade::canonical_jcs_from_str(&str) -> core::result::Result<alloc::string::String, radroots_event::trade::RadrootsTradeProtocolError>
-pub fn radroots_event::trade::canonical_jcs_value(&serde_json::value::Value) -> core::result::Result<alloc::string::String, radroots_event::trade::RadrootsTradeProtocolError>
-pub fn radroots_event::trade::canonical_trade_candidate_id(&radroots_event::trade::RadrootsTradeCandidateTermsV1) -> core::result::Result<radroots_event::id::RadrootsTradeCandidateId, radroots_event::trade::RadrootsTradeProtocolError>
-pub fn radroots_event::trade::canonical_trade_mutation_content(radroots_event::trade::RadrootsTradeMutationEnvelopeV1) -> core::result::Result<radroots_event::trade::RadrootsTradeCanonicalMutationV1, radroots_event::trade::RadrootsTradeProtocolError>
-pub fn radroots_event::trade::canonical_trade_mutation_id(&radroots_event::trade::RadrootsTradeMutationEnvelopeV1) -> core::result::Result<radroots_event::id::RadrootsTradeMutationId, radroots_event::trade::RadrootsTradeProtocolError>
-pub fn radroots_event::trade::trade_mutation_from_canonical_content(&str) -> core::result::Result<radroots_event::trade::RadrootsTradeMutationEnvelopeV1, radroots_event::trade::RadrootsTradeProtocolError>
+pub fn radroots_event::trade::canonical_jcs_from_str(&str) -> core::result::Result<alloc::string::String, radroots_event::trade::TradeProtocolError>
+pub fn radroots_event::trade::canonical_jcs_value(&serde_json::value::Value) -> core::result::Result<alloc::string::String, radroots_event::trade::TradeProtocolError>
+pub fn radroots_event::trade::canonical_trade_candidate_id(&radroots_event::trade::TradeCandidateTermsV1) -> core::result::Result<radroots_event::id::CandidateId, radroots_event::trade::TradeProtocolError>
+pub fn radroots_event::trade::canonical_trade_mutation_content(radroots_event::trade::TradeMutationEnvelopeV1) -> core::result::Result<radroots_event::trade::TradeCanonicalMutationV1, radroots_event::trade::TradeProtocolError>
+pub fn radroots_event::trade::canonical_trade_mutation_id(&radroots_event::trade::TradeMutationEnvelopeV1) -> core::result::Result<radroots_event::id::MutationId, radroots_event::trade::TradeProtocolError>
+pub fn radroots_event::trade::trade_mutation_from_canonical_content(&str) -> core::result::Result<radroots_event::trade::TradeMutationEnvelopeV1, radroots_event::trade::TradeProtocolError>
pub mod radroots_event::wire
#[non_exhaustive] pub enum radroots_event::Error
-pub radroots_event::Error::ContractValidation(crate::contract::registry_v7::RadrootsContractValidationError)
+pub radroots_event::Error::ContractValidation(crate::contract::registry_v7::ContractValidationError)
pub radroots_event::Error::IdMismatch
-pub radroots_event::Error::IdMismatch::actual: radroots_event::id::RadrootsEventId
-pub radroots_event::Error::IdMismatch::expected: radroots_event::id::RadrootsEventId
+pub radroots_event::Error::IdMismatch::actual: radroots_event::id::EventId
+pub radroots_event::Error::IdMismatch::expected: radroots_event::id::EventId
pub radroots_event::Error::MalformedEnvelope
pub radroots_event::Error::SignatureInvalid
impl radroots_event::Error
@@ -3788,117 +3443,117 @@ impl core::error::Error for radroots_event::Error
impl core::fmt::Display for radroots_event::Error
pub fn radroots_event::Error::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
pub struct radroots_event::Event
-impl radroots_event::envelope::RadrootsEventEnvelope
-pub fn radroots_event::envelope::RadrootsEventEnvelope::author(&self) -> &radroots_identity::key::PublicKey
-pub fn radroots_event::envelope::RadrootsEventEnvelope::content(&self) -> &str
-pub fn radroots_event::envelope::RadrootsEventEnvelope::created_at(&self) -> radroots_event::envelope::RadrootsEventTimestamp
-pub fn radroots_event::envelope::RadrootsEventEnvelope::created_at_u64(&self) -> u64
-pub fn radroots_event::envelope::RadrootsEventEnvelope::id(&self) -> &radroots_event::id::RadrootsEventId
-pub fn radroots_event::envelope::RadrootsEventEnvelope::id_hex(&self) -> alloc::string::String
-pub fn radroots_event::envelope::RadrootsEventEnvelope::kind(&self) -> radroots_event::envelope::RadrootsEventKind
-pub fn radroots_event::envelope::RadrootsEventEnvelope::kind_class(&self) -> radroots_event::envelope::RadrootsEventKindClass
-pub fn radroots_event::envelope::RadrootsEventEnvelope::kind_u32(&self) -> u32
-pub fn radroots_event::envelope::RadrootsEventEnvelope::new(radroots_event::envelope::RadrootsEventEnvelopeParts) -> core::result::Result<Self, radroots_event::envelope::RadrootsEventEnvelopeError>
-pub fn radroots_event::envelope::RadrootsEventEnvelope::new_with_limits(radroots_event::envelope::RadrootsEventEnvelopeParts, radroots_event::envelope::RadrootsEventEnvelopeLimits) -> core::result::Result<Self, radroots_event::envelope::RadrootsEventEnvelopeError>
-pub fn radroots_event::envelope::RadrootsEventEnvelope::sig(&self) -> &radroots_event::id::RadrootsEventSignature
-pub fn radroots_event::envelope::RadrootsEventEnvelope::signature_hex(&self) -> alloc::string::String
-pub fn radroots_event::envelope::RadrootsEventEnvelope::tag_slices(&self) -> &[radroots_event::envelope::RadrootsEventTag]
-pub fn radroots_event::envelope::RadrootsEventEnvelope::tags(&self) -> &radroots_event::envelope::RadrootsEventTags
-pub fn radroots_event::envelope::RadrootsEventEnvelope::tags_as_vec(&self) -> alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>
-pub fn radroots_event::envelope::RadrootsEventEnvelope::to_nip01_wire(&self) -> RadrootsNip01EventWire
+impl radroots_event::envelope::EventEnvelope
+pub fn radroots_event::envelope::EventEnvelope::author(&self) -> &radroots_identity::key::PublicKey
+pub fn radroots_event::envelope::EventEnvelope::content(&self) -> &str
+pub fn radroots_event::envelope::EventEnvelope::created_at(&self) -> radroots_event::envelope::EventTimestamp
+pub fn radroots_event::envelope::EventEnvelope::created_at_u64(&self) -> u64
+pub fn radroots_event::envelope::EventEnvelope::id(&self) -> &radroots_event::id::EventId
+pub fn radroots_event::envelope::EventEnvelope::id_hex(&self) -> alloc::string::String
+pub fn radroots_event::envelope::EventEnvelope::kind(&self) -> radroots_event::envelope::EventKind
+pub fn radroots_event::envelope::EventEnvelope::kind_class(&self) -> radroots_event::envelope::EventKindClass
+pub fn radroots_event::envelope::EventEnvelope::kind_u32(&self) -> u32
+pub fn radroots_event::envelope::EventEnvelope::new(radroots_event::envelope::EventEnvelopeParts) -> core::result::Result<Self, radroots_event::envelope::EventEnvelopeError>
+pub fn radroots_event::envelope::EventEnvelope::new_with_limits(radroots_event::envelope::EventEnvelopeParts, radroots_event::envelope::EventEnvelopeLimits) -> core::result::Result<Self, radroots_event::envelope::EventEnvelopeError>
+pub fn radroots_event::envelope::EventEnvelope::sig(&self) -> &radroots_event::id::EventSignature
+pub fn radroots_event::envelope::EventEnvelope::signature_hex(&self) -> alloc::string::String
+pub fn radroots_event::envelope::EventEnvelope::tag_slices(&self) -> &[radroots_event::envelope::EventTag]
+pub fn radroots_event::envelope::EventEnvelope::tags(&self) -> &radroots_event::envelope::EventTags
+pub fn radroots_event::envelope::EventEnvelope::tags_as_vec(&self) -> alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>
+pub fn radroots_event::envelope::EventEnvelope::to_nip01_wire(&self) -> Nip01EventWire
pub struct radroots_event::EventDraft
-impl radroots_event::draft::RadrootsEventDraft
-pub fn radroots_event::draft::RadrootsEventDraft::content(&self) -> &str
-pub fn radroots_event::draft::RadrootsEventDraft::contract_id(&self) -> &str
-pub fn radroots_event::draft::RadrootsEventDraft::contract_registry_version(&self) -> u32
-pub fn radroots_event::draft::RadrootsEventDraft::created_at(&self) -> radroots_event::envelope::RadrootsEventTimestamp
-pub fn radroots_event::draft::RadrootsEventDraft::created_at_u64(&self) -> u64
-pub fn radroots_event::draft::RadrootsEventDraft::expected_event_id(&self) -> &radroots_event::id::RadrootsEventId
-pub fn radroots_event::draft::RadrootsEventDraft::expected_event_id_hex(&self) -> alloc::string::String
-pub fn radroots_event::draft::RadrootsEventDraft::expected_pubkey(&self) -> &radroots_identity::key::PublicKey
-pub fn radroots_event::draft::RadrootsEventDraft::kind(&self) -> radroots_event::envelope::RadrootsEventKind
-pub fn radroots_event::draft::RadrootsEventDraft::kind_u32(&self) -> u32
-pub fn radroots_event::draft::RadrootsEventDraft::new(impl core::convert::Into<alloc::string::String>, u32, u64, alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>, impl core::convert::Into<alloc::string::String>, impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::draft::RadrootsDraftError>
-pub fn radroots_event::draft::RadrootsEventDraft::nip01_preimage(&self) -> core::result::Result<alloc::string::String, radroots_event::draft::RadrootsDraftError>
-pub fn radroots_event::draft::RadrootsEventDraft::tags(&self) -> &radroots_event::envelope::RadrootsEventTags
-pub fn radroots_event::draft::RadrootsEventDraft::tags_as_vec(&self) -> alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>
-pub fn radroots_event::draft::RadrootsEventDraft::validate_for_signing(&self) -> core::result::Result<(), radroots_event::draft::RadrootsDraftError>
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::draft::RadrootsEventDraft
-pub fn radroots_event::draft::RadrootsEventDraft::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+impl radroots_event::draft::EventDraft
+pub fn radroots_event::draft::EventDraft::content(&self) -> &str
+pub fn radroots_event::draft::EventDraft::contract_id(&self) -> &str
+pub fn radroots_event::draft::EventDraft::contract_registry_version(&self) -> u32
+pub fn radroots_event::draft::EventDraft::created_at(&self) -> radroots_event::envelope::EventTimestamp
+pub fn radroots_event::draft::EventDraft::created_at_u64(&self) -> u64
+pub fn radroots_event::draft::EventDraft::expected_event_id(&self) -> &radroots_event::id::EventId
+pub fn radroots_event::draft::EventDraft::expected_event_id_hex(&self) -> alloc::string::String
+pub fn radroots_event::draft::EventDraft::expected_pubkey(&self) -> &radroots_identity::key::PublicKey
+pub fn radroots_event::draft::EventDraft::kind(&self) -> radroots_event::envelope::EventKind
+pub fn radroots_event::draft::EventDraft::kind_u32(&self) -> u32
+pub fn radroots_event::draft::EventDraft::new(impl core::convert::Into<alloc::string::String>, u32, u64, alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>, impl core::convert::Into<alloc::string::String>, impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::draft::DraftError>
+pub fn radroots_event::draft::EventDraft::nip01_preimage(&self) -> core::result::Result<alloc::string::String, radroots_event::draft::DraftError>
+pub fn radroots_event::draft::EventDraft::tags(&self) -> &radroots_event::envelope::EventTags
+pub fn radroots_event::draft::EventDraft::tags_as_vec(&self) -> alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>
+pub fn radroots_event::draft::EventDraft::validate_for_signing(&self) -> core::result::Result<(), radroots_event::draft::DraftError>
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::draft::EventDraft
+pub fn radroots_event::draft::EventDraft::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
pub struct radroots_event::EventId(_)
-impl radroots_event::id::RadrootsEventId
-pub const fn radroots_event::id::RadrootsEventId::as_bytes(&self) -> &[u8; 32]
-pub const fn radroots_event::id::RadrootsEventId::from_bytes([u8; 32]) -> Self
-pub const fn radroots_event::id::RadrootsEventId::into_bytes(self) -> [u8; 32]
-pub fn radroots_event::id::RadrootsEventId::into_string(self) -> alloc::string::String
-pub fn radroots_event::id::RadrootsEventId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::RadrootsIdParseError>
-pub fn radroots_event::id::RadrootsEventId::to_hex(&self) -> alloc::string::String
-impl core::convert::AsRef<[u8]> for radroots_event::id::RadrootsEventId
-pub fn radroots_event::id::RadrootsEventId::as_ref(&self) -> &[u8]
-impl core::convert::From<[u8; 32]> for radroots_event::id::RadrootsEventId
-pub fn radroots_event::id::RadrootsEventId::from([u8; 32]) -> Self
-impl core::convert::From<radroots_event::id::RadrootsEventId> for [u8; 32]
-pub fn [u8; 32]::from(radroots_event::id::RadrootsEventId) -> Self
-impl core::convert::TryFrom<&str> for radroots_event::id::RadrootsEventId
-pub type radroots_event::id::RadrootsEventId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEventId::try_from(&str) -> core::result::Result<Self, Self::Error>
-impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::RadrootsEventId
-pub type radroots_event::id::RadrootsEventId::Error = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEventId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
-impl core::fmt::Display for radroots_event::id::RadrootsEventId
-pub fn radroots_event::id::RadrootsEventId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-impl core::str::traits::FromStr for radroots_event::id::RadrootsEventId
-pub type radroots_event::id::RadrootsEventId::Err = radroots_event::id::RadrootsIdParseError
-pub fn radroots_event::id::RadrootsEventId::from_str(&str) -> core::result::Result<Self, Self::Err>
-impl serde_core::ser::Serialize for radroots_event::id::RadrootsEventId
-pub fn radroots_event::id::RadrootsEventId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::RadrootsEventId
-pub fn radroots_event::id::RadrootsEventId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+impl radroots_event::id::EventId
+pub const fn radroots_event::id::EventId::as_bytes(&self) -> &[u8; 32]
+pub const fn radroots_event::id::EventId::from_bytes([u8; 32]) -> Self
+pub const fn radroots_event::id::EventId::into_bytes(self) -> [u8; 32]
+pub fn radroots_event::id::EventId::into_string(self) -> alloc::string::String
+pub fn radroots_event::id::EventId::parse(impl core::convert::AsRef<str>) -> core::result::Result<Self, radroots_event::id::ParseError>
+pub fn radroots_event::id::EventId::to_hex(&self) -> alloc::string::String
+impl core::convert::AsRef<[u8]> for radroots_event::id::EventId
+pub fn radroots_event::id::EventId::as_ref(&self) -> &[u8]
+impl core::convert::From<[u8; 32]> for radroots_event::id::EventId
+pub fn radroots_event::id::EventId::from([u8; 32]) -> Self
+impl core::convert::From<radroots_event::id::EventId> for [u8; 32]
+pub fn [u8; 32]::from(radroots_event::id::EventId) -> Self
+impl core::convert::TryFrom<&str> for radroots_event::id::EventId
+pub type radroots_event::id::EventId::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::EventId::try_from(&str) -> core::result::Result<Self, Self::Error>
+impl core::convert::TryFrom<alloc::string::String> for radroots_event::id::EventId
+pub type radroots_event::id::EventId::Error = radroots_event::id::ParseError
+pub fn radroots_event::id::EventId::try_from(alloc::string::String) -> core::result::Result<Self, Self::Error>
+impl core::fmt::Display for radroots_event::id::EventId
+pub fn radroots_event::id::EventId::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+impl core::str::traits::FromStr for radroots_event::id::EventId
+pub type radroots_event::id::EventId::Err = radroots_event::id::ParseError
+pub fn radroots_event::id::EventId::from_str(&str) -> core::result::Result<Self, Self::Err>
+impl serde_core::ser::Serialize for radroots_event::id::EventId
+pub fn radroots_event::id::EventId::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::id::EventId
+pub fn radroots_event::id::EventId::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
pub struct radroots_event::EventKind(_)
-impl radroots_event::envelope::RadrootsEventKind
-pub const fn radroots_event::envelope::RadrootsEventKind::as_u32(self) -> u32
-pub const fn radroots_event::envelope::RadrootsEventKind::class(self) -> radroots_event::envelope::RadrootsEventKindClass
-pub const fn radroots_event::envelope::RadrootsEventKind::new(u32) -> Self
-impl core::convert::From<u32> for radroots_event::envelope::RadrootsEventKind
-pub fn radroots_event::envelope::RadrootsEventKind::from(u32) -> Self
-impl serde_core::ser::Serialize for radroots_event::envelope::RadrootsEventKind
-pub fn radroots_event::envelope::RadrootsEventKind::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::envelope::RadrootsEventKind
-pub fn radroots_event::envelope::RadrootsEventKind::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+impl radroots_event::envelope::EventKind
+pub const fn radroots_event::envelope::EventKind::as_u32(self) -> u32
+pub const fn radroots_event::envelope::EventKind::class(self) -> radroots_event::envelope::EventKindClass
+pub const fn radroots_event::envelope::EventKind::new(u32) -> Self
+impl core::convert::From<u32> for radroots_event::envelope::EventKind
+pub fn radroots_event::envelope::EventKind::from(u32) -> Self
+impl serde_core::ser::Serialize for radroots_event::envelope::EventKind
+pub fn radroots_event::envelope::EventKind::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::envelope::EventKind
+pub fn radroots_event::envelope::EventKind::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
pub struct radroots_event::EventTag(_)
-impl radroots_event::envelope::RadrootsEventTag
-pub fn radroots_event::envelope::RadrootsEventTag::as_slice(&self) -> &[alloc::string::String]
-pub fn radroots_event::envelope::RadrootsEventTag::into_vec(self) -> alloc::vec::Vec<alloc::string::String>
-pub fn radroots_event::envelope::RadrootsEventTag::new(usize, alloc::vec::Vec<alloc::string::String>) -> core::result::Result<Self, radroots_event::envelope::RadrootsEventEnvelopeError>
-pub fn radroots_event::envelope::RadrootsEventTag::new_with_limits(usize, alloc::vec::Vec<alloc::string::String>, radroots_event::envelope::RadrootsEventEnvelopeLimits) -> core::result::Result<Self, radroots_event::envelope::RadrootsEventEnvelopeError>
-impl serde_core::ser::Serialize for radroots_event::envelope::RadrootsEventTag
-pub fn radroots_event::envelope::RadrootsEventTag::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::envelope::RadrootsEventTag
-pub fn radroots_event::envelope::RadrootsEventTag::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+impl radroots_event::envelope::EventTag
+pub fn radroots_event::envelope::EventTag::as_slice(&self) -> &[alloc::string::String]
+pub fn radroots_event::envelope::EventTag::into_vec(self) -> alloc::vec::Vec<alloc::string::String>
+pub fn radroots_event::envelope::EventTag::new(usize, alloc::vec::Vec<alloc::string::String>) -> core::result::Result<Self, radroots_event::envelope::EventEnvelopeError>
+pub fn radroots_event::envelope::EventTag::new_with_limits(usize, alloc::vec::Vec<alloc::string::String>, radroots_event::envelope::EventEnvelopeLimits) -> core::result::Result<Self, radroots_event::envelope::EventEnvelopeError>
+impl serde_core::ser::Serialize for radroots_event::envelope::EventTag
+pub fn radroots_event::envelope::EventTag::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::envelope::EventTag
+pub fn radroots_event::envelope::EventTag::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
pub struct radroots_event::SignedEvent
-impl radroots_event::draft::RadrootsSignedEvent
-pub fn radroots_event::draft::RadrootsSignedEvent::content(&self) -> &str
-pub fn radroots_event::draft::RadrootsSignedEvent::created_at(&self) -> u64
-pub fn radroots_event::draft::RadrootsSignedEvent::envelope(&self) -> &radroots_event::envelope::RadrootsEventEnvelope
-pub fn radroots_event::draft::RadrootsSignedEvent::from_wire_verified_id(RadrootsNip01EventWire, impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::draft::RadrootsSignedEventError>
-pub fn radroots_event::draft::RadrootsSignedEvent::id(&self) -> &radroots_event::id::RadrootsEventId
-pub fn radroots_event::draft::RadrootsSignedEvent::id_hex(&self) -> alloc::string::String
-pub fn radroots_event::draft::RadrootsSignedEvent::id_str(&self) -> &str
-pub fn radroots_event::draft::RadrootsSignedEvent::kind(&self) -> u32
-pub fn radroots_event::draft::RadrootsSignedEvent::new(radroots_event::draft::RadrootsSignedEventParts) -> core::result::Result<Self, radroots_event::draft::RadrootsSignedEventError>
-pub fn radroots_event::draft::RadrootsSignedEvent::pubkey(&self) -> &radroots_identity::key::PublicKey
-pub fn radroots_event::draft::RadrootsSignedEvent::raw_json(&self) -> &str
-pub fn radroots_event::draft::RadrootsSignedEvent::sig(&self) -> &radroots_event::id::RadrootsEventSignature
-pub fn radroots_event::draft::RadrootsSignedEvent::sig_str(&self) -> &str
-pub fn radroots_event::draft::RadrootsSignedEvent::signature_hex(&self) -> alloc::string::String
-pub fn radroots_event::draft::RadrootsSignedEvent::tags_as_vec(&self) -> alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>
-pub fn radroots_event::draft::RadrootsSignedEvent::wire(&self) -> &RadrootsNip01EventWire
-impl serde_core::ser::Serialize for radroots_event::draft::RadrootsSignedEvent
-pub fn radroots_event::draft::RadrootsSignedEvent::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
-impl<'de> serde_core::de::Deserialize<'de> for radroots_event::draft::RadrootsSignedEvent
-pub fn radroots_event::draft::RadrootsSignedEvent::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
+impl radroots_event::draft::SignedEvent
+pub fn radroots_event::draft::SignedEvent::content(&self) -> &str
+pub fn radroots_event::draft::SignedEvent::created_at(&self) -> u64
+pub fn radroots_event::draft::SignedEvent::envelope(&self) -> &radroots_event::envelope::EventEnvelope
+pub fn radroots_event::draft::SignedEvent::from_wire_verified_id(Nip01EventWire, impl core::convert::Into<alloc::string::String>) -> core::result::Result<Self, radroots_event::draft::SignedEventError>
+pub fn radroots_event::draft::SignedEvent::id(&self) -> &radroots_event::id::EventId
+pub fn radroots_event::draft::SignedEvent::id_hex(&self) -> alloc::string::String
+pub fn radroots_event::draft::SignedEvent::id_str(&self) -> &str
+pub fn radroots_event::draft::SignedEvent::kind(&self) -> u32
+pub fn radroots_event::draft::SignedEvent::new(radroots_event::draft::SignedEventParts) -> core::result::Result<Self, radroots_event::draft::SignedEventError>
+pub fn radroots_event::draft::SignedEvent::pubkey(&self) -> &radroots_identity::key::PublicKey
+pub fn radroots_event::draft::SignedEvent::raw_json(&self) -> &str
+pub fn radroots_event::draft::SignedEvent::sig(&self) -> &radroots_event::id::EventSignature
+pub fn radroots_event::draft::SignedEvent::sig_str(&self) -> &str
+pub fn radroots_event::draft::SignedEvent::signature_hex(&self) -> alloc::string::String
+pub fn radroots_event::draft::SignedEvent::tags_as_vec(&self) -> alloc::vec::Vec<alloc::vec::Vec<alloc::string::String>>
+pub fn radroots_event::draft::SignedEvent::wire(&self) -> &Nip01EventWire
+impl serde_core::ser::Serialize for radroots_event::draft::SignedEvent
+pub fn radroots_event::draft::SignedEvent::serialize<S>(&self, S) -> core::result::Result<<S as serde_core::ser::Serializer>::Ok, <S as serde_core::ser::Serializer>::Error> where S: serde_core::ser::Serializer
+impl<'de> serde_core::de::Deserialize<'de> for radroots_event::draft::SignedEvent
+pub fn radroots_event::draft::SignedEvent::deserialize<D>(D) -> core::result::Result<Self, <D as serde_core::de::Deserializer>::Error> where D: serde_core::de::Deserializer<'de>
pub struct radroots_event::VerifiedEvent(_)
impl radroots_event::VerifiedEvent
-pub const fn radroots_event::VerifiedEvent::event(&self) -> &radroots_event::envelope::RadrootsEventEnvelope
-pub fn radroots_event::VerifiedEvent::into_event(self) -> radroots_event::envelope::RadrootsEventEnvelope
+pub const fn radroots_event::VerifiedEvent::event(&self) -> &radroots_event::envelope::EventEnvelope
+pub fn radroots_event::VerifiedEvent::into_event(self) -> radroots_event::envelope::EventEnvelope
pub fn radroots_event::VerifiedEvent::validate_contract(self) -> core::result::Result<radroots_event::admission::ContractValidatedEvent, radroots_event::Error>
diff --git a/tools/xtask/src/contract.rs b/tools/xtask/src/contract.rs
@@ -216,59 +216,59 @@ const RETIRED_OPERATION_EVENT_NAMES: [&str; 15] = [
"RadrootsNip10RelayHint",
];
const REQUIRED_CALENDAR_PUBLIC_TYPES: [&str; 34] = [
- "RadrootsNip01EventWireParts",
+ "Nip01EventWireParts",
"BlobUrl",
- "RadrootsAuthoredImage",
- "RadrootsAuthoredImageError",
- "RadrootsIanaTimeZoneId",
- "RadrootsCalendarUri",
- "RadrootsCalendarRequest",
- "RadrootsCalendarParticipant",
- "RadrootsCalendarEventError",
- "RadrootsCalendarDate",
- "RadrootsAuthoredCalendarDateEvent",
- "RadrootsAuthoredCalendarTimeEvent",
- "RadrootsParsedNip52CalendarCommon",
- "RadrootsParsedNip52CalendarCommonParts",
- "RadrootsParsedNip52CalendarDateEvent",
- "RadrootsObservedUtcDay",
- "RadrootsParsedNip52CalendarTimeEvent",
- "RadrootsCalendarAdmissionError",
- "RadrootsAdmittedCalendarDateEvent",
- "RadrootsAdmittedCalendarTimeEvent",
- "RadrootsCalendarUid",
- "RadrootsCalendarEventReference",
- "RadrootsCalendarEventRevisionReference",
- "RadrootsCalendarEventAuthorReference",
- "RadrootsAuthoredCalendar",
- "RadrootsParsedNip52CalendarParts",
- "RadrootsParsedNip52Calendar",
- "RadrootsAdmittedCalendar",
- "RadrootsCalendarEventRsvpStatus",
- "RadrootsCalendarEventFreeBusy",
- "RadrootsAuthoredCalendarEventRsvp",
- "RadrootsParsedNip52CalendarEventRsvpParts",
- "RadrootsParsedNip52CalendarEventRsvp",
- "RadrootsAdmittedCalendarEventRsvp",
+ "AuthoredImage",
+ "AuthoredImageError",
+ "IanaTimeZoneId",
+ "CalendarUri",
+ "CalendarRequest",
+ "CalendarParticipant",
+ "CalendarEventError",
+ "CalendarDate",
+ "AuthoredCalendarDateEvent",
+ "AuthoredCalendarTimeEvent",
+ "ParsedNip52CalendarCommon",
+ "ParsedNip52CalendarCommonParts",
+ "ParsedNip52CalendarDateEvent",
+ "ObservedUtcDay",
+ "ParsedNip52CalendarTimeEvent",
+ "CalendarAdmissionError",
+ "AdmittedCalendarDateEvent",
+ "AdmittedCalendarTimeEvent",
+ "CalendarUid",
+ "CalendarEventReference",
+ "CalendarEventRevisionReference",
+ "CalendarEventAuthorReference",
+ "AuthoredCalendar",
+ "ParsedNip52CalendarParts",
+ "ParsedNip52Calendar",
+ "AdmittedCalendar",
+ "CalendarEventRsvpStatus",
+ "CalendarEventFreeBusy",
+ "AuthoredCalendarEventRsvp",
+ "ParsedNip52CalendarEventRsvpParts",
+ "ParsedNip52CalendarEventRsvp",
+ "AdmittedCalendarEventRsvp",
];
const REQUIRED_POST_PUBLIC_TYPES: [&str; 34] = [
"ApprovedBlobUrl",
"ByteVerifiedDescriptor",
- "RadrootsNip01EventWireParts",
- "RadrootsEventEnvelope",
+ "Nip01EventWireParts",
+ "EventEnvelope",
"RadrootsSignatureVerifiedEvent",
- "RadrootsAuthoredImage",
- "RadrootsPost",
- "RadrootsAuthoredPostError",
- "RadrootsPostImageDimensions",
- "RadrootsAuthoredPostImage",
- "RadrootsAuthoredUpdate",
- "RadrootsAuthoredPhotoUpdate",
- "RadrootsAuthoredAsk",
- "RadrootsNip10ReplyError",
- "RadrootsNostrRelayHint",
- "RadrootsNip10ReplyReference",
- "RadrootsAuthoredNip10Reply",
+ "AuthoredImage",
+ "Post",
+ "AuthoredPostError",
+ "PostImageDimensions",
+ "AuthoredPostImage",
+ "AuthoredUpdate",
+ "AuthoredPhotoUpdate",
+ "AuthoredAsk",
+ "Nip10ReplyError",
+ "NostrRelayHint",
+ "Nip10ReplyReference",
+ "AuthoredNip10Reply",
"RadrootsPostDiagnostic",
"RadrootsPostClassification",
"RadrootsInboundPostImeta",
@@ -289,25 +289,25 @@ const REQUIRED_POST_PUBLIC_TYPES: [&str; 34] = [
];
const REQUIRED_FOOD_AVAILABILITY_PUBLIC_TYPES: [&str; 31] = [
"ByteVerifiedDescriptor",
- "RadrootsNip01EventWireParts",
- "RadrootsEventEnvelope",
+ "Nip01EventWireParts",
+ "EventEnvelope",
"RadrootsSignatureVerifiedEvent",
- "RadrootsClassifiedListingPartition",
- "RadrootsAuthoredImage",
- "RadrootsFoodAvailabilityError",
- "RadrootsFoodContent",
- "RadrootsFoodIdentifier",
- "RadrootsFoodText",
- "RadrootsFoodPublishedAt",
- "RadrootsFoodCurrency",
- "RadrootsFoodUnit",
- "RadrootsFoodPrice",
- "RadrootsFoodQuantity",
- "RadrootsFoodAvailabilityStatus",
- "RadrootsFoodImageDimensions",
- "RadrootsFoodAvailabilityImage",
- "RadrootsFoodAvailabilityDetailsParts",
- "RadrootsFoodAvailabilityDetails",
+ "ClassifiedListingPartition",
+ "AuthoredImage",
+ "FoodAvailabilityError",
+ "FoodContent",
+ "FoodIdentifier",
+ "FoodText",
+ "FoodPublishedAt",
+ "FoodCurrency",
+ "FoodUnit",
+ "FoodPrice",
+ "FoodQuantity",
+ "FoodAvailabilityStatus",
+ "FoodImageDimensions",
+ "FoodAvailabilityImage",
+ "FoodAvailabilityDetailsParts",
+ "FoodAvailabilityDetails",
"RadrootsFoodAvailabilityEncodeError",
"RadrootsFoodAvailabilityImageDiagnostic",
"RadrootsInboundFoodAvailabilityImage",
@@ -324,8 +324,8 @@ const CALENDAR_OPERATION_EXPECTATIONS: [CalendarOperationExpectation; 12] = [
CalendarOperationExpectation {
key: "social_calendar_date_event_build_authored_draft",
id: "social.calendar_date_event.build_authored_draft",
- inputs: &["RadrootsAuthoredCalendarDateEvent"],
- outputs: &["RadrootsNip01EventWireParts"],
+ inputs: &["AuthoredCalendarDateEvent"],
+ outputs: &["Nip01EventWireParts"],
error_class: "encode_error",
rust_modules: &[
"crates/event/src/calendar.rs",
@@ -333,11 +333,11 @@ const CALENDAR_OPERATION_EXPECTATIONS: [CalendarOperationExpectation; 12] = [
"crates/event_codec/src/calendar/encode.rs",
],
rust_types: &[
- "radroots_event::calendar::RadrootsAuthoredCalendarDateEvent",
- "radroots_event::calendar::RadrootsCalendarDate",
- "radroots_event::calendar::RadrootsCalendarEventError",
- "radroots_event::media::RadrootsAuthoredImage",
- "radroots_event::wire::RadrootsNip01EventWireParts",
+ "radroots_event::calendar::AuthoredCalendarDateEvent",
+ "radroots_event::calendar::CalendarDate",
+ "radroots_event::calendar::CalendarEventError",
+ "radroots_event::media::AuthoredImage",
+ "radroots_event::wire::Nip01EventWireParts",
"radroots_event_codec::error::EventEncodeError",
],
vector: "contracts/conformance/vectors/calendar/radroots_profile.v1.json",
@@ -346,19 +346,19 @@ const CALENDAR_OPERATION_EXPECTATIONS: [CalendarOperationExpectation; 12] = [
key: "social_calendar_date_event_parse_nip52",
id: "social.calendar_date_event.parse_nip52",
inputs: &["u32", "NostrTags", "String"],
- outputs: &["RadrootsParsedNip52CalendarDateEvent"],
+ outputs: &["ParsedNip52CalendarDateEvent"],
error_class: "parse_error",
rust_modules: &[
"crates/event/src/calendar.rs",
"crates/event_codec/src/calendar/decode.rs",
],
rust_types: &[
- "radroots_event::calendar::RadrootsCalendarDate",
- "radroots_event::calendar::RadrootsCalendarRequest",
- "radroots_event::calendar::RadrootsCalendarUri",
- "radroots_event::calendar::RadrootsParsedNip52CalendarCommon",
- "radroots_event::calendar::RadrootsParsedNip52CalendarCommonParts",
- "radroots_event::calendar::RadrootsParsedNip52CalendarDateEvent",
+ "radroots_event::calendar::CalendarDate",
+ "radroots_event::calendar::CalendarRequest",
+ "radroots_event::calendar::CalendarUri",
+ "radroots_event::calendar::ParsedNip52CalendarCommon",
+ "radroots_event::calendar::ParsedNip52CalendarCommonParts",
+ "radroots_event::calendar::ParsedNip52CalendarDateEvent",
"radroots_event_codec::error::EventParseError",
],
vector: "contracts/conformance/vectors/calendar/nip52_baseline.v1.json",
@@ -366,25 +366,25 @@ const CALENDAR_OPERATION_EXPECTATIONS: [CalendarOperationExpectation; 12] = [
CalendarOperationExpectation {
key: "social_calendar_date_event_admit_radroots_profile",
id: "social.calendar_date_event.admit_radroots_profile",
- inputs: &["RadrootsParsedNip52CalendarDateEvent"],
- outputs: &["RadrootsAdmittedCalendarDateEvent"],
+ inputs: &["ParsedNip52CalendarDateEvent"],
+ outputs: &["AdmittedCalendarDateEvent"],
error_class: "admission_error",
rust_modules: &[
"crates/event/src/calendar.rs",
"crates/event_codec/src/calendar/decode.rs",
],
rust_types: &[
- "radroots_event::calendar::RadrootsAdmittedCalendarDateEvent",
- "radroots_event::calendar::RadrootsCalendarAdmissionError",
- "radroots_event::calendar::RadrootsParsedNip52CalendarDateEvent",
+ "radroots_event::calendar::AdmittedCalendarDateEvent",
+ "radroots_event::calendar::CalendarAdmissionError",
+ "radroots_event::calendar::ParsedNip52CalendarDateEvent",
],
vector: "contracts/conformance/vectors/calendar/radroots_profile.v1.json",
},
CalendarOperationExpectation {
key: "social_calendar_time_event_build_authored_draft",
id: "social.calendar_time_event.build_authored_draft",
- inputs: &["RadrootsAuthoredCalendarTimeEvent"],
- outputs: &["RadrootsNip01EventWireParts"],
+ inputs: &["AuthoredCalendarTimeEvent"],
+ outputs: &["Nip01EventWireParts"],
error_class: "encode_error",
rust_modules: &[
"crates/event/src/calendar.rs",
@@ -392,11 +392,11 @@ const CALENDAR_OPERATION_EXPECTATIONS: [CalendarOperationExpectation; 12] = [
"crates/event_codec/src/calendar/encode.rs",
],
rust_types: &[
- "radroots_event::calendar::RadrootsAuthoredCalendarTimeEvent",
- "radroots_event::calendar::RadrootsCalendarEventError",
- "radroots_event::calendar::RadrootsIanaTimeZoneId",
- "radroots_event::media::RadrootsAuthoredImage",
- "radroots_event::wire::RadrootsNip01EventWireParts",
+ "radroots_event::calendar::AuthoredCalendarTimeEvent",
+ "radroots_event::calendar::CalendarEventError",
+ "radroots_event::calendar::IanaTimeZoneId",
+ "radroots_event::media::AuthoredImage",
+ "radroots_event::wire::Nip01EventWireParts",
"radroots_event_codec::error::EventEncodeError",
],
vector: "contracts/conformance/vectors/calendar/radroots_profile.v1.json",
@@ -405,20 +405,20 @@ const CALENDAR_OPERATION_EXPECTATIONS: [CalendarOperationExpectation; 12] = [
key: "social_calendar_time_event_parse_nip52",
id: "social.calendar_time_event.parse_nip52",
inputs: &["u32", "NostrTags", "String"],
- outputs: &["RadrootsParsedNip52CalendarTimeEvent"],
+ outputs: &["ParsedNip52CalendarTimeEvent"],
error_class: "parse_error",
rust_modules: &[
"crates/event/src/calendar.rs",
"crates/event_codec/src/calendar/decode.rs",
],
rust_types: &[
- "radroots_event::calendar::RadrootsCalendarRequest",
- "radroots_event::calendar::RadrootsCalendarUri",
- "radroots_event::calendar::RadrootsIanaTimeZoneId",
- "radroots_event::calendar::RadrootsObservedUtcDay",
- "radroots_event::calendar::RadrootsParsedNip52CalendarCommon",
- "radroots_event::calendar::RadrootsParsedNip52CalendarCommonParts",
- "radroots_event::calendar::RadrootsParsedNip52CalendarTimeEvent",
+ "radroots_event::calendar::CalendarRequest",
+ "radroots_event::calendar::CalendarUri",
+ "radroots_event::calendar::IanaTimeZoneId",
+ "radroots_event::calendar::ObservedUtcDay",
+ "radroots_event::calendar::ParsedNip52CalendarCommon",
+ "radroots_event::calendar::ParsedNip52CalendarCommonParts",
+ "radroots_event::calendar::ParsedNip52CalendarTimeEvent",
"radroots_event_codec::error::EventParseError",
],
vector: "contracts/conformance/vectors/calendar/nip52_baseline.v1.json",
@@ -426,25 +426,25 @@ const CALENDAR_OPERATION_EXPECTATIONS: [CalendarOperationExpectation; 12] = [
CalendarOperationExpectation {
key: "social_calendar_time_event_admit_radroots_profile",
id: "social.calendar_time_event.admit_radroots_profile",
- inputs: &["RadrootsParsedNip52CalendarTimeEvent"],
- outputs: &["RadrootsAdmittedCalendarTimeEvent"],
+ inputs: &["ParsedNip52CalendarTimeEvent"],
+ outputs: &["AdmittedCalendarTimeEvent"],
error_class: "admission_error",
rust_modules: &[
"crates/event/src/calendar.rs",
"crates/event_codec/src/calendar/decode.rs",
],
rust_types: &[
- "radroots_event::calendar::RadrootsAdmittedCalendarTimeEvent",
- "radroots_event::calendar::RadrootsCalendarAdmissionError",
- "radroots_event::calendar::RadrootsParsedNip52CalendarTimeEvent",
+ "radroots_event::calendar::AdmittedCalendarTimeEvent",
+ "radroots_event::calendar::CalendarAdmissionError",
+ "radroots_event::calendar::ParsedNip52CalendarTimeEvent",
],
vector: "contracts/conformance/vectors/calendar/radroots_profile.v1.json",
},
CalendarOperationExpectation {
key: "social_calendar_build_authored_draft",
id: "social.calendar.build_authored_draft",
- inputs: &["RadrootsAuthoredCalendar"],
- outputs: &["RadrootsNip01EventWireParts"],
+ inputs: &["AuthoredCalendar"],
+ outputs: &["Nip01EventWireParts"],
error_class: "encode_error",
rust_modules: &[
"crates/event/src/calendar.rs",
@@ -452,12 +452,12 @@ const CALENDAR_OPERATION_EXPECTATIONS: [CalendarOperationExpectation; 12] = [
"crates/event_codec/src/calendar/encode.rs",
],
rust_types: &[
- "radroots_event::calendar::RadrootsAuthoredCalendar",
- "radroots_event::calendar::RadrootsCalendarEventError",
- "radroots_event::calendar::RadrootsCalendarEventReference",
- "radroots_event::calendar::RadrootsCalendarUid",
- "radroots_event::media::RadrootsAuthoredImage",
- "radroots_event::wire::RadrootsNip01EventWireParts",
+ "radroots_event::calendar::AuthoredCalendar",
+ "radroots_event::calendar::CalendarEventError",
+ "radroots_event::calendar::CalendarEventReference",
+ "radroots_event::calendar::CalendarUid",
+ "radroots_event::media::AuthoredImage",
+ "radroots_event::wire::Nip01EventWireParts",
"radroots_event_codec::error::EventEncodeError",
],
vector: "contracts/conformance/vectors/calendar/radroots_profile.v1.json",
@@ -466,18 +466,18 @@ const CALENDAR_OPERATION_EXPECTATIONS: [CalendarOperationExpectation; 12] = [
key: "social_calendar_parse_nip52",
id: "social.calendar.parse_nip52",
inputs: &["u32", "NostrTags", "String"],
- outputs: &["RadrootsParsedNip52Calendar"],
+ outputs: &["ParsedNip52Calendar"],
error_class: "parse_error",
rust_modules: &[
"crates/event/src/calendar.rs",
"crates/event_codec/src/calendar/decode.rs",
],
rust_types: &[
- "radroots_event::calendar::RadrootsCalendarEventError",
- "radroots_event::calendar::RadrootsCalendarEventReference",
- "radroots_event::calendar::RadrootsCalendarUri",
- "radroots_event::calendar::RadrootsParsedNip52Calendar",
- "radroots_event::calendar::RadrootsParsedNip52CalendarParts",
+ "radroots_event::calendar::CalendarEventError",
+ "radroots_event::calendar::CalendarEventReference",
+ "radroots_event::calendar::CalendarUri",
+ "radroots_event::calendar::ParsedNip52Calendar",
+ "radroots_event::calendar::ParsedNip52CalendarParts",
"radroots_event_codec::error::EventParseError",
],
vector: "contracts/conformance/vectors/calendar/nip52_baseline.v1.json",
@@ -485,8 +485,8 @@ const CALENDAR_OPERATION_EXPECTATIONS: [CalendarOperationExpectation; 12] = [
CalendarOperationExpectation {
key: "social_calendar_admit_radroots_profile",
id: "social.calendar.admit_radroots_profile",
- inputs: &["RadrootsParsedNip52Calendar"],
- outputs: &["RadrootsAdmittedCalendar"],
+ inputs: &["ParsedNip52Calendar"],
+ outputs: &["AdmittedCalendar"],
error_class: "admission_error",
rust_modules: &[
"crates/event/src/calendar.rs",
@@ -494,34 +494,34 @@ const CALENDAR_OPERATION_EXPECTATIONS: [CalendarOperationExpectation; 12] = [
],
rust_types: &[
"radroots_blossom::BlobUrl",
- "radroots_event::calendar::RadrootsAdmittedCalendar",
- "radroots_event::calendar::RadrootsCalendarAdmissionError",
- "radroots_event::calendar::RadrootsCalendarEventReference",
- "radroots_event::calendar::RadrootsCalendarUid",
- "radroots_event::calendar::RadrootsParsedNip52Calendar",
+ "radroots_event::calendar::AdmittedCalendar",
+ "radroots_event::calendar::CalendarAdmissionError",
+ "radroots_event::calendar::CalendarEventReference",
+ "radroots_event::calendar::CalendarUid",
+ "radroots_event::calendar::ParsedNip52Calendar",
],
vector: "contracts/conformance/vectors/calendar/radroots_profile.v1.json",
},
CalendarOperationExpectation {
key: "social_calendar_rsvp_build_authored_draft",
id: "social.calendar_rsvp.build_authored_draft",
- inputs: &["RadrootsAuthoredCalendarEventRsvp"],
- outputs: &["RadrootsNip01EventWireParts"],
+ inputs: &["AuthoredCalendarEventRsvp"],
+ outputs: &["Nip01EventWireParts"],
error_class: "encode_error",
rust_modules: &[
"crates/event/src/calendar.rs",
"crates/event_codec/src/calendar/encode.rs",
],
rust_types: &[
- "radroots_event::calendar::RadrootsAuthoredCalendarEventRsvp",
- "radroots_event::calendar::RadrootsCalendarEventAuthorReference",
- "radroots_event::calendar::RadrootsCalendarEventError",
- "radroots_event::calendar::RadrootsCalendarEventReference",
- "radroots_event::calendar::RadrootsCalendarEventRevisionReference",
- "radroots_event::calendar::RadrootsCalendarUid",
- "radroots_event::calendar::RadrootsCalendarEventFreeBusy",
- "radroots_event::calendar::RadrootsCalendarEventRsvpStatus",
- "radroots_event::wire::RadrootsNip01EventWireParts",
+ "radroots_event::calendar::AuthoredCalendarEventRsvp",
+ "radroots_event::calendar::CalendarEventAuthorReference",
+ "radroots_event::calendar::CalendarEventError",
+ "radroots_event::calendar::CalendarEventReference",
+ "radroots_event::calendar::CalendarEventRevisionReference",
+ "radroots_event::calendar::CalendarUid",
+ "radroots_event::calendar::CalendarEventFreeBusy",
+ "radroots_event::calendar::CalendarEventRsvpStatus",
+ "radroots_event::wire::Nip01EventWireParts",
"radroots_event_codec::error::EventEncodeError",
],
vector: "contracts/conformance/vectors/calendar/radroots_profile.v1.json",
@@ -530,21 +530,21 @@ const CALENDAR_OPERATION_EXPECTATIONS: [CalendarOperationExpectation; 12] = [
key: "social_calendar_rsvp_parse_nip52",
id: "social.calendar_rsvp.parse_nip52",
inputs: &["u32", "NostrTags", "String"],
- outputs: &["RadrootsParsedNip52CalendarEventRsvp"],
+ outputs: &["ParsedNip52CalendarEventRsvp"],
error_class: "parse_error",
rust_modules: &[
"crates/event/src/calendar.rs",
"crates/event_codec/src/calendar/decode.rs",
],
rust_types: &[
- "radroots_event::calendar::RadrootsCalendarEventAuthorReference",
- "radroots_event::calendar::RadrootsCalendarEventError",
- "radroots_event::calendar::RadrootsCalendarEventReference",
- "radroots_event::calendar::RadrootsCalendarEventRevisionReference",
- "radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvp",
- "radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvpParts",
- "radroots_event::calendar::RadrootsCalendarEventFreeBusy",
- "radroots_event::calendar::RadrootsCalendarEventRsvpStatus",
+ "radroots_event::calendar::CalendarEventAuthorReference",
+ "radroots_event::calendar::CalendarEventError",
+ "radroots_event::calendar::CalendarEventReference",
+ "radroots_event::calendar::CalendarEventRevisionReference",
+ "radroots_event::calendar::ParsedNip52CalendarEventRsvp",
+ "radroots_event::calendar::ParsedNip52CalendarEventRsvpParts",
+ "radroots_event::calendar::CalendarEventFreeBusy",
+ "radroots_event::calendar::CalendarEventRsvpStatus",
"radroots_event_codec::error::EventParseError",
],
vector: "contracts/conformance/vectors/calendar/nip52_baseline.v1.json",
@@ -552,23 +552,23 @@ const CALENDAR_OPERATION_EXPECTATIONS: [CalendarOperationExpectation; 12] = [
CalendarOperationExpectation {
key: "social_calendar_rsvp_admit_radroots_profile",
id: "social.calendar_rsvp.admit_radroots_profile",
- inputs: &["RadrootsParsedNip52CalendarEventRsvp"],
- outputs: &["RadrootsAdmittedCalendarEventRsvp"],
+ inputs: &["ParsedNip52CalendarEventRsvp"],
+ outputs: &["AdmittedCalendarEventRsvp"],
error_class: "admission_error",
rust_modules: &[
"crates/event/src/calendar.rs",
"crates/event_codec/src/calendar/decode.rs",
],
rust_types: &[
- "radroots_event::calendar::RadrootsAdmittedCalendarEventRsvp",
- "radroots_event::calendar::RadrootsCalendarAdmissionError",
- "radroots_event::calendar::RadrootsCalendarEventAuthorReference",
- "radroots_event::calendar::RadrootsCalendarEventReference",
- "radroots_event::calendar::RadrootsCalendarEventRevisionReference",
- "radroots_event::calendar::RadrootsCalendarUid",
- "radroots_event::calendar::RadrootsParsedNip52CalendarEventRsvp",
- "radroots_event::calendar::RadrootsCalendarEventFreeBusy",
- "radroots_event::calendar::RadrootsCalendarEventRsvpStatus",
+ "radroots_event::calendar::AdmittedCalendarEventRsvp",
+ "radroots_event::calendar::CalendarAdmissionError",
+ "radroots_event::calendar::CalendarEventAuthorReference",
+ "radroots_event::calendar::CalendarEventReference",
+ "radroots_event::calendar::CalendarEventRevisionReference",
+ "radroots_event::calendar::CalendarUid",
+ "radroots_event::calendar::ParsedNip52CalendarEventRsvp",
+ "radroots_event::calendar::CalendarEventFreeBusy",
+ "radroots_event::calendar::CalendarEventRsvpStatus",
],
vector: "contracts/conformance/vectors/calendar/radroots_profile.v1.json",
},
@@ -577,8 +577,8 @@ const POST_OPERATION_EXPECTATIONS: [PostOperationExpectation; 8] = [
PostOperationExpectation {
key: "social_update_build_authored_draft",
id: "social.update.build_authored_draft",
- inputs: &["RadrootsAuthoredUpdate"],
- outputs: &["RadrootsNip01EventWireParts"],
+ inputs: &["AuthoredUpdate"],
+ outputs: &["Nip01EventWireParts"],
error_class: "encode_error",
signing: "none",
rust_modules: &[
@@ -586,8 +586,8 @@ const POST_OPERATION_EXPECTATIONS: [PostOperationExpectation; 8] = [
"crates/event_codec/src/post/authored.rs",
],
rust_types: &[
- "radroots_event::post::RadrootsAuthoredPostError",
- "radroots_event::post::RadrootsAuthoredUpdate",
+ "radroots_event::post::AuthoredPostError",
+ "radroots_event::post::AuthoredUpdate",
],
case_kinds: &[
"social.update.build_authored_draft.valid",
@@ -597,8 +597,8 @@ const POST_OPERATION_EXPECTATIONS: [PostOperationExpectation; 8] = [
PostOperationExpectation {
key: "social_photo_update_build_authored_draft",
id: "social.photo_update.build_authored_draft",
- inputs: &["RadrootsAuthoredPhotoUpdate"],
- outputs: &["RadrootsNip01EventWireParts"],
+ inputs: &["AuthoredPhotoUpdate"],
+ outputs: &["Nip01EventWireParts"],
error_class: "encode_error",
signing: "none",
rust_modules: &[
@@ -608,11 +608,11 @@ const POST_OPERATION_EXPECTATIONS: [PostOperationExpectation; 8] = [
rust_types: &[
"radroots_blossom::ApprovedBlobUrl",
"radroots_blossom::ByteVerifiedDescriptor",
- "radroots_event::media::RadrootsAuthoredImage",
- "radroots_event::post::RadrootsAuthoredPhotoUpdate",
- "radroots_event::post::RadrootsAuthoredPostError",
- "radroots_event::post::RadrootsAuthoredPostImage",
- "radroots_event::post::RadrootsPostImageDimensions",
+ "radroots_event::media::AuthoredImage",
+ "radroots_event::post::AuthoredPhotoUpdate",
+ "radroots_event::post::AuthoredPostError",
+ "radroots_event::post::AuthoredPostImage",
+ "radroots_event::post::PostImageDimensions",
],
case_kinds: &[
"social.photo_update.build_authored_draft.valid",
@@ -622,8 +622,8 @@ const POST_OPERATION_EXPECTATIONS: [PostOperationExpectation; 8] = [
PostOperationExpectation {
key: "social_ask_build_authored_draft",
id: "social.ask.build_authored_draft",
- inputs: &["RadrootsAuthoredAsk"],
- outputs: &["RadrootsNip01EventWireParts"],
+ inputs: &["AuthoredAsk"],
+ outputs: &["Nip01EventWireParts"],
error_class: "encode_error",
signing: "none",
rust_modules: &[
@@ -631,9 +631,9 @@ const POST_OPERATION_EXPECTATIONS: [PostOperationExpectation; 8] = [
"crates/event_codec/src/post/authored.rs",
],
rust_types: &[
- "radroots_event::post::RadrootsAuthoredAsk",
- "radroots_event::post::RadrootsAuthoredPostError",
- "radroots_event::post::RadrootsAuthoredPostImage",
+ "radroots_event::post::AuthoredAsk",
+ "radroots_event::post::AuthoredPostError",
+ "radroots_event::post::AuthoredPostImage",
],
case_kinds: &[
"social.ask.build_authored_draft.valid",
@@ -643,8 +643,8 @@ const POST_OPERATION_EXPECTATIONS: [PostOperationExpectation; 8] = [
PostOperationExpectation {
key: "social_reply_build_authored_draft",
id: "social.reply.build_authored_draft",
- inputs: &["RadrootsAuthoredNip10Reply"],
- outputs: &["RadrootsNip01EventWireParts"],
+ inputs: &["AuthoredNip10Reply"],
+ outputs: &["Nip01EventWireParts"],
error_class: "encode_error",
signing: "none",
rust_modules: &[
@@ -653,10 +653,10 @@ const POST_OPERATION_EXPECTATIONS: [PostOperationExpectation; 8] = [
"crates/event_codec/src/reply/authored.rs",
],
rust_types: &[
- "radroots_event::post::reply::RadrootsAuthoredNip10Reply",
- "radroots_event::post::reply::RadrootsNip10ReplyError",
- "radroots_event::tag::relay_hint::RadrootsNostrRelayHint",
- "radroots_event::post::reply::RadrootsNip10ReplyReference",
+ "radroots_event::post::reply::AuthoredNip10Reply",
+ "radroots_event::post::reply::Nip10ReplyError",
+ "radroots_event::tag::relay_hint::NostrRelayHint",
+ "radroots_event::post::reply::Nip10ReplyReference",
],
case_kinds: &[
"social.reply.build_authored_draft.valid",
@@ -675,7 +675,7 @@ const POST_OPERATION_EXPECTATIONS: [PostOperationExpectation; 8] = [
"crates/event_codec/src/reply/inbound.rs",
],
rust_types: &[
- "radroots_event::tag::relay_hint::RadrootsNostrRelayHint",
+ "radroots_event::tag::relay_hint::NostrRelayHint",
"radroots_event_codec::reply::inbound::RadrootsInboundNip10EventReference",
"radroots_event_codec::reply::inbound::RadrootsInboundNip10Participant",
"radroots_event_codec::reply::inbound::RadrootsInboundNip10ReplyProjection",
@@ -692,7 +692,7 @@ const POST_OPERATION_EXPECTATIONS: [PostOperationExpectation; 8] = [
PostOperationExpectation {
key: "social_reply_verify_and_admit_event",
id: "social.reply.verify_and_admit_event",
- inputs: &["RadrootsEventEnvelope"],
+ inputs: &["EventEnvelope"],
outputs: &["RadrootsAdmittedNip10ReplyEvent"],
error_class: "admission_error",
signing: "nip01",
@@ -702,7 +702,7 @@ const POST_OPERATION_EXPECTATIONS: [PostOperationExpectation; 8] = [
"crates/event_codec/src/verification.rs",
],
rust_types: &[
- "radroots_event::envelope::RadrootsEventEnvelope",
+ "radroots_event::envelope::EventEnvelope",
"radroots_event_codec::reply::admission::RadrootsAdmittedNip10ReplyEvent",
"radroots_event_codec::reply::admission::RadrootsNip10ReplyAdmissionError",
"radroots_event_codec::reply::inbound::RadrootsInboundNip10ReplyProjection",
@@ -737,7 +737,7 @@ const POST_OPERATION_EXPECTATIONS: [PostOperationExpectation; 8] = [
PostOperationExpectation {
key: "social_post_verify_and_admit_event",
id: "social.post.verify_and_admit_event",
- inputs: &["RadrootsEventEnvelope"],
+ inputs: &["EventEnvelope"],
outputs: &["RadrootsPostAdmissionOutcome"],
error_class: "admission_error",
signing: "nip01",
@@ -747,7 +747,7 @@ const POST_OPERATION_EXPECTATIONS: [PostOperationExpectation; 8] = [
"crates/event_codec/src/verification.rs",
],
rust_types: &[
- "radroots_event::envelope::RadrootsEventEnvelope",
+ "radroots_event::envelope::EventEnvelope",
"radroots_event_codec::post::admission::RadrootsAdmittedRootPostEvent",
"radroots_event_codec::post::admission::RadrootsPostAdmissionError",
"radroots_event_codec::post::admission::RadrootsPostAdmissionOutcome",
@@ -1034,8 +1034,8 @@ const FOOD_AVAILABILITY_OPERATION_EXPECTATIONS: [FoodAvailabilityOperationExpect
FoodAvailabilityOperationExpectation {
key: "food_availability_build_authored_draft",
id: "food_availability.build_authored_draft",
- inputs: &["RadrootsFoodAvailabilityDetails", "u64"],
- outputs: &["RadrootsNip01EventWireParts"],
+ inputs: &["FoodAvailabilityDetails", "u64"],
+ outputs: &["Nip01EventWireParts"],
error_class: "encode_error",
signing: "none",
rust_modules: &[
@@ -1044,12 +1044,12 @@ const FOOD_AVAILABILITY_OPERATION_EXPECTATIONS: [FoodAvailabilityOperationExpect
],
rust_types: &[
"radroots_blossom::ByteVerifiedDescriptor",
- "radroots_event::food::availability::RadrootsFoodAvailabilityDetails",
- "radroots_event::food::availability::RadrootsFoodAvailabilityDetailsParts",
- "radroots_event::food::availability::RadrootsFoodAvailabilityError",
- "radroots_event::food::availability::RadrootsFoodAvailabilityImage",
- "radroots_event::media::RadrootsAuthoredImage",
- "radroots_event::wire::RadrootsNip01EventWireParts",
+ "radroots_event::food::availability::FoodAvailabilityDetails",
+ "radroots_event::food::availability::FoodAvailabilityDetailsParts",
+ "radroots_event::food::availability::FoodAvailabilityError",
+ "radroots_event::food::availability::FoodAvailabilityImage",
+ "radroots_event::media::AuthoredImage",
+ "radroots_event::wire::Nip01EventWireParts",
"radroots_event_codec::food_availability::authored::RadrootsFoodAvailabilityEncodeError",
],
case_kinds: &[
@@ -1070,8 +1070,8 @@ const FOOD_AVAILABILITY_OPERATION_EXPECTATIONS: [FoodAvailabilityOperationExpect
"crates/event_codec/src/food_availability/inbound.rs",
],
rust_types: &[
- "radroots_event::listing::classified::RadrootsClassifiedListingPartition",
- "radroots_event::food::availability::RadrootsFoodAvailabilityError",
+ "radroots_event::listing::classified::ClassifiedListingPartition",
+ "radroots_event::food::availability::FoodAvailabilityError",
"radroots_event_codec::food_availability::inbound::RadrootsFoodAvailabilityImageDiagnostic",
"radroots_event_codec::food_availability::inbound::RadrootsFoodAvailabilityProjectionError",
"radroots_event_codec::food_availability::inbound::RadrootsFoodAvailabilityProjectionOutcome",
@@ -1087,7 +1087,7 @@ const FOOD_AVAILABILITY_OPERATION_EXPECTATIONS: [FoodAvailabilityOperationExpect
FoodAvailabilityOperationExpectation {
key: "food_availability_verify_and_admit_event",
id: "food_availability.verify_and_admit_event",
- inputs: &["RadrootsEventEnvelope"],
+ inputs: &["EventEnvelope"],
outputs: &["RadrootsFoodAvailabilityAdmissionOutcome"],
error_class: "admission_error",
signing: "nip01",
@@ -1097,7 +1097,7 @@ const FOOD_AVAILABILITY_OPERATION_EXPECTATIONS: [FoodAvailabilityOperationExpect
"crates/event_codec/src/verification.rs",
],
rust_types: &[
- "radroots_event::envelope::RadrootsEventEnvelope",
+ "radroots_event::envelope::EventEnvelope",
"radroots_event_codec::food_availability::admission::RadrootsAdmittedFoodAvailabilityEvent",
"radroots_event_codec::food_availability::admission::RadrootsExcludedClassifiedListingCandidate",
"radroots_event_codec::food_availability::admission::RadrootsFoodAvailabilityAdmissionError",
@@ -1788,7 +1788,7 @@ struct EventBoundaryExpectation {
const PROFILE_WITNESSES: [EventBoundarySourceWitness; 5] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/profile.rs",
- required_fragments: &["pub struct RadrootsAuthoredProfile"],
+ required_fragments: &["pub struct AuthoredProfile"],
},
EventBoundarySourceWitness {
relative_path: "crates/event_codec/src/profile/inbound/registry_v7.rs",
@@ -1817,7 +1817,7 @@ const PROFILE_WITNESSES: [EventBoundarySourceWitness; 5] = [
const FOLLOW_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/follow.rs",
- required_fragments: &["pub struct RadrootsFollow"],
+ required_fragments: &["pub struct Follow"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -1829,10 +1829,10 @@ const POST_WITNESSES: [EventBoundarySourceWitness; 5] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/post.rs",
required_fragments: &[
- "pub struct RadrootsPost",
- "pub struct RadrootsAuthoredUpdate",
- "pub struct RadrootsAuthoredPhotoUpdate",
- "pub struct RadrootsAuthoredAsk",
+ "pub struct Post",
+ "pub struct AuthoredUpdate",
+ "pub struct AuthoredPhotoUpdate",
+ "pub struct AuthoredAsk",
],
},
EventBoundarySourceWitness {
@@ -1868,13 +1868,13 @@ const POST_WITNESSES: [EventBoundarySourceWitness; 5] = [
const REPLY_WITNESSES: [EventBoundarySourceWitness; 5] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/relay_hint.rs",
- required_fragments: &["pub struct RadrootsNostrRelayHint"],
+ required_fragments: &["pub struct NostrRelayHint"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/reply.rs",
required_fragments: &[
- "pub struct RadrootsNip10ReplyReference",
- "pub struct RadrootsAuthoredNip10Reply",
+ "pub struct Nip10ReplyReference",
+ "pub struct AuthoredNip10Reply",
],
},
EventBoundarySourceWitness {
@@ -1903,14 +1903,14 @@ const REPLY_WITNESSES: [EventBoundarySourceWitness; 5] = [
const COMMENT_WITNESSES: [EventBoundarySourceWitness; 8] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/relay_hint.rs",
- required_fragments: &["pub struct RadrootsNostrRelayHint"],
+ required_fragments: &["pub struct NostrRelayHint"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/comment.rs",
required_fragments: &[
- "pub enum RadrootsNip22CommentRoot",
- "pub enum RadrootsNip22CommentPosition",
- "pub struct RadrootsAuthoredNip22Comment",
+ "pub enum Nip22CommentRoot",
+ "pub enum Nip22CommentPosition",
+ "pub struct AuthoredNip22Comment",
],
},
EventBoundarySourceWitness {
@@ -1951,7 +1951,7 @@ const COMMENT_WITNESSES: [EventBoundarySourceWitness; 8] = [
const DELETION_WITNESSES: [EventBoundarySourceWitness; 8] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/deletion.rs",
- required_fragments: &["pub struct RadrootsAuthoredNip09DeletionRequest"],
+ required_fragments: &["pub struct AuthoredNip09DeletionRequest"],
},
EventBoundarySourceWitness {
relative_path: "crates/event_codec/src/deletion/authored.rs",
@@ -2002,7 +2002,7 @@ const DELETION_WITNESSES: [EventBoundarySourceWitness; 8] = [
const REACTION_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/reaction.rs",
- required_fragments: &["pub struct RadrootsReaction"],
+ required_fragments: &["pub struct Reaction"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2013,7 +2013,7 @@ const REACTION_WITNESSES: [EventBoundarySourceWitness; 2] = [
const REPOST_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/repost.rs",
- required_fragments: &["pub struct RadrootsRepost"],
+ required_fragments: &["pub struct Repost"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2024,7 +2024,7 @@ const REPOST_WITNESSES: [EventBoundarySourceWitness; 2] = [
const GENERIC_REPOST_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/repost.rs",
- required_fragments: &["pub struct RadrootsGenericRepost"],
+ required_fragments: &["pub struct GenericRepost"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2035,7 +2035,7 @@ const GENERIC_REPOST_WITNESSES: [EventBoundarySourceWitness; 2] = [
const SEAL_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/seal.rs",
- required_fragments: &["pub struct RadrootsSeal"],
+ required_fragments: &["pub struct Seal"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2046,7 +2046,7 @@ const SEAL_WITNESSES: [EventBoundarySourceWitness; 2] = [
const MESSAGE_WITNESSES: [EventBoundarySourceWitness; 4] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/message.rs",
- required_fragments: &["pub struct RadrootsMessage"],
+ required_fragments: &["pub struct Message"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2068,7 +2068,7 @@ const MESSAGE_WITNESSES: [EventBoundarySourceWitness; 4] = [
const MESSAGE_FILE_WITNESSES: [EventBoundarySourceWitness; 4] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/message_file.rs",
- required_fragments: &["pub struct RadrootsMessageFile"],
+ required_fragments: &["pub struct MessageFile"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2090,7 +2090,7 @@ const MESSAGE_FILE_WITNESSES: [EventBoundarySourceWitness; 4] = [
const GIFT_WRAP_WITNESSES: [EventBoundarySourceWitness; 4] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/gift_wrap.rs",
- required_fragments: &["pub struct RadrootsGiftWrap"],
+ required_fragments: &["pub struct GiftWrap"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2109,7 +2109,7 @@ const GIFT_WRAP_WITNESSES: [EventBoundarySourceWitness; 4] = [
const PUBLIC_FILE_METADATA_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/file_metadata.rs",
- required_fragments: &["pub struct RadrootsFileMetadata"],
+ required_fragments: &["pub struct FileMetadata"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2120,7 +2120,7 @@ const PUBLIC_FILE_METADATA_WITNESSES: [EventBoundarySourceWitness; 2] = [
const REPORT_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/report.rs",
- required_fragments: &["pub struct RadrootsReport"],
+ required_fragments: &["pub struct Report"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2131,7 +2131,7 @@ const REPORT_WITNESSES: [EventBoundarySourceWitness; 2] = [
const LIST_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/list.rs",
- required_fragments: &["pub struct RadrootsList"],
+ required_fragments: &["pub struct List"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2145,7 +2145,7 @@ const LIST_WITNESSES: [EventBoundarySourceWitness; 2] = [
const RELAY_LIST_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/list.rs",
- required_fragments: &["pub struct RadrootsList"],
+ required_fragments: &["pub struct List"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2156,7 +2156,7 @@ const RELAY_LIST_WITNESSES: [EventBoundarySourceWitness; 2] = [
const LIST_SET_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/list_set.rs",
- required_fragments: &["pub struct RadrootsListSet"],
+ required_fragments: &["pub struct ListSet"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2170,7 +2170,7 @@ const LIST_SET_WITNESSES: [EventBoundarySourceWitness; 2] = [
const ARTICLE_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/article.rs",
- required_fragments: &["pub struct RadrootsArticle"],
+ required_fragments: &["pub struct Article"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2182,10 +2182,10 @@ const KNOWLEDGE_WITNESSES: [EventBoundarySourceWitness; 3] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/knowledge.rs",
required_fragments: &[
- "pub struct RadrootsWikiArticle",
- "pub struct RadrootsKnowledgeClaim",
- "pub struct RadrootsKnowledgeFieldReport",
- "pub struct RadrootsEvidenceBounty",
+ "pub struct WikiArticle",
+ "pub struct KnowledgeClaim",
+ "pub struct KnowledgeFieldReport",
+ "pub struct EvidenceBounty",
],
},
EventBoundarySourceWitness {
@@ -2200,7 +2200,7 @@ const KNOWLEDGE_WITNESSES: [EventBoundarySourceWitness; 3] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/contract/registry_v7.rs",
required_fragments: &[
- "RadrootsReducer::KnowledgeProjection",
+ "Reducer::KnowledgeProjection",
"\"radroots.wiki.article.v1\"",
"\"radroots.knowledge.claim.v1\"",
"pub fn validate_event_contract_shape",
@@ -2211,7 +2211,7 @@ const KNOWLEDGE_WITNESSES: [EventBoundarySourceWitness; 3] = [
const APP_DATA_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/app_data.rs",
- required_fragments: &["pub struct RadrootsAppData"],
+ required_fragments: &["pub struct AppData"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2234,9 +2234,9 @@ const CALENDAR_DATE_WITNESSES: [EventBoundarySourceWitness; 4] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/calendar.rs",
required_fragments: &[
- "pub struct RadrootsAuthoredCalendarDateEvent",
- "pub struct RadrootsParsedNip52CalendarDateEvent",
- "pub struct RadrootsAdmittedCalendarDateEvent",
+ "pub struct AuthoredCalendarDateEvent",
+ "pub struct ParsedNip52CalendarDateEvent",
+ "pub struct AdmittedCalendarDateEvent",
],
},
EventBoundarySourceWitness {
@@ -2260,9 +2260,9 @@ const CALENDAR_TIME_WITNESSES: [EventBoundarySourceWitness; 4] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/calendar.rs",
required_fragments: &[
- "pub struct RadrootsAuthoredCalendarTimeEvent",
- "pub struct RadrootsParsedNip52CalendarTimeEvent",
- "pub struct RadrootsAdmittedCalendarTimeEvent",
+ "pub struct AuthoredCalendarTimeEvent",
+ "pub struct ParsedNip52CalendarTimeEvent",
+ "pub struct AdmittedCalendarTimeEvent",
],
},
EventBoundarySourceWitness {
@@ -2286,9 +2286,9 @@ const CALENDAR_WITNESSES: [EventBoundarySourceWitness; 4] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/calendar.rs",
required_fragments: &[
- "pub struct RadrootsAuthoredCalendar {",
- "pub struct RadrootsParsedNip52Calendar {",
- "pub struct RadrootsAdmittedCalendar {",
+ "pub struct AuthoredCalendar {",
+ "pub struct ParsedNip52Calendar {",
+ "pub struct AdmittedCalendar {",
],
},
EventBoundarySourceWitness {
@@ -2312,9 +2312,9 @@ const CALENDAR_RSVP_WITNESSES: [EventBoundarySourceWitness; 4] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/calendar.rs",
required_fragments: &[
- "pub struct RadrootsAuthoredCalendarEventRsvp {",
- "pub struct RadrootsParsedNip52CalendarEventRsvp {",
- "pub struct RadrootsAdmittedCalendarEventRsvp {",
+ "pub struct AuthoredCalendarEventRsvp {",
+ "pub struct ParsedNip52CalendarEventRsvp {",
+ "pub struct AdmittedCalendarEventRsvp {",
],
},
EventBoundarySourceWitness {
@@ -2337,7 +2337,7 @@ const CALENDAR_RSVP_WITNESSES: [EventBoundarySourceWitness; 4] = [
const FARM_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/farm.rs",
- required_fragments: &["pub struct RadrootsFarm"],
+ required_fragments: &["pub struct Farm"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2348,7 +2348,7 @@ const FARM_WITNESSES: [EventBoundarySourceWitness; 2] = [
const PLOT_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/plot.rs",
- required_fragments: &["pub struct RadrootsPlot"],
+ required_fragments: &["pub struct Plot"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2359,7 +2359,7 @@ const PLOT_WITNESSES: [EventBoundarySourceWitness; 2] = [
const COOP_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/coop.rs",
- required_fragments: &["pub struct RadrootsCoop"],
+ required_fragments: &["pub struct Coop"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2370,7 +2370,7 @@ const COOP_WITNESSES: [EventBoundarySourceWitness; 2] = [
const DOCUMENT_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/document.rs",
- required_fragments: &["pub struct RadrootsDocument"],
+ required_fragments: &["pub struct Document"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2381,7 +2381,7 @@ const DOCUMENT_WITNESSES: [EventBoundarySourceWitness; 2] = [
const RESOURCE_AREA_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/resource_area.rs",
- required_fragments: &["pub struct RadrootsResourceArea"],
+ required_fragments: &["pub struct ResourceArea"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2392,7 +2392,7 @@ const RESOURCE_AREA_WITNESSES: [EventBoundarySourceWitness; 2] = [
const RESOURCE_CAP_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/resource_cap.rs",
- required_fragments: &["pub struct RadrootsResourceHarvestCap"],
+ required_fragments: &["pub struct ResourceHarvestCap"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2403,7 +2403,7 @@ const RESOURCE_CAP_WITNESSES: [EventBoundarySourceWitness; 2] = [
const OPERATIONAL_LISTING_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/operational_listing.rs",
- required_fragments: &["pub struct RadrootsOperationalListing"],
+ required_fragments: &["pub struct OperationalListing"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2416,7 +2416,7 @@ const FOOD_AVAILABILITY_WITNESSES: [EventBoundarySourceWitness; 6] = [
relative_path: "crates/event/src/food_availability.rs",
required_fragments: &[
"pub const RADROOTS_FOOD_AVAILABILITY_CONTRACT_ID: &str",
- "pub struct RadrootsFoodAvailabilityDetails",
+ "pub struct FoodAvailabilityDetails",
],
},
EventBoundarySourceWitness {
@@ -2450,7 +2450,7 @@ const FOOD_AVAILABILITY_WITNESSES: [EventBoundarySourceWitness; 6] = [
const DVM_REQUEST_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/job_request.rs",
- required_fragments: &["pub struct RadrootsJobRequest"],
+ required_fragments: &["pub struct JobRequest"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2464,7 +2464,7 @@ const DVM_REQUEST_WITNESSES: [EventBoundarySourceWitness; 2] = [
const DVM_RESULT_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/job_result.rs",
- required_fragments: &["pub struct RadrootsJobResult"],
+ required_fragments: &["pub struct JobResult"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2478,7 +2478,7 @@ const DVM_RESULT_WITNESSES: [EventBoundarySourceWitness; 2] = [
const DVM_FEEDBACK_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/job_feedback.rs",
- required_fragments: &["pub struct RadrootsJobFeedback"],
+ required_fragments: &["pub struct JobFeedback"],
},
EventBoundarySourceWitness {
relative_path: "crates/event/src/kinds.rs",
@@ -2605,13 +2605,11 @@ const TRADE_VALIDATION_RECEIPT_WITNESSES: [EventBoundarySourceWitness; 2] = [
const RELAY_DOC_WITNESSES: [EventBoundarySourceWitness; 2] = [
EventBoundarySourceWitness {
relative_path: "crates/event/src/relay_document.rs",
- required_fragments: &["pub struct RadrootsRelayDocument"],
+ required_fragments: &["pub struct RelayDocument"],
},
EventBoundarySourceWitness {
relative_path: "crates/nostr/src/nip11.rs",
- required_fragments: &[
- "pub async fn fetch_nip11(ws_url: &str) -> Option<RadrootsRelayDocument>",
- ],
+ required_fragments: &["pub async fn fetch_nip11(ws_url: &str) -> Option<RelayDocument>"],
},
];
@@ -2619,7 +2617,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "profile",
kind: "0",
- radroots_type: "RadrootsAuthoredProfile / RadrootsInboundProfileMetadata",
+ radroots_type: "AuthoredProfile / RadrootsInboundProfileMetadata",
rpc_methods: &[
"events.profile.publish",
"events.profile.list",
@@ -2630,7 +2628,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "follow",
kind: "3",
- radroots_type: "RadrootsFollow",
+ radroots_type: "Follow",
rpc_methods: &[
"events.follow.publish",
"events.follow.list",
@@ -2641,14 +2639,14 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "post",
kind: "1",
- radroots_type: "RadrootsAuthoredUpdate / RadrootsAuthoredPhotoUpdate / RadrootsAuthoredAsk / RadrootsInboundPostProjection",
+ radroots_type: "AuthoredUpdate / AuthoredPhotoUpdate / AuthoredAsk / RadrootsInboundPostProjection",
rpc_methods: &["events.post.publish", "events.post.list", "events.post.get"],
witnesses: &POST_WITNESSES,
},
EventBoundaryExpectation {
domain: "reply",
kind: "1",
- radroots_type: "RadrootsAuthoredNip10Reply / RadrootsInboundNip10ReplyProjection / RadrootsAdmittedNip10ReplyEvent / RadrootsNostrNip10ReplyEventBuilder",
+ radroots_type: "AuthoredNip10Reply / RadrootsInboundNip10ReplyProjection / RadrootsAdmittedNip10ReplyEvent / RadrootsNostrNip10ReplyEventBuilder",
rpc_methods: &[
"social.reply.build_authored_draft",
"social.reply.project_verified_event",
@@ -2659,7 +2657,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "comment",
kind: "1111",
- radroots_type: "RadrootsAuthoredNip22Comment / RadrootsInboundNip22CommentProjection / RadrootsAdmittedNip22CommentEvent / RadrootsNostrNip22CommentEventBuilder",
+ radroots_type: "AuthoredNip22Comment / RadrootsInboundNip22CommentProjection / RadrootsAdmittedNip22CommentEvent / RadrootsNostrNip22CommentEventBuilder",
rpc_methods: &[
"social.comment.build_authored_draft",
"social.comment.project_verified_event",
@@ -2670,7 +2668,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "deletion_request",
kind: "5",
- radroots_type: "RadrootsAuthoredNip09DeletionRequest / RadrootsInboundNip09DeletionProjection / RadrootsAdmittedNip09DeletionRequestEvent / RadrootsNip09SuppressionDecision / RadrootsNostrNip09DeletionRequestEventBuilder",
+ radroots_type: "AuthoredNip09DeletionRequest / RadrootsInboundNip09DeletionProjection / RadrootsAdmittedNip09DeletionRequestEvent / RadrootsNip09SuppressionDecision / RadrootsNostrNip09DeletionRequestEventBuilder",
rpc_methods: &[
"social.deletion_request.build_authored_draft",
"social.deletion_request.project_verified_event",
@@ -2682,7 +2680,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "reaction",
kind: "7",
- radroots_type: "RadrootsReaction",
+ radroots_type: "Reaction",
rpc_methods: &[
"events.reaction.publish",
"events.reaction.list",
@@ -2693,7 +2691,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "repost",
kind: "6",
- radroots_type: "RadrootsRepost",
+ radroots_type: "Repost",
rpc_methods: &[
"events.repost.publish",
"events.repost.list",
@@ -2704,7 +2702,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "generic_repost",
kind: "16",
- radroots_type: "RadrootsGenericRepost",
+ radroots_type: "GenericRepost",
rpc_methods: &[
"events.generic_repost.publish",
"events.generic_repost.list",
@@ -2715,14 +2713,14 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "seal",
kind: "13",
- radroots_type: "RadrootsSeal",
+ radroots_type: "Seal",
rpc_methods: &["events.seal.encode", "events.seal.decode"],
witnesses: &SEAL_WITNESSES,
},
EventBoundaryExpectation {
domain: "message",
kind: "14",
- radroots_type: "RadrootsMessage",
+ radroots_type: "Message",
rpc_methods: &[
"events.message.publish",
"events.message.list",
@@ -2733,7 +2731,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "message_file",
kind: "15",
- radroots_type: "RadrootsMessageFile",
+ radroots_type: "MessageFile",
rpc_methods: &[
"events.message_file.publish",
"events.message_file.list",
@@ -2744,7 +2742,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "gift_wrap",
kind: "1059",
- radroots_type: "RadrootsGiftWrap",
+ radroots_type: "GiftWrap",
rpc_methods: &[
"events.gift_wrap.publish",
"events.gift_wrap.list",
@@ -2755,7 +2753,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "public_file_metadata",
kind: "1063",
- radroots_type: "RadrootsFileMetadata",
+ radroots_type: "FileMetadata",
rpc_methods: &[
"events.public_file_metadata.publish",
"events.public_file_metadata.list",
@@ -2766,7 +2764,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "report",
kind: "1984",
- radroots_type: "RadrootsReport",
+ radroots_type: "Report",
rpc_methods: &[
"events.report.publish",
"events.report.list",
@@ -2777,14 +2775,14 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "list",
kind: "10000..10102",
- radroots_type: "RadrootsList",
+ radroots_type: "List",
rpc_methods: &["events.list.publish", "events.list.list", "events.list.get"],
witnesses: &LIST_WITNESSES,
},
EventBoundaryExpectation {
domain: "relay_list",
kind: "10002",
- radroots_type: "RadrootsList",
+ radroots_type: "List",
rpc_methods: &[
"events.relay_list.publish",
"events.relay_list.list",
@@ -2795,7 +2793,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "list_set",
kind: "30000..30007, 30015, 30030, 30063, 30267, 39089, 39092",
- radroots_type: "RadrootsListSet",
+ radroots_type: "ListSet",
rpc_methods: &[
"events.list_set.publish",
"events.list_set.list",
@@ -2806,7 +2804,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "article",
kind: "30023",
- radroots_type: "RadrootsArticle",
+ radroots_type: "Article",
rpc_methods: &[
"events.article.publish",
"events.article.list",
@@ -2828,7 +2826,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "app_data",
kind: "30078",
- radroots_type: "RadrootsAppData",
+ radroots_type: "AppData",
rpc_methods: &[
"events.app_data.publish",
"events.app_data.list",
@@ -2850,7 +2848,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "calendar_date",
kind: "31922",
- radroots_type: "RadrootsAuthoredCalendarDateEvent / RadrootsParsedNip52CalendarDateEvent / RadrootsAdmittedCalendarDateEvent",
+ radroots_type: "AuthoredCalendarDateEvent / ParsedNip52CalendarDateEvent / AdmittedCalendarDateEvent",
rpc_methods: &[
"events.calendar_date.publish",
"events.calendar_date.list",
@@ -2861,7 +2859,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "calendar_time",
kind: "31923",
- radroots_type: "RadrootsAuthoredCalendarTimeEvent / RadrootsParsedNip52CalendarTimeEvent / RadrootsAdmittedCalendarTimeEvent",
+ radroots_type: "AuthoredCalendarTimeEvent / ParsedNip52CalendarTimeEvent / AdmittedCalendarTimeEvent",
rpc_methods: &[
"events.calendar_time.publish",
"events.calendar_time.list",
@@ -2872,7 +2870,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "calendar",
kind: "31924",
- radroots_type: "RadrootsAuthoredCalendar / RadrootsParsedNip52Calendar / RadrootsAdmittedCalendar",
+ radroots_type: "AuthoredCalendar / ParsedNip52Calendar / AdmittedCalendar",
rpc_methods: &[
"events.calendar.publish",
"events.calendar.list",
@@ -2883,7 +2881,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "calendar_rsvp",
kind: "31925",
- radroots_type: "RadrootsAuthoredCalendarEventRsvp / RadrootsParsedNip52CalendarEventRsvp / RadrootsAdmittedCalendarEventRsvp",
+ radroots_type: "AuthoredCalendarEventRsvp / ParsedNip52CalendarEventRsvp / AdmittedCalendarEventRsvp",
rpc_methods: &[
"events.calendar_rsvp.publish",
"events.calendar_rsvp.list",
@@ -2894,28 +2892,28 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "farm",
kind: "30340",
- radroots_type: "RadrootsFarm",
+ radroots_type: "Farm",
rpc_methods: &["events.farm.publish", "events.farm.list", "events.farm.get"],
witnesses: &FARM_WITNESSES,
},
EventBoundaryExpectation {
domain: "plot",
kind: "30350",
- radroots_type: "RadrootsPlot",
+ radroots_type: "Plot",
rpc_methods: &["events.plot.publish", "events.plot.list", "events.plot.get"],
witnesses: &PLOT_WITNESSES,
},
EventBoundaryExpectation {
domain: "coop",
kind: "30360",
- radroots_type: "RadrootsCoop",
+ radroots_type: "Coop",
rpc_methods: &["events.coop.publish", "events.coop.list", "events.coop.get"],
witnesses: &COOP_WITNESSES,
},
EventBoundaryExpectation {
domain: "document",
kind: "30361",
- radroots_type: "RadrootsDocument",
+ radroots_type: "Document",
rpc_methods: &[
"events.document.publish",
"events.document.list",
@@ -2926,7 +2924,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "resource_area",
kind: "30370",
- radroots_type: "RadrootsResourceArea",
+ radroots_type: "ResourceArea",
rpc_methods: &[
"events.resource_area.publish",
"events.resource_area.list",
@@ -2937,7 +2935,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "resource_cap",
kind: "30371",
- radroots_type: "RadrootsResourceHarvestCap",
+ radroots_type: "ResourceHarvestCap",
rpc_methods: &[
"events.resource_cap.publish",
"events.resource_cap.list",
@@ -2948,7 +2946,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "food_availability",
kind: "30402",
- radroots_type: "RadrootsFoodAvailabilityDetails / RadrootsInboundFoodAvailabilityProjection / RadrootsAdmittedFoodAvailabilityEvent / RadrootsNostrFoodAvailabilityEventBuilder",
+ radroots_type: "FoodAvailabilityDetails / RadrootsInboundFoodAvailabilityProjection / RadrootsAdmittedFoodAvailabilityEvent / RadrootsNostrFoodAvailabilityEventBuilder",
rpc_methods: &[
"food_availability.build_authored_draft",
"food_availability.project_verified_event",
@@ -2960,7 +2958,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "operational_listing",
kind: "30402",
- radroots_type: "RadrootsOperationalListing",
+ radroots_type: "OperationalListing",
rpc_methods: &[
"events.operational_listing.publish",
"events.operational_listing.list",
@@ -2971,7 +2969,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "dvm_request",
kind: "5000-5999",
- radroots_type: "RadrootsJobRequest",
+ radroots_type: "JobRequest",
rpc_methods: &[
"events.dvm_request.publish",
"events.dvm_request.list",
@@ -2982,7 +2980,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "dvm_result",
kind: "6000-6999",
- radroots_type: "RadrootsJobResult",
+ radroots_type: "JobResult",
rpc_methods: &[
"events.dvm_result.publish",
"events.dvm_result.list",
@@ -2993,7 +2991,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "dvm_feedback",
kind: "7000",
- radroots_type: "RadrootsJobFeedback",
+ radroots_type: "JobFeedback",
rpc_methods: &[
"events.dvm_feedback.publish",
"events.dvm_feedback.list",
@@ -3004,7 +3002,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "trade:proposal",
kind: "3470",
- radroots_type: "RadrootsTradeMutationEnvelopeV1",
+ radroots_type: "TradeMutationEnvelopeV1",
rpc_methods: &[
"trade.get_trade",
"trade.list_trades",
@@ -3015,7 +3013,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "trade:decision",
kind: "3471",
- radroots_type: "RadrootsTradeMutationEnvelopeV1",
+ radroots_type: "TradeMutationEnvelopeV1",
rpc_methods: &[
"trade.decide_candidate",
"trade.get_trade",
@@ -3026,7 +3024,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "trade:revision_proposal",
kind: "3472",
- radroots_type: "RadrootsTradeMutationEnvelopeV1",
+ radroots_type: "TradeMutationEnvelopeV1",
rpc_methods: &[
"trade.get_trade",
"trade.list_trades",
@@ -3037,7 +3035,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "trade:revision_decision",
kind: "3473",
- radroots_type: "RadrootsTradeMutationEnvelopeV1",
+ radroots_type: "TradeMutationEnvelopeV1",
rpc_methods: &[
"trade.decide_candidate",
"trade.get_trade",
@@ -3048,7 +3046,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "trade:cancellation",
kind: "3474",
- radroots_type: "RadrootsTradeMutationEnvelopeV1",
+ radroots_type: "TradeMutationEnvelopeV1",
rpc_methods: &["trade.cancel_trade", "trade.get_trade", "trade.list_trades"],
witnesses: &TRADE_CANCELLATION_WITNESSES,
},
@@ -3066,7 +3064,7 @@ const CANONICAL_EVENT_BOUNDARY_EXPECTATIONS: [EventBoundaryExpectation; 44] = [
EventBoundaryExpectation {
domain: "relay_doc",
kind: "N/A",
- radroots_type: "RadrootsRelayDocument",
+ radroots_type: "RelayDocument",
rpc_methods: &["system.relay_doc.get"],
witnesses: &RELAY_DOC_WITNESSES,
},
@@ -6421,12 +6419,10 @@ fn validate_deletion_operation_inventory(
.filter(|name| {
name.contains("Nip09Deletion")
|| name.starts_with("RadrootsNip09")
- || name.starts_with("RadrootsNip01Coordinate")
+ || name.starts_with("Nip01Coordinate")
|| matches!(
*name,
- "RadrootsNip01EventWireParts"
- | "RadrootsEventEnvelope"
- | "RadrootsSignatureVerifiedEvent"
+ "Nip01EventWireParts" | "EventEnvelope" | "RadrootsSignatureVerifiedEvent"
)
})
.collect::<BTreeSet<_>>();
@@ -9669,17 +9665,17 @@ domains = ["profile", "farm", "operational_listing", "trade"]
[shared_types]
public = [
- "RadrootsNip01EventWireParts",
- "RadrootsEventDraft",
- "RadrootsSignedEvent",
- "RadrootsEventEnvelope",
- "RadrootsEventRef",
- "RadrootsEventPtr",
- "RadrootsClassifiedListingAddress",
- "RadrootsAuthoredProfile",
+ "Nip01EventWireParts",
+ "EventDraft",
+ "SignedEvent",
+ "EventEnvelope",
+ "EventRef",
+ "EventPtr",
+ "ClassifiedListingAddress",
+ "AuthoredProfile",
"RadrootsInboundProfileMetadata",
- "RadrootsFarm",
- "RadrootsOperationalListing",
+ "Farm",
+ "OperationalListing",
]
[errors]
@@ -9693,8 +9689,8 @@ algorithm_crates = ["radroots_b"]
domain = "profile"
id = "profile.build_authored_draft"
stability = "beta"
-inputs = ["RadrootsAuthoredProfile"]
-outputs = ["RadrootsNip01EventWireParts"]
+inputs = ["AuthoredProfile"]
+outputs = ["Nip01EventWireParts"]
error_class = "encode_error"
deterministic = true
signing = "native"
@@ -9702,7 +9698,7 @@ transport = "native"
[operations.profile_build_authored_draft.implementation]
rust_modules = ["crates/core/src/unit.rs"]
-rust_types = ["radroots_event::profile::RadrootsAuthoredProfile"]
+rust_types = ["radroots_event::profile::AuthoredProfile"]
[operations.profile_build_authored_draft.conformance]
vector = "contracts/conformance/vectors/profile/metadata.v1.json"
@@ -9711,8 +9707,8 @@ vector = "contracts/conformance/vectors/profile/metadata.v1.json"
domain = "operational_listing"
id = "operational_listing.build_draft"
stability = "beta"
-inputs = ["RadrootsOperationalListing"]
-outputs = ["RadrootsNip01EventWireParts"]
+inputs = ["OperationalListing"]
+outputs = ["Nip01EventWireParts"]
error_class = "encode_error"
deterministic = true
signing = "native"
@@ -9720,7 +9716,7 @@ transport = "native"
[operations.operational_listing_build_draft.implementation]
rust_modules = ["crates/core/src/unit.rs"]
-rust_types = ["radroots_event::listing::operational::RadrootsOperationalListing"]
+rust_types = ["radroots_event::listing::operational::OperationalListing"]
[operations.operational_listing_build_draft.conformance]
vector = "contracts/conformance/vectors/operational_listing/build_draft.v1.json"
@@ -11280,8 +11276,8 @@ packages = []
resolve_event_boundary_matrix_path_with_override(&root, None).expect("matrix path");
let raw = fs::read_to_string(&matrix_path).expect("read matrix");
let drifted = raw.replacen(
- "| message | 14 | RadrootsMessage |",
- "| message | 999 | RadrootsMessage |",
+ "| message | 14 | Message |",
+ "| message | 999 | Message |",
1,
);
let temp = temp_root("event_boundary_drift");
diff --git a/tools/xtask/src/contract/comment_authority.rs b/tools/xtask/src/contract/comment_authority.rs
@@ -4,18 +4,18 @@ pub(super) const COMMENT_CONFORMANCE_VECTOR_RELATIVE: &str =
"contracts/conformance/vectors/comment/verified_profile.v1.json";
pub(super) const REQUIRED_COMMENT_PUBLIC_TYPES: [&str; 26] = [
- "RadrootsNip01EventWireParts",
- "RadrootsEventEnvelope",
+ "Nip01EventWireParts",
+ "EventEnvelope",
"RadrootsSignatureVerifiedEvent",
- "RadrootsNostrRelayHint",
- "RadrootsNip22CommentError",
- "RadrootsNip22CommentRootKind",
- "RadrootsNip22EventRootReference",
- "RadrootsNip22AddressRootReference",
- "RadrootsNip22CommentParentReference",
- "RadrootsNip22CommentRoot",
- "RadrootsNip22CommentPosition",
- "RadrootsAuthoredNip22Comment",
+ "NostrRelayHint",
+ "Nip22CommentError",
+ "Nip22CommentRootKind",
+ "Nip22EventRootReference",
+ "Nip22AddressRootReference",
+ "Nip22CommentParentReference",
+ "Nip22CommentRoot",
+ "Nip22CommentPosition",
+ "AuthoredNip22Comment",
"RadrootsNip22CommentDiagnostic",
"RadrootsInboundNip22Participant",
"RadrootsInboundNip22EventRoot",
@@ -36,8 +36,8 @@ pub(super) const COMMENT_OPERATION_EXPECTATIONS: [CommentOperationExpectation; 3
CommentOperationExpectation {
key: "social_comment_build_authored_draft",
id: "social.comment.build_authored_draft",
- inputs: &["RadrootsAuthoredNip22Comment"],
- outputs: &["RadrootsNip01EventWireParts"],
+ inputs: &["AuthoredNip22Comment"],
+ outputs: &["Nip01EventWireParts"],
error_class: "encode_error",
signing: "none",
rust_modules: &[
@@ -46,16 +46,16 @@ pub(super) const COMMENT_OPERATION_EXPECTATIONS: [CommentOperationExpectation; 3
"crates/event_codec/src/comment/authored.rs",
],
rust_types: &[
- "radroots_event::post::comment::RadrootsAuthoredNip22Comment",
- "radroots_event::post::comment::RadrootsNip22AddressRootReference",
- "radroots_event::post::comment::RadrootsNip22CommentError",
- "radroots_event::post::comment::RadrootsNip22CommentParentReference",
- "radroots_event::post::comment::RadrootsNip22CommentPosition",
- "radroots_event::post::comment::RadrootsNip22CommentRoot",
- "radroots_event::post::comment::RadrootsNip22CommentRootKind",
- "radroots_event::post::comment::RadrootsNip22EventRootReference",
- "radroots_event::tag::relay_hint::RadrootsNostrRelayHint",
- "radroots_event::wire::RadrootsNip01EventWireParts",
+ "radroots_event::post::comment::AuthoredNip22Comment",
+ "radroots_event::post::comment::Nip22AddressRootReference",
+ "radroots_event::post::comment::Nip22CommentError",
+ "radroots_event::post::comment::Nip22CommentParentReference",
+ "radroots_event::post::comment::Nip22CommentPosition",
+ "radroots_event::post::comment::Nip22CommentRoot",
+ "radroots_event::post::comment::Nip22CommentRootKind",
+ "radroots_event::post::comment::Nip22EventRootReference",
+ "radroots_event::tag::relay_hint::NostrRelayHint",
+ "radroots_event::wire::Nip01EventWireParts",
],
case_kinds: &[
"social.comment.build_authored_draft.valid",
@@ -96,7 +96,7 @@ pub(super) const COMMENT_OPERATION_EXPECTATIONS: [CommentOperationExpectation; 3
CommentOperationExpectation {
key: "social_comment_verify_and_admit_event",
id: "social.comment.verify_and_admit_event",
- inputs: &["RadrootsEventEnvelope"],
+ inputs: &["EventEnvelope"],
outputs: &["RadrootsAdmittedNip22CommentEvent"],
error_class: "admission_error",
signing: "nip01",
@@ -106,7 +106,7 @@ pub(super) const COMMENT_OPERATION_EXPECTATIONS: [CommentOperationExpectation; 3
"crates/event_codec/src/verification.rs",
],
rust_types: &[
- "radroots_event::envelope::RadrootsEventEnvelope",
+ "radroots_event::envelope::EventEnvelope",
"radroots_event_codec::comment::admission::RadrootsAdmittedNip22CommentEvent",
"radroots_event_codec::comment::admission::RadrootsNip22CommentAdmissionError",
"radroots_event_codec::comment::inbound::RadrootsInboundNip22CommentProjection",
diff --git a/tools/xtask/src/contract/deletion_authority.rs b/tools/xtask/src/contract/deletion_authority.rs
@@ -6,16 +6,16 @@ pub(super) const DELETION_SUPPRESSION_CONFORMANCE_VECTOR_RELATIVE: &str =
"contracts/conformance/vectors/deletion/suppression.v1.json";
pub(super) const REQUIRED_DELETION_PUBLIC_TYPES: [&str; 23] = [
- "RadrootsNip01EventWireParts",
- "RadrootsEventEnvelope",
+ "Nip01EventWireParts",
+ "EventEnvelope",
"RadrootsSignatureVerifiedEvent",
- "RadrootsNip01Coordinate",
- "RadrootsNip01CoordinateParts",
- "RadrootsNip01CoordinateParseError",
- "RadrootsNip09DeletionError",
- "RadrootsNip09DeletionEventTarget",
- "RadrootsNip09DeletionAddressTarget",
- "RadrootsAuthoredNip09DeletionRequest",
+ "Nip01Coordinate",
+ "Nip01CoordinateParts",
+ "Nip01CoordinateParseError",
+ "Nip09DeletionError",
+ "Nip09DeletionEventTarget",
+ "Nip09DeletionAddressTarget",
+ "AuthoredNip09DeletionRequest",
"RadrootsNip09DeletionDiagnostic",
"RadrootsInboundNip09DeletionEventTarget",
"RadrootsInboundNip09DeletionAddressTarget",
@@ -36,8 +36,8 @@ pub(super) const DELETION_OPERATION_EXPECTATIONS: [DeletionOperationExpectation;
key: "social_deletion_request_build_authored_draft",
id: "social.deletion_request.build_authored_draft",
vector: DELETION_CONFORMANCE_VECTOR_RELATIVE,
- inputs: &["RadrootsAuthoredNip09DeletionRequest"],
- outputs: &["RadrootsNip01EventWireParts"],
+ inputs: &["AuthoredNip09DeletionRequest"],
+ outputs: &["Nip01EventWireParts"],
error_class: "encode_error",
signing: "none",
rust_modules: &[
@@ -45,12 +45,12 @@ pub(super) const DELETION_OPERATION_EXPECTATIONS: [DeletionOperationExpectation;
"crates/event_codec/src/deletion/authored.rs",
],
rust_types: &[
- "radroots_event::post::deletion::RadrootsAuthoredNip09DeletionRequest",
- "radroots_event::post::deletion::RadrootsNip09DeletionAddressTarget",
- "radroots_event::post::deletion::RadrootsNip09DeletionError",
- "radroots_event::post::deletion::RadrootsNip09DeletionEventTarget",
- "radroots_event::id::RadrootsNip01Coordinate",
- "radroots_event::wire::RadrootsNip01EventWireParts",
+ "radroots_event::post::deletion::AuthoredNip09DeletionRequest",
+ "radroots_event::post::deletion::Nip09DeletionAddressTarget",
+ "radroots_event::post::deletion::Nip09DeletionError",
+ "radroots_event::post::deletion::Nip09DeletionEventTarget",
+ "radroots_event::id::Nip01Coordinate",
+ "radroots_event::wire::Nip01EventWireParts",
],
case_kinds: &[
"social.deletion_request.build_authored_draft.valid",
@@ -87,7 +87,7 @@ pub(super) const DELETION_OPERATION_EXPECTATIONS: [DeletionOperationExpectation;
key: "social_deletion_request_verify_and_admit_event",
id: "social.deletion_request.verify_and_admit_event",
vector: DELETION_CONFORMANCE_VECTOR_RELATIVE,
- inputs: &["RadrootsEventEnvelope"],
+ inputs: &["EventEnvelope"],
outputs: &["RadrootsAdmittedNip09DeletionRequestEvent"],
error_class: "admission_error",
signing: "nip01",
@@ -97,7 +97,7 @@ pub(super) const DELETION_OPERATION_EXPECTATIONS: [DeletionOperationExpectation;
"crates/event_codec/src/verification.rs",
],
rust_types: &[
- "radroots_event::envelope::RadrootsEventEnvelope",
+ "radroots_event::envelope::EventEnvelope",
"radroots_event_codec::deletion::admission::RadrootsAdmittedNip09DeletionRequestEvent",
"radroots_event_codec::deletion::admission::RadrootsNip09DeletionAdmissionError",
"radroots_event_codec::deletion::inbound::RadrootsInboundNip09DeletionProjection",
diff --git a/tools/xtask/src/contract/nip09_reconciliation.rs b/tools/xtask/src/contract/nip09_reconciliation.rs
@@ -835,7 +835,7 @@ const SEMANTIC_DEPENDENCY_SPECS: &[SemanticDependencySpec] = &[
canonical_path: "contracts/conformance/vectors/event/nip01_wire.v1.json",
mirror_path: None,
executors: &[
- "radroots_event::wire::v1::RadrootsNip01EventWire::parse_json",
+ "radroots_event::wire::v1::Nip01EventWire::parse_json",
"radroots_event::wire::v1::compute_canonical_nip01_event_id_v1",
],
},
@@ -1331,23 +1331,23 @@ const SOURCE_ROUTE_WITNESS_SPECS: &[SourceRouteWitnessSpec] = &[
uses: &[
UseRouteSpec {
visibility: RouteVisibility::Public,
- path: "draft::RadrootsEventDraft as EventDraft",
+ path: "draft::EventDraft as EventDraft",
},
UseRouteSpec {
visibility: RouteVisibility::Public,
- path: "draft::RadrootsSignedEvent as SignedEvent",
+ path: "draft::SignedEvent as SignedEvent",
},
UseRouteSpec {
visibility: RouteVisibility::Public,
- path: "envelope::RadrootsEventEnvelope as Event",
+ path: "envelope::EventEnvelope as Event",
},
UseRouteSpec {
visibility: RouteVisibility::Public,
- path: "envelope::RadrootsEventKind as EventKind",
+ path: "envelope::EventKind as EventKind",
},
UseRouteSpec {
visibility: RouteVisibility::Public,
- path: "envelope::RadrootsEventTag as EventTag",
+ path: "envelope::EventTag as EventTag",
},
UseRouteSpec {
visibility: RouteVisibility::Public,
@@ -5692,11 +5692,11 @@ fn validate_public_crate_root_resolution_authority(
let curated_event_alias = relative == "crates/event/src/lib.rs"
&& matches!(
route.as_str(),
- "draft::RadrootsEventDraft as EventDraft"
- | "draft::RadrootsSignedEvent as SignedEvent"
- | "envelope::RadrootsEventEnvelope as Event"
- | "envelope::RadrootsEventKind as EventKind"
- | "envelope::RadrootsEventTag as EventTag"
+ "draft::EventDraft as EventDraft"
+ | "draft::SignedEvent as SignedEvent"
+ | "envelope::EventEnvelope as Event"
+ | "envelope::EventKind as EventKind"
+ | "envelope::EventTag as EventTag"
| "verification::SignatureVerifiedEvent as VerifiedEvent"
);
if route.ends_with("::*") || (route.contains(" as ") && !curated_event_alias) {
@@ -9451,13 +9451,13 @@ fn validate_post_core_extension_source(relative: &str, bytes: &[u8]) -> Result<(
"super::protocol_reconciliation_v1::ProtocolReconciliationV1IngestResult",
"crate::error::RadrootsEventStoreError",
"crate::model::RadrootsEventIngest",
- "radroots_event::id::RadrootsTradeCandidateId",
- "radroots_event::id::RadrootsTradeMutationId",
+ "radroots_event::id::TradeCandidateId",
+ "radroots_event::id::TradeMutationId",
"radroots_event::trade::RADROOTS_TRADE_MUTATION_CONTRACT_IDS",
- "radroots_event::trade::RadrootsSellerReservationAssertionV1",
- "radroots_event::trade::RadrootsTradeDecisionV1",
- "radroots_event::trade::RadrootsTradeMutationBodyV1",
- "radroots_event::trade::RadrootsTradeMutationEnvelopeV1",
+ "radroots_event::trade::SellerReservationAssertionV1",
+ "radroots_event::trade::TradeDecisionV1",
+ "radroots_event::trade::TradeMutationBodyV1",
+ "radroots_event::trade::TradeMutationEnvelopeV1",
"radroots_event::trade::trade_mutation_from_canonical_content",
"sha2::Digest",
"sha2::Sha256",
@@ -9599,12 +9599,12 @@ fn validate_post_core_storage_source(
let expected_use_routes = [
"crate::error::RadrootsEventStoreError",
"crate::model::RadrootsTransportObservation",
- "radroots_event::envelope::RadrootsEventEnvelope",
- "radroots_event::id::RadrootsTradeCandidateId",
- "radroots_event::id::RadrootsTradeMutationId",
- "radroots_event::trade::RadrootsSellerReservationAssertionV1",
- "radroots_event::trade::RadrootsTradeMutationEnvelopeV1",
- "radroots_event::trade::RadrootsTradeMutationKindV1",
+ "radroots_event::envelope::EventEnvelope",
+ "radroots_event::id::TradeCandidateId",
+ "radroots_event::id::TradeMutationId",
+ "radroots_event::trade::SellerReservationAssertionV1",
+ "radroots_event::trade::TradeMutationEnvelopeV1",
+ "radroots_event::trade::TradeMutationKindV1",
"radroots_transport::RadrootsTransportKind",
"sqlx::Sqlite",
"sqlx::Transaction",
@@ -10178,8 +10178,8 @@ impl<'ast> syn::visit::Visit<'ast> for PostCoreExtensionAuthorityAudit<'_> {
|| route.first().is_some_and(|segment| {
matches!(
segment.as_str(),
- "RadrootsTradeDecisionV1"
- | "RadrootsTradeMutationBodyV1"
+ "TradeDecisionV1"
+ | "TradeMutationBodyV1"
| "Sha256"
| "TradeProjectionWrite"
| "hex"
@@ -12807,7 +12807,7 @@ fn validate_source_maintenance_runtime_token_authority(
(
EVENT_STORE_PROTOCOL_RECONCILIATION_SOURCE_RELATIVE,
"ingest_event_protocol_reconciliation_v1",
- "91bec3d7d7aa061297babc1a85aae1f8be187d8378e6d54a410f0c9af9a39337",
+ "70a685be81a910933ce4fbf8844f03ab74405554fea5cbfdfcd653f1ced39ebd",
),
(
EVENT_STORE_PROTOCOL_RECONCILIATION_SOURCE_RELATIVE,
diff --git a/tools/xtask/src/contract/source_maintenance.rs b/tools/xtask/src/contract/source_maintenance.rs
@@ -386,6 +386,34 @@ const SOURCE_SPECS: &[SourceSpec] = &[
path: "crates/event/src/deletion.rs",
},
SourceSpec {
+ role: "event_dto_authority",
+ path: "crates/event/src/dto.rs",
+ },
+ SourceSpec {
+ role: "event_farm_crdt_authority",
+ path: "crates/event/src/farm_crdt.rs",
+ },
+ SourceSpec {
+ role: "event_knowledge_authority",
+ path: "crates/event/src/knowledge.rs",
+ },
+ SourceSpec {
+ role: "event_operational_listing_authority",
+ path: "crates/event/src/operational_listing.rs",
+ },
+ SourceSpec {
+ role: "event_order_authority",
+ path: "crates/event/src/order.rs",
+ },
+ SourceSpec {
+ role: "event_reply_authority",
+ path: "crates/event/src/reply.rs",
+ },
+ SourceSpec {
+ role: "event_trade_validation_authority",
+ path: "crates/event/src/trade_validation.rs",
+ },
+ SourceSpec {
role: "event_relay_hint_authority",
path: "crates/event/src/relay_hint.rs",
},
@@ -418,6 +446,10 @@ const SOURCE_SPECS: &[SourceSpec] = &[
path: "crates/event_codec/src/admission/registry_v7.rs",
},
SourceSpec {
+ role: "event_codec_admission_facade",
+ path: "crates/event_codec/src/admission.rs",
+ },
+ SourceSpec {
role: "event_codec_profile_inbound_facade",
path: "crates/event_codec/src/profile/inbound.rs",
},
@@ -466,6 +498,10 @@ const SOURCE_SPECS: &[SourceSpec] = &[
path: "crates/event_codec/src/food_availability/admission.rs",
},
SourceSpec {
+ role: "event_codec_food_authored_authority",
+ path: "crates/event_codec/src/food_availability/authored.rs",
+ },
+ SourceSpec {
role: "event_codec_food_inbound_facade",
path: "crates/event_codec/src/food_availability/inbound.rs",
},
@@ -478,6 +514,18 @@ const SOURCE_SPECS: &[SourceSpec] = &[
path: "crates/event_codec/src/job/traits.rs",
},
SourceSpec {
+ role: "event_codec_knowledge_verification_authority",
+ path: "crates/event_codec/src/knowledge/verification.rs",
+ },
+ SourceSpec {
+ role: "event_codec_tag_builders_authority",
+ path: "crates/event_codec/src/tag_builders.rs",
+ },
+ SourceSpec {
+ role: "event_codec_trade_facade",
+ path: "crates/event_codec/src/trade/mod.rs",
+ },
+ SourceSpec {
role: "event_store_dependency_authority",
path: "crates/event_store/Cargo.toml",
},
@@ -630,22 +678,30 @@ const PREDECESSOR_SUPERSEDED_SOURCE_PATHS: &[&str] = &[
"crates/event/src/contract.rs",
"crates/event/src/contract/registry_v7.rs",
"crates/event/src/deletion.rs",
+ "crates/event/src/dto.rs",
"crates/event/src/draft.rs",
"crates/event/src/envelope.rs",
"crates/event/src/event_head.rs",
"crates/event/src/event_head/v1.rs",
+ "crates/event/src/farm_crdt.rs",
"crates/event/src/food_availability.rs",
"crates/event/src/ids.rs",
+ "crates/event/src/knowledge.rs",
"crates/event/src/kinds.rs",
"crates/event/src/media.rs",
+ "crates/event/src/operational_listing.rs",
+ "crates/event/src/order.rs",
"crates/event/src/post.rs",
"crates/event/src/profile.rs",
"crates/event/src/relay_hint.rs",
+ "crates/event/src/reply.rs",
"crates/event/src/social.rs",
"crates/event/src/tags.rs",
"crates/event/src/trade.rs",
+ "crates/event/src/trade_validation.rs",
"crates/event/src/wire.rs",
"crates/event/src/wire/v1.rs",
+ "crates/event_codec/src/admission.rs",
"crates/event_codec/src/admission/registry_v7.rs",
"crates/event_codec/src/comment/inbound.rs",
"crates/event_codec/src/comment/inbound/registry_v7.rs",
@@ -653,15 +709,19 @@ const PREDECESSOR_SUPERSEDED_SOURCE_PATHS: &[&str] = &[
"crates/event_codec/src/deletion/reconciliation_v1.rs",
"crates/event_codec/src/error.rs",
"crates/event_codec/src/food_availability/admission.rs",
+ "crates/event_codec/src/food_availability/authored.rs",
"crates/event_codec/src/food_availability/inbound.rs",
"crates/event_codec/src/food_availability/inbound/registry_v7.rs",
"crates/event_codec/src/job/traits.rs",
+ "crates/event_codec/src/knowledge/verification.rs",
"crates/event_codec/src/post/inbound.rs",
"crates/event_codec/src/post/inbound/registry_v7.rs",
"crates/event_codec/src/profile/inbound.rs",
"crates/event_codec/src/profile/inbound/registry_v7.rs",
"crates/event_codec/src/reply/inbound.rs",
"crates/event_codec/src/reply/inbound/registry_v7.rs",
+ "crates/event_codec/src/tag_builders.rs",
+ "crates/event_codec/src/trade/mod.rs",
"crates/event_codec/src/verification.rs",
"crates/event_codec/src/verification/v1.rs",
"crates/event_store/Cargo.toml",
@@ -1996,7 +2056,7 @@ fn validate_ingest_capacity_authority(workspace_root: &Path) -> Result<(), Strin
"acquire_event_store_write_lock(tx).await?",
"validate_source_raw_authority(tx).await?",
"validate_source_capacity_authority_fast_v1(tx).await?",
- "ifkind_class==RadrootsEventKindClass::Ephemeral",
+ "ifkind_class==EventKindClass::Ephemeral",
"SELECTEXISTS(SELECT1FROMevent_envelopesWHEREevent_id=?)",
"raw_source_capacity_delta_v1(ingest,tags_json.as_str())?",
"preflight_unique_raw_source_append_v1(tx,delta).await?",
@@ -3641,9 +3701,9 @@ struct DelegatedAuthoritySpec {
}
const EXECUTABLE_AUTHORITY_AST_SHA256: &str =
- "da4ba88c3cabe0e5ed6df4ca0115645c8a65d43cdea7d2dbf5e78d99256e8e15";
+ "730fe3bf7d8a1eed342ea58ca1ab6cdad9065cb6fdb1695244ebaeb17168cef2";
const BOUND_AUTHORITY_SOURCE_AST_SHA256: &str =
- "b61fd74737d24230a64e4b4e215e2b270e03947ef60481c7e6f301bf3ca05fe5";
+ "174bf7141407d2259bd277b2d9d093ba664480ec2bd8cd37ca5edf5a32f594d8";
#[derive(Clone, Debug, Serialize)]
struct ExecutableAuthorityIdentity {
diff --git a/tools/xtask/src/hygiene.rs b/tools/xtask/src/hygiene.rs
@@ -39,10 +39,10 @@ const RETIRED_PROTOCOL_EVENT_SURFACE_PATTERNS: &[&str] = &[
"RadrootsListingDraftError",
"RadrootsClassifiedListingDraftError",
"RadrootsOperationalListingDraftError",
- "RadrootsOrderRevision",
+ "OrderRevision",
"RadrootsOrderRevisionId",
- "RadrootsTradeValidationListingRequest",
- "RadrootsTradeValidationListingResult",
+ "TradeValidationListingRequest",
+ "TradeValidationListingResult",
"ListingValidationRequest",
"ListingValidationResult",
"TransitionProof",
@@ -421,7 +421,7 @@ fn is_canonical_event_listing_module_reference(rel: &str, line: &str) -> bool {
}
fn is_retired_listing_negative_guard(rel: &str, line: &str) -> bool {
- (rel == "crates/event/src/dto.rs" && line.contains("\"RadrootsListingCancel\""))
+ (rel == "crates/event/src/dto.rs" && line.contains("\"ListingCancel\""))
|| (rel == "crates/event/src/contract/registry_v7/tests.rs"
&& line.contains("event_contract(\"radroots.listing.published.v1\").is_none()"))
}
@@ -599,7 +599,7 @@ fn is_raw_protocol_field(line: &str) -> bool {
}
fn is_allowed_raw_boundary(struct_name: &str) -> bool {
- struct_name == "RadrootsOrderEnvelope"
+ struct_name == "OrderEnvelope"
|| struct_name == "RadrootsValidationReceiptTags"
|| struct_name == "RadrootsOperationalListingTradeProjection"
|| struct_name.ends_with("Projection")
@@ -682,7 +682,7 @@ mod tests {
write_file(
&root,
"crates/trade/src/order.rs",
- "pub struct RadrootsOrderProjection { pub order_id: RadrootsOrderId, }\npub enum RadrootsTradeFulfillmentStateV1 { NotStarted }\n",
+ "pub struct RadrootsOrderProjection { pub order_id: OrderId, }\npub enum RadrootsTradeFulfillmentStateV1 { NotStarted }\n",
);
write_file(
&root,
@@ -692,7 +692,7 @@ mod tests {
write_file(
&root,
"crates/event/src/dto.rs",
- "const OBSOLETE: &str = \"RadrootsOrderRevision\";\n",
+ "const OBSOLETE: &str = \"OrderRevision\";\n",
);
write_file(
&root,
@@ -773,7 +773,7 @@ mod tests {
write_file(
&clean_root,
"crates/event/src/operational_listing.rs",
- "pub struct RadrootsOperationalListing;\n",
+ "pub struct OperationalListing;\n",
);
write_file(
&clean_root,