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
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
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
(-main & args)
(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
(acclimated? rpc-url cat-id-or-rescue-order)
Fetches acclimation status from the blockchain
Fetches acclimation status from the blockchain
(activate-eligible-list eligible-list)
sets the active
bit on an eligible-list
sets the `active` bit on an eligible-list
(deactivate-eligible-list eligible-list)
clears the active
bit on an eligible-list
clears the `active` bit on an eligible-list
(eligible-list-active? eligible-list)
check if an eligible-list is active
check if an eligible-list is active
(eligible? eligible-list rescue-order)
checks an eligible-list for a given rescue-order
checks an eligible-list for a given rescue-order
(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
(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
(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
(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
(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.
(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
(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
(get-accessory-eligible-list rpc-url accessory-id)
Fetches accessory eligible list - map
Fetches accessory eligible list - map
(get-accessory-image-data rpc-url accessory-id)
Fetches accessory image data - map
Fetches accessory image data - map
(get-accessory-info rpc-url accessory-id)
Fetches accessory info - map
Fetches accessory info - map
(get-accessory-palette rpc-url accessory-id palette-index)
Fetches accessory palette - vector of integers
Fetches accessory palette - vector of integers
(get-accessory-palette-count rpc-url accessory-id)
Fetches integer palette count - integer
Fetches integer palette count - integer
(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]
(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
(get-contract-abi contract-key)
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
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
(get-contract-address contract-key)
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
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
(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
(get-erc721-traits cat-id)
Evaluates to a map of erc-721-traits
Evaluates to a map of `erc-721-traits`
(get-extended-traits cat-id)
Evaluates to a map of extended-traits
Evaluates to a map of `extended-traits`
(get-full-accessory-palette cat-id)
Get the full accessory palette including MoonCat specific colors
Get the full accessory palette including MoonCat specific colors
(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
(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]`
(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
(get-mooncat-palette-row cat-id)
Get the accessory palette row for a MoonCat
Get the accessory palette row for a MoonCat
(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]`
(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)
(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
(get-total-managed-accesories rpc-url manager-address)
Fetches total number of accessories managed by address
Fetches total number of accessories managed by address
(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
(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`
(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
(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
(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
(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
(print-all-hues)
(print-all-palette-keys)
(print-all-palettes)
(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])
(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`
(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)`
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close