0.1.5 • Published 4 years ago

@weavery/clarity v0.1.5

Weekly downloads
318
License
Unlicense
Repository
github
Last release
4 years ago

Clarity Runtime for JavaScript

Project license Discord

Acknowledgments

We thank Arweave and Blockstack for sponsoring the development of this project as part of the development of Sworn.

Status

Mapping of Clarity types

ClarityTypeScriptJavaScriptNotes
boolbooleanboolean
(buff N)Uint8ArrayUint8Array
errErr<T>Err
intnumber or bigintnumber or BigInt
(list N T)Array<T>Array
(optional T)T or nullT or null
principalStringString
(response T E)T or Err<E>T or Err
(string-ascii N)StringString
(string-utf8 N)StringString
(tuple ...)Map<String, any>Map
uintnumber or bigintnumber or BigInt

Supported Clarity features

ClarityTypeTypeScriptStatusNotes
*functionmul()
+functionadd()
-functionsub()
/functiondiv()
<functionlt<T>()
<=functionle<T>()
>functiongt<T>()
>=functionge<T>()
appendfunctionappend()
as-contractsyntaxasContract<A>()
as-max-len?syntaxasMaxLen<T>()
at-blocksyntaxatBlock<A>()Not supported by SmartWeave.
block-heightkeywordblockHeight()
concatfunctionconcat()
contract-call?functioncontractCall<A, B>()Not supported by SmartWeave.
contract-callerkeywordcontractCaller()
contract-offunctioncontractOf()Not supported by SmartWeave.
default-tofunctiondefaultTo<T>()
errfunctionerr<T()
filterfunctionfilter<A>()
foldfunctionfold<A, B>()
ft-get-balancefunctionftGetBalance()🚧
ft-mint?functionftMint()🚧
ft-transfer?functionftTransfer()🚧
getfunctionget<T>()
get-block-info?functiongetBlockInfo()Not supported by SmartWeave.
hash160functionhash160()
is-eqfunctionisEq()
is-errfunctionisErr()
is-nonefunctionisNone()
is-okfunctionisOk()
is-somefunctionisSome()
keccak256functionkeccak256()
lenfunctionlen<T>()
listfunctionlist<T>()
mapfunctionmap<A, B>()
map-deletefunctionmapDelete()
map-get?functionmapGet()
map-insertfunctionmapInsert()
map-setfunctionmapSet()
matchsyntaxmatch<T, E>()
modfunctionmod()
nft-get-owner?functionnftGetOwner()🚧
nft-mint?functionnftMint()🚧
nft-transfer?functionnftTransfer()🚧
noneconstantnone
notfunctionnot()
okfunctionok<T, E>()
powfunctionpow()
printfunctionprint<T>()
sha256functionsha256()
sha512functionsha512()
sha512/256functionsha512_256()
somefunctionsome()
to-intfunctiontoInt()🚧
to-uintfunctiontoUint()🚧
try!syntaxtryUnwrap<A, B>()
tuplefunctiontuple()
tx-senderkeywordtxSender()
unwrap!syntaxunwrap<A, B>()
unwrap-err!syntaxunwrapErr<A, B>()
unwrap-err-panicfunctionunwrapErrPanic<A, B>()
unwrap-panicfunctionunwrapPanic<A, B>()
xorfunctionxor()

Legend: ❌ = not supported. 🚧 = work in progress. ✅ = supported. ⓐ = supported on SmartWeave (Arweave).