Browse Source

Regen reference

Signed-off-by: Mary Anthony <mary@blockstack.com>
feat/clarity-updates
Mary Anthony 5 years ago
parent
commit
fee467a1b4
  1. 24
      _data/clarityRef.json

24
_data/clarityRef.json

@ -168,6 +168,14 @@
"description": "The `fold` function applies the input function `func` to each element of the\ninput list _and_ the output of the previous application of the `fold` function. When invoked on\nthe first list element, it uses the `initial-value` as the second input. `fold` returns the last\nvalue return by the successive applications.",
"example": "(fold * (list 2 2 2) 1) ;; Returns 8\n(fold * (list 2 2 2) 0) ;; Returns 0"
},
{
"name": "len",
"input_type": "buff|list",
"output_type": "uint",
"signature": "(len buffer)",
"description": "The `len` function returns the length of a given buffer / list.",
"example": "(len \"blockstack\") ;; Returns 10\n(len (list 1 2 3 4 5)) ;; Returns 5\n"
},
{
"name": "list",
"input_type": "A, ...",
@ -204,9 +212,9 @@
"name": "contract-map-get",
"input_type": "ContractName, MapName, tuple",
"output_type": "(optional (tuple))",
"signature": "(contract-map-get contract-name map-name key-tuple)",
"signature": "(contract-map-get .contract-name map-name key-tuple)",
"description": "The `contract-map-get` function looks up and returns an entry from a\ncontract other than the current contract's data map. The value is looked up using `key-tuple`.\nIf there is no value associated with that key in the data map, the function returns a (none) option. Otherwise,\nit returns (some value).",
"example": "(expects! (contract-map-get names-contract names-map (tuple (name \"blockstack\")) (err 1))) ;; Returns (tuple (id 1337))\n(expects! (contract-map-get names-contract names-map ((name \"blockstack\")) (err 1)));; Same command, using a shorthand for constructing the tuple\n"
"example": "(expects! (contract-map-get .names-contract names-map (tuple (name \"blockstack\")) (err 1))) ;; Returns (tuple (id 1337))\n(expects! (contract-map-get .names-contract names-map ((name \"blockstack\")) (err 1)));; Same command, using a shorthand for constructing the tuple\n"
},
{
"name": "map-set!",
@ -308,9 +316,9 @@
"name": "contract-call!",
"input_type": "ContractName, PublicFunctionName, Arg0, ...",
"output_type": "(response A B)",
"signature": "(contract-call! contract-name function-name arg0 arg1 ...)",
"signature": "(contract-call! .contract-name function-name arg0 arg1 ...)",
"description": "The `contract-call!` function executes the given public function of the given contract.\nYou _may not_ this function to call a public function defined in the current contract. If the public\nfunction returns _err_, any database changes resulting from calling `contract-call!` are aborted.\nIf the function returns _ok_, database changes occurred.",
"example": "(contract-call! tokens transfer 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR 19) ;; Returns (ok 1)"
"example": "(contract-call! .tokens transfer 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR 19) ;; Returns (ok 1)"
},
{
"name": "as-contract",
@ -320,6 +328,14 @@
"description": "The `as-contract` function switches the current context's `tx-origin` value to the _contract's_ \nprincipal and executes `expr` with that context. It returns the resulting value of `expr`.",
"example": "(as-contract (print tx-sender)) ;; Returns 'CTcontract.name"
},
{
"name": "at-block",
"input_type": "(buff 32), A",
"output_type": "A",
"signature": "(at-block block-hash expr)",
"description": "The `at-block` function evaluates the expression `expr` _as if_ it were evaluated at the end of the\nblock indicated by the _block-hash_ argument. The `expr` closure must be read-only.\n\nThe function returns the result of evaluating `expr`.\n",
"example": "(at-block 0x0000000000000000000000000000000000000000000000000000000000000000 (var-get data))\n(at-block (get-block-info header-hash (- block-height 10)) (var-get data))"
},
{
"name": "get-block-info",
"input_type": "BlockInfoPropertyName, BlockHeightInt",

Loading…
Cancel
Save