Liking cljdoc? Tell your friends :D

libmooncat.core


+accessory-static-color-rows+clj/s

a map of grouped palette colors which do not depend on a MoonCat

a map of grouped palette colors which do not depend on a MoonCat
raw docstring

+accessory-static-palette+clj/s

a vector of static accessory colors maps. Each map has the keys:

:id - index in vector :rgba - vector [uint8 r, uint8 g, uint8 b, uint8 a] :html - string 'rgba(...)' :title - string

a vector of static accessory colors maps. Each map has the keys:

:id - index in vector
:rgba - vector [uint8 r, uint8 g, uint8 b, uint8 a]
:html - string 'rgba(...)'
:title - string
raw docstring

+mooncat-border-color-index+clj/s

the global palette index which corresponds to the glowing border color of the MoonCat. The MoonCat palette begins at this index

the global palette index which corresponds to the `glowing` border
color of the MoonCat. The MoonCat palette begins at this index
raw docstring

+total-mooncats+clj/s


+version+clj/s


-mainclj

(-main & args)

accessory-exists?clj/s

(accessory-exists? rpc-url idat-hex)

Fetches if the idat of an accessory already exists in the smart contract

Fetches if the idat of an accessory already exists in the smart contract
raw docstring

acclimated?clj/s

(acclimated? rpc-url cat-id-or-rescue-order)

Fetches acclimation status from the blockchain

Fetches acclimation status from the blockchain
raw docstring

activate-eligible-listclj/s

(activate-eligible-list eligible-list)

sets the active bit on an eligible-list

sets the `active` bit on an eligible-list
raw docstring

deactivate-eligible-listclj/s

(deactivate-eligible-list eligible-list)

clears the active bit on an eligible-list

clears the `active` bit on an eligible-list
raw docstring

eligible-list-active?clj/s

(eligible-list-active? eligible-list)

check if an eligible-list is active

check if an eligible-list is active
raw docstring

eligible?clj/s

(eligible? eligible-list rescue-order)

checks an eligible-list for a given rescue-order

checks an eligible-list for a given rescue-order
raw docstring

filter-rescue-ordersclj/s

(filter-rescue-orders & filters)

Takes one or multiple filter map and returns an array of rescue-orders. If multiple filter maps are supplied, the results will be combined as though with OR.

Each filter can specify multiple criteria that the MoonCat must meet. The available properties (criteria) are:

:id - (f string) | string | vector of strings :hue - (f float) :order - (f rescue-order) | integer | vector of rescue-orders :vintage - integer | array of integers :genesis - boolean :pale - boolean :facing: :left | :right :expression :smiling | :grumpy | :pouting | shy | vector of expressions :pattern: :pure | :tabby | :spotted | :tortie | vector of patterns :pose :standing | :sleeping | :pouncing | :stalking | vector of poses :color :red | :orange | :yellow | :chartreuse | :green | ... | :fuchsia | vector of colors

Takes one or multiple `filter` map and returns an array of rescue-orders.
 If multiple `filter` maps are supplied, the results will be combined as though with OR.

Each filter can specify multiple criteria that the MoonCat must meet. The available properties (criteria) are:

 :id - (f string) | string | vector of strings
 :hue - (f float)
 :order - (f rescue-order) | integer | vector of rescue-orders
 :vintage -  integer | array of integers
 :genesis - boolean
 :pale - boolean
 :facing: :left | :right
 :expression :smiling | :grumpy | :pouting | shy | vector of expressions
 :pattern: :pure | :tabby | :spotted | :tortie | vector of patterns
 :pose :standing | :sleeping | :pouncing | :stalking | vector of poses
 :color :red | :orange | :yellow | :chartreuse | :green | ... | :fuchsia | vector of colors
raw docstring

generate-cat-idclj/s

(generate-cat-id attributes)

Generates a cat-id hex with the provided attributes map. If an attribute is missing, the first value is the default.

available attributes are:

:hue - number in [-2, 360) | color keyword | color string :expression :smiling | :grumpy | :pouting | :shy :pattern - :pure | :tabby | :spotted | :tortie :pose - :standing | :sleeping | :pouncing | :stalking]) :facing - :left | :right :pale - true | false

Generates a cat-id hex with the provided `attributes` map.
If an attribute is missing, the first value is the default.

available attributes are:

 :hue - number in [-2, 360) | color keyword | color string
 :expression :smiling | :grumpy | :pouting | :shy
 :pattern - :pure | :tabby | :spotted | :tortie
 :pose - :standing | :sleeping | :pouncing | :stalking])
 :facing - :left | :right
 :pale - true | false
