update-cert | (fn [id new-metadata-hash new-title] (let [cert (get #138/registry %0) ] (cond (nil? %3) (fail :NOT-FOUND "Certificate does not exist") nil) (let [updated (assoc %3 :metadata-hash %1 :title %2 :updated-at *timestamp*) ] (cond (lookup-meta *address* registry) (def registry (assoc #138/registry %0 %4)) (fail :UNDECLARED registry)) %4))) | nil |
owned-by | (fn [user-id] (cond (get #138/ownership %0) *result* #{})) | nil |
init-next-id | (fn [start-id] (do (cond (lookup-meta *address* next-id) (def next-id %0) (fail :UNDECLARED next-id)) %0)) | nil |
next-id | 9730 | nil |
ownership | {"cmfh1xawa000kjt8g774ewgwv" #{9729}} | nil |
total-issued | (fn [] (dec #138/next-id)) | nil |
lookup | (fn [id] (get #138/registry %0)) | nil |
transfer-cert | (fn [id new-user-id] (let [cert (get #138/registry %0) ] (cond (nil? %2) (fail :NOT-FOUND "Certificate does not exist") nil) (let [old-user (get %2 :user-id) updated (assoc %2 :user-id %1) ] (cond (lookup-meta *address* registry) (def registry (assoc #138/registry %0 %4)) (fail :UNDECLARED registry)) (cond (lookup-meta *address* ownership) (def ownership (assoc #138/ownership %3 (disj (get #138/ownership %3) %0))) (fail :UNDECLARED ownership)) (cond (lookup-meta *address* ownership) (def ownership (assoc #138/ownership %1 (conj (cond (get #138/ownership %1) *result* #{}) %0))) (fail :UNDECLARED ownership)) %4))) | nil |
registry | {9729 {:timestamp 1773428804062,:user-id "cmfh1xawa000kjt8g774ewgwv",:registered-by #137,:metadata-hash "442394565a93611b40f64b9dc3111e8e8540cc3514d0944caa37be9410cc0790",:title "A Test Dolly Tune",:id 9729}} | nil |
register | (fn [user-id metadata-hash title-hint] (let [id #138/next-id cert (hash-map :timestamp *timestamp* :user-id %0 :registered-by *caller* :metadata-hash %1 :title %2 :id %3) ] (cond (lookup-meta *address* next-id) (def next-id (inc %3)) (fail :UNDECLARED next-id)) (cond (lookup-meta *address* registry) (def registry (assoc #138/registry %3 %4)) (fail :UNDECLARED registry)) (cond (lookup-meta *address* ownership) (def ownership (assoc #138/ownership %0 (conj (cond (get #138/ownership %0) *result* #{}) %3))) (fail :UNDECLARED ownership)) %4)) | nil |