Files
common/docs/assets/js/102.bba977af.js
T
2019-02-28 12:19:16 +00:00

1 line
2.4 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[102],{457:function(t,e,a){"use strict";a.r(e);var s=a(37),r=Object(s.a)({},function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[a("h1",{attrs:{id:"polkadot-trie-db"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#polkadot-trie-db","aria-hidden":"true"}},[t._v("#")]),t._v(" @polkadot/trie-db")]),t._v(" "),a("p",[t._v("A re-implementation of a Patricia Trie. Unlike other implementations, this allows for the specification of a hash function as well as encoder/decoder and operates in a sync fashion by default.")]),t._v(" "),a("p",[t._v("This is a JavaScript port of the "),a("a",{attrs:{href:"https://github.com/ethereum/py-trie",target:"_blank",rel:"noopener noreferrer"}},[t._v("Python Ethereum Trie"),a("OutboundLink")],1),t._v(" with additions to support transactions (checkpoints) and multiple codecs, by default only the Substrate codec.")]),t._v(" "),a("h2",{attrs:{id:"usage"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#usage","aria-hidden":"true"}},[t._v("#")]),t._v(" Usage")]),t._v(" "),a("p",[t._v("Installation -")]),t._v(" "),a("div",{staticClass:"language- line-numbers-mode"},[a("pre",{pre:!0,attrs:{class:"language-text"}},[a("code",[t._v("yarn add @polkadot/trie-db\n")])]),t._v(" "),a("div",{staticClass:"line-numbers-wrapper"},[a("span",{staticClass:"line-number"},[t._v("1")]),a("br")])]),a("p",[t._v("Classes can be imported as follows:")]),t._v(" "),a("div",{staticClass:"language-js line-numbers-mode"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" Trie "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'@polkadot/trie-db'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// Default export")]),t._v("\n")])]),t._v(" "),a("div",{staticClass:"line-numbers-wrapper"},[a("span",{staticClass:"line-number"},[t._v("1")]),a("br")])]),a("h2",{attrs:{id:"utilities"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#utilities","aria-hidden":"true"}},[t._v("#")]),t._v(" Utilities")]),t._v(" "),a("p",[a("router-link",{attrs:{to:"/trie-db/SUMMARY.html"}},[t._v("Utilities")])],1)])},[],!1,null,null,null);e.default=r.exports}}]);