Explorer

definy.account-name-find

description
The first name from index whose account ID (or event hash if by_event) is key. Empty if there is none. names is newest first, so it is the current name of the account
type
Fn(names: List<@definy.account-name-entry>, key: String, by_event: Boolean, index: Number) -> String
expression
fn(names$0, key$1, by_event$2, index$3) =>
  match @core.list-get(list: $0, index: $3) {
    #some(entry$4) =>
      match @core.equal(
          left: match $2 {
            true =>
              $4.event_hash,
            false =>
              $4.account_id
          },
          right: $1
        ) {
        true =>
          $4.name,
        false =>
          @definy.account-name-find(names: $0, key: $1, by_event: $2, index: @core.plus(left: $3, right: 1))
      },
    #none(_) =>
      ""
  }
visibility
public
definy.account-name-find (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: Imuntgn-6EOyJfE17lFPXA78Z_AoLEiMwv4ApSFM3qs
content hash: ci-eYFwQ7rMXyMgOUE_lzJQO2uQMyLz-_Qy4c6C5zKI