raw docstring

generate-eligible-listclj/s

(generate-eligible-list rescue-orders)

Turns a sequence of rescue-orders into a vector of 100 hex-encoded bytes32 values representing an eligible-list

Turns a sequence of rescue-orders into a vector of 100 hex-encoded bytes32
values representing an eligible-list
raw docstring

generate-imageclj/s

(generate-image cat-id)
(generate-image cat-id accessories)
(generate-image cat-id accessories options)

Takes a cat-id hex string, a vector of accessories, and an optional options map. Evaluates to a png data uri.

Each accessory should be a map with the keys:

:idat - string the idat image data :palettes - vector of palettes (palette is an 8 el vec of integer palette indexes) :z-index - integer layer distance from cat (+/- determined by background) :positions - 4 el vec of 2 el vecs with x&y offsets for each position :width - integer width of the accessory :height - integer height of the accessory :meta - integer metadata of the accessory

:palette-index (optional) - which palette to use (default: 0) :background (optional) - overrides meta attribute :mirror-placement (optional) - overrides meta attribute :mirror-accessory (optional) - overrides meta attribute :palette (dev) - takes a 9 element array, drops first element and sets as palette 0

The available options are:

:glow - boolean, when set draws glow where applicable (default: true) :scale - integer number of drawn pixels per accessory pixel (default: 1) :padding - integer number of pixels to pad the drawn image (default: 3 * scale) :background-color - string background fill (default: transparent) :full-size - boolean, when set draws full 128x128 image instead of minimum bounding image (default: false) :no-cat - boolean, when true cat image is not included in output

Takes a `cat-id` hex string, a vector of `accessories`, and an
optional `options` map. Evaluates to a png data uri.

Each accessory should be a map with the keys:

  :idat - string the idat image data
  :palettes - vector of palettes (palette is an 8 el vec of integer palette indexes)
  :z-index - integer layer distance from cat (+/- determined by `background`)
  :positions - 4 el vec of 2 el vecs with x&y offsets for each position
  :width - integer width of the accessory
  :height - integer height of the accessory
  :meta - integer metadata of the accessory

  :palette-index (optional) - which palette to use (default: 0)
  :background (optional) - overrides meta attribute
  :mirror-placement (optional) - overrides meta attribute
  :mirror-accessory (optional) - overrides meta attribute
  :palette (dev) - takes a 9 element array, drops first element and sets as palette 0

The available options are:

  :glow - boolean, when set draws glow where applicable (default: true)
  :scale - integer number of drawn pixels per accessory pixel (default: 1)
  :padding - integer number of pixels to pad the drawn image (default: 3 * scale)
  :background-color - string background fill (default: transparent)
  :full-size - boolean, when set draws full 128x128 image instead of minimum
               bounding image (default: false)
  :no-cat - boolean, when true cat image is not included in output
raw docstring

generate-image-dataclj/s

(generate-image-data pixels)
(generate-image-data pixels remap-palette scale-factor)

Takes a vector of pixels in the form [[x0 y0 p0] [x1 y1 p1]...] and evaluates a map containing the keys:

:pixels - the supplied pixels vec :width - the (minimized) image width :height - the (minimized) image height :offset-x - translation offset for raw x coord to minimized x coord :offset-y - translation offset for raw y coord to minimized y coord :palette-mapping - mapping of compressed and sorted palette-indexes {old-index0 new-index0, old-index1 new-index1, ...} :idat - a zlib compressed PNG IDAT compatible pixel data array :idat-hex - the PNG IDAT data in hexidecimal

If remap-palette is true, the palette order will sorted from most frequently used to least frequently used.

If scale-factor is a positive integer, each pixel in the resulting image data will be made of scale-factor pixels.

Takes a vector of pixels in the form `[[x0 y0 p0] [x1 y1 p1]...]`
and evaluates a map containing the keys:

  :pixels - the supplied `pixels` vec
  :width - the (minimized) image width
  :height - the (minimized) image height
  :offset-x - translation offset for raw `x` coord to minimized `x` coord
  :offset-y - translation offset for raw `y` coord to minimized `y` coord
  :palette-mapping - mapping of compressed and sorted palette-indexes
                      `{old-index0 new-index0, old-index1 new-index1, ...}`
  :idat - a zlib compressed PNG IDAT compatible pixel data array
  :idat-hex - the PNG IDAT data in hexidecimal

If `remap-palette` is true, the palette order will sorted from most
frequently used to least frequently used.

If `scale-factor` is a positive integer, each pixel in the resulting image
data will be made of `scale-factor` pixels.
raw docstring

generate-metabyteclj/s

(generate-metabyte accessory-metadata)

Turns an accessory-metadata map into a byte.

accessory-metadata keys are:

:audience - 0 | 1 | 2 | 3 :mirror-accessory - bool :mirror-placement - bool :background - bool

Turns an `accessory-metadata` map into a byte.

`accessory-metadata` keys are:

  :audience - 0 | 1 | 2 | 3
  :mirror-accessory - bool
  :mirror-placement - bool
  :background - bool
raw docstring

get-accessoryclj/s

(get-accessory rpc-url accessory-id)

Fetches all data associated with an accessory as a map with the keys:

:total-supply - integer :available-supply - integer :name - string :manager - address :price-wei - string :price-eth - string :available - boolean :availablePalettes - integer :palettes - vec of palettes :positions - vec of positions :meta - integer :width - integer :height - integer :idat - string :eligible-list - vector of 100 bytes32s

Fetches all data associated with an accessory as a map with the keys:

:total-supply - integer
:available-supply - integer
:name - string
:manager - address
:price-wei - string
:price-eth - string
:available - boolean
:availablePalettes - integer
:palettes - vec of palettes
:positions - vec of positions
:meta - integer
:width - integer
:height - integer
:idat - string
:eligible-list - vector of 100 bytes32s
raw docstring

get-accessory-eligible-listclj/s

(get-accessory-eligible-list rpc-url accessory-id)

Fetches accessory eligible list - map

Fetches accessory eligible list - map
raw docstring

get-accessory-image-dataclj/s

(get-accessory-image-data rpc-url accessory-id)

Fetches accessory image data - map

Fetches accessory image data - map
raw docstring

get-accessory-infoclj/s

(get-accessory-info rpc-url accessory-id)

Fetches accessory info - map

Fetches accessory info - map
raw docstring

get-accessory-paletteclj/s

(get-accessory-palette rpc-url accessory-id palette-index)

Fetches accessory palette - vector of integers

Fetches accessory palette - vector of integers
raw docstring

get-accessory-palette-countclj/s

(get-accessory-palette-count rpc-url accessory-id)

Fetches integer palette count - integer

Fetches integer palette count - integer
raw docstring

get-base-traitsclj/s

(get-base-traits cat-id)

Evaluates to a map of base-traits parsed from a cat-id hex.

a base-traits map has the keys:

:cat-id - cat-id hex :genesis - bool :pale - bool :facing - :left | :right :expression :smiling | :grumpy | :pouting | :shy :pattern - :pure | :tabby | :spotted | :tortie :pose - :standing | :sleeping | :pouncing | :stalking])

:k-int - integer k-value :hue-value - number base hue :hue - keyword hue color :glow - vector of 3 ints representing glow color [r g b]

Evaluates to a map of `base-traits` parsed from a cat-id hex.

a `base-traits` map has the keys:

  :cat-id - cat-id hex
  :genesis - bool
  :pale - bool
  :facing - :left | :right
  :expression :smiling | :grumpy | :pouting | :shy
  :pattern - :pure | :tabby | :spotted | :tortie
  :pose - :standing | :sleeping | :pouncing | :stalking])

  :k-int - integer k-value
  :hue-value - number base hue
  :hue - keyword hue color
  :glow - vector of 3 ints representing glow color [r g b]
raw docstring

get-cat-idclj/s

(get-cat-id rescue-order)

Gets the cat-id hex associated with a given rescue-order

Gets the cat-id hex associated with a given rescue-order
raw docstring

get-contract-abiclj/s

(get-contract-abi contract-key)

get the JSON ABI of the smart contract associated with the contract-key

supported contract-keys are:

:mooncatrescue - Original MoonCatRescue Contract :mooncatacclimator - Official ERC721 MoonCatAcclimator wrapper :mooncataccessories - Official MoonCat Accessories :deprecated-unofficial-mooncatwrapper - Deprecated Unofficial MoonCat Wrapper

get the JSON ABI of the smart contract associated with the `contract-key`

supported `contract-key`s are:

 :mooncatrescue - Original MoonCatRescue Contract
 :mooncatacclimator - Official ERC721 MoonCatAcclimator wrapper
 :mooncataccessories - Official MoonCat Accessories
 :deprecated-unofficial-mooncatwrapper - Deprecated Unofficial MoonCat Wrapper
raw docstring

get-contract-addressclj/s

(get-contract-address contract-key)

get the Ethereum address of the smart contract associated with the contract-key

supported contract-keys are:

:mooncatrescue - Original MoonCatRescue Contract :mooncatacclimator - Official ERC721 MoonCatAcclimator wrapper :mooncataccessories - Official MoonCat Accessories :deprecated-unofficial-mooncatwrapper - Deprecated Unofficial MoonCat Wrapper

get the Ethereum address of the smart contract associated with the `contract-key`

supported `contract-key`s are:

 :mooncatrescue - Original MoonCatRescue Contract
 :mooncatacclimator - Official ERC721 MoonCatAcclimator wrapper
 :mooncataccessories - Official MoonCat Accessories
 :deprecated-unofficial-mooncatwrapper - Deprecated Unofficial MoonCat Wrapper
raw docstring

get-drawable-mooncat-accessoryclj/s

(get-drawable-mooncat-accessory rpc-url rescue-order owned-accessory-index)

Fetches the MoonCat's owned accessory data and merges it with the accessory image data resulting in a map with the keys:

:positions :palettes :meta :idat :width :height :z-index :palette-index

Fetches the MoonCat's owned accessory data and merges it with the accessory image data
resulting in a map with the keys:

  :positions
  :palettes
  :meta
  :idat
  :width
  :height
  :z-index
  :palette-index
raw docstring

get-erc721-traitsclj/s

(get-erc721-traits cat-id)

Evaluates to a map of erc-721-traits

Evaluates to a map of `erc-721-traits`
raw docstring

get-extended-traitsclj/s

(get-extended-traits cat-id)

Evaluates to a map of extended-traits

Evaluates to a map of `extended-traits`
raw docstring

get-full-accessory-paletteclj/s

(get-full-accessory-palette cat-id)

Get the full accessory palette including MoonCat specific colors

Get the full accessory palette including MoonCat specific colors
raw docstring

get-managed-accessory-id-by-indexclj/s

(get-managed-accessory-id-by-index rpc-url manager-address index)

Fetches the accessory-id of a managed accessory

Fetches the accessory-id of a managed accessory
raw docstring

get-max-offsetsclj/s

(get-max-offsets pixels)

Takes a vector of pixels in the form [[x0 y0 p0] [x1 y1 p1]...] and evaulates to the maximum offsets for the image to fit on the 128x128 image grid in the form [max-offset-x max-offset-y]

Takes a vector of pixels in the form `[[x0 y0 p0] [x1 y1 p1]...]`
and evaulates to the maximum offsets for the image to fit on the
128x128 image grid in the form `[max-offset-x max-offset-y]`
raw docstring

get-mooncat-accessoryclj/s

(get-mooncat-accessory rpc-url rescue-order owned-accessory-index)

Fetches the MoonCat's owned accessory data as a map with the keys:

:accessory-id :palette-index :z-index

Fetches the MoonCat's owned accessory data as a map with the keys:

:accessory-id
:palette-index
:z-index
raw docstring

get-mooncat-image-vectorclj/s

(get-mooncat-image-vector cat-id)

deprecated

deprecated
raw docstring

get-mooncat-palette-rowclj/s

(get-mooncat-palette-row cat-id)

Get the accessory palette row for a MoonCat

Get the accessory palette row for a MoonCat
raw docstring

get-offsetsclj/s

(get-offsets pixels)

Takes a vector of pixels in the form [[x0 y0 p0] [x1 y1 p1]...] and evaluates to the offsets of the minimum bounding image on a 128x128 image grid in the form [offset-x offset-y]

Takes a vector of pixels in the form `[[x0 y0 p0] [x1 y1 p1]...]`
and evaluates to the offsets of the minimum bounding image on a
128x128 image grid in the form `[offset-x offset-y]`
raw docstring

get-rescue-orderclj/s

(get-rescue-order cat-id)

Gets the rescue-order of a cat-id hex (if one exists)

Gets the rescue-order of a cat-id hex (if one exists)
raw docstring

get-total-accessoriesclj/s

(get-total-accessories rpc-url)

Fetches total number of accessories in contract as a STRING

Fetches total number of accessories in contract as a STRING
raw docstring

get-total-managed-accesoriesclj/s

(get-total-managed-accesories rpc-url manager-address)

Fetches total number of accessories managed by address

Fetches total number of accessories managed by address
raw docstring

get-total-mooncat-accessoriesclj/s

(get-total-mooncat-accessories rpc-url rescue-order)

Fetches the number of accessories owned by the MoonCat

Fetches the number of accessories owned by the MoonCat
raw docstring

get-traitsclj/s

(get-traits cat-id-or-rescue-order)
(get-traits result-type cat-id-or-rescue-order)

safely get traits by cat-id or rescue-order

invalid input will return a map {:classification :invalid :reason "..."}

valid result-type arguments are: :basic | "basic" :extended | "extended" :erc721 | "erc721

default result-type is basic

safely get traits by cat-id or rescue-order

invalid input will return a map `{:classification :invalid :reason "..."}`

valid `result-type` arguments are:
  :basic | "basic"
  :extended | "extended"
  :erc721 | "erc721

default result-type is `basic`
raw docstring

mooncat-contract-detailsclj/s

(mooncat-contract-details rpc-url cat-id-or-rescue-order)

Fetches contract details map for a rescued mooncat from the supplied rpc-url. If the cat doesn't exist the result is nil. In clojurescript, evaluates to a Promise

Fetches contract details map for a rescued mooncat from the supplied rpc-url.
If the cat doesn't exist the result is nil.
In clojurescript, evaluates to a Promise
raw docstring

parse-cat-idclj/s

(parse-cat-id cat-id-or-rescue-order)

takes a cat-id or rescue-order and turns it into a validated cat-id hex string or a map with details if input is invalid

takes a cat-id or rescue-order and turns it into a validated cat-id hex string
or a map with details if input is invalid
raw docstring

parse-eligible-listclj/s

(parse-eligible-list eligible-list)

Turns a vector of 100 hex-encode bytes32 values representing an eligible-list into a vector of rescue-orders

Turns a vector of 100 hex-encode bytes32 values representing an eligible-list
into a vector of rescue-orders
raw docstring

parse-metabyteclj/s

(parse-metabyte metabyte)

Parses a metabyte integer into a map with the keys: :verified - bool :reserved - 0-4 :audience - 0 | 1 | 2 | 3 :mirror-accessory - bool :mirror-placement - bool :background - bool

Parses a `metabyte` integer into a map with the keys:
:verified - bool
:reserved - 0-4
:audience - 0 | 1 | 2 | 3
:mirror-accessory - bool
:mirror-placement - bool
:background - bool
raw docstring

(print-all-hues)

(print-all-palette-keys)

(print-all-palettes)

random-cat-idclj/s

(random-cat-id)
(random-cat-id constraints)

Generates a random cat-id hex. If a constraints map is supplied, the resulting id will conform to the given attributes. Each value in a constraints map should be a vector of permitted values.

available constraints and their relevant values are:

:hues [numbers [-2, 360) | color keywords] :expressions [:smiling :grumpy :pouting :shy]) :patterns [:pure :tabby :spotted :tortie]) :poses [:standing :sleeping :pouncing :stalking]) :facings [:left :right]) :pales [true false])

Generates a random cat-id hex. If a `constraints` map is supplied,
the resulting id will conform to the given attributes. Each value
in a `constraints` map should be a vector of permitted values.

available constraints and their relevant values are:

 :hues [numbers [-2, 360) | color keywords]
 :expressions [:smiling :grumpy :pouting :shy])
 :patterns [:pure :tabby :spotted :tortie])
 :poses [:standing :sleeping :pouncing :stalking])
 :facings [:left :right])
 :pales [true false])
raw docstring

read-image-dataclj/s

(read-image-data image-data)

Takes an image-data map which must contain the keys: :width - width of the image :height - height of the image :idat-hex - hex encoded (compressed) IDAT byte array

and the optional keys: :offset-x - added to x coordinates :offset-y - added to y coordinates :palette-fn - run on the palette index :mirror - if true flip pixels horizontally

Evaluates to a pixels vec which contains vectors of triples [x y i] with x-coordinate x y-coordinate y and palette-index i

Takes an `image-data` map which must contain the keys:
  :width - width of the image
  :height - height of the image
  :idat-hex - hex encoded (compressed) IDAT byte array

and the optional keys:
  :offset-x - added to `x` coordinates
  :offset-y - added to `y` coordinates
  :palette-fn - run on the palette index
  :mirror - if true flip pixels horizontally

Evaluates to a `pixels` vec which contains vectors of triples
`[x y i]` with x-coordinate `x` y-coordinate `y` and
palette-index `i`
raw docstring

save-image!clj

(save-image! filename cat-id & [accessories options])

Saves generated png image to disk. See (doc generate-image)

Saves generated png image to disk. See `(doc generate-image)`
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close