{"_id":"near-sdk-js","_rev":"27-f5bb98120e320fe15130020be63a2fd3","name":"near-sdk-js","description":"High Level JavaScript SDK for building smart contracts on NEAR","dist-tags":{"next":"0.6.0-0","latest":"2.0.0"},"versions":{"0.1.1":{"name":"near-sdk-js","version":"0.1.1","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@0.1.1","maintainers":[{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"bin":{"near-sdk":"cli/cli.js"},"dist":{"shasum":"3faf8823b2ce5a1ec96c40617ab8c6eb3274a555","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-0.1.1.tgz","fileCount":17,"integrity":"sha512-XjpJhyuQirdIxPHfxAwCEkn4CA+HSnJ9FmEfBNNUjJS12yMZrnGB7zITPJkHiVbRWiFTNVF3HDa5mrLZxGdqtQ==","signatures":[{"sig":"MEUCIACSncln5gmFUdyBHb8ylv7CzS/4FEcjzf9bVzWOD1WMAiEA8cCEd8uK++ecrH2DvhRQ8+UnD9HnilVX4pNBF0Hv4Ho=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":7245254,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJihh+3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrXKxAAnp8dl4xWi42qLqsfSeMzYL8U8PB69IdR0iGAYE+2tgxKoGqz\r\nzHiAq+8gK15AQCDU2g29AAcJtuHz4wDUYEzrJ0UNl2nYY921nqwapOD23rzL\r\ng+Ybr2rwqwCv+v+jwqV/hImy744vOI0YzgyHxClV4Cd0oKitffNn4YTjs+bO\r\nurx2Cc5cT19SvFlLUHS25l/brkbowS11qF/fZfuchbAMamq1LhGOJ6HavMPv\r\nhaDY7EN/hvErcfXN7ebFQT8xv3/gScg3khc2sU4mKxMHUN8GKNyPNv0cZdFW\r\ntRdqWiNwG/hTfDvq+G91HeUgPxBE2v2vEVqavG0AHYhy3eqtQOUflob/0l1a\r\nRvVwMllVbyrgUTEBPpAHshOErYT2AKph6tC40C5SfjmTlixCjADd2IHhn6vw\r\nQLjCuKl1nCcYkxG8vCMzktJwn/feeOkMsZaOqfr9DhQQJvdzWuW8N70XRqEg\r\n0iOSdq2asW4FtvkCPNskNOSzPIqSFn/cLxrGyC6MpDQuNTimNGQ7Fn6s1wQ3\r\ns9a9n7FH0x0ISTep23I5t3gHC2tK2DXaHsw7OQd66lLH5XEA5NdIopmtZ3SF\r\nJmENvRZSQIN6xyvsCBGiRsBbFxUjxUkMX4eaosbd7OfvMuJgIzO8yjypW3/q\r\nCMGy8TCcoa0HyHC1kuMSBjkOp7hhp6Nkk6Q=\r\n=9I1t\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","type":"module","gitHead":"5b28b9101b3eea5f7088e25e0c372d0c9d5e2e3a","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"},"repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.5.0","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"16.14.2","dependencies":{"yargs":"^17.5.1","rollup":"^2.61.1","@babel/core":"^7.17.5","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","rollup-plugin-sourcemaps":"^0.6.3","@rollup/plugin-node-resolve":"^13.1.1","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_0.1.1_1652957111039_0.6851315239524882","host":"s3://npm-registry-packages"}},"0.2.0":{"name":"near-sdk-js","version":"0.2.0","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@0.2.0","maintainers":[{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"bin":{"near-sdk":"cli/cli.js"},"dist":{"shasum":"412914d08b2221b9b400ae846cebebc752f1bc75","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-0.2.0.tgz","fileCount":21,"integrity":"sha512-PowwZI5/yaecF7MtYYB4HDkkyuxw3GwbxjecL5DnZtacIww4K72hXwsxsdmv2JIYJUiIFReKeX55y90gtiFsmw==","signatures":[{"sig":"MEUCIQCJnxInib9ZwfeT9PVQAnM3NV4A0ls3uaPMQKfkdu7CrgIgNiSwJG9fSZFEa8Xml+XTpSboGO+nQB2t2txsoPP8XiU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":7568938,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJijzScACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqkTxAAjvhtzAUZjTlNqLZhNIKlMXoV7z87+t2OaY2/+fFOp/a2sZk0\r\nm87qw7OrNb8g5H/wo9K03jNShc0pNF1hx9v97e9n28XKdXmJ9sZ8JdjLeINS\r\n5vuaNHPb6TT7KlCe07I6Fc+lvo3hOg5Y/Iqfk0K7h5D09S8NS9QmuPEnkpq/\r\n9zRaRDz7dTptSsXyA3bwLNSrdvqv9h68Saw4XgiarM4GTMKC37jcKxwtNdkg\r\nVz57aEDEan+GRQZfBWhiRBUOG7eWtfy0gzc1yqzKgd8WPj7rrWKFeOTFtBGH\r\nNCEnSKBNfIxxE7wCzl8IH2GD08vFKCxPMpT0+XLs0UlSbqMouYTSwnQL2BtJ\r\ncF2wLV0vr8oIOsi/Db54TQAAGZttCjqGFzKcT4rYuScjnOqk4DrhygcWEgYz\r\nYqoHWWNHbNv1QnLvVuwfWNg7TSaH8Rt47qNGDcqESFonweR6b6/M/Ml8yJUg\r\nO4BffFh1sXapdDagpC8kOPytK/b4Q7HcFOeGg9wEqA81Ol6ObzfNZ5YpdJPo\r\nS/E51D0csfnQxm6sng/lIjQ4hA5KeqlSrQAPA3BPhxSf8RrvLwOnqCGTS/P2\r\njqW1Py9n3IhiBmTH7Wqk0qJ0CFFBUcniikYwrFqBGPtlCIPhUn6VhQA4orsM\r\n7PJwzZd1I1yenwTKSgbTBfpqdDh/iDMSgjE=\r\n=k+3q\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","type":"module","gitHead":"f015908191fcfdbc93da374526dd7c1ff38feb8c","scripts":{"test":"echo \"Error: no test specified\" && exit 0"},"_npmUser":{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"},"repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.5.0","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"16.14.2","dependencies":{"yargs":"^17.5.1","rollup":"^2.61.1","@babel/core":"^7.17.5","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","rollup-plugin-sourcemaps":"^0.6.3","@rollup/plugin-node-resolve":"^13.1.1","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_0.2.0_1653552284500_0.996781369438229","host":"s3://npm-registry-packages"}},"0.3.0":{"name":"near-sdk-js","version":"0.3.0","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@0.3.0","maintainers":[{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"bin":{"near-sdk":"cli/cli.js"},"dist":{"shasum":"ba3ba983c0a41d329ff675db51d8544fd7f02c39","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-0.3.0.tgz","fileCount":23,"integrity":"sha512-L5rt//CWxPqZEnWweHiAvoi1N7ucX3jBB7cKLCLja5n7pMez4HnHnMtVv1uidAC7hSnTIiWI4xoRFA+IAjh8YQ==","signatures":[{"sig":"MEUCIQCre7uAVkeS7NzyPlYj3/FyUuW+QwXFfdjKynfHffZpLwIgGjSCo2ZCHZHCRBDh9Jx+DHOe7aX9gaMaC7XIwZ0N6bI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":8065010,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJin34oACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq8DQ/9Er4/MO12Hgbn1GNY1KBRxwyx5Ts35Lqp0C6CCLaOo5GX2+W5\r\n+hFsPlMy2REe2+MEPjvZr89Y9hHkFZnrCUeXZ6eaUTCvojz8CFE3CCZ2i69T\r\nuSd58ibspnprtRdWoSc2wDDDUNTbQ188f8qh6v7qqiUAMD+zJ9x6ENH3WL7b\r\nrF6T/chAoYLNzhFGUxlRgvo5MqdzJbZJ8Tn2ea2YtbklKBuUMrny9a64HG/I\r\nfrcHUOKHDT8BA05oFBXJNWZK4W1cplUc1YXhI7VynXaKHIjwor6tY+IF1biJ\r\n/joi/ySQMjoCZYET0NIpOv4NUQzA1wy3/dkXdLsKwa6S9oDMo8pOaOraUvma\r\n769FObAarvyAePTmSyzrFymPQl3pPNW/qR1hepOYoj4fVxf6MRW08Llvnl6f\r\nb2rjx8O/QQGqa0xTJvPboYm1lcl20Xc1m6X3wO37RvG4mMGgAzjqeT42Xnqd\r\nzLWflagUYtUABmyOJ79S/AiAGzWWCZd036oTjBpd7YPOxc6ThrA7eqlNbNLX\r\nvQVf0TVuUDAKEjOD4JhDIFL0/T+HSPD2JcNJNGsS1GvEcNeSem+zpxDF2J9N\r\nKYEbjDoAZMi7eeFkRsX3lVQ0tMn8khVQlFl9vlo1M1iUbTpCwZnrKT2sIzL3\r\n8nbzrfH4Bti/eQAh+2V/it3o7Z9o/uob1j8=\r\n=OHZV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","type":"module","gitHead":"2efe453dc65ff97903b9b6d3270b71036c3bcde9","scripts":{"test":"cd tests && yarn rebuild && yarn test && cd .."},"_npmUser":{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"},"repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.5.0","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"16.14.2","dependencies":{"yargs":"^17.5.1","rollup":"^2.61.1","@babel/core":"^7.17.5","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","rollup-plugin-sourcemaps":"^0.6.3","@rollup/plugin-node-resolve":"^13.1.1","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_0.3.0_1654619688516_0.4593079545378218","host":"s3://npm-registry-packages"}},"0.4.0-0":{"name":"near-sdk-js","version":"0.4.0-0","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@0.4.0-0","maintainers":[{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"bin":{"near-sdk":"cli/cli.js"},"dist":{"shasum":"e2243e8cfeae4d744f20b16baba76bf41892da89","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-0.4.0-0.tgz","fileCount":31,"integrity":"sha512-mIATqGLV3BfQfg9ZP+ufCqFVgvAKYAWIRPCvHHLNnK+H+NciTatLfOGGiIU8/oo9kk8QdcMWMMyewscmIgJx0w==","signatures":[{"sig":"MEYCIQDFBPvojP6q7kEoUQT2NhBx7qBubvqZfykFlLRUKEqKYQIhAJK54JDkgwJno0+9JtLP6ElsLkV8+p4SjExvCcj3CdBn","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":101124,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi2dQQACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrtVQ//VGXH70/Tqihd7xYRHqiV072bqyFc1+Y1cczHuPZbEbUzSkeI\r\nYZiV96v5tKlJjENhpXzZK9AsTFdBg1fnG8ElD76mCMchxvebFJNpViMhK+nY\r\nkaPj6tUWQm7a8tdYTYtDlW+QTqA4KpdlAuzl28N4lwTJAlsHkdP3SdESl9CN\r\n6ue0EpFZ1/trd1UvBwO+AoiiJWs3DdohxwVh4yWVNIEQlq6FyIrfNes/fqfY\r\nhW0RSAsrkMHxbPj8WvjLwmqeNLPM+2JMIW3Bi8l3bbota2bBrJVG9rlS95uo\r\nNAwA5Egz6JrllReod5rpHljGZYBQRUajJc1psBJFn1FIsuesUAadDUSjD2Yc\r\nIbh8hUumHuzjAiprcZQaf7trNRJAMyMFhd/oZ450t9LGgPqKwbswwpD40R6y\r\nEFrQSrwjJ6x/EpUu+kKS236uvllWlthwbsUpPV8w0k3EbixwBKYBFqBVHShD\r\nZ6p0zdW74065X5lI9YI3IiYJEROcjCT8pLLlukieujmsiai3mlUsRG+tmZqE\r\n7fkHHpO+l9Kf3ff3oTD5Vjhf4Ia98BSF2sCdwxi6Xko2YTGl2W4WM+UWDw54\r\njWv+a2yQS8eezypUqEZ0mlRm/fDQrWAapxaimsfBS24HSHBnAI8JNXMVRL+Q\r\nq6y9s6yn3u4Z0VA7XVa9+/N4FQnDokmKToc=\r\n=4WNb\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","readme":"# NEAR-SDK-JS (Standalone)\n\n## Installation\nIt is tested on Ubuntu 20.04, M1 Mac and Intel Mac. Other linux should also work but they're not tested.\n\n1. Make sure you have make, cmake and nodejs. On Linux, also make sure you have gcc.\n2. `make setup`\n\n## Usage\n\n1. Copy project layout including configurations from `examples/` as a starting point\n2. Write smart contracts with JavaScript. You can use most npm packages that uses portable ES2020 features. \n3. Build the contract with `yarn build`.\n4. If no errors happens, a `<contract-name>.wasm` will be generate at `<project-dir>/build/`. It can be tested with workspaces-js and deployed to a NEAR node.\n\n## Running Examples\nThere are a couple of contract examples in the project:\n\n- [Clean contract state](https://github.com/near/near-sdk-js/tree/develop/examples/src/clean-state.js)\n- [Counter using low level API](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter-lowlevel.js)\n- [Counter in JavaScript](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter.js)\n- [Counter in TypeScript](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter.ts)\n- [Doing cross contract call](https://github.com/near/near-sdk-js/tree/develop/examples/src/cross-contract-call.js)\n- [Fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/fungible-token.js)\n- [Lockable fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/fungible-token-lockable.js)\n- [Non fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/non-fungible-token.js)\n- [Non fungible token receiver contract](https://github.com/near/near-sdk-js/tree/develop/examples/src/non-fungible-token-receiver.js)\n- [Status message board](https://github.com/near/near-sdk-js/tree/develop/examples/src/status-message.js)\n- [Status message board with unique messages](https://github.com/near/near-sdk-js/tree/develop/examples/src/status-message-collections.js)\n\nTo build all examples, run `yarn build` in `examples/`. To test all examples, run `yarn test`. You can also build and test one specific example with `yarn build:<example-name>` and `yarn test:<example-name>`, see `examples/package.json`.\n\nTo deploy and call a contract on a NEAR node, use near-cli's `near deploy` and `near call`.\n\n## Error Handling in NEAR-SDK-JS\n\nIf you want to indicate an error happened and fail the transaction, just throw an error object in JavaScript. The compiled JavaScript contract includes error handling capability. It will catch throwed errors and automatically invoke `panic_utf8` with `\"{error.message}\\n:{error.stack}\"`. As a result, transaction will fail with `\"Smart contract panicked: {error.message}\\n{error.stack}\"` error message. You can also use an error utilities library to organize your errors, such as verror.\n\nWhen your JS code or library throws an error, uncaught, the transaction will also fail with GuestPanic error, with the error message and stacktrace.\n\nWhen call host function with inappropriate type, means incorrect number of arguments or arg is not expected type:\n    - if arguments less than params, remaining argument are set as 'undefined'\n    - if arguments more than params, remaining argument are ignored\n    - if argument is different than the required type, it'll be coerced to required type\n    - if argument is different than the required type but cannot be coerced, will throw runtime type error, also with message and stacktrace\n\n## Test\nWe recommend to use near-workspaces to write tests for your smart contracts. See any of the examples for how tests are setup and written.\n\n## NEAR-SDK-JS API Reference\n\nAll NEAR blockchain provided functionality (host functions) are defined in `src/api.ts` and exported as `near`. You can use them by:\n```js\nimport {near} from 'near-sdk-js'\n\n// near.<api doucmented below>. e.g.:\nlet signer = near.signerAccountId()\n```\n\nTo use nightly host functions, such as `altBn128G1Sum`, your contract need to be built with nightly enabled. Use:\n```\nexport NEAR_NIGHTLY=1\nyarn build\n```\n\n### About Type\n\nNEAR-SDK-JS is written in TypeScript, so every API function has a type specified by signature that looks familiar to JavaScript/TypeScript Developers. Two types in the signature need a special attention:\n- Most of the API take `BigInt` instead of Number as type. This because JavaScript Number cannot hold 64 bit and 128 bit integer without losing precision.\n- `Bytes` in both arguments and return represent a byte buffer, internally it's a JavaScript String Object. Any binary data `0x00-0xff` is stored as the char '\\x00-\\xff'. This is because QuickJS doesn't have ArrayBuffer in C API.\n    - To ensure correctness, every `Bytes` argument need to be pass in with the `bytes()` function to runtime type check it's indeed a `Bytes`.\n    - If `Bytes` is too long that `bytes()` can cause gas limit problem, such as in factory contract, represents the content of contract to be deployed. In this case you can precheck and guarantee the correctness of the content and use without `bytes()`.\n\n### Context API\n\n```\nfunction currentAccountId(): String;\nfunction signerAccountId(): String;\nfunction signerAccountPk(): Bytes;\nfunction predecessorAccountId(): String;\nfunction input(): Bytes;\nfunction blockIndex(): BigInt;\nfunction blockHeight(): BigInt;\nfunction blockTimestamp(): BigInt;\nfunction epochHeight(): BigInt;\nfunction storageUsage(): BigInt\n```\n\n### Economics API\n```\nfunction accountBalance(): BigInt;\nfunction accountLockedBalance(): BigInt;\nfunction attachedDeposit(): BigInt;\nfunction prepaidGas(): BigInt;\nfunction usedGas(): BigInt;\n```\n\n### Math API\n\n\n```\nfunction randomSeed(): Bytes;\nfunction sha256(value: Bytes): Bytes;\nfunction keccak256(value: Bytes): Bytes;\nfunction keccak512(value: Bytes): Bytes;\nfunction ripemd160(value: Bytes): Bytes;\nfunction ecrecover(hash: Bytes, sign: Bytes, v: BigInt, malleability_flag: BigInt): Bytes | null;\n```\n\n### Miscellaneous API\n\n\n```\nfunction valueReturn(value: Bytes);\nfunction panic(msg?: String);\nfunction panicUtf8(msg: Bytes);\nfunction log(msg: String);\nfunction logUtf8(msg: Bytes);\nfunction logUtf16(msg: Bytes);\n```\n\n### Promises API\n\n```\nfunction promiseCreate(account_id: String, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt): BigInt;\nfunction promiseThen(promise_index: BigInt, account_id: String, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt): BigInt;\nfunction promiseAnd(...promise_idx: BigInt): BigInt;\nfunction promiseBatchCreate(account_id: String): BigInt;\nfunction promiseBatchThen(promise_index: BigInt, account_id: String): BigInt;\n```\n\n### Promise API actions\n\n```\nfunction promiseBatchActionCreateAccount(promise_index: BigInt);\nfunction promiseBatchActionDeployContract(promise_index: BigInt, code: Bytes);\nfunction promiseBatchActionFunctionCall(promise_index: BigInt, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt);\nfunction promiseBatchActionTransfer(promise_index: BigInt, amount: BigInt);\nfunction promiseBatchActionStake(promise_index: BigInt, amount: BigInt, public_key: Bytes);\nfunction promiseBatchActionAddKeyWithFullAccess(promise_index: BigInt, public_key: Bytes, nonce: BigInt);\nfunction promiseBatchActionAddKeyWithFunctionCall(promise_index: BigInt, public_key: Bytes, nonce: BigInt, allowance: BigInt, receiver_id: String, method_names: String);\nfunction promiseBatchActionDeleteKey(promise_index: BigInt, public_key: Bytes);\nfunction promiseBatchActionDeleteAccount(promise_index: BigInt, beneficiary_id: String);\n```\n\n### Promise API results\n\n```\nfunction promiseResultsCount(): BigInt;\nfunction promiseResult(result_idx: BigInt, register_id: BigInt): BigInt;\nfunction promiseReturn(promise_idx: BigInt);\n```\n\n### Storage API\n\n```\nfunction storageWrite(key: Bytes, value: Bytes, register_id: BigInt): BigInt;\nfunction storageRead(key: Bytes, register_id: BigInt): BigInt;\nfunction storageRemove(key: Bytes, register_id: BigInt): BigInt;\nfunction storageHasKey(key: Bytes): BigInt;\n```\n\n### Validator API\n\n```\nfunction validatorStake(account_id: String): BigInt;\nfunction validatorTotalStake(): BigInt;\n```\n\n### Alt BN128\n\n```\nfunction altBn128G1Multiexp(value: Bytes, register_id: BigInt);\nfunction altBn128G1Sum(value: Bytes, register_id: BigInt);\nfunction altBn128PairingCheck(value: Bytes): BigInt;\n```\n\n### Collections\nA few useful on-chain persistent collections are provided. All keys, values and elements are of type `Bytes`.\n\n#### Vector\nVector is an iterable implementation of vector that stores its content on the trie. Usage:\n\n```js\nimport {Vector} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.v = new Vector('my_prefix_')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.v = Object.assign(new Vector, this.v)\n}\n\nsomeMethod() {\n    // insert\n    this.v.push('abc')\n    this.v.push('def')\n    this.v.push('ghi')\n\n    // batch insert, extend:\n    this.v.extend(['xyz', '123'])\n\n    // get\n    let first = this.v.get(0)\n\n    // remove, move the last element to the given index\n    this.v.swapRemove(0) \n\n    // replace\n    this.v.replace(1, 'jkl')\n\n    // remove the last\n    this.v.pop()\n\n    // len, isEmpty\n    let len = this.v.len()\n    let isEmpty = this.v.isEnpty()\n\n    // iterate\n    for (let element of this.v) {\n        near.log(element)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.v.toArray()\n\n    // clear\n    ths.v.clear()\n}\n```\n\n#### LookupMap\nLookupMap is an non-iterable implementation of a map that stores its content directly on the trie. It's like a big hash map, but on trie. Usage:\n```js\nimport {LookupMap} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.m = new LookupMap('prefix_a')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.m = Object.assign(new LookupMap, this.m)\n}\n\nsomeMethod() {\n    // insert\n    this.m.set('abc', 'aaa')\n    this.m.set('def', 'bbb')\n    this.m.set('ghi', 'ccc')\n\n    // batch insert, extend:\n    this.m.extend([['xyz', '123'], ['key2', 'value2']])\n\n    // check exist\n    let exist = this.m.containsKey('abc')\n\n    // get\n    let value = this.m.get('abc')\n\n    // remove\n    this.m.remove('def') \n\n    // replace\n    this.m.set('ghi', 'ddd')\n}\n```\n\n#### LookupSet\nLookupSet is an non-iterable implementation of a set that stores its content directly on the trie. It's like LookupMap, but it only stores whether the value presents. Usage:\n```js\nimport {LookupSet} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.s = new LookupSet('prefix_b')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.s = Object.assign(new LookupSet, this.s)\n}\n\nsomeMethod() {\n    // insert\n    this.s.set('abc')\n    this.s.set('def')\n    this.s.set('ghi')\n\n    // batch insert, extend:\n    this.s.extend(['xyz', '123'])\n\n    // check exist\n    let exist = this.s.contains('abc')\n\n    // remove\n    this.s.remove('def')\n}\n```\n\n#### UnorderedMap\nUnorderedMap is an iterable implementation of a map that stores its content directly on the trie. Usage:\n```js\nimport {UnorderedMap} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.m = new UnorderedMap('prefix_c')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.m.keys = Object.assign(new Vector, this.m.keys)\n    this.m.values = Object.assign(new Vector, this.m.values)\n    this.m = Object.assign(new UnorderedMap, this.m)\n}\n\nsomeMethod() {\n    // insert\n    this.m.set('abc', 'aaa')\n    this.m.set('def', 'bbb')\n    this.m.set('ghi', 'ccc')\n\n    // batch insert, extend:\n    this.m.extend([['xyz', '123'], ['key2', 'value2']])\n\n    // get\n    let value = this.m.get('abc')\n\n    // remove\n    this.m.remove('def') \n\n    // replace\n    this.m.set('ghi', 'ddd')\n\n    // len, isEmpty\n    let len = this.m.len()\n    let isEmpty = this.m.isEnpty()\n\n    // iterate\n    for (let [k, v] of this.m) {\n        near.log(k+v)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.m.toArray()\n\n    // clear\n    this.m.clear()\n}\n```\n\n#### UnorderedSet\nUnorderedSet is an iterable implementation of a set that stores its content directly on the trie. It's like UnorderedMap but it only stores whether the value presents. Usage:\n```js\nimport {UnorderedSet} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.s = new UnorderedSet('prefix_d')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.s.elements = Object.assign(new Vector, this.s.elements)\n    this.s = Object.assign(new UnorderedSet, this.s)\n}\n\nsomeMethod() {\n    // insert\n    this.s.set('abc')\n    this.s.set('def')\n    this.s.set('ghi')\n\n    // batch insert, extend:\n    this.s.extend(['xyz', '123'])\n\n    // check exist\n    let exist = this.s.contains('abc')\n\n    // remove\n    this.s.remove('def')\n\n    // len, isEmpty\n    let len = this.s.len()\n    let isEmpty = this.s.isEnpty()\n\n    // iterate\n    for (let e of this.s) {\n        near.log(e)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.s.toArray()\n\n    // clear\n    this.s.clear()\n}\n```\n","gitHead":"3cb3e5dcc33dfd7c5c2af925cf2626a7f07815d4","scripts":{"test":"yarn test:standalone && yarn test:enclaved","build":"tsc -p ./tsconfig.json","pretest":"yarn build","postinstall":"cd cli && mkdir -p deps && cd deps && node ../post-install.js","test:enclaved":"test:enclaved:unit && test:enclaved:examples","test:standalone":"test:standalone:unit && test:standalone:examples","test:enclaved:unit":"cd jsvm/tests && yarn rebuild && yarn test && cd ../..","test:standalone:unit":"cd tests && yarn rebuild && yarn test && cd ..","test:enclaved:examples":"cd jsvm/examples && yarn && yarn rebuild && yarn test && cd ../..","test:standalone:examples":"cd examples && yarn && yarn rebuild && yarn test && cd .."},"_npmUser":{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"},"repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.5.0","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"16.14.2","dependencies":{"yargs":"^17.5.1","rollup":"^2.61.1","@babel/core":"^7.17.5","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@babel/preset-typescript":"^7.18.6","rollup-plugin-sourcemaps":"^0.6.3","@rollup/plugin-node-resolve":"^13.1.1","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"typescript":"^4.7.2","@types/node":"^17.0.38","@types/rollup":"^0.54.0","@rollup/plugin-typescript":"^8.3.2"},"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_0.4.0-0_1658442768625_0.10355234716372697","host":"s3://npm-registry-packages"}},"0.4.0-1":{"name":"near-sdk-js","version":"0.4.0-1","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@0.4.0-1","maintainers":[{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"bin":{"near-sdk":"cli/cli.js"},"dist":{"shasum":"542904ae707de9f65d4cd31dad4575f9ae82fb29","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-0.4.0-1.tgz","fileCount":33,"integrity":"sha512-PxE6BXtilsS6iIcUXPhrMNnZ63U38lQXJK32snFZnv+Ul+MwDMOxvszgP84zWpMCBmG0t/KcX0rDq22zgWILig==","signatures":[{"sig":"MEUCIBDZwuhJCKitderYJRQsfBK3eL4rNO6nWhkohkgEvkK0AiEA0iiRL9VdBvK9Z1hb90OGN7pV7LykpisqN3ZvSQ5zHDo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":105295,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi2d59ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmro7w/+IubpZ84PunKKILyNsblP/0LzD4FC4IBf4taXUfNJAHrPnLnD\r\nJZL6FpE5NUEEB4vcPmCZ6WdxaqjGxXq+NhCCkyP7DWBGOQ4qesQRQAc7JP+d\r\npW8excLXYPpRcheSu54UbR+/DPkvksLtw/7iL4BlZRlIravhrYrMkw9C7Awl\r\nMtl67Ngdb9TyFrc/DAnghuuWhtzgUPlQtBc7tfqfzFKnKgvQZvbD/jFhEMex\r\nHL4NDdPiiA+pBjBc4wYRyeWiBCEoPUj5W9ceF9AGn7z/bupoKhE2fOGamujD\r\nMOr4BgIo3TIgCr41m8PMBGuMwOV2kQACaQcY5Vg6cyXvU2pCu8abLm2ttuKU\r\nS4h0BRw1xQzdn0k+vQOR3IYLojm7W1ATUue21r8TxNk8lVl/9PnFbPp+PkAA\r\nW/70bTcqBBLNK42TkwfTgGMJeQJq7O9v8V5vToNIi1uRBWD2Yr3a83/V7GUs\r\nUOXMJVZMR0Fh6ocf7Ss2ERTlpzgxduWnIXJX3p8t2BTETVtIpYB5wYTMCkDL\r\nfn+lQLain/jBpiLVB7q9tH8xfnDlJ2/N/ruO9nFLwd6uz0FpLTPfBVF5y8uS\r\n5uojPgQNJ6zf+pPQOZSgr7t0/T8u1gn4CrObBcpyUk7g6w3I1i6teHjI8yo+\r\nrMC5+gHZSfnJK6D8Ou1XBeBROsO4fLj0Kmo=\r\n=EKpF\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","readme":"# NEAR-SDK-JS (Standalone)\n\n## Installation\nIt is tested on Ubuntu 20.04, M1 Mac and Intel Mac. Other linux should also work but they're not tested.\n\n1. Make sure you have make, cmake and nodejs. On Linux, also make sure you have gcc.\n2. `make setup`\n\n## Usage\n\n1. Copy project layout including configurations from `examples/` as a starting point\n2. Write smart contracts with JavaScript. You can use most npm packages that uses portable ES2020 features. \n3. Build the contract with `yarn build`.\n4. If no errors happens, a `<contract-name>.wasm` will be generate at `<project-dir>/build/`. It can be tested with workspaces-js and deployed to a NEAR node.\n\n## Running Examples\nThere are a couple of contract examples in the project:\n\n- [Clean contract state](https://github.com/near/near-sdk-js/tree/develop/examples/src/clean-state.js)\n- [Counter using low level API](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter-lowlevel.js)\n- [Counter in JavaScript](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter.js)\n- [Counter in TypeScript](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter.ts)\n- [Doing cross contract call](https://github.com/near/near-sdk-js/tree/develop/examples/src/cross-contract-call.js)\n- [Fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/fungible-token.js)\n- [Lockable fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/fungible-token-lockable.js)\n- [Non fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/non-fungible-token.js)\n- [Non fungible token receiver contract](https://github.com/near/near-sdk-js/tree/develop/examples/src/non-fungible-token-receiver.js)\n- [Status message board](https://github.com/near/near-sdk-js/tree/develop/examples/src/status-message.js)\n- [Status message board with unique messages](https://github.com/near/near-sdk-js/tree/develop/examples/src/status-message-collections.js)\n\nTo build all examples, run `yarn build` in `examples/`. To test all examples, run `yarn test`. You can also build and test one specific example with `yarn build:<example-name>` and `yarn test:<example-name>`, see `examples/package.json`.\n\nTo deploy and call a contract on a NEAR node, use near-cli's `near deploy` and `near call`.\n\n## Error Handling in NEAR-SDK-JS\n\nIf you want to indicate an error happened and fail the transaction, just throw an error object in JavaScript. The compiled JavaScript contract includes error handling capability. It will catch throwed errors and automatically invoke `panic_utf8` with `\"{error.message}\\n:{error.stack}\"`. As a result, transaction will fail with `\"Smart contract panicked: {error.message}\\n{error.stack}\"` error message. You can also use an error utilities library to organize your errors, such as verror.\n\nWhen your JS code or library throws an error, uncaught, the transaction will also fail with GuestPanic error, with the error message and stacktrace.\n\nWhen call host function with inappropriate type, means incorrect number of arguments or arg is not expected type:\n    - if arguments less than params, remaining argument are set as 'undefined'\n    - if arguments more than params, remaining argument are ignored\n    - if argument is different than the required type, it'll be coerced to required type\n    - if argument is different than the required type but cannot be coerced, will throw runtime type error, also with message and stacktrace\n\n## Test\nWe recommend to use near-workspaces to write tests for your smart contracts. See any of the examples for how tests are setup and written.\n\n## NEAR-SDK-JS API Reference\n\nAll NEAR blockchain provided functionality (host functions) are defined in `src/api.ts` and exported as `near`. You can use them by:\n```js\nimport {near} from 'near-sdk-js'\n\n// near.<api doucmented below>. e.g.:\nlet signer = near.signerAccountId()\n```\n\nTo use nightly host functions, such as `altBn128G1Sum`, your contract need to be built with nightly enabled. Use:\n```\nexport NEAR_NIGHTLY=1\nyarn build\n```\n\n### About Type\n\nNEAR-SDK-JS is written in TypeScript, so every API function has a type specified by signature that looks familiar to JavaScript/TypeScript Developers. Two types in the signature need a special attention:\n- Most of the API take `BigInt` instead of Number as type. This because JavaScript Number cannot hold 64 bit and 128 bit integer without losing precision.\n- `Bytes` in both arguments and return represent a byte buffer, internally it's a JavaScript String Object. Any binary data `0x00-0xff` is stored as the char '\\x00-\\xff'. This is because QuickJS doesn't have ArrayBuffer in C API.\n    - To ensure correctness, every `Bytes` argument need to be pass in with the `bytes()` function to runtime type check it's indeed a `Bytes`.\n    - If `Bytes` is too long that `bytes()` can cause gas limit problem, such as in factory contract, represents the content of contract to be deployed. In this case you can precheck and guarantee the correctness of the content and use without `bytes()`.\n\n### Context API\n\n```\nfunction currentAccountId(): String;\nfunction signerAccountId(): String;\nfunction signerAccountPk(): Bytes;\nfunction predecessorAccountId(): String;\nfunction input(): Bytes;\nfunction blockIndex(): BigInt;\nfunction blockHeight(): BigInt;\nfunction blockTimestamp(): BigInt;\nfunction epochHeight(): BigInt;\nfunction storageUsage(): BigInt\n```\n\n### Economics API\n```\nfunction accountBalance(): BigInt;\nfunction accountLockedBalance(): BigInt;\nfunction attachedDeposit(): BigInt;\nfunction prepaidGas(): BigInt;\nfunction usedGas(): BigInt;\n```\n\n### Math API\n\n\n```\nfunction randomSeed(): Bytes;\nfunction sha256(value: Bytes): Bytes;\nfunction keccak256(value: Bytes): Bytes;\nfunction keccak512(value: Bytes): Bytes;\nfunction ripemd160(value: Bytes): Bytes;\nfunction ecrecover(hash: Bytes, sign: Bytes, v: BigInt, malleability_flag: BigInt): Bytes | null;\n```\n\n### Miscellaneous API\n\n\n```\nfunction valueReturn(value: Bytes);\nfunction panic(msg?: String);\nfunction panicUtf8(msg: Bytes);\nfunction log(msg: String);\nfunction logUtf8(msg: Bytes);\nfunction logUtf16(msg: Bytes);\n```\n\n### Promises API\n\n```\nfunction promiseCreate(account_id: String, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt): BigInt;\nfunction promiseThen(promise_index: BigInt, account_id: String, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt): BigInt;\nfunction promiseAnd(...promise_idx: BigInt): BigInt;\nfunction promiseBatchCreate(account_id: String): BigInt;\nfunction promiseBatchThen(promise_index: BigInt, account_id: String): BigInt;\n```\n\n### Promise API actions\n\n```\nfunction promiseBatchActionCreateAccount(promise_index: BigInt);\nfunction promiseBatchActionDeployContract(promise_index: BigInt, code: Bytes);\nfunction promiseBatchActionFunctionCall(promise_index: BigInt, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt);\nfunction promiseBatchActionTransfer(promise_index: BigInt, amount: BigInt);\nfunction promiseBatchActionStake(promise_index: BigInt, amount: BigInt, public_key: Bytes);\nfunction promiseBatchActionAddKeyWithFullAccess(promise_index: BigInt, public_key: Bytes, nonce: BigInt);\nfunction promiseBatchActionAddKeyWithFunctionCall(promise_index: BigInt, public_key: Bytes, nonce: BigInt, allowance: BigInt, receiver_id: String, method_names: String);\nfunction promiseBatchActionDeleteKey(promise_index: BigInt, public_key: Bytes);\nfunction promiseBatchActionDeleteAccount(promise_index: BigInt, beneficiary_id: String);\n```\n\n### Promise API results\n\n```\nfunction promiseResultsCount(): BigInt;\nfunction promiseResult(result_idx: BigInt, register_id: BigInt): BigInt;\nfunction promiseReturn(promise_idx: BigInt);\n```\n\n### Storage API\n\n```\nfunction storageWrite(key: Bytes, value: Bytes, register_id: BigInt): BigInt;\nfunction storageRead(key: Bytes, register_id: BigInt): BigInt;\nfunction storageRemove(key: Bytes, register_id: BigInt): BigInt;\nfunction storageHasKey(key: Bytes): BigInt;\n```\n\n### Validator API\n\n```\nfunction validatorStake(account_id: String): BigInt;\nfunction validatorTotalStake(): BigInt;\n```\n\n### Alt BN128\n\n```\nfunction altBn128G1Multiexp(value: Bytes, register_id: BigInt);\nfunction altBn128G1Sum(value: Bytes, register_id: BigInt);\nfunction altBn128PairingCheck(value: Bytes): BigInt;\n```\n\n### Collections\nA few useful on-chain persistent collections are provided. All keys, values and elements are of type `Bytes`.\n\n#### Vector\nVector is an iterable implementation of vector that stores its content on the trie. Usage:\n\n```js\nimport {Vector} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.v = new Vector('my_prefix_')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.v = Object.assign(new Vector, this.v)\n}\n\nsomeMethod() {\n    // insert\n    this.v.push('abc')\n    this.v.push('def')\n    this.v.push('ghi')\n\n    // batch insert, extend:\n    this.v.extend(['xyz', '123'])\n\n    // get\n    let first = this.v.get(0)\n\n    // remove, move the last element to the given index\n    this.v.swapRemove(0) \n\n    // replace\n    this.v.replace(1, 'jkl')\n\n    // remove the last\n    this.v.pop()\n\n    // len, isEmpty\n    let len = this.v.len()\n    let isEmpty = this.v.isEnpty()\n\n    // iterate\n    for (let element of this.v) {\n        near.log(element)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.v.toArray()\n\n    // clear\n    ths.v.clear()\n}\n```\n\n#### LookupMap\nLookupMap is an non-iterable implementation of a map that stores its content directly on the trie. It's like a big hash map, but on trie. Usage:\n```js\nimport {LookupMap} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.m = new LookupMap('prefix_a')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.m = Object.assign(new LookupMap, this.m)\n}\n\nsomeMethod() {\n    // insert\n    this.m.set('abc', 'aaa')\n    this.m.set('def', 'bbb')\n    this.m.set('ghi', 'ccc')\n\n    // batch insert, extend:\n    this.m.extend([['xyz', '123'], ['key2', 'value2']])\n\n    // check exist\n    let exist = this.m.containsKey('abc')\n\n    // get\n    let value = this.m.get('abc')\n\n    // remove\n    this.m.remove('def') \n\n    // replace\n    this.m.set('ghi', 'ddd')\n}\n```\n\n#### LookupSet\nLookupSet is an non-iterable implementation of a set that stores its content directly on the trie. It's like LookupMap, but it only stores whether the value presents. Usage:\n```js\nimport {LookupSet} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.s = new LookupSet('prefix_b')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.s = Object.assign(new LookupSet, this.s)\n}\n\nsomeMethod() {\n    // insert\n    this.s.set('abc')\n    this.s.set('def')\n    this.s.set('ghi')\n\n    // batch insert, extend:\n    this.s.extend(['xyz', '123'])\n\n    // check exist\n    let exist = this.s.contains('abc')\n\n    // remove\n    this.s.remove('def')\n}\n```\n\n#### UnorderedMap\nUnorderedMap is an iterable implementation of a map that stores its content directly on the trie. Usage:\n```js\nimport {UnorderedMap} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.m = new UnorderedMap('prefix_c')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.m.keys = Object.assign(new Vector, this.m.keys)\n    this.m.values = Object.assign(new Vector, this.m.values)\n    this.m = Object.assign(new UnorderedMap, this.m)\n}\n\nsomeMethod() {\n    // insert\n    this.m.set('abc', 'aaa')\n    this.m.set('def', 'bbb')\n    this.m.set('ghi', 'ccc')\n\n    // batch insert, extend:\n    this.m.extend([['xyz', '123'], ['key2', 'value2']])\n\n    // get\n    let value = this.m.get('abc')\n\n    // remove\n    this.m.remove('def') \n\n    // replace\n    this.m.set('ghi', 'ddd')\n\n    // len, isEmpty\n    let len = this.m.len()\n    let isEmpty = this.m.isEnpty()\n\n    // iterate\n    for (let [k, v] of this.m) {\n        near.log(k+v)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.m.toArray()\n\n    // clear\n    this.m.clear()\n}\n```\n\n#### UnorderedSet\nUnorderedSet is an iterable implementation of a set that stores its content directly on the trie. It's like UnorderedMap but it only stores whether the value presents. Usage:\n```js\nimport {UnorderedSet} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.s = new UnorderedSet('prefix_d')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.s.elements = Object.assign(new Vector, this.s.elements)\n    this.s = Object.assign(new UnorderedSet, this.s)\n}\n\nsomeMethod() {\n    // insert\n    this.s.set('abc')\n    this.s.set('def')\n    this.s.set('ghi')\n\n    // batch insert, extend:\n    this.s.extend(['xyz', '123'])\n\n    // check exist\n    let exist = this.s.contains('abc')\n\n    // remove\n    this.s.remove('def')\n\n    // len, isEmpty\n    let len = this.s.len()\n    let isEmpty = this.s.isEnpty()\n\n    // iterate\n    for (let e of this.s) {\n        near.log(e)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.s.toArray()\n\n    // clear\n    this.s.clear()\n}\n```\n","gitHead":"d572d769f9f38d1d1c87fb3258647493f43d6308","scripts":{"test":"yarn test:standalone && yarn test:enclaved","build":"tsc -p ./tsconfig.json","pretest":"yarn build","postinstall":"cd cli && mkdir -p deps && cd deps && node ../post-install.js","test:enclaved":"test:enclaved:unit && test:enclaved:examples","test:standalone":"test:standalone:unit && test:standalone:examples","test:enclaved:unit":"cd jsvm/tests && yarn rebuild && yarn test && cd ../..","test:standalone:unit":"cd tests && yarn rebuild && yarn test && cd ..","test:enclaved:examples":"cd jsvm/examples && yarn && yarn rebuild && yarn test && cd ../..","test:standalone:examples":"cd examples && yarn && yarn rebuild && yarn test && cd .."},"_npmUser":{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"},"repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.5.0","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"16.14.2","dependencies":{"yargs":"^17.5.1","rollup":"^2.61.1","@babel/core":"^7.17.5","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@babel/preset-typescript":"^7.18.6","rollup-plugin-sourcemaps":"^0.6.3","@rollup/plugin-node-resolve":"^13.1.1","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"typescript":"^4.7.2","@types/node":"^17.0.38","@types/rollup":"^0.54.0","@rollup/plugin-typescript":"^8.3.2"},"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_0.4.0-1_1658445437098_0.44585949222044885","host":"s3://npm-registry-packages"}},"0.4.0-2":{"name":"near-sdk-js","version":"0.4.0-2","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@0.4.0-2","maintainers":[{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"bin":{"near-sdk":"cli/cli.js"},"dist":{"shasum":"6d5e8b22add8d1a385dbb421d77e1ee864f1a9af","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-0.4.0-2.tgz","fileCount":33,"integrity":"sha512-/hJeMvwU2A/09qlFGTzm+x5WSDxQpABtz4LsQwafsWLjUel4dIFHFiIL0JVTVGI/FkNNA646OvNx9uPWr8iSOQ==","signatures":[{"sig":"MEUCIQCecapeH3v8gvfj5LQIVT8kz9w4VHr5q24OFOzlWXCq5QIgKt3NTTYNHTeblvwGrDPOtVvP3kB15BmUPrlT4q/RHo0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":105204,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi2sLtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpMWA//WQ/hadeejRsrEW6UHkJAoUtxZ3I5KVPf6FmO1gERo8edd/38\r\n0reOGp05TzIuHpNirWovd7k/YqsYxeJVI55VUHhOojSdsoPdwaz8UpSNvpo4\r\nBbsxifJU6Jt/RfA9ShDSHjFoHD3AKpTwDyoygAFmMgNW5G/LLv6307xizIZ1\r\nIOqwamw63BgidWZnfEBb3HW6f8M59hkCe4qd0elqJG7lF+ttEkK8f1qEpc9s\r\nAUOba0NO3kKC8HnincqckxiDt/Dpgscv1xNaC6sOooZQPm7tmOM+4+Wtwqdr\r\nOwBoJu6v0PT05yEdQTAxWTbRuiGpDTJ4B3kq8dh+gc4Iv+c4USgP4JIKBkN7\r\nKOnau2K4TDdCqYva6+oo7teMfly3y/qAFgV+mt1kWtDaucFu8eY2lCXi77Bc\r\nh3g2j1kc7w03onxYy1Hz8GNTM9QQ4oOlzeTO7KQbF9i+tkLPGBh+Vr9sPrJU\r\nW4OrLUkbrb5KKZZtqz6IFx/jraLTYTPTBDAnI40A6iRz/C0T8LYPsXhUNKVS\r\nqd7vURBrpSRwCGCnWRPQV1sfATNgl/3YNpo2G61NRo/i2qO8qqKafKpDYhwO\r\n//cwz3FWyCeIprzeQnhaOyhEjyCeCXC7nXWM1h6cX6BtjMxgVYzY+4NOeWB8\r\nndE7LXKV6K96RR7m/FzmOQgp2FSYY7NJ2go=\r\n=kTRo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","readme":"# NEAR-SDK-JS (Standalone)\n\n## Installation\nIt is tested on Ubuntu 20.04, M1 Mac and Intel Mac. Other linux should also work but they're not tested.\n\n1. Make sure you have make, cmake and nodejs. On Linux, also make sure you have gcc.\n2. `make setup`\n\n## Usage\n\n1. Copy project layout including configurations from `examples/` as a starting point\n2. Write smart contracts with JavaScript. You can use most npm packages that uses portable ES2020 features. \n3. Build the contract with `yarn build`.\n4. If no errors happens, a `<contract-name>.wasm` will be generate at `<project-dir>/build/`. It can be tested with workspaces-js and deployed to a NEAR node.\n\n## Running Examples\nThere are a couple of contract examples in the project:\n\n- [Clean contract state](https://github.com/near/near-sdk-js/tree/develop/examples/src/clean-state.js)\n- [Counter using low level API](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter-lowlevel.js)\n- [Counter in JavaScript](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter.js)\n- [Counter in TypeScript](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter.ts)\n- [Doing cross contract call](https://github.com/near/near-sdk-js/tree/develop/examples/src/cross-contract-call.js)\n- [Fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/fungible-token.js)\n- [Lockable fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/fungible-token-lockable.js)\n- [Non fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/non-fungible-token.js)\n- [Non fungible token receiver contract](https://github.com/near/near-sdk-js/tree/develop/examples/src/non-fungible-token-receiver.js)\n- [Status message board](https://github.com/near/near-sdk-js/tree/develop/examples/src/status-message.js)\n- [Status message board with unique messages](https://github.com/near/near-sdk-js/tree/develop/examples/src/status-message-collections.js)\n\nTo build all examples, run `yarn build` in `examples/`. To test all examples, run `yarn test`. You can also build and test one specific example with `yarn build:<example-name>` and `yarn test:<example-name>`, see `examples/package.json`.\n\nTo deploy and call a contract on a NEAR node, use near-cli's `near deploy` and `near call`.\n\n## Error Handling in NEAR-SDK-JS\n\nIf you want to indicate an error happened and fail the transaction, just throw an error object in JavaScript. The compiled JavaScript contract includes error handling capability. It will catch throwed errors and automatically invoke `panic_utf8` with `\"{error.message}\\n:{error.stack}\"`. As a result, transaction will fail with `\"Smart contract panicked: {error.message}\\n{error.stack}\"` error message. You can also use an error utilities library to organize your errors, such as verror.\n\nWhen your JS code or library throws an error, uncaught, the transaction will also fail with GuestPanic error, with the error message and stacktrace.\n\nWhen call host function with inappropriate type, means incorrect number of arguments or arg is not expected type:\n    - if arguments less than params, remaining argument are set as 'undefined'\n    - if arguments more than params, remaining argument are ignored\n    - if argument is different than the required type, it'll be coerced to required type\n    - if argument is different than the required type but cannot be coerced, will throw runtime type error, also with message and stacktrace\n\n## Test\nWe recommend to use near-workspaces to write tests for your smart contracts. See any of the examples for how tests are setup and written.\n\n## NEAR-SDK-JS API Reference\n\nAll NEAR blockchain provided functionality (host functions) are defined in `src/api.ts` and exported as `near`. You can use them by:\n```js\nimport {near} from 'near-sdk-js'\n\n// near.<api doucmented below>. e.g.:\nlet signer = near.signerAccountId()\n```\n\nTo use nightly host functions, such as `altBn128G1Sum`, your contract need to be built with nightly enabled. Use:\n```\nexport NEAR_NIGHTLY=1\nyarn build\n```\n\n### About Type\n\nNEAR-SDK-JS is written in TypeScript, so every API function has a type specified by signature that looks familiar to JavaScript/TypeScript Developers. Two types in the signature need a special attention:\n- Most of the API take `BigInt` instead of Number as type. This because JavaScript Number cannot hold 64 bit and 128 bit integer without losing precision.\n- `Bytes` in both arguments and return represent a byte buffer, internally it's a JavaScript String Object. Any binary data `0x00-0xff` is stored as the char '\\x00-\\xff'. This is because QuickJS doesn't have ArrayBuffer in C API.\n    - To ensure correctness, every `Bytes` argument need to be pass in with the `bytes()` function to runtime type check it's indeed a `Bytes`.\n    - If `Bytes` is too long that `bytes()` can cause gas limit problem, such as in factory contract, represents the content of contract to be deployed. In this case you can precheck and guarantee the correctness of the content and use without `bytes()`.\n\n### Context API\n\n```\nfunction currentAccountId(): String;\nfunction signerAccountId(): String;\nfunction signerAccountPk(): Bytes;\nfunction predecessorAccountId(): String;\nfunction input(): Bytes;\nfunction blockIndex(): BigInt;\nfunction blockHeight(): BigInt;\nfunction blockTimestamp(): BigInt;\nfunction epochHeight(): BigInt;\nfunction storageUsage(): BigInt\n```\n\n### Economics API\n```\nfunction accountBalance(): BigInt;\nfunction accountLockedBalance(): BigInt;\nfunction attachedDeposit(): BigInt;\nfunction prepaidGas(): BigInt;\nfunction usedGas(): BigInt;\n```\n\n### Math API\n\n\n```\nfunction randomSeed(): Bytes;\nfunction sha256(value: Bytes): Bytes;\nfunction keccak256(value: Bytes): Bytes;\nfunction keccak512(value: Bytes): Bytes;\nfunction ripemd160(value: Bytes): Bytes;\nfunction ecrecover(hash: Bytes, sign: Bytes, v: BigInt, malleability_flag: BigInt): Bytes | null;\n```\n\n### Miscellaneous API\n\n\n```\nfunction valueReturn(value: Bytes);\nfunction panic(msg?: String);\nfunction panicUtf8(msg: Bytes);\nfunction log(msg: String);\nfunction logUtf8(msg: Bytes);\nfunction logUtf16(msg: Bytes);\n```\n\n### Promises API\n\n```\nfunction promiseCreate(account_id: String, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt): BigInt;\nfunction promiseThen(promise_index: BigInt, account_id: String, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt): BigInt;\nfunction promiseAnd(...promise_idx: BigInt): BigInt;\nfunction promiseBatchCreate(account_id: String): BigInt;\nfunction promiseBatchThen(promise_index: BigInt, account_id: String): BigInt;\n```\n\n### Promise API actions\n\n```\nfunction promiseBatchActionCreateAccount(promise_index: BigInt);\nfunction promiseBatchActionDeployContract(promise_index: BigInt, code: Bytes);\nfunction promiseBatchActionFunctionCall(promise_index: BigInt, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt);\nfunction promiseBatchActionTransfer(promise_index: BigInt, amount: BigInt);\nfunction promiseBatchActionStake(promise_index: BigInt, amount: BigInt, public_key: Bytes);\nfunction promiseBatchActionAddKeyWithFullAccess(promise_index: BigInt, public_key: Bytes, nonce: BigInt);\nfunction promiseBatchActionAddKeyWithFunctionCall(promise_index: BigInt, public_key: Bytes, nonce: BigInt, allowance: BigInt, receiver_id: String, method_names: String);\nfunction promiseBatchActionDeleteKey(promise_index: BigInt, public_key: Bytes);\nfunction promiseBatchActionDeleteAccount(promise_index: BigInt, beneficiary_id: String);\n```\n\n### Promise API results\n\n```\nfunction promiseResultsCount(): BigInt;\nfunction promiseResult(result_idx: BigInt, register_id: BigInt): BigInt;\nfunction promiseReturn(promise_idx: BigInt);\n```\n\n### Storage API\n\n```\nfunction storageWrite(key: Bytes, value: Bytes, register_id: BigInt): BigInt;\nfunction storageRead(key: Bytes, register_id: BigInt): BigInt;\nfunction storageRemove(key: Bytes, register_id: BigInt): BigInt;\nfunction storageHasKey(key: Bytes): BigInt;\n```\n\n### Validator API\n\n```\nfunction validatorStake(account_id: String): BigInt;\nfunction validatorTotalStake(): BigInt;\n```\n\n### Alt BN128\n\n```\nfunction altBn128G1Multiexp(value: Bytes, register_id: BigInt);\nfunction altBn128G1Sum(value: Bytes, register_id: BigInt);\nfunction altBn128PairingCheck(value: Bytes): BigInt;\n```\n\n### Collections\nA few useful on-chain persistent collections are provided. All keys, values and elements are of type `Bytes`.\n\n#### Vector\nVector is an iterable implementation of vector that stores its content on the trie. Usage:\n\n```js\nimport {Vector} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.v = new Vector('my_prefix_')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.v = Object.assign(new Vector, this.v)\n}\n\nsomeMethod() {\n    // insert\n    this.v.push('abc')\n    this.v.push('def')\n    this.v.push('ghi')\n\n    // batch insert, extend:\n    this.v.extend(['xyz', '123'])\n\n    // get\n    let first = this.v.get(0)\n\n    // remove, move the last element to the given index\n    this.v.swapRemove(0) \n\n    // replace\n    this.v.replace(1, 'jkl')\n\n    // remove the last\n    this.v.pop()\n\n    // len, isEmpty\n    let len = this.v.len()\n    let isEmpty = this.v.isEnpty()\n\n    // iterate\n    for (let element of this.v) {\n        near.log(element)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.v.toArray()\n\n    // clear\n    ths.v.clear()\n}\n```\n\n#### LookupMap\nLookupMap is an non-iterable implementation of a map that stores its content directly on the trie. It's like a big hash map, but on trie. Usage:\n```js\nimport {LookupMap} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.m = new LookupMap('prefix_a')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.m = Object.assign(new LookupMap, this.m)\n}\n\nsomeMethod() {\n    // insert\n    this.m.set('abc', 'aaa')\n    this.m.set('def', 'bbb')\n    this.m.set('ghi', 'ccc')\n\n    // batch insert, extend:\n    this.m.extend([['xyz', '123'], ['key2', 'value2']])\n\n    // check exist\n    let exist = this.m.containsKey('abc')\n\n    // get\n    let value = this.m.get('abc')\n\n    // remove\n    this.m.remove('def') \n\n    // replace\n    this.m.set('ghi', 'ddd')\n}\n```\n\n#### LookupSet\nLookupSet is an non-iterable implementation of a set that stores its content directly on the trie. It's like LookupMap, but it only stores whether the value presents. Usage:\n```js\nimport {LookupSet} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.s = new LookupSet('prefix_b')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.s = Object.assign(new LookupSet, this.s)\n}\n\nsomeMethod() {\n    // insert\n    this.s.set('abc')\n    this.s.set('def')\n    this.s.set('ghi')\n\n    // batch insert, extend:\n    this.s.extend(['xyz', '123'])\n\n    // check exist\n    let exist = this.s.contains('abc')\n\n    // remove\n    this.s.remove('def')\n}\n```\n\n#### UnorderedMap\nUnorderedMap is an iterable implementation of a map that stores its content directly on the trie. Usage:\n```js\nimport {UnorderedMap} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.m = new UnorderedMap('prefix_c')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.m.keys = Object.assign(new Vector, this.m.keys)\n    this.m.values = Object.assign(new Vector, this.m.values)\n    this.m = Object.assign(new UnorderedMap, this.m)\n}\n\nsomeMethod() {\n    // insert\n    this.m.set('abc', 'aaa')\n    this.m.set('def', 'bbb')\n    this.m.set('ghi', 'ccc')\n\n    // batch insert, extend:\n    this.m.extend([['xyz', '123'], ['key2', 'value2']])\n\n    // get\n    let value = this.m.get('abc')\n\n    // remove\n    this.m.remove('def') \n\n    // replace\n    this.m.set('ghi', 'ddd')\n\n    // len, isEmpty\n    let len = this.m.len()\n    let isEmpty = this.m.isEnpty()\n\n    // iterate\n    for (let [k, v] of this.m) {\n        near.log(k+v)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.m.toArray()\n\n    // clear\n    this.m.clear()\n}\n```\n\n#### UnorderedSet\nUnorderedSet is an iterable implementation of a set that stores its content directly on the trie. It's like UnorderedMap but it only stores whether the value presents. Usage:\n```js\nimport {UnorderedSet} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.s = new UnorderedSet('prefix_d')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.s.elements = Object.assign(new Vector, this.s.elements)\n    this.s = Object.assign(new UnorderedSet, this.s)\n}\n\nsomeMethod() {\n    // insert\n    this.s.set('abc')\n    this.s.set('def')\n    this.s.set('ghi')\n\n    // batch insert, extend:\n    this.s.extend(['xyz', '123'])\n\n    // check exist\n    let exist = this.s.contains('abc')\n\n    // remove\n    this.s.remove('def')\n\n    // len, isEmpty\n    let len = this.s.len()\n    let isEmpty = this.s.isEnpty()\n\n    // iterate\n    for (let e of this.s) {\n        near.log(e)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.s.toArray()\n\n    // clear\n    this.s.clear()\n}\n```\n","gitHead":"a3de8f156c60d9342769a2e05c1f783c8e9bdc94","scripts":{"test":"yarn test:standalone && yarn test:enclaved","build":"tsc -p ./tsconfig.json","pretest":"yarn build","postinstall":"cd cli && mkdir -p deps && cd deps && node ../post-install.js","test:enclaved":"test:enclaved:unit && test:enclaved:examples","test:standalone":"test:standalone:unit && test:standalone:examples","test:enclaved:unit":"cd jsvm/tests && yarn rebuild && yarn test && cd ../..","test:standalone:unit":"cd tests && yarn rebuild && yarn test && cd ..","test:enclaved:examples":"cd jsvm/examples && yarn && yarn rebuild && yarn test && cd ../..","test:standalone:examples":"cd examples && yarn && yarn rebuild && yarn test && cd .."},"_npmUser":{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"},"repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.5.0","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"16.14.2","dependencies":{"yargs":"^17.5.1","rollup":"^2.61.1","@babel/core":"^7.17.5","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@babel/preset-typescript":"^7.18.6","rollup-plugin-sourcemaps":"^0.6.3","@rollup/plugin-node-resolve":"^13.1.1","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"typescript":"^4.7.2","@types/node":"^17.0.38","@types/rollup":"^0.54.0","@rollup/plugin-typescript":"^8.3.2"},"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_0.4.0-2_1658503917410_0.005853838013459622","host":"s3://npm-registry-packages"}},"0.4.0-3":{"name":"near-sdk-js","version":"0.4.0-3","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@0.4.0-3","maintainers":[{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"bin":{"near-sdk-js":"cli/cli.js"},"dist":{"shasum":"ca6996a3b1ceedd5c126a670add7f8241b20cbd2","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-0.4.0-3.tgz","fileCount":33,"integrity":"sha512-57lmb1trYhJ9171EWec/2GZa/0/7ESbgc5sx3YKS9SPY/5I9+h1BCwBNvKjdH6wMrhSvMfK3/x7Ly/p9SAfpxA==","signatures":[{"sig":"MEUCIQCQA75dwytHEyiHi5uNPTaFEdoI/Y5if2wEP6B26XjGoQIgZQWDtaZzfEUj/3Cd+SxUK/OYPKDxUDAI7IEPKWpBmXg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":108064,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi4/boACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrYAg/6AjrZQggcvgTXZ5R7Ahl6TJB8qbNRMHPijYU8MQS4lnzQmO6u\r\nR0hRh5Nn00DXZWMWBpeTiow6eVjNLhTJPUTcn6D2T04r4A4fM4ZsdhIHHkEc\r\noKZKWb+gBzKLnHo9pAFEfqJDKI2yqQSlgNMlskYSiJczAXs7weFiTzg4jFtI\r\nCl5ZijMzQjAGeL1XXYPoeayBDODNgI9eBJ5Z1zxiwD0k8Tbq1XXrARR+Ml1J\r\n6LGHHu4JQwoLIORMFiNT7EBVQbl3ynaAeK4+HADAjQePV1XJ2VxbzpNPBM/C\r\npuVn2AasGBx43OlxpWNzdOzJiBehKjafmfneoJ206xxTowwV8lPgNWa6wOD1\r\nXDe/D79eddKfMMINrft/STE9NifJOGMEDh/e6DvzppI1/vx27uNl/+1GqVqP\r\n6hVA6v25GpW9OTBZzpMKxmFqKXR9IBCblj4gPLOBn6kta63XislS5w7lpHGj\r\npRcBa18SEcB69CxM+80LbbhyoZmV24sUjhV+D5jNpW/FdTEKmRjKAHiEOOMh\r\nAMYp+ElmoY3xVkzj+5+nwjKUD0VA78P9Wj69R4hKqSAQJ00/oxUrD8fQvLBL\r\nnzxKtYEg6EuIfFv8wq+hGocReH9/HThRU8fIQ96F+NXneFUxdui5mKX5XIPN\r\nU0rtpQ8otrfJi3HoSbuxYkFvzS1kxRoqK54=\r\n=fcNb\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","readme":"# NEAR-SDK-JS (Standalone)\n\n## Installation\nIt is tested on Ubuntu 20.04, M1 Mac and Intel Mac. Other linux should also work but they're not tested.\n\n1. Make sure you have make, cmake and nodejs. On Linux, also make sure you have gcc.\n2. `make setup`\n\n## Usage\n\n1. Copy project layout including configurations from `examples/` as a starting point\n2. Write smart contracts with JavaScript. You can use most npm packages that uses portable ES2020 features. \n3. Build the contract with `yarn build`.\n4. If no errors happens, a `<contract-name>.wasm` will be generate at `<project-dir>/build/`. It can be tested with workspaces-js and deployed to a NEAR node.\n\n## Running Examples\nThere are a couple of contract examples in the project:\n\n- [Clean contract state](https://github.com/near/near-sdk-js/tree/develop/examples/src/clean-state.js)\n- [Counter using low level API](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter-lowlevel.js)\n- [Counter in JavaScript](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter.js)\n- [Counter in TypeScript](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter.ts)\n- [Doing cross contract call](https://github.com/near/near-sdk-js/tree/develop/examples/src/cross-contract-call.js)\n- [Fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/fungible-token.js)\n- [Lockable fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/fungible-token-lockable.js)\n- [Non fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/non-fungible-token.js)\n- [Non fungible token receiver contract](https://github.com/near/near-sdk-js/tree/develop/examples/src/non-fungible-token-receiver.js)\n- [Status message board](https://github.com/near/near-sdk-js/tree/develop/examples/src/status-message.js)\n- [Status message board with unique messages](https://github.com/near/near-sdk-js/tree/develop/examples/src/status-message-collections.js)\n\nTo build all examples, run `yarn build` in `examples/`. To test all examples, run `yarn test`. You can also build and test one specific example with `yarn build:<example-name>` and `yarn test:<example-name>`, see `examples/package.json`.\n\nTo deploy and call a contract on a NEAR node, use near-cli's `near deploy` and `near call`.\n\n## Error Handling in NEAR-SDK-JS\n\nIf you want to indicate an error happened and fail the transaction, just throw an error object in JavaScript. The compiled JavaScript contract includes error handling capability. It will catch throwed errors and automatically invoke `panic_utf8` with `\"{error.message}\\n:{error.stack}\"`. As a result, transaction will fail with `\"Smart contract panicked: {error.message}\\n{error.stack}\"` error message. You can also use an error utilities library to organize your errors, such as verror.\n\nWhen your JS code or library throws an error, uncaught, the transaction will also fail with GuestPanic error, with the error message and stacktrace.\n\nWhen call host function with inappropriate type, means incorrect number of arguments or arg is not expected type:\n    - if arguments less than params, remaining argument are set as 'undefined'\n    - if arguments more than params, remaining argument are ignored\n    - if argument is different than the required type, it'll be coerced to required type\n    - if argument is different than the required type but cannot be coerced, will throw runtime type error, also with message and stacktrace\n\n## Test\nWe recommend to use near-workspaces to write tests for your smart contracts. See any of the examples for how tests are setup and written.\n\n## NEAR-SDK-JS API Reference\n\nAll NEAR blockchain provided functionality (host functions) are defined in `src/api.ts` and exported as `near`. You can use them by:\n```js\nimport {near} from 'near-sdk-js'\n\n// near.<api doucmented below>. e.g.:\nlet signer = near.signerAccountId()\n```\n\nTo use nightly host functions, such as `altBn128G1Sum`, your contract need to be built with nightly enabled. Use:\n```\nexport NEAR_NIGHTLY=1\nyarn build\n```\n\n### About Type\n\nNEAR-SDK-JS is written in TypeScript, so every API function has a type specified by signature that looks familiar to JavaScript/TypeScript Developers. Two types in the signature need a special attention:\n- Most of the API take `BigInt` instead of Number as type. This because JavaScript Number cannot hold 64 bit and 128 bit integer without losing precision.\n- `Bytes` in both arguments and return represent a byte buffer, internally it's a JavaScript String Object. Any binary data `0x00-0xff` is stored as the char '\\x00-\\xff'. This is because QuickJS doesn't have ArrayBuffer in C API.\n    - To ensure correctness, every `Bytes` argument need to be pass in with the `bytes()` function to runtime type check it's indeed a `Bytes`.\n    - If `Bytes` is too long that `bytes()` can cause gas limit problem, such as in factory contract, represents the content of contract to be deployed. In this case you can precheck and guarantee the correctness of the content and use without `bytes()`.\n\n### Context API\n\n```\nfunction currentAccountId(): String;\nfunction signerAccountId(): String;\nfunction signerAccountPk(): Bytes;\nfunction predecessorAccountId(): String;\nfunction input(): Bytes;\nfunction blockIndex(): BigInt;\nfunction blockHeight(): BigInt;\nfunction blockTimestamp(): BigInt;\nfunction epochHeight(): BigInt;\nfunction storageUsage(): BigInt\n```\n\n### Economics API\n```\nfunction accountBalance(): BigInt;\nfunction accountLockedBalance(): BigInt;\nfunction attachedDeposit(): BigInt;\nfunction prepaidGas(): BigInt;\nfunction usedGas(): BigInt;\n```\n\n### Math API\n\n\n```\nfunction randomSeed(): Bytes;\nfunction sha256(value: Bytes): Bytes;\nfunction keccak256(value: Bytes): Bytes;\nfunction keccak512(value: Bytes): Bytes;\nfunction ripemd160(value: Bytes): Bytes;\nfunction ecrecover(hash: Bytes, sign: Bytes, v: BigInt, malleability_flag: BigInt): Bytes | null;\n```\n\n### Miscellaneous API\n\n\n```\nfunction valueReturn(value: Bytes);\nfunction panic(msg?: String);\nfunction panicUtf8(msg: Bytes);\nfunction log(msg: String);\nfunction logUtf8(msg: Bytes);\nfunction logUtf16(msg: Bytes);\n```\n\n### Promises API\n\n```\nfunction promiseCreate(account_id: String, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt): BigInt;\nfunction promiseThen(promise_index: BigInt, account_id: String, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt): BigInt;\nfunction promiseAnd(...promise_idx: BigInt): BigInt;\nfunction promiseBatchCreate(account_id: String): BigInt;\nfunction promiseBatchThen(promise_index: BigInt, account_id: String): BigInt;\n```\n\n### Promise API actions\n\n```\nfunction promiseBatchActionCreateAccount(promise_index: BigInt);\nfunction promiseBatchActionDeployContract(promise_index: BigInt, code: Bytes);\nfunction promiseBatchActionFunctionCall(promise_index: BigInt, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt);\nfunction promiseBatchActionTransfer(promise_index: BigInt, amount: BigInt);\nfunction promiseBatchActionStake(promise_index: BigInt, amount: BigInt, public_key: Bytes);\nfunction promiseBatchActionAddKeyWithFullAccess(promise_index: BigInt, public_key: Bytes, nonce: BigInt);\nfunction promiseBatchActionAddKeyWithFunctionCall(promise_index: BigInt, public_key: Bytes, nonce: BigInt, allowance: BigInt, receiver_id: String, method_names: String);\nfunction promiseBatchActionDeleteKey(promise_index: BigInt, public_key: Bytes);\nfunction promiseBatchActionDeleteAccount(promise_index: BigInt, beneficiary_id: String);\n```\n\n### Promise API results\n\n```\nfunction promiseResultsCount(): BigInt;\nfunction promiseResult(result_idx: BigInt, register_id: BigInt): BigInt;\nfunction promiseReturn(promise_idx: BigInt);\n```\n\n### Storage API\n\n```\nfunction storageWrite(key: Bytes, value: Bytes, register_id: BigInt): BigInt;\nfunction storageRead(key: Bytes, register_id: BigInt): BigInt;\nfunction storageRemove(key: Bytes, register_id: BigInt): BigInt;\nfunction storageHasKey(key: Bytes): BigInt;\n```\n\n### Validator API\n\n```\nfunction validatorStake(account_id: String): BigInt;\nfunction validatorTotalStake(): BigInt;\n```\n\n### Alt BN128\n\n```\nfunction altBn128G1Multiexp(value: Bytes, register_id: BigInt);\nfunction altBn128G1Sum(value: Bytes, register_id: BigInt);\nfunction altBn128PairingCheck(value: Bytes): BigInt;\n```\n\n### Collections\nA few useful on-chain persistent collections are provided. All keys, values and elements are of type `Bytes`.\n\n#### Vector\nVector is an iterable implementation of vector that stores its content on the trie. Usage:\n\n```js\nimport {Vector} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.v = new Vector('my_prefix_')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.v = Object.assign(new Vector, this.v)\n}\n\nsomeMethod() {\n    // insert\n    this.v.push('abc')\n    this.v.push('def')\n    this.v.push('ghi')\n\n    // batch insert, extend:\n    this.v.extend(['xyz', '123'])\n\n    // get\n    let first = this.v.get(0)\n\n    // remove, move the last element to the given index\n    this.v.swapRemove(0) \n\n    // replace\n    this.v.replace(1, 'jkl')\n\n    // remove the last\n    this.v.pop()\n\n    // len, isEmpty\n    let len = this.v.len()\n    let isEmpty = this.v.isEnpty()\n\n    // iterate\n    for (let element of this.v) {\n        near.log(element)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.v.toArray()\n\n    // clear\n    ths.v.clear()\n}\n```\n\n#### LookupMap\nLookupMap is an non-iterable implementation of a map that stores its content directly on the trie. It's like a big hash map, but on trie. Usage:\n```js\nimport {LookupMap} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.m = new LookupMap('prefix_a')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.m = Object.assign(new LookupMap, this.m)\n}\n\nsomeMethod() {\n    // insert\n    this.m.set('abc', 'aaa')\n    this.m.set('def', 'bbb')\n    this.m.set('ghi', 'ccc')\n\n    // batch insert, extend:\n    this.m.extend([['xyz', '123'], ['key2', 'value2']])\n\n    // check exist\n    let exist = this.m.containsKey('abc')\n\n    // get\n    let value = this.m.get('abc')\n\n    // remove\n    this.m.remove('def') \n\n    // replace\n    this.m.set('ghi', 'ddd')\n}\n```\n\n#### LookupSet\nLookupSet is an non-iterable implementation of a set that stores its content directly on the trie. It's like LookupMap, but it only stores whether the value presents. Usage:\n```js\nimport {LookupSet} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.s = new LookupSet('prefix_b')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.s = Object.assign(new LookupSet, this.s)\n}\n\nsomeMethod() {\n    // insert\n    this.s.set('abc')\n    this.s.set('def')\n    this.s.set('ghi')\n\n    // batch insert, extend:\n    this.s.extend(['xyz', '123'])\n\n    // check exist\n    let exist = this.s.contains('abc')\n\n    // remove\n    this.s.remove('def')\n}\n```\n\n#### UnorderedMap\nUnorderedMap is an iterable implementation of a map that stores its content directly on the trie. Usage:\n```js\nimport {UnorderedMap} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.m = new UnorderedMap('prefix_c')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.m.keys = Object.assign(new Vector, this.m.keys)\n    this.m.values = Object.assign(new Vector, this.m.values)\n    this.m = Object.assign(new UnorderedMap, this.m)\n}\n\nsomeMethod() {\n    // insert\n    this.m.set('abc', 'aaa')\n    this.m.set('def', 'bbb')\n    this.m.set('ghi', 'ccc')\n\n    // batch insert, extend:\n    this.m.extend([['xyz', '123'], ['key2', 'value2']])\n\n    // get\n    let value = this.m.get('abc')\n\n    // remove\n    this.m.remove('def') \n\n    // replace\n    this.m.set('ghi', 'ddd')\n\n    // len, isEmpty\n    let len = this.m.len()\n    let isEmpty = this.m.isEnpty()\n\n    // iterate\n    for (let [k, v] of this.m) {\n        near.log(k+v)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.m.toArray()\n\n    // clear\n    this.m.clear()\n}\n```\n\n#### UnorderedSet\nUnorderedSet is an iterable implementation of a set that stores its content directly on the trie. It's like UnorderedMap but it only stores whether the value presents. Usage:\n```js\nimport {UnorderedSet} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.s = new UnorderedSet('prefix_d')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.s.elements = Object.assign(new Vector, this.s.elements)\n    this.s = Object.assign(new UnorderedSet, this.s)\n}\n\nsomeMethod() {\n    // insert\n    this.s.set('abc')\n    this.s.set('def')\n    this.s.set('ghi')\n\n    // batch insert, extend:\n    this.s.extend(['xyz', '123'])\n\n    // check exist\n    let exist = this.s.contains('abc')\n\n    // remove\n    this.s.remove('def')\n\n    // len, isEmpty\n    let len = this.s.len()\n    let isEmpty = this.s.isEnpty()\n\n    // iterate\n    for (let e of this.s) {\n        near.log(e)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.s.toArray()\n\n    // clear\n    this.s.clear()\n}\n```\n","gitHead":"004946885c61037d90638175f44b8612d259377b","scripts":{"test":"yarn test:standalone && yarn test:enclaved","build":"tsc -p ./tsconfig.json","pretest":"yarn build","postinstall":"cd cli && mkdir -p deps && cd deps && node ../post-install.js","test:enclaved":"yarn test:enclaved:unit && yarn test:enclaved:examples","test:standalone":"yarn test:standalone:unit && yarn test:standalone:examples","test:enclaved:unit":"cd jsvm/tests && yarn rebuild && yarn test && cd ../..","test:standalone:unit":"yarn && cd tests && yarn && yarn build && yarn test && cd ..","test:enclaved:examples":"cd jsvm/examples && yarn && yarn rebuild && yarn test && cd ../..","test:standalone:examples":"yarn && cd examples && yarn && yarn build && yarn test && cd .."},"_npmUser":{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"},"repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.5.0","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"16.14.2","dependencies":{"yargs":"^17.5.1","rollup":"^2.61.1","@babel/core":"^7.17.5","superserial":"^0.3.0","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@babel/preset-typescript":"^7.18.6","rollup-plugin-sourcemaps":"^0.6.3","@rollup/plugin-node-resolve":"^13.1.1","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"typescript":"^4.7.2","@types/node":"^17.0.38","@types/rollup":"^0.54.0","@rollup/plugin-typescript":"^8.3.2"},"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_0.4.0-3_1659107048334_0.9267905805308465","host":"s3://npm-registry-packages"}},"0.4.0-4":{"name":"near-sdk-js","version":"0.4.0-4","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@0.4.0-4","maintainers":[{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"bin":{"near-sdk-js":"cli/cli.js"},"dist":{"shasum":"8c30f3f2f6a0b82a210d04d86f6ccc3f939ee63d","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-0.4.0-4.tgz","fileCount":33,"integrity":"sha512-p08dr7mTRJIhiV5VXQ0PkkqTqPOg1OPqqHwKheBZK/vGz24h7c/6Dn2aPC5kb7bzlOmZ4DJz9FsWqtAKFe19ng==","signatures":[{"sig":"MEUCIQCo5/QHeT379vbh6GQ7HkGPD7mb0kZ2XSRZeyu9BOukqgIgBjr4tcnrqDlhFoLdTnxpdt2h8RTLks4BFrnr9K1BTxk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":108118,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi6nyEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqX0g//REOZ4UMF57joQ8yf3I/yjOQMkzoRytWwpc00xyGf78fwN4nY\r\nUa1iagLIyNoficXa49ISKEAn/RjlKmy9dUNejLIcSn/yQ8qGZBYe3m5HH+1i\r\ngfQnoPeAvUpHSPT70HxZCmL7Xcf7Ykyc0mgQOAboIyPhpS6UabtuMuXP9pjQ\r\n0hxiibj0cozQPt/mSL/mXYSocOz3qvi3aYgzqXK0dJP7ZWrMAX7RHSLxeSW4\r\nLQQMUsyH/BMqkoJVh1m3E3WrJxZF6Hw04EaW+GAzSCx43cPS0scSOa6tgKLt\r\nLIXu6UIQH011vuj2hV4VgAMs+lbuC/CWkxHAkMdaEu/JrhZlfa9dY78qsq3y\r\nlhv9vDRO1S8O9WMF+GFfk3z5hXpasOsNjYYQ7qqhwZvdMVP0r6TT9DB8CRiz\r\nv91qvwqWjxOo7hHGZb5KBqXW+e8DtJCwzFddH/IlEcsTbaVDsP7AXVJEgGl9\r\neIDdryT5pr7REKPlUzK7ljsFLA6ahHrzDmC1C0tA5WAIL21rUWH7asP99QG7\r\nDKJYyRwNSNGWovyrF6FHOp5fDKi30T0xi/0iNgtSW/7GyE+hOkK3OJDXUdhg\r\nFJi18BGnFCrHrk0ZQtRAduyFvkFxRTJ11yW6sOeQSfDTtYZd0SBptv4aTnEJ\r\nGZiaFel3vtJQRANeRDEAWHTYZp3+HFVBYrU=\r\n=xdUQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","readme":"# NEAR-SDK-JS (Standalone)\n\n## Installation\nIt is tested on Ubuntu 20.04, M1 Mac and Intel Mac. Other linux should also work but they're not tested.\n\n1. Make sure you have make, cmake and nodejs. On Linux, also make sure you have gcc.\n2. `make setup`\n\n## Usage\n\n1. Copy project layout including configurations from `examples/` as a starting point\n2. Write smart contracts with JavaScript. You can use most npm packages that uses portable ES2020 features. \n3. Build the contract with `yarn build`.\n4. If no errors happens, a `<contract-name>.wasm` will be generate at `<project-dir>/build/`. It can be tested with workspaces-js and deployed to a NEAR node.\n\n## Running Examples\nThere are a couple of contract examples in the project:\n\n- [Clean contract state](https://github.com/near/near-sdk-js/tree/develop/examples/src/clean-state.js)\n- [Counter using low level API](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter-lowlevel.js)\n- [Counter in JavaScript](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter.js)\n- [Counter in TypeScript](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter.ts)\n- [Doing cross contract call](https://github.com/near/near-sdk-js/tree/develop/examples/src/cross-contract-call.js)\n- [Fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/fungible-token.js)\n- [Lockable fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/fungible-token-lockable.js)\n- [Non fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/non-fungible-token.js)\n- [Non fungible token receiver contract](https://github.com/near/near-sdk-js/tree/develop/examples/src/non-fungible-token-receiver.js)\n- [Status message board](https://github.com/near/near-sdk-js/tree/develop/examples/src/status-message.js)\n- [Status message board with unique messages](https://github.com/near/near-sdk-js/tree/develop/examples/src/status-message-collections.js)\n\nTo build all examples, run `yarn build` in `examples/`. To test all examples, run `yarn test`. You can also build and test one specific example with `yarn build:<example-name>` and `yarn test:<example-name>`, see `examples/package.json`.\n\nTo deploy and call a contract on a NEAR node, use near-cli's `near deploy` and `near call`.\n\n## Error Handling in NEAR-SDK-JS\n\nIf you want to indicate an error happened and fail the transaction, just throw an error object in JavaScript. The compiled JavaScript contract includes error handling capability. It will catch throwed errors and automatically invoke `panic_utf8` with `\"{error.message}\\n:{error.stack}\"`. As a result, transaction will fail with `\"Smart contract panicked: {error.message}\\n{error.stack}\"` error message. You can also use an error utilities library to organize your errors, such as verror.\n\nWhen your JS code or library throws an error, uncaught, the transaction will also fail with GuestPanic error, with the error message and stacktrace.\n\nWhen call host function with inappropriate type, means incorrect number of arguments or arg is not expected type:\n    - if arguments less than params, remaining argument are set as 'undefined'\n    - if arguments more than params, remaining argument are ignored\n    - if argument is different than the required type, it'll be coerced to required type\n    - if argument is different than the required type but cannot be coerced, will throw runtime type error, also with message and stacktrace\n\n## Test\nWe recommend to use near-workspaces to write tests for your smart contracts. See any of the examples for how tests are setup and written.\n\n## NEAR-SDK-JS API Reference\n\nAll NEAR blockchain provided functionality (host functions) are defined in `src/api.ts` and exported as `near`. You can use them by:\n```js\nimport {near} from 'near-sdk-js'\n\n// near.<api doucmented below>. e.g.:\nlet signer = near.signerAccountId()\n```\n\nTo use nightly host functions, such as `altBn128G1Sum`, your contract need to be built with nightly enabled. Use:\n```\nexport NEAR_NIGHTLY=1\nyarn build\n```\n\n### About Type\n\nNEAR-SDK-JS is written in TypeScript, so every API function has a type specified by signature that looks familiar to JavaScript/TypeScript Developers. Two types in the signature need a special attention:\n- Most of the API take `BigInt` instead of Number as type. This because JavaScript Number cannot hold 64 bit and 128 bit integer without losing precision.\n- `Bytes` in both arguments and return represent a byte buffer, internally it's a JavaScript String Object. Any binary data `0x00-0xff` is stored as the char '\\x00-\\xff'. This is because QuickJS doesn't have ArrayBuffer in C API.\n    - To ensure correctness, every `Bytes` argument need to be pass in with the `bytes()` function to runtime type check it's indeed a `Bytes`.\n    - If `Bytes` is too long that `bytes()` can cause gas limit problem, such as in factory contract, represents the content of contract to be deployed. In this case you can precheck and guarantee the correctness of the content and use without `bytes()`.\n\n### Context API\n\n```\nfunction currentAccountId(): String;\nfunction signerAccountId(): String;\nfunction signerAccountPk(): Bytes;\nfunction predecessorAccountId(): String;\nfunction input(): Bytes;\nfunction blockIndex(): BigInt;\nfunction blockHeight(): BigInt;\nfunction blockTimestamp(): BigInt;\nfunction epochHeight(): BigInt;\nfunction storageUsage(): BigInt\n```\n\n### Economics API\n```\nfunction accountBalance(): BigInt;\nfunction accountLockedBalance(): BigInt;\nfunction attachedDeposit(): BigInt;\nfunction prepaidGas(): BigInt;\nfunction usedGas(): BigInt;\n```\n\n### Math API\n\n\n```\nfunction randomSeed(): Bytes;\nfunction sha256(value: Bytes): Bytes;\nfunction keccak256(value: Bytes): Bytes;\nfunction keccak512(value: Bytes): Bytes;\nfunction ripemd160(value: Bytes): Bytes;\nfunction ecrecover(hash: Bytes, sign: Bytes, v: BigInt, malleability_flag: BigInt): Bytes | null;\n```\n\n### Miscellaneous API\n\n\n```\nfunction valueReturn(value: Bytes);\nfunction panic(msg?: String);\nfunction panicUtf8(msg: Bytes);\nfunction log(msg: String);\nfunction logUtf8(msg: Bytes);\nfunction logUtf16(msg: Bytes);\n```\n\n### Promises API\n\n```\nfunction promiseCreate(account_id: String, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt): BigInt;\nfunction promiseThen(promise_index: BigInt, account_id: String, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt): BigInt;\nfunction promiseAnd(...promise_idx: BigInt): BigInt;\nfunction promiseBatchCreate(account_id: String): BigInt;\nfunction promiseBatchThen(promise_index: BigInt, account_id: String): BigInt;\n```\n\n### Promise API actions\n\n```\nfunction promiseBatchActionCreateAccount(promise_index: BigInt);\nfunction promiseBatchActionDeployContract(promise_index: BigInt, code: Bytes);\nfunction promiseBatchActionFunctionCall(promise_index: BigInt, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt);\nfunction promiseBatchActionTransfer(promise_index: BigInt, amount: BigInt);\nfunction promiseBatchActionStake(promise_index: BigInt, amount: BigInt, public_key: Bytes);\nfunction promiseBatchActionAddKeyWithFullAccess(promise_index: BigInt, public_key: Bytes, nonce: BigInt);\nfunction promiseBatchActionAddKeyWithFunctionCall(promise_index: BigInt, public_key: Bytes, nonce: BigInt, allowance: BigInt, receiver_id: String, method_names: String);\nfunction promiseBatchActionDeleteKey(promise_index: BigInt, public_key: Bytes);\nfunction promiseBatchActionDeleteAccount(promise_index: BigInt, beneficiary_id: String);\n```\n\n### Promise API results\n\n```\nfunction promiseResultsCount(): BigInt;\nfunction promiseResult(result_idx: BigInt, register_id: BigInt): BigInt;\nfunction promiseReturn(promise_idx: BigInt);\n```\n\n### Storage API\n\n```\nfunction storageWrite(key: Bytes, value: Bytes, register_id: BigInt): BigInt;\nfunction storageRead(key: Bytes, register_id: BigInt): BigInt;\nfunction storageRemove(key: Bytes, register_id: BigInt): BigInt;\nfunction storageHasKey(key: Bytes): BigInt;\n```\n\n### Validator API\n\n```\nfunction validatorStake(account_id: String): BigInt;\nfunction validatorTotalStake(): BigInt;\n```\n\n### Alt BN128\n\n```\nfunction altBn128G1Multiexp(value: Bytes, register_id: BigInt);\nfunction altBn128G1Sum(value: Bytes, register_id: BigInt);\nfunction altBn128PairingCheck(value: Bytes): BigInt;\n```\n\n### Collections\nA few useful on-chain persistent collections are provided. All keys, values and elements are of type `Bytes`.\n\n#### Vector\nVector is an iterable implementation of vector that stores its content on the trie. Usage:\n\n```js\nimport {Vector} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.v = new Vector('my_prefix_')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.v = Object.assign(new Vector, this.v)\n}\n\nsomeMethod() {\n    // insert\n    this.v.push('abc')\n    this.v.push('def')\n    this.v.push('ghi')\n\n    // batch insert, extend:\n    this.v.extend(['xyz', '123'])\n\n    // get\n    let first = this.v.get(0)\n\n    // remove, move the last element to the given index\n    this.v.swapRemove(0) \n\n    // replace\n    this.v.replace(1, 'jkl')\n\n    // remove the last\n    this.v.pop()\n\n    // len, isEmpty\n    let len = this.v.len()\n    let isEmpty = this.v.isEnpty()\n\n    // iterate\n    for (let element of this.v) {\n        near.log(element)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.v.toArray()\n\n    // clear\n    ths.v.clear()\n}\n```\n\n#### LookupMap\nLookupMap is an non-iterable implementation of a map that stores its content directly on the trie. It's like a big hash map, but on trie. Usage:\n```js\nimport {LookupMap} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.m = new LookupMap('prefix_a')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.m = Object.assign(new LookupMap, this.m)\n}\n\nsomeMethod() {\n    // insert\n    this.m.set('abc', 'aaa')\n    this.m.set('def', 'bbb')\n    this.m.set('ghi', 'ccc')\n\n    // batch insert, extend:\n    this.m.extend([['xyz', '123'], ['key2', 'value2']])\n\n    // check exist\n    let exist = this.m.containsKey('abc')\n\n    // get\n    let value = this.m.get('abc')\n\n    // remove\n    this.m.remove('def') \n\n    // replace\n    this.m.set('ghi', 'ddd')\n}\n```\n\n#### LookupSet\nLookupSet is an non-iterable implementation of a set that stores its content directly on the trie. It's like LookupMap, but it only stores whether the value presents. Usage:\n```js\nimport {LookupSet} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.s = new LookupSet('prefix_b')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.s = Object.assign(new LookupSet, this.s)\n}\n\nsomeMethod() {\n    // insert\n    this.s.set('abc')\n    this.s.set('def')\n    this.s.set('ghi')\n\n    // batch insert, extend:\n    this.s.extend(['xyz', '123'])\n\n    // check exist\n    let exist = this.s.contains('abc')\n\n    // remove\n    this.s.remove('def')\n}\n```\n\n#### UnorderedMap\nUnorderedMap is an iterable implementation of a map that stores its content directly on the trie. Usage:\n```js\nimport {UnorderedMap} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.m = new UnorderedMap('prefix_c')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.m.keys = Object.assign(new Vector, this.m.keys)\n    this.m.values = Object.assign(new Vector, this.m.values)\n    this.m = Object.assign(new UnorderedMap, this.m)\n}\n\nsomeMethod() {\n    // insert\n    this.m.set('abc', 'aaa')\n    this.m.set('def', 'bbb')\n    this.m.set('ghi', 'ccc')\n\n    // batch insert, extend:\n    this.m.extend([['xyz', '123'], ['key2', 'value2']])\n\n    // get\n    let value = this.m.get('abc')\n\n    // remove\n    this.m.remove('def') \n\n    // replace\n    this.m.set('ghi', 'ddd')\n\n    // len, isEmpty\n    let len = this.m.len()\n    let isEmpty = this.m.isEnpty()\n\n    // iterate\n    for (let [k, v] of this.m) {\n        near.log(k+v)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.m.toArray()\n\n    // clear\n    this.m.clear()\n}\n```\n\n#### UnorderedSet\nUnorderedSet is an iterable implementation of a set that stores its content directly on the trie. It's like UnorderedMap but it only stores whether the value presents. Usage:\n```js\nimport {UnorderedSet} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.s = new UnorderedSet('prefix_d')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.s.elements = Object.assign(new Vector, this.s.elements)\n    this.s = Object.assign(new UnorderedSet, this.s)\n}\n\nsomeMethod() {\n    // insert\n    this.s.set('abc')\n    this.s.set('def')\n    this.s.set('ghi')\n\n    // batch insert, extend:\n    this.s.extend(['xyz', '123'])\n\n    // check exist\n    let exist = this.s.contains('abc')\n\n    // remove\n    this.s.remove('def')\n\n    // len, isEmpty\n    let len = this.s.len()\n    let isEmpty = this.s.isEnpty()\n\n    // iterate\n    for (let e of this.s) {\n        near.log(e)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.s.toArray()\n\n    // clear\n    this.s.clear()\n}\n```\n","gitHead":"1b097ca0326fa92cbd2636cee44655ae07560113","scripts":{"test":"yarn test:standalone && yarn test:enclaved","build":"tsc -p ./tsconfig.json","pretest":"yarn build","postinstall":"cd cli && mkdir -p deps && cd deps && node ../post-install.js","test:enclaved":"yarn test:enclaved:unit && yarn test:enclaved:examples","test:standalone":"yarn test:standalone:unit && yarn test:standalone:examples","test:enclaved:unit":"cd jsvm/tests && yarn rebuild && yarn test && cd ../..","test:standalone:unit":"yarn && cd tests && yarn && yarn build && yarn test && cd ..","test:enclaved:examples":"cd jsvm/examples && yarn && yarn rebuild && yarn test && cd ../..","test:standalone:examples":"yarn && cd examples && yarn && yarn build && yarn test && cd .."},"_npmUser":{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"},"repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.5.0","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"16.14.2","dependencies":{"yargs":"^17.5.1","rollup":"^2.61.1","@babel/core":"^7.17.5","superserial":"^0.3.0","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@babel/preset-typescript":"^7.18.6","rollup-plugin-sourcemaps":"^0.6.3","@rollup/plugin-node-resolve":"^13.1.1","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"typescript":"^4.7.2","@types/node":"^17.0.38","@types/rollup":"^0.54.0","@rollup/plugin-typescript":"^8.3.2"},"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_0.4.0-4_1659534468170_0.843761131218707","host":"s3://npm-registry-packages"}},"0.4.0-5":{"name":"near-sdk-js","version":"0.4.0-5","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@0.4.0-5","maintainers":[{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"bin":{"near-sdk-js":"cli/cli.js"},"dist":{"shasum":"deb2ace9d0914bc5c9f43a517638b75cb9bdb746","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-0.4.0-5.tgz","fileCount":33,"integrity":"sha512-lOQDc61vf4QvM2BJkaVJcRY21l4K46xKJXJbdKanqi/WCYnKLV5i0UUbJ4sjOcScS1BHZyitLWaAdLGCCzYniQ==","signatures":[{"sig":"MEUCIBgbE5S9v9O2WJyW/HzHdq75Hx4ciAHpHGrj8j/QsJ9KAiEA9Ke2/2hxOm0HxpyQdwYK+dsKOGbsP0u+sXU+1fkIiHA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":109464,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi7MI+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr4rw/8DQ8tsGoCjyf5P81rAE5pM/PnGJ5S/dUiq8XUtiRXxBQ3UPQe\r\noxmD5Ww9kGGGcM+eN+7SkR2QUiMSTJL/63fhkej80b5pis3z8ACM08fZh1mF\r\nsnpwvYmSlWn06USP9wRrVBDBxp2tIDKODEYpDuO5ovLX0QfXjLHmHUwkuhog\r\npZW2CpJOyS1Z05ZRSU0hqIb+PozCH8308iex+I5euVnITaUKR/IVVXRr7Ecu\r\nkC/aVO7AWKN0ZWL5bHS1HS22Eu9GSUv+pdb1HWpSZd+arWrVLq7amlqrGadK\r\nqJqTZ0L3dRlsK0l8DUvVUJFxqU+xW25XUtPUUR5SoCMRDyrKmuCqrUagr0oO\r\nsYt3UBqT4nQQmpQuzOfaQfXdoPvGLqd0TodIjvf4sHsd4eVrRfVeIKWeIBNc\r\njAjzBpdkd7uTjpCZBzazMix3S4Dj7YWutAFdRw1eTG1tdcoQ93C23G6Z6wKi\r\nGEXflqWWC1M4gxpVe87n6ZRk9IwoHe+x9YJ8BRXGxeAepele92AKD20AHJAx\r\nbaUVpgSbvln/0gSsibePPdXrcbWFHPJGTR9Eyj7+GoRkJrwej40nLx7KPqVD\r\nt6Ea7iRieBQbIsXvHo/p+H0ucCrzYGYdHnkG4HId7OKfNMsriT+TIVmXA+yB\r\n5O9mcUJchytH8b9+r75HVQSoy8xivvuS7Ow=\r\n=XI4I\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","readme":"# NEAR-SDK-JS (Standalone)\n\n## Installation\nIt is tested on Ubuntu 20.04, M1 Mac and Intel Mac. Other linux should also work but they're not tested.\n\n1. Make sure you have make, cmake and nodejs. On Linux, also make sure you have gcc.\n2. `make setup`\n\n## Usage\n\n1. Copy project layout including configurations from `examples/` as a starting point\n2. Write smart contracts with JavaScript. You can use most npm packages that uses portable ES2020 features. \n3. Build the contract with `yarn build`.\n4. If no errors happens, a `<contract-name>.wasm` will be generate at `<project-dir>/build/`. It can be tested with workspaces-js and deployed to a NEAR node.\n\n## Running Examples\nThere are a couple of contract examples in the project:\n\n- [Clean contract state](https://github.com/near/near-sdk-js/tree/develop/examples/src/clean-state.js)\n- [Counter using low level API](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter-lowlevel.js)\n- [Counter in JavaScript](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter.js)\n- [Counter in TypeScript](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter.ts)\n- [Doing cross contract call](https://github.com/near/near-sdk-js/tree/develop/examples/src/cross-contract-call.js)\n- [Fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/fungible-token.js)\n- [Lockable fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/fungible-token-lockable.js)\n- [Non fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/non-fungible-token.js)\n- [Non fungible token receiver contract](https://github.com/near/near-sdk-js/tree/develop/examples/src/non-fungible-token-receiver.js)\n- [Status message board](https://github.com/near/near-sdk-js/tree/develop/examples/src/status-message.js)\n- [Status message board with unique messages](https://github.com/near/near-sdk-js/tree/develop/examples/src/status-message-collections.js)\n\nTo build all examples, run `yarn build` in `examples/`. To test all examples, run `yarn test`. You can also build and test one specific example with `yarn build:<example-name>` and `yarn test:<example-name>`, see `examples/package.json`.\n\nTo deploy and call a contract on a NEAR node, use near-cli's `near deploy` and `near call`.\n\n## Error Handling in NEAR-SDK-JS\n\nIf you want to indicate an error happened and fail the transaction, just throw an error object in JavaScript. The compiled JavaScript contract includes error handling capability. It will catch throwed errors and automatically invoke `panic_utf8` with `\"{error.message}\\n:{error.stack}\"`. As a result, transaction will fail with `\"Smart contract panicked: {error.message}\\n{error.stack}\"` error message. You can also use an error utilities library to organize your errors, such as verror.\n\nWhen your JS code or library throws an error, uncaught, the transaction will also fail with GuestPanic error, with the error message and stacktrace.\n\nWhen call host function with inappropriate type, means incorrect number of arguments or arg is not expected type:\n    - if arguments less than params, remaining argument are set as 'undefined'\n    - if arguments more than params, remaining argument are ignored\n    - if argument is different than the required type, it'll be coerced to required type\n    - if argument is different than the required type but cannot be coerced, will throw runtime type error, also with message and stacktrace\n\n## Test\nWe recommend to use near-workspaces to write tests for your smart contracts. See any of the examples for how tests are setup and written.\n\n## NEAR-SDK-JS API Reference\n\nAll NEAR blockchain provided functionality (host functions) are defined in `src/api.ts` and exported as `near`. You can use them by:\n```js\nimport {near} from 'near-sdk-js'\n\n// near.<api doucmented below>. e.g.:\nlet signer = near.signerAccountId()\n```\n\nTo use nightly host functions, such as `altBn128G1Sum`, your contract need to be built with nightly enabled. Use:\n```\nexport NEAR_NIGHTLY=1\nyarn build\n```\n\n### About Type\n\nNEAR-SDK-JS is written in TypeScript, so every API function has a type specified by signature that looks familiar to JavaScript/TypeScript Developers. Two types in the signature need a special attention:\n- Most of the API take `BigInt` instead of Number as type. This because JavaScript Number cannot hold 64 bit and 128 bit integer without losing precision.\n- `Bytes` in both arguments and return represent a byte buffer, internally it's a JavaScript String Object. Any binary data `0x00-0xff` is stored as the char '\\x00-\\xff'. This is because QuickJS doesn't have ArrayBuffer in C API.\n    - To ensure correctness, every `Bytes` argument need to be pass in with the `bytes()` function to runtime type check it's indeed a `Bytes`.\n    - If `Bytes` is too long that `bytes()` can cause gas limit problem, such as in factory contract, represents the content of contract to be deployed. In this case you can precheck and guarantee the correctness of the content and use without `bytes()`.\n\n### Context API\n\n```\nfunction currentAccountId(): String;\nfunction signerAccountId(): String;\nfunction signerAccountPk(): Bytes;\nfunction predecessorAccountId(): String;\nfunction input(): Bytes;\nfunction blockIndex(): BigInt;\nfunction blockHeight(): BigInt;\nfunction blockTimestamp(): BigInt;\nfunction epochHeight(): BigInt;\nfunction storageUsage(): BigInt\n```\n\n### Economics API\n```\nfunction accountBalance(): BigInt;\nfunction accountLockedBalance(): BigInt;\nfunction attachedDeposit(): BigInt;\nfunction prepaidGas(): BigInt;\nfunction usedGas(): BigInt;\n```\n\n### Math API\n\n\n```\nfunction randomSeed(): Bytes;\nfunction sha256(value: Bytes): Bytes;\nfunction keccak256(value: Bytes): Bytes;\nfunction keccak512(value: Bytes): Bytes;\nfunction ripemd160(value: Bytes): Bytes;\nfunction ecrecover(hash: Bytes, sign: Bytes, v: BigInt, malleability_flag: BigInt): Bytes | null;\n```\n\n### Miscellaneous API\n\n\n```\nfunction valueReturn(value: Bytes);\nfunction panic(msg?: String);\nfunction panicUtf8(msg: Bytes);\nfunction log(msg: String);\nfunction logUtf8(msg: Bytes);\nfunction logUtf16(msg: Bytes);\n```\n\n### Promises API\n\n```\nfunction promiseCreate(account_id: String, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt): BigInt;\nfunction promiseThen(promise_index: BigInt, account_id: String, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt): BigInt;\nfunction promiseAnd(...promise_idx: BigInt): BigInt;\nfunction promiseBatchCreate(account_id: String): BigInt;\nfunction promiseBatchThen(promise_index: BigInt, account_id: String): BigInt;\n```\n\n### Promise API actions\n\n```\nfunction promiseBatchActionCreateAccount(promise_index: BigInt);\nfunction promiseBatchActionDeployContract(promise_index: BigInt, code: Bytes);\nfunction promiseBatchActionFunctionCall(promise_index: BigInt, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt);\nfunction promiseBatchActionTransfer(promise_index: BigInt, amount: BigInt);\nfunction promiseBatchActionStake(promise_index: BigInt, amount: BigInt, public_key: Bytes);\nfunction promiseBatchActionAddKeyWithFullAccess(promise_index: BigInt, public_key: Bytes, nonce: BigInt);\nfunction promiseBatchActionAddKeyWithFunctionCall(promise_index: BigInt, public_key: Bytes, nonce: BigInt, allowance: BigInt, receiver_id: String, method_names: String);\nfunction promiseBatchActionDeleteKey(promise_index: BigInt, public_key: Bytes);\nfunction promiseBatchActionDeleteAccount(promise_index: BigInt, beneficiary_id: String);\n```\n\n### Promise API results\n\n```\nfunction promiseResultsCount(): BigInt;\nfunction promiseResult(result_idx: BigInt, register_id: BigInt): BigInt;\nfunction promiseReturn(promise_idx: BigInt);\n```\n\n### Storage API\n\n```\nfunction storageWrite(key: Bytes, value: Bytes, register_id: BigInt): BigInt;\nfunction storageRead(key: Bytes, register_id: BigInt): BigInt;\nfunction storageRemove(key: Bytes, register_id: BigInt): BigInt;\nfunction storageHasKey(key: Bytes): BigInt;\n```\n\n### Validator API\n\n```\nfunction validatorStake(account_id: String): BigInt;\nfunction validatorTotalStake(): BigInt;\n```\n\n### Alt BN128\n\n```\nfunction altBn128G1Multiexp(value: Bytes, register_id: BigInt);\nfunction altBn128G1Sum(value: Bytes, register_id: BigInt);\nfunction altBn128PairingCheck(value: Bytes): BigInt;\n```\n\n### Collections\nA few useful on-chain persistent collections are provided. All keys, values and elements are of type `Bytes`.\n\n#### Vector\nVector is an iterable implementation of vector that stores its content on the trie. Usage:\n\n```js\nimport {Vector} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.v = new Vector('my_prefix_')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.v = Object.assign(new Vector, this.v)\n}\n\nsomeMethod() {\n    // insert\n    this.v.push('abc')\n    this.v.push('def')\n    this.v.push('ghi')\n\n    // batch insert, extend:\n    this.v.extend(['xyz', '123'])\n\n    // get\n    let first = this.v.get(0)\n\n    // remove, move the last element to the given index\n    this.v.swapRemove(0) \n\n    // replace\n    this.v.replace(1, 'jkl')\n\n    // remove the last\n    this.v.pop()\n\n    // len, isEmpty\n    let len = this.v.len()\n    let isEmpty = this.v.isEnpty()\n\n    // iterate\n    for (let element of this.v) {\n        near.log(element)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.v.toArray()\n\n    // clear\n    ths.v.clear()\n}\n```\n\n#### LookupMap\nLookupMap is an non-iterable implementation of a map that stores its content directly on the trie. It's like a big hash map, but on trie. Usage:\n```js\nimport {LookupMap} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.m = new LookupMap('prefix_a')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.m = Object.assign(new LookupMap, this.m)\n}\n\nsomeMethod() {\n    // insert\n    this.m.set('abc', 'aaa')\n    this.m.set('def', 'bbb')\n    this.m.set('ghi', 'ccc')\n\n    // batch insert, extend:\n    this.m.extend([['xyz', '123'], ['key2', 'value2']])\n\n    // check exist\n    let exist = this.m.containsKey('abc')\n\n    // get\n    let value = this.m.get('abc')\n\n    // remove\n    this.m.remove('def') \n\n    // replace\n    this.m.set('ghi', 'ddd')\n}\n```\n\n#### LookupSet\nLookupSet is an non-iterable implementation of a set that stores its content directly on the trie. It's like LookupMap, but it only stores whether the value presents. Usage:\n```js\nimport {LookupSet} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.s = new LookupSet('prefix_b')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.s = Object.assign(new LookupSet, this.s)\n}\n\nsomeMethod() {\n    // insert\n    this.s.set('abc')\n    this.s.set('def')\n    this.s.set('ghi')\n\n    // batch insert, extend:\n    this.s.extend(['xyz', '123'])\n\n    // check exist\n    let exist = this.s.contains('abc')\n\n    // remove\n    this.s.remove('def')\n}\n```\n\n#### UnorderedMap\nUnorderedMap is an iterable implementation of a map that stores its content directly on the trie. Usage:\n```js\nimport {UnorderedMap} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.m = new UnorderedMap('prefix_c')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.m.keys = Object.assign(new Vector, this.m.keys)\n    this.m.values = Object.assign(new Vector, this.m.values)\n    this.m = Object.assign(new UnorderedMap, this.m)\n}\n\nsomeMethod() {\n    // insert\n    this.m.set('abc', 'aaa')\n    this.m.set('def', 'bbb')\n    this.m.set('ghi', 'ccc')\n\n    // batch insert, extend:\n    this.m.extend([['xyz', '123'], ['key2', 'value2']])\n\n    // get\n    let value = this.m.get('abc')\n\n    // remove\n    this.m.remove('def') \n\n    // replace\n    this.m.set('ghi', 'ddd')\n\n    // len, isEmpty\n    let len = this.m.len()\n    let isEmpty = this.m.isEnpty()\n\n    // iterate\n    for (let [k, v] of this.m) {\n        near.log(k+v)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.m.toArray()\n\n    // clear\n    this.m.clear()\n}\n```\n\n#### UnorderedSet\nUnorderedSet is an iterable implementation of a set that stores its content directly on the trie. It's like UnorderedMap but it only stores whether the value presents. Usage:\n```js\nimport {UnorderedSet} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.s = new UnorderedSet('prefix_d')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.s.elements = Object.assign(new Vector, this.s.elements)\n    this.s = Object.assign(new UnorderedSet, this.s)\n}\n\nsomeMethod() {\n    // insert\n    this.s.set('abc')\n    this.s.set('def')\n    this.s.set('ghi')\n\n    // batch insert, extend:\n    this.s.extend(['xyz', '123'])\n\n    // check exist\n    let exist = this.s.contains('abc')\n\n    // remove\n    this.s.remove('def')\n\n    // len, isEmpty\n    let len = this.s.len()\n    let isEmpty = this.s.isEnpty()\n\n    // iterate\n    for (let e of this.s) {\n        near.log(e)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.s.toArray()\n\n    // clear\n    this.s.clear()\n}\n```\n","gitHead":"6767e39674f16799c395b001c5404326426c5eef","scripts":{"test":"yarn test:standalone && yarn test:enclaved","build":"tsc -p ./tsconfig.json","pretest":"yarn build","postinstall":"cd cli && rm -rf deps && mkdir -p deps && cd deps && node ../post-install.js","test:enclaved":"yarn test:enclaved:unit && yarn test:enclaved:examples","test:standalone":"yarn test:standalone:unit && yarn test:standalone:examples","test:enclaved:unit":"cd jsvm/tests && yarn rebuild && yarn test && cd ../..","test:standalone:unit":"yarn && cd tests && yarn && yarn build && yarn test && cd ..","test:enclaved:examples":"cd jsvm/examples && yarn && yarn rebuild && yarn test && cd ../..","test:standalone:examples":"yarn && cd examples && yarn && yarn build && yarn test && cd .."},"_npmUser":{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"},"repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.5.0","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"16.14.2","dependencies":{"yargs":"^17.5.1","rollup":"^2.61.1","@babel/core":"^7.17.5","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@babel/preset-typescript":"^7.18.6","rollup-plugin-sourcemaps":"^0.6.3","@rollup/plugin-node-resolve":"^13.1.1","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"typescript":"^4.7.2","@types/node":"^17.0.38","@types/rollup":"^0.54.0","@rollup/plugin-typescript":"^8.3.2"},"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_0.4.0-5_1659683390616_0.47612741515143964","host":"s3://npm-registry-packages"}},"0.4.0":{"name":"near-sdk-js","version":"0.4.0","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@0.4.0","maintainers":[{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"bin":{"near-sdk-js":"cli/cli.js"},"dist":{"shasum":"3a784a536fa979a22f0778f772c9267aa36159b7","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-0.4.0.tgz","fileCount":33,"integrity":"sha512-aYGW703ibJ7wjL51wPGzNLHqw4JoMylfGUjbDpR5fqpJwNqGf2SkeB0EyrJB/Th5pdomcuXbPVVlY33FM3EeDg==","signatures":[{"sig":"MEYCIQCtSF7QmWAqKYbqxGSiPBnnNLE0CQw1p26C1JhJe/3elgIhAIiPFuLTZMXE7Y1h/Y45ICRb2Zvkoeum64HxemJiGX3O","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":109462,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjBzoTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqeTw//boI1Z92XYlp58CL4SfQ5AcQGtOFxsfB1UD0VLnG5w3X6KXjS\r\ndIJxhlCh63rL2YY5B3G1/KOjTrQn5pdGfQ3CHgBXJi0QHW7hqRVy6pVUuoZ6\r\nrz2hSiweDUJectxOr6jwh+I+nqz0EgzrUT9cmBK0b6VMuk2BM2eDSLImaO4n\r\ns25RgMI5W8FZF5MgzEcTiI55Q8ESOqMqwG4BeRQ2v0gcjjrgrEzb6XR0l7xl\r\ny0+RrqrDLNKO7e/JbeNT1Zh+kVC1uFHUN/PE0uSWdZhFoVSdbsOVz36bM0KA\r\npZEnVcamGu0kkppe22cDkEfbBdeTgPUtTMNF58/W/J+6sncz+X21mLFAmTwW\r\nIpiMa2ydI0VhCdSeMXZ7+2Lo8Nt15ziRKt0r0091O4fQJEkrr5eU/tcoC6QD\r\njQFgSy1aFkXjjTMQJKhShD9TrzNnQve0T4NKDcYJZReESzXw5hK2XYGou3C0\r\nRU4vUTYmMAUjUQoJgSbM5pLauGS6He/EtR69808eiyf1TG4FmagrDZqZAqiE\r\nfjmv8Qzfw7j/zo6eMQ6X1Bm3rd1pm4XXJKCXeX9UhlO3oqcrztj/S3Z/PsCv\r\n89om5zZOlyIgN6StZtMERyMDptIXiNXJ+nXMZDIq3IqUQA1sp9/HOOpER/Tr\r\nBE+LwSPMCoprCJIZEBp2H3+ohIjZ9vM4Gsg=\r\n=fzz3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","gitHead":"59dba80910f2a6e384f5c0aed5beb5b3e3b49f82","scripts":{"test":"yarn test:standalone && yarn test:enclaved","build":"tsc -p ./tsconfig.json","pretest":"yarn build","postinstall":"cd cli && rm -rf deps && mkdir -p deps && cd deps && node ../post-install.js","test:enclaved":"yarn test:enclaved:unit && yarn test:enclaved:examples","test:standalone":"yarn test:standalone:unit && yarn test:standalone:examples","test:enclaved:unit":"cd jsvm/tests && yarn rebuild && yarn test && cd ../..","test:standalone:unit":"yarn && cd tests && yarn && yarn build && yarn test && cd ..","test:enclaved:examples":"cd jsvm/examples && yarn && yarn rebuild && yarn test && cd ../..","test:standalone:examples":"yarn && cd examples && yarn && yarn build && yarn test && cd .."},"_npmUser":{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"},"repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.11.0","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"16.16.0","dependencies":{"yargs":"^17.5.1","rollup":"^2.61.1","@babel/core":"^7.17.5","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@babel/preset-typescript":"^7.18.6","rollup-plugin-sourcemaps":"^0.6.3","@rollup/plugin-node-resolve":"^13.1.1","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^4.7.2","@types/node":"^17.0.38","@types/rollup":"^0.54.0","@rollup/plugin-typescript":"^8.3.2"},"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_0.4.0_1661418003582_0.9893047098924448","host":"s3://npm-registry-packages"}},"0.5.0-0":{"name":"near-sdk-js","version":"0.5.0-0","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@0.5.0-0","maintainers":[{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"bin":{"near-sdk-js":"cli/cli.js"},"dist":{"shasum":"c39e1e4fc4e9f22709dac690db2bba84592396c8","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-0.5.0-0.tgz","fileCount":43,"integrity":"sha512-cqCnCUYn4P0RI3jy2f1gkatqQ3X7gIV7TxTiPoyp1u54H1sa4hLBMSzAcsLbqL8qiZFEkCAG5OiN6TSJcrubtg==","signatures":[{"sig":"MEUCIQDy2WgJDxMjcrkntqCfhXFAFJKd3ZBHDYqstJHj7a9OUAIgMCBFGsJ+FaGFs0Y4iGVMf0J3olQbqimFChLsL3ibDJw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":113369,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjEJPMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq3MBAAj40sWvIil18dyl1U1sMHNq1VYzu/hJVuF8lLi3jBg3To3mQa\r\nPy3LawoueuEQcS+X+K8S0Sgy/5lFvyv1jjMr2h2fljGFIBE9kdT5T1RIPsAp\r\nIqjjV9S8Hkv2U2CUl/Sh++kT5kt7dnnx0mkaEA07RiP5BPL7frtCMy9HPUXG\r\nxmWic+BT50pLdTQVRVdB4do9iDJCMVU8jne93hF5Wj6FaTJmW72y+R0h2FeT\r\nFOdmZok4m+vAi/AyJBQpeTNXNrk9Drb5/j6QXasFZpNqnO8Sz+xlm15QCfKe\r\n7FPNqvrhGIbWaWpp7fSm7gyVzcRc+povk8pjRa6F0wjNTTm/MzML5vx2+8MR\r\ngXPGx1Z4kjbfEzpzBjiAj/t2ZH7223nynJTtY627X6x0fgW9NtcUbD6RwEP0\r\ntQfOjcm48WOB0LWGhpg/NPepIbARIUTLY3z7aWZKXERycEYhX9JTBd6SX1Rv\r\nrupYNvSFeQZE+qSOUyztjSnWKVcvmNbi+4O5DGttOmuqdtsGlkPHVzPzJEVI\r\nuOIqSvXvmMoeKalEhwkEd3jWKyl29dWCPCen3a2MnZLdic1quY7BJ2ZmwZDV\r\nFHn+0aTLcKCPCKvhQlxqcP/nHy+g8pFUiPP67CRVj1nJ/7DbWtFIM/FZh9YB\r\nYlPGNlJfswpUumjnJy7BrqlTyCNTsnH64F8=\r\n=4OSN\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","readme":"# NEAR JavaScript SDK\n\n## Quick Start\n\nUse [`create-near-app`](https://github.com/near/create-near-app) to quickly get started writing smart contracts in JavaScript on NEAR.\n\n    npx create-near-app\n\nThis will scaffold a basic template for you 😎\n\nLearn more in our [Quick Start guide](https://docs.near.org/develop/quickstart-guide).\n\n## Running Examples\nThere are a couple of contract examples in the project:\n\n- [Clean contract state](https://github.com/near/near-sdk-js/tree/develop/examples/src/clean-state.js)\n- [Counter using low level API](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter-lowlevel.js)\n- [Counter in JavaScript](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter.js)\n- [Counter in TypeScript](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter.ts)\n- [Doing cross contract call](https://github.com/near/near-sdk-js/tree/develop/examples/src/cross-contract-call.js)\n- [Fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/fungible-token.js)\n- [Lockable fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/fungible-token-lockable.js)\n- [Non fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/non-fungible-token.js)\n- [Non fungible token receiver contract](https://github.com/near/near-sdk-js/tree/develop/examples/src/non-fungible-token-receiver.js)\n- [Status message board](https://github.com/near/near-sdk-js/tree/develop/examples/src/status-message.js)\n- [Status message board with unique messages](https://github.com/near/near-sdk-js/tree/develop/examples/src/status-message-collections.js)\n\nTo build all examples, run `yarn build` in `examples/`. To test all examples, run `yarn test`. You can also build and test one specific example with `yarn build:<example-name>` and `yarn test:<example-name>`, see `examples/package.json`.\n\nTo deploy and call a contract on a NEAR node, use near-cli's `near deploy` and `near call`.\n\n## Error Handling in NEAR-SDK-JS\n\nIf you want to indicate an error happened and fail the transaction, just throw an error object in JavaScript. The compiled JavaScript contract includes error handling capability. It will catch throwed errors and automatically invoke `panic_utf8` with `\"{error.message}\\n:{error.stack}\"`. As a result, transaction will fail with `\"Smart contract panicked: {error.message}\\n{error.stack}\"` error message. You can also use an error utilities library to organize your errors, such as verror.\n\nWhen your JS code or library throws an error, uncaught, the transaction will also fail with GuestPanic error, with the error message and stacktrace.\n\nWhen call host function with inappropriate type, means incorrect number of arguments or arg is not expected type:\n    - if arguments less than params, remaining argument are set as 'undefined'\n    - if arguments more than params, remaining argument are ignored\n    - if argument is different than the required type, it'll be coerced to required type\n    - if argument is different than the required type but cannot be coerced, will throw runtime type error, also with message and stacktrace\n\n## Test\nWe recommend to use near-workspaces to write tests for your smart contracts. See any of the examples for how tests are setup and written.\n\n## NEAR-SDK-JS API Reference\n\nAll NEAR blockchain provided functionality (host functions) are defined in `src/api.ts` and exported as `near`. You can use them by:\n```js\nimport {near} from 'near-sdk-js'\n\n// near.<api doucmented below>. e.g.:\nlet signer = near.signerAccountId()\n```\n\nTo use nightly host functions, such as `altBn128G1Sum`, your contract need to be built with nightly enabled. Use:\n```\nexport NEAR_NIGHTLY=1\nyarn build\n```\n\n### About Type\n\nNEAR-SDK-JS is written in TypeScript, so every API function has a type specified by signature that looks familiar to JavaScript/TypeScript Developers. Two types in the signature need a special attention:\n- Most of the API take `BigInt` instead of Number as type. This because JavaScript Number cannot hold 64 bit and 128 bit integer without losing precision.\n- `Bytes` in both arguments and return represent a byte buffer, internally it's a JavaScript String Object. Any binary data `0x00-0xff` is stored as the char '\\x00-\\xff'. This is because QuickJS doesn't have ArrayBuffer in C API.\n    - To ensure correctness, every `Bytes` argument need to be pass in with the `bytes()` function to runtime type check it's indeed a `Bytes`.\n    - If `Bytes` is too long that `bytes()` can cause gas limit problem, such as in factory contract, represents the content of contract to be deployed. In this case you can precheck and guarantee the correctness of the content and use without `bytes()`.\n\n### Context API\n\n```\nfunction currentAccountId(): String;\nfunction signerAccountId(): String;\nfunction signerAccountPk(): Bytes;\nfunction predecessorAccountId(): String;\nfunction input(): Bytes;\nfunction blockIndex(): BigInt;\nfunction blockHeight(): BigInt;\nfunction blockTimestamp(): BigInt;\nfunction epochHeight(): BigInt;\nfunction storageUsage(): BigInt\n```\n\n### Economics API\n```\nfunction accountBalance(): BigInt;\nfunction accountLockedBalance(): BigInt;\nfunction attachedDeposit(): BigInt;\nfunction prepaidGas(): BigInt;\nfunction usedGas(): BigInt;\n```\n\n### Math API\n\n\n```\nfunction randomSeed(): Bytes;\nfunction sha256(value: Bytes): Bytes;\nfunction keccak256(value: Bytes): Bytes;\nfunction keccak512(value: Bytes): Bytes;\nfunction ripemd160(value: Bytes): Bytes;\nfunction ecrecover(hash: Bytes, sign: Bytes, v: BigInt, malleability_flag: BigInt): Bytes | null;\n```\n\n### Miscellaneous API\n\n\n```\nfunction valueReturn(value: Bytes);\nfunction panic(msg?: String);\nfunction panicUtf8(msg: Bytes);\nfunction log(msg: String);\nfunction logUtf8(msg: Bytes);\nfunction logUtf16(msg: Bytes);\n```\n\n### Promises API\n\n```\nfunction promiseCreate(account_id: String, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt): BigInt;\nfunction promiseThen(promise_index: BigInt, account_id: String, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt): BigInt;\nfunction promiseAnd(...promise_idx: BigInt): BigInt;\nfunction promiseBatchCreate(account_id: String): BigInt;\nfunction promiseBatchThen(promise_index: BigInt, account_id: String): BigInt;\n```\n\n### Promise API actions\n\n```\nfunction promiseBatchActionCreateAccount(promise_index: BigInt);\nfunction promiseBatchActionDeployContract(promise_index: BigInt, code: Bytes);\nfunction promiseBatchActionFunctionCall(promise_index: BigInt, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt);\nfunction promiseBatchActionTransfer(promise_index: BigInt, amount: BigInt);\nfunction promiseBatchActionStake(promise_index: BigInt, amount: BigInt, public_key: Bytes);\nfunction promiseBatchActionAddKeyWithFullAccess(promise_index: BigInt, public_key: Bytes, nonce: BigInt);\nfunction promiseBatchActionAddKeyWithFunctionCall(promise_index: BigInt, public_key: Bytes, nonce: BigInt, allowance: BigInt, receiver_id: String, method_names: String);\nfunction promiseBatchActionDeleteKey(promise_index: BigInt, public_key: Bytes);\nfunction promiseBatchActionDeleteAccount(promise_index: BigInt, beneficiary_id: String);\n```\n\n### Promise API results\n\n```\nfunction promiseResultsCount(): BigInt;\nfunction promiseResult(result_idx: BigInt, register_id: BigInt): BigInt;\nfunction promiseReturn(promise_idx: BigInt);\n```\n\n### Storage API\n\n```\nfunction storageWrite(key: Bytes, value: Bytes, register_id: BigInt): BigInt;\nfunction storageRead(key: Bytes, register_id: BigInt): BigInt;\nfunction storageRemove(key: Bytes, register_id: BigInt): BigInt;\nfunction storageHasKey(key: Bytes): BigInt;\n```\n\n### Validator API\n\n```\nfunction validatorStake(account_id: String): BigInt;\nfunction validatorTotalStake(): BigInt;\n```\n\n### Alt BN128\n\n```\nfunction altBn128G1Multiexp(value: Bytes, register_id: BigInt);\nfunction altBn128G1Sum(value: Bytes, register_id: BigInt);\nfunction altBn128PairingCheck(value: Bytes): BigInt;\n```\n\n### Collections\nA few useful on-chain persistent collections are provided. All keys, values and elements are of type `Bytes`.\n\n#### Vector\nVector is an iterable implementation of vector that stores its content on the trie. Usage:\n\n```js\nimport {Vector} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.v = new Vector('my_prefix_')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.v = Object.assign(new Vector, this.v)\n}\n\nsomeMethod() {\n    // insert\n    this.v.push('abc')\n    this.v.push('def')\n    this.v.push('ghi')\n\n    // batch insert, extend:\n    this.v.extend(['xyz', '123'])\n\n    // get\n    let first = this.v.get(0)\n\n    // remove, move the last element to the given index\n    this.v.swapRemove(0) \n\n    // replace\n    this.v.replace(1, 'jkl')\n\n    // remove the last\n    this.v.pop()\n\n    // len, isEmpty\n    let len = this.v.length\n    let isEmpty = this.v.isEmpty()\n\n    // iterate\n    for (let element of this.v) {\n        near.log(element)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.v.toArray()\n\n    // clear\n    ths.v.clear()\n}\n```\n\n#### LookupMap\nLookupMap is an non-iterable implementation of a map that stores its content directly on the trie. It's like a big hash map, but on trie. Usage:\n```js\nimport {LookupMap} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.m = new LookupMap('prefix_a')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.m = Object.assign(new LookupMap, this.m)\n}\n\nsomeMethod() {\n    // insert\n    this.m.set('abc', 'aaa')\n    this.m.set('def', 'bbb')\n    this.m.set('ghi', 'ccc')\n\n    // batch insert, extend:\n    this.m.extend([['xyz', '123'], ['key2', 'value2']])\n\n    // check exist\n    let exist = this.m.containsKey('abc')\n\n    // get\n    let value = this.m.get('abc')\n\n    // remove\n    this.m.remove('def') \n\n    // replace\n    this.m.set('ghi', 'ddd')\n}\n```\n\n#### LookupSet\nLookupSet is an non-iterable implementation of a set that stores its content directly on the trie. It's like LookupMap, but it only stores whether the value presents. Usage:\n```js\nimport {LookupSet} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.s = new LookupSet('prefix_b')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.s = Object.assign(new LookupSet, this.s)\n}\n\nsomeMethod() {\n    // insert\n    this.s.set('abc')\n    this.s.set('def')\n    this.s.set('ghi')\n\n    // batch insert, extend:\n    this.s.extend(['xyz', '123'])\n\n    // check exist\n    let exist = this.s.contains('abc')\n\n    // remove\n    this.s.remove('def')\n}\n```\n\n#### UnorderedMap\nUnorderedMap is an iterable implementation of a map that stores its content directly on the trie. Usage:\n```js\nimport {UnorderedMap} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.m = new UnorderedMap('prefix_c')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.m.keys = Object.assign(new Vector, this.m.keys)\n    this.m.values = Object.assign(new Vector, this.m.values)\n    this.m = Object.assign(new UnorderedMap, this.m)\n}\n\nsomeMethod() {\n    // insert\n    this.m.set('abc', 'aaa')\n    this.m.set('def', 'bbb')\n    this.m.set('ghi', 'ccc')\n\n    // batch insert, extend:\n    this.m.extend([['xyz', '123'], ['key2', 'value2']])\n\n    // get\n    let value = this.m.get('abc')\n\n    // remove\n    this.m.remove('def') \n\n    // replace\n    this.m.set('ghi', 'ddd')\n\n    // len, isEmpty\n    let len = this.m.length\n    let isEmpty = this.m.isEmpty()\n\n    // iterate\n    for (let [k, v] of this.m) {\n        near.log(k+v)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.m.toArray()\n\n    // clear\n    this.m.clear()\n}\n```\n\n#### UnorderedSet\nUnorderedSet is an iterable implementation of a set that stores its content directly on the trie. It's like UnorderedMap but it only stores whether the value presents. Usage:\n```js\nimport {UnorderedSet} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.s = new UnorderedSet('prefix_d')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.s.elements = Object.assign(new Vector, this.s.elements)\n    this.s = Object.assign(new UnorderedSet, this.s)\n}\n\nsomeMethod() {\n    // insert\n    this.s.set('abc')\n    this.s.set('def')\n    this.s.set('ghi')\n\n    // batch insert, extend:\n    this.s.extend(['xyz', '123'])\n\n    // check exist\n    let exist = this.s.contains('abc')\n\n    // remove\n    this.s.remove('def')\n\n    // len, isEmpty\n    let len = this.s.length\n    let isEmpty = this.s.isEmpty()\n\n    // iterate\n    for (let e of this.s) {\n        near.log(e)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.s.toArray()\n\n    // clear\n    this.s.clear()\n}\n```\n","gitHead":"b551a65554defa60240b72b558d35b689f5d3ebd","scripts":{"test":"yarn test:unit && yarn test:examples","build":"tsc -p ./tsconfig.json","pretest":"yarn build","test:unit":"yarn && cd tests && yarn && yarn build && yarn test && cd ..","postinstall":"cd cli && rm -rf deps && mkdir -p deps && cd deps && node ../post-install.js","test:examples":"yarn && cd examples && yarn && yarn build && yarn test && cd .."},"_npmUser":{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"},"repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.11.0","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"16.16.0","dependencies":{"bs58":"^5.0.0","yargs":"^17.5.1","rollup":"^2.61.1","@babel/core":"^7.17.5","@scure/base":"^1.1.1","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@babel/preset-typescript":"^7.18.6","rollup-plugin-sourcemaps":"^0.6.3","@rollup/plugin-node-resolve":"^13.1.1","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"typescript":"^4.7.2","@types/node":"^17.0.38","@types/rollup":"^0.54.0","@rollup/plugin-typescript":"^8.3.2"},"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_0.5.0-0_1662030796515_0.5373091330355426","host":"s3://npm-registry-packages"}},"0.5.0-1":{"name":"near-sdk-js","version":"0.5.0-1","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@0.5.0-1","maintainers":[{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"bin":{"near-sdk-js":"cli/cli.js"},"dist":{"shasum":"bdcf69ac287706477ecb7210c75a27f1e7244066","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-0.5.0-1.tgz","fileCount":47,"integrity":"sha512-PV4BKAIQUJuLLQ0O6AchAMIWlT18PQ1G/SuXuIp1DAzjiqX0jIyVEC7c7YcMt0TD6mTy1fFJy1Bjld6Eh0mZFg==","signatures":[{"sig":"MEYCIQDxxqZG6/YPOJByFgwUgCiiIlr1WGV/o4qyt4ZePfyYHgIhAIkgEl9BQTCTqE0iXCrSMKGq02StTEN5YLfG0LSGSAjo","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":128767,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjGK3sACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoB3A//ag6+U+foRV1mZMvdEbQBgJcvBGWbpG3awtIll785u1csxIsB\r\nwqL98/F+NCiXOO3T+9dS3FiKmbBzhV96fGPFPsIFg2XnOFSzr2brxTcrTyMI\r\npBduHg2/Di42L0E8oSgInxWlvT7R7uF/0ZdjZIgwErE6uMBEjtzAOJM1KUoH\r\nUKkrZZgZJnnhVdQ1au5pwjgcSimoBk8Vg84wZTEebb1LKTltSQe/zxqnt5ED\r\nU3NXJLkXF5NRYU/VWWBwMZQKd0lg1zT2aEveKDGH09L9u3jgAaMTEQOnyQ+S\r\nED10kAZTz5e9CnR16hqD5Ty7phKC6T0gIKjOblwayiIG/GhA5c444mEdYV9j\r\n7s/9G6exqjNFOcGKD/1AH1OJw3fh+7pGGmShn5DWxE4zL0sYlUUrJRJhwB3l\r\n4Uk9xIgT7+TqKdKTdf0Ae5Y2qLL03eLIX/E3uRM8jRf/FOD1ncDUyFyLuNHs\r\nhpUhfNMV561mtNqkYryAG3ZWm2q4LEYTsdmrpLZeFEjqwvI0UQ7riHhIWDpF\r\nTgZEQBXaheG4/JNk2qR1w0RHuEK+orVTNaX0qL56v1edVsGOW3epNhoswdgQ\r\niT7h7Jvpx3OdUP9z0h3XOTXf2JUJmOCx3ukckaB1LBUlKtxP8iTyUdhKt6L1\r\nM1btncQWLnv9Ia0PF8stMLtvbLb2jo4PTZ0=\r\n=pgxs\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","readme":"# NEAR JavaScript SDK\n\n## Quick Start\n\nUse [`create-near-app`](https://github.com/near/create-near-app) to quickly get started writing smart contracts in JavaScript on NEAR.\n\n    npx create-near-app\n\nThis will scaffold a basic template for you 😎\n\nLearn more in our [Quick Start guide](https://docs.near.org/develop/quickstart-guide).\n\n## Running Examples\nThere are a couple of contract examples in the project:\n\n- [Clean contract state](https://github.com/near/near-sdk-js/tree/develop/examples/src/clean-state.js)\n- [Counter using low level API](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter-lowlevel.js)\n- [Counter in JavaScript](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter.js)\n- [Counter in TypeScript](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter.ts)\n- [Doing cross contract call](https://github.com/near/near-sdk-js/tree/develop/examples/src/cross-contract-call.js)\n- [Fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/fungible-token.js)\n- [Lockable fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/fungible-token-lockable.js)\n- [Non fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/non-fungible-token.js)\n- [Non fungible token receiver contract](https://github.com/near/near-sdk-js/tree/develop/examples/src/non-fungible-token-receiver.js)\n- [Status message board](https://github.com/near/near-sdk-js/tree/develop/examples/src/status-message.js)\n- [Status message board with unique messages](https://github.com/near/near-sdk-js/tree/develop/examples/src/status-message-collections.js)\n\nTo build all examples, run `yarn build` in `examples/`. To test all examples, run `yarn test`. You can also build and test one specific example with `yarn build:<example-name>` and `yarn test:<example-name>`, see `examples/package.json`.\n\nTo deploy and call a contract on a NEAR node, use near-cli's `near deploy` and `near call`.\n\n## Error Handling in NEAR-SDK-JS\n\nIf you want to indicate an error happened and fail the transaction, just throw an error object in JavaScript. The compiled JavaScript contract includes error handling capability. It will catch throwed errors and automatically invoke `panic_utf8` with `\"{error.message}\\n:{error.stack}\"`. As a result, transaction will fail with `\"Smart contract panicked: {error.message}\\n{error.stack}\"` error message. You can also use an error utilities library to organize your errors, such as verror.\n\nWhen your JS code or library throws an error, uncaught, the transaction will also fail with GuestPanic error, with the error message and stacktrace.\n\nWhen call host function with inappropriate type, means incorrect number of arguments or arg is not expected type:\n    - if arguments less than params, remaining argument are set as 'undefined'\n    - if arguments more than params, remaining argument are ignored\n    - if argument is different than the required type, it'll be coerced to required type\n    - if argument is different than the required type but cannot be coerced, will throw runtime type error, also with message and stacktrace\n\n## Test\nWe recommend to use near-workspaces to write tests for your smart contracts. See any of the examples for how tests are setup and written.\n\n## NEAR-SDK-JS API Reference\n\nAll NEAR blockchain provided functionality (host functions) are defined in `src/api.ts` and exported as `near`. You can use them by:\n```js\nimport {near} from 'near-sdk-js'\n\n// near.<api doucmented below>. e.g.:\nlet signer = near.signerAccountId()\n```\n\nTo use nightly host functions, such as `altBn128G1Sum`, your contract need to be built with nightly enabled. Use:\n```\nexport NEAR_NIGHTLY=1\nyarn build\n```\n\n### About Type\n\nNEAR-SDK-JS is written in TypeScript, so every API function has a type specified by signature that looks familiar to JavaScript/TypeScript Developers. Two types in the signature need a special attention:\n- Most of the API take `BigInt` instead of Number as type. This because JavaScript Number cannot hold 64 bit and 128 bit integer without losing precision.\n- `Bytes` in both arguments and return represent a byte buffer, internally it's a JavaScript String Object. Any binary data `0x00-0xff` is stored as the char '\\x00-\\xff'. This is because QuickJS doesn't have ArrayBuffer in C API.\n    - To ensure correctness, every `Bytes` argument need to be pass in with the `bytes()` function to runtime type check it's indeed a `Bytes`.\n    - If `Bytes` is too long that `bytes()` can cause gas limit problem, such as in factory contract, represents the content of contract to be deployed. In this case you can precheck and guarantee the correctness of the content and use without `bytes()`.\n\n### Context API\n\n```\nfunction currentAccountId(): String;\nfunction signerAccountId(): String;\nfunction signerAccountPk(): Bytes;\nfunction predecessorAccountId(): String;\nfunction input(): Bytes;\nfunction blockIndex(): BigInt;\nfunction blockHeight(): BigInt;\nfunction blockTimestamp(): BigInt;\nfunction epochHeight(): BigInt;\nfunction storageUsage(): BigInt\n```\n\n### Economics API\n```\nfunction accountBalance(): BigInt;\nfunction accountLockedBalance(): BigInt;\nfunction attachedDeposit(): BigInt;\nfunction prepaidGas(): BigInt;\nfunction usedGas(): BigInt;\n```\n\n### Math API\n\n\n```\nfunction randomSeed(): Bytes;\nfunction sha256(value: Bytes): Bytes;\nfunction keccak256(value: Bytes): Bytes;\nfunction keccak512(value: Bytes): Bytes;\nfunction ripemd160(value: Bytes): Bytes;\nfunction ecrecover(hash: Bytes, sign: Bytes, v: BigInt, malleability_flag: BigInt): Bytes | null;\n```\n\n### Miscellaneous API\n\n\n```\nfunction valueReturn(value: Bytes);\nfunction panic(msg?: String);\nfunction panicUtf8(msg: Bytes);\nfunction log(msg: String);\nfunction logUtf8(msg: Bytes);\nfunction logUtf16(msg: Bytes);\n```\n\n### Promises API\n\n```\nfunction promiseCreate(account_id: String, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt): BigInt;\nfunction promiseThen(promise_index: BigInt, account_id: String, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt): BigInt;\nfunction promiseAnd(...promise_idx: BigInt): BigInt;\nfunction promiseBatchCreate(account_id: String): BigInt;\nfunction promiseBatchThen(promise_index: BigInt, account_id: String): BigInt;\n```\n\n### Promise API actions\n\n```\nfunction promiseBatchActionCreateAccount(promise_index: BigInt);\nfunction promiseBatchActionDeployContract(promise_index: BigInt, code: Bytes);\nfunction promiseBatchActionFunctionCall(promise_index: BigInt, method_name: String, arguments: Bytes, amount: BigInt, gas: BigInt);\nfunction promiseBatchActionTransfer(promise_index: BigInt, amount: BigInt);\nfunction promiseBatchActionStake(promise_index: BigInt, amount: BigInt, public_key: Bytes);\nfunction promiseBatchActionAddKeyWithFullAccess(promise_index: BigInt, public_key: Bytes, nonce: BigInt);\nfunction promiseBatchActionAddKeyWithFunctionCall(promise_index: BigInt, public_key: Bytes, nonce: BigInt, allowance: BigInt, receiver_id: String, method_names: String);\nfunction promiseBatchActionDeleteKey(promise_index: BigInt, public_key: Bytes);\nfunction promiseBatchActionDeleteAccount(promise_index: BigInt, beneficiary_id: String);\n```\n\n### Promise API results\n\n```\nfunction promiseResultsCount(): BigInt;\nfunction promiseResult(result_idx: BigInt, register_id: BigInt): BigInt;\nfunction promiseReturn(promise_idx: BigInt);\n```\n\n### Storage API\n\n```\nfunction storageWrite(key: Bytes, value: Bytes, register_id: BigInt): BigInt;\nfunction storageRead(key: Bytes, register_id: BigInt): BigInt;\nfunction storageRemove(key: Bytes, register_id: BigInt): BigInt;\nfunction storageHasKey(key: Bytes): BigInt;\n```\n\n### Validator API\n\n```\nfunction validatorStake(account_id: String): BigInt;\nfunction validatorTotalStake(): BigInt;\n```\n\n### Alt BN128\n\n```\nfunction altBn128G1Multiexp(value: Bytes, register_id: BigInt);\nfunction altBn128G1Sum(value: Bytes, register_id: BigInt);\nfunction altBn128PairingCheck(value: Bytes): BigInt;\n```\n\n### Collections\nA few useful on-chain persistent collections are provided. All keys, values and elements are of type `Bytes`.\n\n#### Vector\nVector is an iterable implementation of vector that stores its content on the trie. Usage:\n\n```js\nimport {Vector} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.v = new Vector('my_prefix_')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.v = Object.assign(new Vector, this.v)\n}\n\nsomeMethod() {\n    // insert\n    this.v.push('abc')\n    this.v.push('def')\n    this.v.push('ghi')\n\n    // batch insert, extend:\n    this.v.extend(['xyz', '123'])\n\n    // get\n    let first = this.v.get(0)\n\n    // remove, move the last element to the given index\n    this.v.swapRemove(0) \n\n    // replace\n    this.v.replace(1, 'jkl')\n\n    // remove the last\n    this.v.pop()\n\n    // len, isEmpty\n    let len = this.v.length\n    let isEmpty = this.v.isEmpty()\n\n    // iterate\n    for (let element of this.v) {\n        near.log(element)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.v.toArray()\n\n    // clear\n    ths.v.clear()\n}\n```\n\n#### LookupMap\nLookupMap is an non-iterable implementation of a map that stores its content directly on the trie. It's like a big hash map, but on trie. Usage:\n```js\nimport {LookupMap} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.m = new LookupMap('prefix_a')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.m = Object.assign(new LookupMap, this.m)\n}\n\nsomeMethod() {\n    // insert\n    this.m.set('abc', 'aaa')\n    this.m.set('def', 'bbb')\n    this.m.set('ghi', 'ccc')\n\n    // batch insert, extend:\n    this.m.extend([['xyz', '123'], ['key2', 'value2']])\n\n    // check exist\n    let exist = this.m.containsKey('abc')\n\n    // get\n    let value = this.m.get('abc')\n\n    // remove\n    this.m.remove('def') \n\n    // replace\n    this.m.set('ghi', 'ddd')\n}\n```\n\n#### LookupSet\nLookupSet is an non-iterable implementation of a set that stores its content directly on the trie. It's like LookupMap, but it only stores whether the value presents. Usage:\n```js\nimport {LookupSet} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.s = new LookupSet('prefix_b')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.s = Object.assign(new LookupSet, this.s)\n}\n\nsomeMethod() {\n    // insert\n    this.s.set('abc')\n    this.s.set('def')\n    this.s.set('ghi')\n\n    // batch insert, extend:\n    this.s.extend(['xyz', '123'])\n\n    // check exist\n    let exist = this.s.contains('abc')\n\n    // remove\n    this.s.remove('def')\n}\n```\n\n#### UnorderedMap\nUnorderedMap is an iterable implementation of a map that stores its content directly on the trie. Usage:\n```js\nimport {UnorderedMap} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.m = new UnorderedMap('prefix_c')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.m.keys = Object.assign(new Vector, this.m.keys)\n    this.m.values = Object.assign(new Vector, this.m.values)\n    this.m = Object.assign(new UnorderedMap, this.m)\n}\n\nsomeMethod() {\n    // insert\n    this.m.set('abc', 'aaa')\n    this.m.set('def', 'bbb')\n    this.m.set('ghi', 'ccc')\n\n    // batch insert, extend:\n    this.m.extend([['xyz', '123'], ['key2', 'value2']])\n\n    // get\n    let value = this.m.get('abc')\n\n    // remove\n    this.m.remove('def') \n\n    // replace\n    this.m.set('ghi', 'ddd')\n\n    // len, isEmpty\n    let len = this.m.length\n    let isEmpty = this.m.isEmpty()\n\n    // iterate\n    for (let [k, v] of this.m) {\n        near.log(k+v)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.m.toArray()\n\n    // clear\n    this.m.clear()\n}\n```\n\n#### UnorderedSet\nUnorderedSet is an iterable implementation of a set that stores its content directly on the trie. It's like UnorderedMap but it only stores whether the value presents. Usage:\n```js\nimport {UnorderedSet} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.s = new UnorderedSet('prefix_d')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.s.elements = Object.assign(new Vector, this.s.elements)\n    this.s = Object.assign(new UnorderedSet, this.s)\n}\n\nsomeMethod() {\n    // insert\n    this.s.set('abc')\n    this.s.set('def')\n    this.s.set('ghi')\n\n    // batch insert, extend:\n    this.s.extend(['xyz', '123'])\n\n    // check exist\n    let exist = this.s.contains('abc')\n\n    // remove\n    this.s.remove('def')\n\n    // len, isEmpty\n    let len = this.s.length\n    let isEmpty = this.s.isEmpty()\n\n    // iterate\n    for (let e of this.s) {\n        near.log(e)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.s.toArray()\n\n    // clear\n    this.s.clear()\n}\n```\n","gitHead":"27ba29eccf9add9a2950bba4bf42dba31b6f47de","scripts":{"test":"yarn test:unit && yarn test:examples","build":"tsc -p ./tsconfig.json","pretest":"yarn build","test:unit":"yarn && cd tests && yarn && yarn build && yarn test && cd ..","postinstall":"cd cli && rm -rf deps && mkdir -p deps && cd deps && node ../post-install.js","test:examples":"yarn && cd examples && yarn && yarn build && yarn test && cd .."},"_npmUser":{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"},"repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.11.0","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"16.16.0","dependencies":{"yargs":"^17.5.1","rollup":"^2.61.1","@babel/core":"^7.17.5","@scure/base":"^1.1.1","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@babel/preset-typescript":"^7.18.6","rollup-plugin-sourcemaps":"^0.6.3","@rollup/plugin-node-resolve":"^13.1.1","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"typescript":"^4.7.2","@types/node":"^17.0.38","@types/rollup":"^0.54.0","@rollup/plugin-typescript":"^8.3.2"},"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_0.5.0-1_1662561772387_0.6228493397044796","host":"s3://npm-registry-packages"}},"0.5.0":{"name":"near-sdk-js","version":"0.5.0","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@0.5.0","maintainers":[{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"bin":{"near-sdk-js":"cli/cli.js"},"dist":{"shasum":"26644c7147689702cd8d0b0c4ddd5f364522612d","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-0.5.0.tgz","fileCount":47,"integrity":"sha512-wwQTCT+7bu0CahlNxlG5RGaxDiUJQSnjT7GwmK/d2p7Y5PkwWv1K5ZBsZMLOTU3fnhv0Y1LJ6lp00O9kZZLR5Q==","signatures":[{"sig":"MEUCIQDW6kF2/0zneFI2yjqs6cntRQ0zidzCr4L3NqkZxiOF8wIgJwys+fFw8xWXGgXlNd7Q2ZkH+pOycT17xhGQqRxje6E=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132766,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjGuyiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoS0Q//cqeD3I0kKtLJh0f1R3euGjfQhUfV+smX4q3UIcDuV1mkbvdT\r\n045bu4bVaXPFvDRlEr+qgcy9X5Z8UV+x5ClplwJkjLnHUlrz27s1Y462X+MP\r\nAj28h7lTIJuUshag/gogARST3pJs6p3NTUKLbwGXuD2xLeIm1ZrE+lsLsJVS\r\nYPEyrAv5+PhI9wkL5DobtweUaHr7Ew25kZ3TnYJXfjuF0fsK38WhV6+TG/4f\r\nDUvQkAieG0Kob117dQ8o6m5f32laryTPoB7QZkN9pI3CXbgsjahJBObd9fHR\r\nJuLj4GOOPpRS0Bh32bm+JH/aCgb8RheL7vVjiga9ZB9tm+T0nW8bCnlPvIJE\r\nTLsCgmWX8brWtLeu2tL2LK9xUxmUim+HATZVXJcVEWAHZOjoqsXNMXs48CXo\r\nKYWTbU5z363UGAzo7tHQu1voaZckbp6Wx3wp+6ZuDXV23RbHFJBCejJ3WYuJ\r\nLPxEYn5HRw7pV6LkK15qa6sAC4qCL71EK6SKb7DhD1HYkuqjAmMN5UkxEFzZ\r\nizQb7Ntefr5ouvwqsTwMekBdSrX53t3Yfi2Y7/Pm+9Qxn3zFA554SJddkP8G\r\nlnbZ8Bl65e5oZbDKKPz212m+2IjD3wXLIQl72eYGFQJNwbI0iikAkquTtBOG\r\nmfPkacAfdKBj9glKXVHvPC2sbNN4hhi7D/g=\r\n=0ZsR\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","gitHead":"cbd6f2635f10e22228b343d449c5a37de578f08d","scripts":{"test":"yarn test:unit && yarn test:examples","build":"tsc -p ./tsconfig.json","pretest":"yarn build","test:unit":"yarn && cd tests && yarn && yarn build && yarn test && cd ..","postinstall":"cd cli && rm -rf deps && mkdir -p deps && cd deps && node ../post-install.js","test:examples":"yarn && cd examples && yarn && yarn build && yarn test && cd .."},"_npmUser":{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"},"repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.11.0","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"16.16.0","dependencies":{"yargs":"^17.5.1","rollup":"^2.61.1","@babel/core":"^7.17.5","@scure/base":"^1.1.1","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@babel/preset-typescript":"^7.18.6","rollup-plugin-sourcemaps":"^0.6.3","@rollup/plugin-node-resolve":"^13.1.1","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^4.7.2","@types/node":"^17.0.38","@types/rollup":"^0.54.0","@rollup/plugin-typescript":"^8.3.2"},"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_0.5.0_1662708791390_0.32349450625494613","host":"s3://npm-registry-packages"}},"0.6.0-0":{"name":"near-sdk-js","version":"0.6.0-0","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@0.6.0-0","maintainers":[{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"bin":{"near-sdk-js":"lib/cli/cli.js"},"dist":{"shasum":"e71b45b0243093c073adc6027e2292aa161489f5","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-0.6.0-0.tgz","fileCount":675,"integrity":"sha512-ifkzMPOD44WJ/uXRlulrloinbM8NHwrWg7Z7soTqK+4Ig5aIWufpkl1JoojDFjkZwkOKhuWh7uEAUBnObs3LbQ==","signatures":[{"sig":"MEQCIBdYqCGes7J1To/cP9fasc5rWGbrC340xRb0/3MUjRtRAiAxpoGXzrfp+MZR8DiuX1PaZfknk+cnEM512kyQ+tCifg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":143039851,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjUkeDACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrtzg//T01kgkhTkq9E6DPEE5R94uRBTN3r0p+5Ap5ixUEn8NIyC2Pc\r\nnHv+GfTjMRtdteT+TWe3bWBlbJ99ej1zw0OAolFC220cSwr575v1G5R/AvTH\r\nWo9RlQJM+HkOexPlVmj1PMeBpDZ0sN9bFrd3llBcoaoUO0U3NbDTzpWjpb75\r\nC5iK9HbE4gJwo2w5TdtDcqtNuHf+JK+Q1MqQ2j5/m3T1Rnhjumh6XLXCG+bs\r\nrsURwO1PfP2OBQbdkzWrzfiambioS1rOknGLCiLdSs1PVHH42uuixEzJvRHw\r\ny1zIVXKwbEL1TVWPDTlFpm3lxec61p70mRThcmP7XoLsC+On8RQ2clBDBbwL\r\ny6WCO6oGBX03fcJUVoDrLYoDQ25xn1MoLUK4DjvxfgR+Q8mCoiQlEl+3btt8\r\noAM1ILlbo/wFl9iWl/vf4SQJdQmPKJYsi8xJzUsOqRLvOteiqM4wlyPYhcLP\r\nyPRPfKIy0ZnmimwUNHCzc08mJgnfRaeZ8sUazFyh764sQlDfO+a2MGaVc/GD\r\ncNhWx64G5x8ddU/blsKL+HtPYscWZFMMiAx/PKywv45TXT32JYA6fOKDCPMM\r\nL5u4jAUapPW36UGGteYvNQLVMIJlIYa0tx4V9cv6GLdslcGOIy2zXRBiO6FU\r\nqpNM1r5pmHKC+rOOHloWYHoBbhAjFGu/N6A=\r\n=LnUj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","readme":"# NEAR JavaScript SDK\n\n## Quick Start\n\nUse [`create-near-app`](https://github.com/near/create-near-app) to quickly get started writing smart contracts in JavaScript on NEAR.\n\n    npx create-near-app\n\nThis will scaffold a basic template for you 😎\n\nLearn more in our [Quick Start guide](https://docs.near.org/develop/quickstart-guide).\n\n## Running Examples\n\nThere are a couple of contract examples in the project:\n\n- [Clean contract state](https://github.com/near/near-sdk-js/tree/develop/examples/src/clean-state.js)\n- [Counter using low level API](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter-lowlevel.js)\n- [Counter in JavaScript](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter.js)\n- [Counter in TypeScript](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter.ts)\n- [Doing cross contract call](https://github.com/near/near-sdk-js/tree/develop/examples/src/cross-contract-call.js)\n- [Fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/fungible-token.js)\n- [Lockable fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/fungible-token-lockable.js)\n- [Non fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/non-fungible-token.js)\n- [Non fungible token receiver contract](https://github.com/near/near-sdk-js/tree/develop/examples/src/non-fungible-token-receiver.js)\n- [Status message board](https://github.com/near/near-sdk-js/tree/develop/examples/src/status-message.js)\n- [Status message board with unique messages](https://github.com/near/near-sdk-js/tree/develop/examples/src/status-message-collections.js)\n\nTo build all examples, run `yarn build` in `examples/`. To test all examples, run `yarn test`. You can also build and test one specific example with `yarn build:<example-name>` and `yarn test:<example-name>`, see `examples/package.json`.\n\nTo deploy and call a contract on a NEAR node, use near-cli's `near deploy` and `near call`.\n\n## Test\n\nWe recommend to use near-workspaces to write tests for your smart contracts. See any of the examples for how tests are setup and written.\n\n## Error Handling in NEAR-SDK-JS\n\nIf you want to indicate an error happened and fail the transaction, just throw an error object in JavaScript. The compiled JavaScript contract includes error handling capability. It will catch throwed errors and automatically invoke `panic_utf8` with `\"{error.message}\\n:{error.stack}\"`. As a result, transaction will fail with `\"Smart contract panicked: {error.message}\\n{error.stack}\"` error message. You can also use an error utilities library to organize your errors, such as verror.\n\nWhen your JS code or library throws an error, uncaught, the transaction will also fail with GuestPanic error, with the error message and stacktrace.\n\nWhen call host function with inappropriate type, means incorrect number of arguments or arg is not expected type:\n\n- if arguments less than params, remaining argument are set as 'undefined'\n- if arguments more than params, remaining argument are ignored\n- if argument is different than the required type, it'll be coerced to required type\n- if argument is different than the required type but cannot be coerced, will throw runtime type error, also with message and stacktrace\n\n## NEAR-SDK-JS API Reference\n\nAll NEAR blockchain provided functionality (host functions) are defined in `src/api.ts` and exported as `near`. You can use them by:\n\n```js\nimport { near } from \"near-sdk-js\";\n\n// near.<api doucmented below>. e.g.:\nlet signer = near.signerAccountId();\n```\n\nTo use nightly host functions, such as `altBn128G1Sum`, your contract need to be built with nightly enabled. Use:\n\n```\nexport NEAR_NIGHTLY=1\nyarn build\n```\n\n### About Type\n\nNEAR-SDK-JS is written in TypeScript, so every API function has a type specified by signature that looks familiar to JavaScript/TypeScript Developers. Two types in the signature need a special attention:\n\n- Most of the API take `bigint` instead of Number as type. This because JavaScript Number cannot hold 64 bit and 128 bit integer without losing precision.\n- `Bytes` in both arguments and return represent a byte buffer, internally it's a JavaScript String Object. Any binary data `0x00-0xff` is stored as the char '\\x00-\\xff'. This is because QuickJS doesn't have Uint8Array in C API.\n  - To ensure correctness, every `Bytes` argument need to be pass in with the `bytes()` function to runtime type check it's indeed a `Bytes`.\n  - If `Bytes` is too long that `bytes()` can cause gas limit problem, such as in factory contract, represents the content of contract to be deployed. In this case you can precheck and guarantee the correctness of the content and use without `bytes()`.\n\n### Context API\n\n```\nfunction currentAccountId(): string;\nfunction signerAccountId(): string;\nfunction signerAccountPk(): Bytes;\nfunction predecessorAccountId(): string;\nfunction input(): Bytes;\nfunction blockIndex(): bigint;\nfunction blockHeight(): bigint;\nfunction blockTimestamp(): bigint;\nfunction epochHeight(): bigint;\nfunction storageUsage(): bigint\n```\n\n### Economics API\n\n```\nfunction accountBalance(): bigint;\nfunction accountLockedBalance(): bigint;\nfunction attachedDeposit(): bigint;\nfunction prepaidGas(): bigint;\nfunction usedGas(): bigint;\n```\n\n### Math API\n\n```\nfunction randomSeed(): Bytes;\nfunction sha256(value: Bytes): Bytes;\nfunction keccak256(value: Bytes): Bytes;\nfunction keccak512(value: Bytes): Bytes;\nfunction ripemd160(value: Bytes): Bytes;\nfunction ecrecover(hash: Bytes, sign: Bytes, v: bigint, malleability_flag: bigint): Bytes | null;\n```\n\n### Miscellaneous API\n\n```\nfunction valueReturn(value: Bytes);\nfunction panic(msg?: string);\nfunction panicUtf8(msg: Bytes);\nfunction log(msg: string);\nfunction logUtf8(msg: Bytes);\nfunction logUtf16(msg: Bytes);\n```\n\n### Promises API\n\n```\nfunction promiseCreate(account_id: string, method_name: string, arguments: Bytes, amount: bigint, gas: bigint): bigint;\nfunction promiseThen(promise_index: bigint, account_id: string, method_name: string, arguments: Bytes, amount: bigint, gas: bigint): bigint;\nfunction promiseAnd(...promise_idx: bigint): bigint;\nfunction promiseBatchCreate(account_id: string): bigint;\nfunction promiseBatchThen(promise_index: bigint, account_id: string): bigint;\n```\n\n### Promise API actions\n\n```\nfunction promiseBatchActionCreateAccount(promise_index: bigint);\nfunction promiseBatchActionDeployContract(promise_index: bigint, code: Bytes);\nfunction promiseBatchActionFunctionCall(promise_index: bigint, method_name: string, arguments: Bytes, amount: bigint, gas: bigint);\nfunction promiseBatchActionFunctionCallWeight(promise_index: bigint, method_name: string, arguments: Bytes, amount: bigint, gas: bigint, weight: bigint);\n\nfunction promiseBatchActionTransfer(promise_index: bigint, amount: bigint);\nfunction promiseBatchActionStake(promise_index: bigint, amount: bigint, public_key: Bytes);\nfunction promiseBatchActionAddKeyWithFullAccess(promise_index: bigint, public_key: Bytes, nonce: bigint);\nfunction promiseBatchActionAddKeyWithFunctionCall(promise_index: bigint, public_key: Bytes, nonce: bigint, allowance: bigint, receiver_id: string, method_names: string);\nfunction promiseBatchActionDeleteKey(promise_index: bigint, public_key: Bytes);\nfunction promiseBatchActionDeleteAccount(promise_index: bigint, beneficiary_id: string);\n```\n\n### Promise API results\n\n```\nfunction promiseResultsCount(): bigint;\nfunction promiseResult(result_idx: bigint, register_id: bigint): bigint;\nfunction promiseReturn(promise_idx: bigint);\n```\n\n### Storage API\n\n```\nfunction storageWrite(key: Bytes, value: Bytes, register_id: bigint): bigint;\nfunction storageRead(key: Bytes, register_id: bigint): bigint;\nfunction storageRemove(key: Bytes, register_id: bigint): bigint;\nfunction storageHasKey(key: Bytes): bigint;\n```\n\n### Validator API\n\n```\nfunction validatorStake(account_id: string): bigint;\nfunction validatorTotalStake(): bigint;\n```\n\n### Alt BN128\n\n```\nfunction altBn128G1Multiexp(value: Bytes, register_id: bigint);\nfunction altBn128G1Sum(value: Bytes, register_id: bigint);\nfunction altBn128PairingCheck(value: Bytes): bigint;\n```\n\n### NearBindgen and other decorators\n\nYou can write a simple smart contract by only using low-level APIs, such as `near.input()`, `near.storageRead()`, etc. In this case, the API of your contract will consist of all the exported JS functions. You can find an example of such a contract [here](https://github.com/near/near-sdk-js/blob/develop/examples/src/counter-lowlevel.js).\n\nBut if you want to build a more complex contracts with ease, you can use decorators from this SDK that will handle serialization, deserialization, and other boilerplate operations for you.\n\nIn order to do that, your contract must be a class decorated with `@NearBindgen({})`. Each method in this class with `@call({})`, `@view({})`, and `@initialize({})` decorators will become functions of your smart contract. `call` functions can change state, and `view` functions can only read it.\n\nYour class must have a `constructor()`. You will not be able to call it, which is why it should not accept any parameters. You must declare all the parameters that you are planning to use in the constructor and set default values.\n\nThe simplest example of the contract that follows all these rules can be found [here](https://github.com/near/near-sdk-js/blob/develop/examples/src/status-message.js)\n\n`NearBindgen` decorator can accept `requireInit parameter`.\n\n```JS\n@NearBindgen({ requireInit: true })\nclass YourContract {\n    ...\n}\n```\n\nIt is `false` by default, but if you will set it to `true`, it will prevent all the `call` functions from being executed before you initialize the state of the contract.\n\nIn order to initialize the contract, you need to add functions flagged with `@initialize({})` decorator.\n\n`@call({})` decorator can accept two parameters: `privateFunction` and `payableFunction`. They are both `false` by default.\n\n`privateFunction: true` can restrict access to this function to the contract itself.\n\n`payableFunction: true` will allow the function to accept payments (deposit). Without this flag, it will panic if any deposit was provided.\n\n### Collections\n\nA few useful on-chain persistent collections are provided. All keys, values and elements are of type `Bytes`.\n\n#### Vector\n\nVector is an iterable implementation of vector that stores its content on the trie. Usage:\n\n```js\nimport {Vector} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.v = new Vector('my_prefix_')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.v = Object.assign(new Vector, this.v)\n}\n\nsomeMethod() {\n    // insert\n    this.v.push('abc')\n    this.v.push('def')\n    this.v.push('ghi')\n\n    // batch insert, extend:\n    this.v.extend(['xyz', '123'])\n\n    // get\n    let first = this.v.get(0)\n\n    // remove, move the last element to the given index\n    this.v.swapRemove(0)\n\n    // replace\n    this.v.replace(1, 'jkl')\n\n    // remove the last\n    this.v.pop()\n\n    // len, isEmpty\n    let len = this.v.length\n    let isEmpty = this.v.isEmpty()\n\n    // iterate\n    for (let element of this.v) {\n        near.log(element)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.v.toArray()\n\n    // clear\n    ths.v.clear()\n}\n```\n\n#### LookupMap\n\nLookupMap is an non-iterable implementation of a map that stores its content directly on the trie. It's like a big hash map, but on trie. Usage:\n\n```js\nimport {LookupMap} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.m = new LookupMap('prefix_a')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.m = Object.assign(new LookupMap, this.m)\n}\n\nsomeMethod() {\n    // insert\n    this.m.set('abc', 'aaa')\n    this.m.set('def', 'bbb')\n    this.m.set('ghi', 'ccc')\n\n    // batch insert, extend:\n    this.m.extend([['xyz', '123'], ['key2', 'value2']])\n\n    // check exist\n    let exist = this.m.containsKey('abc')\n\n    // get\n    let value = this.m.get('abc')\n\n    // remove\n    this.m.remove('def')\n\n    // replace\n    this.m.set('ghi', 'ddd')\n}\n```\n\n#### LookupSet\n\nLookupSet is an non-iterable implementation of a set that stores its content directly on the trie. It's like LookupMap, but it only stores whether the value presents. Usage:\n\n```js\nimport {LookupSet} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.s = new LookupSet('prefix_b')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.s = Object.assign(new LookupSet, this.s)\n}\n\nsomeMethod() {\n    // insert\n    this.s.set('abc')\n    this.s.set('def')\n    this.s.set('ghi')\n\n    // batch insert, extend:\n    this.s.extend(['xyz', '123'])\n\n    // check exist\n    let exist = this.s.contains('abc')\n\n    // remove\n    this.s.remove('def')\n}\n```\n\n#### UnorderedMap\n\nUnorderedMap is an iterable implementation of a map that stores its content directly on the trie. Usage:\n\n```js\nimport {UnorderedMap} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.m = new UnorderedMap('prefix_c')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.m.keys = Object.assign(new Vector, this.m.keys)\n    this.m.values = Object.assign(new Vector, this.m.values)\n    this.m = Object.assign(new UnorderedMap, this.m)\n}\n\nsomeMethod() {\n    // insert\n    this.m.set('abc', 'aaa')\n    this.m.set('def', 'bbb')\n    this.m.set('ghi', 'ccc')\n\n    // batch insert, extend:\n    this.m.extend([['xyz', '123'], ['key2', 'value2']])\n\n    // get\n    let value = this.m.get('abc')\n\n    // remove\n    this.m.remove('def')\n\n    // replace\n    this.m.set('ghi', 'ddd')\n\n    // len, isEmpty\n    let len = this.m.length\n    let isEmpty = this.m.isEmpty()\n\n    // iterate\n    for (let [k, v] of this.m) {\n        near.log(k+v)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.m.toArray()\n\n    // clear\n    this.m.clear()\n}\n```\n\n#### UnorderedSet\n\nUnorderedSet is an iterable implementation of a set that stores its content directly on the trie. It's like UnorderedMap but it only stores whether the value presents. Usage:\n\n```js\nimport {UnorderedSet} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.s = new UnorderedSet('prefix_d')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.s.elements = Object.assign(new Vector, this.s.elements)\n    this.s = Object.assign(new UnorderedSet, this.s)\n}\n\nsomeMethod() {\n    // insert\n    this.s.set('abc')\n    this.s.set('def')\n    this.s.set('ghi')\n\n    // batch insert, extend:\n    this.s.extend(['xyz', '123'])\n\n    // check exist\n    let exist = this.s.contains('abc')\n\n    // remove\n    this.s.remove('def')\n\n    // len, isEmpty\n    let len = this.s.length\n    let isEmpty = this.s.isEmpty()\n\n    // iterate\n    for (let e of this.s) {\n        near.log(e)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.s.toArray()\n\n    // clear\n    this.s.clear()\n}\n```\n\n### Highlevel Promise APIs\n\nWithin a contract class that decorated by `@Nearbindgen`, you can work a high level JavaScript class, called `NearPromise`. It's equivalently expressive as promise batch APIs but much shorter to write and can be chained like a JavaScript Promise.\n\nIn a `@call` method, you can return either a JavaScript value or a `NearPromise` object. In the later case, `@NearBindgen` will automatically `promiseReturn` it for you.\n\nUsage:\n\n```js\n// create new promise\nimport { NearPromise, near, includeBytes } from \"near-sdk-js\";\nimport { PublicKey } from \"near-sdk-js/lib/types\";\n\nlet promise = NearPromise.new(\"account-to-run-promise\");\n\n// possible promise actions, choose and chain what you need:\npromise\n  .createAccount()\n  .transfer(1_000_000_000_000_000_000_000_000_000_000_000_000n)\n  .addFullAccessKey(new PublicKey(near.signerAccountPk()))\n  .addAccessKey(\n    new PublicKey(near.signerAccountPk()),\n    250000000000000000000000n, // allowance\n    \"receiver_account_id\",\n    \"allowed_function_names\"\n  )\n  .stake(100000000000000000000000000000n, new PublicKey(near.signerAccountPk()))\n  .deployContract(includeBytes(\"path/to/contract.wasm\"))\n  .functionCall(\n    \"callee_contract_account_id\",\n    inputArgs,\n    0, // amount\n    2 * Math.pow(10, 13) // gas\n  )\n  .functionCallWeight(\n    \"callee_contract_account_id\",\n    inputArgs,\n    0, // amount\n    2 * Math.pow(10, 13), // gas\n    1 // weight\n  )\n  .deleteKey(new PublicKey(near.signerAccountPk()))\n  .deleteAccount(\"beneficial_account_id\");\n\nreturn promise;\n```\n\nIn the case of deploy contract, `includeBytes` is a helpful build-time util. You can include the content of a wasm contract, by using `includeBytes('path/to/contract.wasm')`.\n\nIn the case of `addFullAccessKey`, `addAccessKey` and `stake`, it takes a `PublicKey` object, you can find more details about it in the Types sections below.\n\nBesides above APIs to build something on top of an API, you can also chain promises with `.then` and `.and`, they're equivalent to promiseThen, promiseAnd:\n\n```js\n// assume promise, promise2 and promise3 are create with above APIs, with several actions added like above.\npromise.and(promise2).then(promise3); // promiseAnd of [promise_id, promise2_id], then promiseThen(promise_and_id, promise3_id)\n\nreturn promise;\n```\n\n### Types\n\nNEAR-SDK-JS also includes type defintions that are equivalent to that in Rust SDK / nearcore. You can browse them in near-sdk-js/src/types. Most of them are just type alias to Bytes and bigint.\n\n#### Public Key\n\nPublic Key is representing a NEAR account's public key in a JavaScript class. You can either initiate a Public Key from binary data, or from a human readable string.\n\nThe binary data is in the same format as nearcore, but encoded in bytes. That's one byte to represent the curve type of the public key, either ed25519 (`\\x00`), or secp256k1 ('\\x01'), follows by the curve-specific public key data in bytes. Examples:\n\n```js\nnew PublicKey(near.signerAccountPk());\nnew PublicKey(\n  \"\\x00\\xeb\\x7f\\x5f\\x11\\xd1\\x08\\x1f\\xe0\\xd2\\x24\\xc5\\x67\\x36\\x21\\xad\\xcb\\x97\\xd5\\x13\\xff\\xa8\\x5e\\x55\\xbc\\x2b\\x74\\x4f\\x0d\\xb1\\xe9\\xf8\\x1f\"\n);\nnew PublicKey(\n  \"\\x01\\xf2\\x56\\xc6\\xe6\\xc8\\x0b\\x21\\x3f\\x2a\\xa0\\xb0\\x17\\x44\\x23\\x5d\\x51\\x5c\\x59\\x44\\x35\\xbe\\x65\\x1b\\x15\\x88\\x3a\\x10\\xdd\\x47\\x2f\\xa6\\x46\\xce\\x62\\xea\\xf3\\x67\\x0d\\xc5\\xcb\\x91\\x00\\xa0\\xca\\x2a\\x55\\xb2\\xc1\\x47\\xc1\\xe9\\xa3\\x8c\\xe4\\x28\\x87\\x8e\\x7d\\x46\\xe1\\xfb\\x71\\x4a\\x99\"\n);\n```\n\nThe human readable form is `ed25519:` or `secp256k1:` following base58-encoded public key. And initialize the Public Key with `PublicKey.fromString`:\n\n```js\nPublicKey.fromString('ed25519:DXkVZkHd7WUUejCK7i74uAoZWy1w9AZqshhTHxhmqHuB`)\nPublicKey.fromString('secp256k1:5r22SrjrDvgY3wdQsnjgxkeAbU1VcM71FYvALEQWihjM3Xk4Be1CpETTqFccChQr4iJwDroSDVmgaWZv2AcXvYeL`)\n```\n\nOnce a PublicKey object is created, it can be used in high level promise APIs that takes a public key, such as `addFullAccessKey`, `addAccessKey` and `stake`.\n","engines":{"node":">=14 <16.6.0 || >16.6.0"},"gitHead":"5b30e812ff17118bea0e33524dff59d3a5c49e00","scripts":{"lint":"eslint --fix .","test":"run-s test:*","build":"tsc -p ./tsconfig.json && chmod u+x lib/cli/cli.js","format":"prettier --write .","pretest":"yarn build","test:unit":"yarn && cd tests && yarn && yarn build && yarn test && cd ..","postinstall":"cd lib/cli && rm -rf deps && mkdir -p deps && cd deps && node ../post-install.js","test:examples":"yarn && cd examples && yarn && yarn build && yarn test && cd .."},"_npmUser":{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"},"repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.11.0","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"resolutions":{"**/@types/estree":"^1.0.0"},"_nodeVersion":"16.16.0","dependencies":{"rollup":"^2.61.1","signale":"^1.4.0","commander":"^9.4.1","@babel/core":"^7.17.5","@scure/base":"^1.1.1","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@babel/preset-typescript":"^7.18.6","rollup-plugin-sourcemaps":"^0.6.3","@rollup/plugin-node-resolve":"^13.1.1","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"eslint":"^8.23.1","prettier":"^2.7.1","typescript":"^4.7.2","@types/node":"^17.0.38","npm-run-all":"^4.1.5","@types/eslint":"^8.4.6","@types/rollup":"^0.54.0","@types/signale":"^1.4.4","@types/babel__core":"^7.1.19","@types/babel__traverse":"^7.18.1","eslint-config-prettier":"^8.5.0","@rollup/plugin-typescript":"^8.3.2","@typescript-eslint/parser":"^5.37.0","@typescript-eslint/eslint-plugin":"^5.37.0"},"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_0.6.0-0_1666336642515_0.45712685411907406","host":"s3://npm-registry-packages"}},"0.6.0":{"name":"near-sdk-js","version":"0.6.0","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@0.6.0","maintainers":[{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"bin":{"near-sdk-js":"lib/cli/cli.js"},"dist":{"shasum":"cad11a57c1b9973c8e074a6a1f3813a8bbf7dfaa","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-0.6.0.tgz","fileCount":675,"integrity":"sha512-rd3YTFfmnC9cF4W5Ckgeh05RbH9vahEOkU8VncwYfZPKuozsppI+NpMqtaB2bzbCqJuKB0GFm4i3APlbEvvP9A==","signatures":[{"sig":"MEUCIQDd2n5WxrKnK/+J3ouvNqlD7+G+KmFGvIzPr9tT9Fy3twIga73NYUb58c9EbTYDVaXNUEB/Yqd5HNQslZScDEOc4Ms=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":143042945,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjX+7BACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqmKxAAjVLevMCEA7eEMo1lzKebnZQPUSOaG0NBUiqFQuer1jI9qmmq\r\nMWleqDCfSp2pGGmbliglh+immcAg/swd5oDzAc66wGnqPF9W53MTNXwknMmj\r\nAboI6U+P9EaLETTmvVN3cgu/mmU295GD4kDUQDCXTa3MiUSlE+WecmrddCb2\r\nxunalWRhzfSLNtKHeYZsTWOSPUJqAio2fKaU/vw7r4wdIUtJwHQZe83438G0\r\nlCkjc8y/7RO975IK2QMKIFxUl9BP+ibzP+DdCs5FmGg3WDHEfeuGD1H+u0vs\r\noth8iojyXUME3APDnqc8C2mv7lavq3EoYEb5NR4lG40i4mJkH8dRW9R9As7m\r\nquEkepFbhRZXfHLyOAkU4+nHAAq+4S4AKelMFQ6ZM9yWcztm0yPUZGHXLuPd\r\n0auCW0W6tHo98knVY09oKZpZNnL/GJBAFtQEFA+kREcaNMl4wNI9gWrdh8Sc\r\nUPn87QSaX2jFyEGpjyxNaC+1cf5y8i5IRILOXHoiPj34+KUcTnaanhCQDrso\r\nvG2M8T5UO/ZIDaXJSBP1PQQ48OAANxBXG8pvv1I58DIhYh9SdUkmS785t0qr\r\n8+jC7MpGwzU7UwZeyAZJORMcGWFAyowkGDbIC+glQBS4F8K01K5zpQDielsy\r\nUS608AZScQuCoL+KzeSHHSNQD6o7y42P8Es=\r\n=g/h/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","engines":{"node":">=14 <16.6.0 || >16.6.0"},"gitHead":"9a45a5411fb15ddb9e8260df64cf0e2b3e87bfc0","scripts":{"lint":"eslint --fix .","test":"run-s test:*","build":"tsc -p ./tsconfig.json && chmod u+x lib/cli/cli.js","format":"prettier --write .","pretest":"yarn build","test:unit":"yarn && cd tests && yarn && yarn build && yarn test && cd ..","postinstall":"cd lib/cli && rm -rf deps && mkdir -p deps && cd deps && node ../post-install.js","test:examples":"yarn && cd examples && yarn && yarn build && yarn test && cd .."},"_npmUser":{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"},"repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.11.0","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"resolutions":{"**/@types/estree":"^1.0.0"},"_nodeVersion":"16.16.0","dependencies":{"rollup":"^2.61.1","signale":"^1.4.0","commander":"^9.4.1","@babel/core":"^7.17.5","@scure/base":"^1.1.1","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@babel/preset-typescript":"^7.18.6","rollup-plugin-sourcemaps":"^0.6.3","@rollup/plugin-node-resolve":"^13.1.1","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"devDependencies":{"chalk":"^5.1.0","eslint":"^8.23.1","prettier":"^2.7.1","ts-morph":"^16.0.0","typescript":"^4.7.2","@types/node":"^17.0.38","npm-run-all":"^4.1.5","@types/eslint":"^8.4.6","@types/rollup":"^0.54.0","@types/signale":"^1.4.4","@types/babel__core":"^7.1.19","@types/babel__traverse":"^7.18.1","eslint-config-prettier":"^8.5.0","@rollup/plugin-typescript":"^8.3.2","@typescript-eslint/parser":"^5.37.0","@typescript-eslint/eslint-plugin":"^5.37.0"},"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_0.6.0_1667231424303_0.08413535457699606","host":"s3://npm-registry-packages"}},"0.7.0-0":{"name":"near-sdk-js","version":"0.7.0-0","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@0.7.0-0","maintainers":[{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"bin":{"near-sdk-js":"lib/cli/cli.js"},"dist":{"shasum":"726d658e3389d4f6888f73f8393d8a5a6de34e3b","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-0.7.0-0.tgz","fileCount":53,"integrity":"sha512-ZqTxeIc090LQmlmfYqEkytFGCIee7idf2xNcm4sg2QGFRn3l5CgRsqkmsRcQIBfAfRSm8l36GIXGARuUsOQNRw==","signatures":[{"sig":"MEUCIGkUjFJ6aDMPbY/TfFBEioUB9CPJoDZ4aM+mcBCYK0apAiEAyZACyxuPo2QRppikzW9ghZBkWTIrOnqr+MLmLX1I2eA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":249270,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtmPOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpk5Q/+IEbuvKfO22h43KZa6ZKxoiESB2vAJ/jNtuXoHI8EoJmpX3dL\r\nwsr784eRYHv0z88jYvR6ltfHEP1zGNlYGfx1Q2C1n09OhNhPYhTCxN46kuFM\r\npa/QIe3JIKwYmGBBXDBQGOJOTN9jtpiNQ3iYXypYx7IpAlbJayqgoct+7sIN\r\nHUfj0VIkVhgmXnji2FkL9YkljfHwLk7TQULHdYkhJJNXVJeIhjHfT3D59RTn\r\nZc1dhKwFsD0nUUDtu/LVAOqHOfCafVv3xP1BEg9N/WKiIqonRT3lE216lfve\r\nVYQ8u3RMi8+7c2+bW+KUL3MA7O8o+/pDB9CS6jC8JnzDdlX8ls+vNoRr96ty\r\n1817oiql91fO6w+zNnOJmqkiX+0hsJ3yo27mcfMJRlxLOA+J8UA07lwoQhY0\r\n7gXJ0ehHKaYCOGjMq0oJMLCzbURJXjneeQHOcE4GfzH/7JSnjkhM/YABweHO\r\n199VZ2SXog/4RN12NbA0ioQoJcmT4R3U+i+AY0lRXz5iDljUPvv5MdHVDmOc\r\ne6YavSHfBaLPvqYoJz+2t0Nc/dqZAIfqWDQqyvJjuOAyPUuKx+6UN263SXlD\r\nwuZ+OeoKbtkoS/TvC3lUZrKecIsu+9htK3mh4UofMdTe6vCli92hCGKt1eW+\r\ndjxHFmAys/SSxXHz6/lKQTkTwsgteyHTK7M=\r\n=Z9AK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","gitHead":"263c9695ab7bb853ced12886c4b3f8663070d900","scripts":{"lint":"eslint --fix .","build":"tsc -p ./tsconfig.json","format":"prettier --write .","preinstall":"npx only-allow pnpm","postinstall":"node lib/cli/post-install.js"},"_npmUser":{"name":"boatnear","email":"bo@near.org"},"repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.3.1","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"16.14.0","dependencies":{"eslint":"^8.20.0","rollup":"^2.61.1","signale":"^1.4.0","near-abi":"^0.1.0","ts-morph":"^16.0.0","commander":"^9.4.1","typescript":"~4.7.2","@babel/core":"^7.20.5","@scure/base":"^1.1.1","json-schema":"0.4.0","@babel/types":"^7.20.5","@types/estree":"^1.0.0","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@babel/preset-typescript":"^7.18.6","rollup-plugin-sourcemaps":"^0.6.3","@typescript-eslint/parser":"^5.31.0","@rollup/plugin-node-resolve":"^13.1.1","near-typescript-json-schema":"0.55.0","@typescript-eslint/eslint-plugin":"^5.31.0","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"devDependencies":{"chalk":"^5.1.0","eslint":"^8.23.1","prettier":"^2.7.1","typescript":"^4.7.2","@types/node":"^17.0.38","npm-run-all":"^4.1.5","@types/eslint":"^8.4.6","@types/rollup":"^0.54.0","@types/signale":"^1.4.4","@types/babel__core":"^7.1.19","@types/babel__traverse":"^7.18.1","eslint-config-prettier":"^8.5.0","@rollup/plugin-typescript":"^8.3.2","@typescript-eslint/parser":"^5.37.0","@typescript-eslint/eslint-plugin":"^5.37.0"},"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_0.7.0-0_1672897485825_0.6652973145292682","host":"s3://npm-registry-packages"}},"0.7.0-1":{"name":"near-sdk-js","version":"0.7.0-1","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@0.7.0-1","maintainers":[{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"bin":{"near-sdk-js":"lib/cli/cli.js"},"dist":{"shasum":"6a41ead3de450505f15ea290b36171e4c79d729a","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-0.7.0-1.tgz","fileCount":53,"integrity":"sha512-JT4K1zP5z1eyRi3vn8WyZyAsyvS1GrSCtGlgetkO0xw3HBLxvuoqVUGm8pg+LX5IWyGeuXgqKU6LRjM2jJNLeg==","signatures":[{"sig":"MEQCIBLSxclQT3C1tk6BItHRawpdPQorob65MoJ7kLvrQfsZAiBrhR6ug9jBSLsdNhR2G9bSbPrXH9xVgkW0txx3LhP0LA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":249794,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjt4QIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoItQ/9Er1FhIfjgUhKvHkkrQzGJTroVy69otr3RxtsTBfgEPk8vWZp\r\nA9+Vf7Ofd8p7QXq6ZZdDuZZuf/4QVrFf+f+jkM8o4iOccJ89K+0E4hEwrbfq\r\nUi2uVs3T6CZ2O96oV/0dGoZITcXDt+fq96y3MwbZhUeYn0VB0YNrlr+02Z7S\r\nVaI+ufHCGHpgNuDyFtVIBNBGzqwqyZ3CobyZZYvD2ui+prr/a94+NQhHT2pM\r\nrntvOspOw8hK3XSquVMMUw9Lwyqjb2kCq0bVbC/FAq3Z0wVs1g9yrj9yt/1k\r\nZH1fyceC9pYmYs3tDsbLB3AJ2BBu6eEeWnF8ET/5yukNosWLWWmWsql5Fek/\r\n6gCFmnNvxq598Bv3+ibKva41FglSQxFp9Wo+bQ6k1YukO2OF2+LwHM13OSXG\r\n7Tg2wbYoH1kYk9frUViasUO0+9eSqudWRM01OnAOJv4op6zwznDaUEvgrozm\r\n2J+EErnEefTLeLsKmC02PvxegVM0W2+Gbzzd37ewmmyHUoRJoxxLhyTm57Wu\r\nLmxBO7fTifV3vLHTbwCA4rlnQP+kf9I4QVP8YcI9o11sv9p1W3dfxIDw7MKX\r\nSeyJvJ3ZdPVnDc+D/2wulWtSenqssmhK5wPjkG+QBvJwyfR5thi0XPY7woVx\r\n9Ba/LC28FQc7WtIMEz0k0V51h5QHnUed+Zo=\r\n=FnVm\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","gitHead":"263c9695ab7bb853ced12886c4b3f8663070d900","scripts":{"lint":"eslint --fix .","build":"tsc -p ./tsconfig.json","format":"prettier --write .","preinstall":"npx only-allow pnpm","postinstall":"node lib/cli/post-install.js"},"_npmUser":{"name":"boatnear","email":"bo@near.org"},"repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.3.1","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"16.14.0","dependencies":{"eslint":"^8.20.0","rollup":"^2.61.1","signale":"^1.4.0","near-abi":"^0.1.0","ts-morph":"^16.0.0","commander":"^9.4.1","typescript":"~4.7.2","@babel/core":"^7.20.5","@scure/base":"^1.1.1","json-schema":"0.4.0","@babel/types":"^7.20.5","@types/estree":"^1.0.0","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@babel/preset-typescript":"^7.18.6","rollup-plugin-sourcemaps":"^0.6.3","@typescript-eslint/parser":"^5.31.0","@rollup/plugin-node-resolve":"^13.1.1","near-typescript-json-schema":"0.55.0","@typescript-eslint/eslint-plugin":"^5.31.0","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"devDependencies":{"chalk":"^5.1.0","eslint":"^8.23.1","prettier":"^2.7.1","typescript":"^4.7.2","@types/node":"^17.0.38","npm-run-all":"^4.1.5","@types/eslint":"^8.4.6","@types/rollup":"^0.54.0","@types/signale":"^1.4.4","@types/babel__core":"^7.1.19","@types/babel__traverse":"^7.18.1","eslint-config-prettier":"^8.5.0","@rollup/plugin-typescript":"^8.3.2","@typescript-eslint/parser":"^5.37.0","@typescript-eslint/eslint-plugin":"^5.37.0"},"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_0.7.0-1_1672971271804_0.7456317472807241","host":"s3://npm-registry-packages"}},"0.7.0-2":{"name":"near-sdk-js","version":"0.7.0-2","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@0.7.0-2","maintainers":[{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"bin":{"near-sdk-js":"lib/cli/cli.js"},"dist":{"shasum":"9ec52a74743fe4064188d841aa1747a2c097f911","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-0.7.0-2.tgz","fileCount":53,"integrity":"sha512-aW6Yf+37B0QTqq8Z06GlFEJpmPl8EDUZvVy/uNBf7qNzvvfZ5EM+oUuYWCM+OOSy2nxHyYC+5P0zOlWhYihguw==","signatures":[{"sig":"MEUCIAsIO78uu5/8va1kjPG1H5ONODJE8QfuUHT1ZRtfj18rAiEAsul5pbEkXf1o/Zb9Zl3Walrq+o2LJ/Oz1ie/rD4D09s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":249794,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjt44pACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmowfQ/+Ke9dOiwvL86le7ySoaA7xg9e5nrSbAdmscfbJqg8LGve9vi6\r\nf1xp8Nq5ISx0VVBoQk/IAWwmnZAwJ4tshBi7UcmL0QiNkwn3YxkmVXhHWcSG\r\nNTniwjnTIOsB0sNY0bgr+qGu8N+jVQbd8uu+Pya+65OxaG74t5kOkHcnQBZL\r\n3Y1mJP3NjrVYqGMV1lEwJ7VaXATdrfuxSPN9IIvipDxfx+Q8Ro3Xuzak+jX3\r\nymHK/bJgm2LSnxI6ZCJgf84L6NMlWbXd1axje9OQjzUlVD+glKIrDxMsjW6z\r\n0YeYbVO1CV2XSyr4+QFirfUYnNrQTygpR8LcIJdQx3YFidSZ7JBso+LcUxm0\r\n9CpoJUAtT3rSS7dPR2DbO2bI+Y8K75QQ23I/N1+w9mixyQh9BdDiLNfEsGAH\r\nPRKmkY0GIRzBB0VnxhY2RNVS26d0VD059iqkyq6dIc0EPw9nsYSxstoBUBWX\r\nIZ2oH353Xttf6HRQJqcztdukz83rK0MsweyHDRtJ2l/DaHz2hzmSTa+OWkg8\r\nlHfBN3gkCqDJ4myhtSyFHWz1fWV60mPF563B/QoyIG7+5Z3L9ygVFg0n9zOu\r\n/65ccGmwIC3/d40czNhzu7fo6boercBjDQMk2r/vvlkL5Wabzdn0PtHAYTfP\r\nXDEp+Gtk12/eEGkp1ypSqe1tWyZft0lzAAY=\r\n=5r1P\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","gitHead":"cd0d001933a7306d94f56b3cf5a6dd06c6d076fd","scripts":{"lint":"eslint --fix .","build":"tsc -p ./tsconfig.json","format":"prettier --write .","preinstall":"npx only-allow pnpm","postinstall":"node lib/cli/post-install.js"},"_npmUser":{"name":"boatnear","email":"bo@near.org"},"repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.3.1","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"16.14.0","dependencies":{"eslint":"^8.20.0","rollup":"^2.61.1","signale":"^1.4.0","near-abi":"^0.1.0","ts-morph":"^16.0.0","commander":"^9.4.1","typescript":"~4.7.2","@babel/core":"^7.20.5","@scure/base":"^1.1.1","json-schema":"0.4.0","@babel/types":"^7.20.5","@types/estree":"^1.0.0","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@babel/preset-typescript":"^7.18.6","rollup-plugin-sourcemaps":"^0.6.3","@typescript-eslint/parser":"^5.31.0","@rollup/plugin-node-resolve":"^13.1.1","near-typescript-json-schema":"0.55.0","@typescript-eslint/eslint-plugin":"^5.31.0","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"devDependencies":{"chalk":"^5.1.0","eslint":"^8.23.1","prettier":"^2.7.1","typescript":"^4.7.2","@types/node":"^17.0.38","npm-run-all":"^4.1.5","@types/eslint":"^8.4.6","@types/rollup":"^0.54.0","@types/signale":"^1.4.4","@types/babel__core":"^7.1.19","@types/babel__traverse":"^7.18.1","eslint-config-prettier":"^8.5.0","@rollup/plugin-typescript":"^8.3.2","@typescript-eslint/parser":"^5.37.0","@typescript-eslint/eslint-plugin":"^5.37.0"},"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_0.7.0-2_1672973865601_0.37277205832987614","host":"s3://npm-registry-packages"}},"0.7.0-3":{"name":"near-sdk-js","version":"0.7.0-3","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":"Near Inc <hello@nearprotocol.com>","license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@0.7.0-3","maintainers":[{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bin":{"near-sdk-js":"lib/cli/cli.js"},"dist":{"shasum":"b4cfc43e5037c865bbcc3ba5c6be968306e3a173","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-0.7.0-3.tgz","fileCount":54,"integrity":"sha512-7rnFPMTRcSUD1uHA/fNVqqH/KwVLIj7BhPeerTY917QKe3fOXxejaJ8K6SAnsH/rF6dd+lxlFVm9SX+cEy9Q3g==","signatures":[{"sig":"MEYCIQDPA12R93rEPNxtALI//JWhNkh8HcduufMoI1rQugswoAIhAPKnA6VgU9V5UzPYH236iSoVHFR8rvekX7jjwR9ytQTO","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":250812,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjyPYLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpjow//dReF3j3J3RZTtAi2EbvZGw6fxTPCGi08JNIyA+YOHAUPdEUg\r\nLyOWJXeIStwflRU0/1rFNYVDyzCmXCGrs8cH8Kv4OA27oELKMBmgIxOJe0yq\r\nnq6YCJpbfqM3YGbzVrifhdV9mHdoUt3ILYuYyOE36gs6R6qGKofgGmaP86QT\r\n3y1JsFLXuXMudY/Jkcei7uDZ70U9HbW2OMFJrb3EBV84xM1eNf68JNpZui99\r\n2Q1+HDTmrFgsVUr8Iw75XzbjdP0CkoakCgeOYaiQX88nmSbO8jLXQyhQ69Gm\r\ncNRJ2keiHvQ5tNxbZxT5wnmISB1k5ijNIwmB3UD/M8/QAMJNAW6yYVUxthO5\r\nMFdCDGTMMHwR1JsfcDzX4XgUZEkG3hSRTFt3+MtxqKEjnbXYJN3nVmDomLQM\r\naBWj9ZjEHe+x9utnQCkpTvGjREo5gcbmt2du4aV/3JBWgmdcFAX0y7um1D54\r\nQ1wXPGTaGO2op8RjqnTPjV52uaw2jayxZujtVEADayWauIN4Bicng2cXezR9\r\nubor9q5lBguAXTqj2V4aQTKoOlZ7yxzGG941oPpLRk2pi7QgoB0obAiYMr2c\r\nwKFX7EHCB+kq/6ph2+Qdbeyx0ab7KNEkSZMtxjayr8IjKsnqLbmgWsMoIWy3\r\nUTgX0nOBZVoQquon360R4mf7OV3bSDfJ8rY=\r\n=qbnR\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","_from":"file:near-sdk-js-0.7.0-3.tgz","types":"lib/index.d.ts","scripts":{"lint":"eslint --fix .","build":"tsc -p ./tsconfig.json","format":"prettier --write .","preinstall":"npx only-allow pnpm","postinstall":"node lib/cli/post-install.js"},"_npmUser":{"name":"boatnear","email":"bo@near.org"},"_resolved":"/tmp/923c83c568d998dcce64ca93e660339f/near-sdk-js-0.7.0-3.tgz","_integrity":"sha512-7rnFPMTRcSUD1uHA/fNVqqH/KwVLIj7BhPeerTY917QKe3fOXxejaJ8K6SAnsH/rF6dd+lxlFVm9SX+cEy9Q3g==","repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.3.1","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"16.14.0","dependencies":{"eslint":"^8.20.0","rollup":"^2.61.1","signale":"^1.4.0","near-abi":"^0.1.0","ts-morph":"^16.0.0","commander":"^9.4.1","typescript":"~4.7.2","@babel/core":"^7.20.5","@scure/base":"^1.1.1","json-schema":"0.4.0","@babel/types":"^7.20.5","@types/estree":"^1.0.0","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@babel/preset-typescript":"^7.18.6","rollup-plugin-sourcemaps":"^0.6.3","@typescript-eslint/parser":"^5.31.0","@rollup/plugin-node-resolve":"^13.1.1","near-typescript-json-schema":"0.55.0","@typescript-eslint/eslint-plugin":"^5.31.0","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"devDependencies":{"chalk":"^5.1.0","json5":"^2.2.3","eslint":"^8.23.1","prettier":"^2.7.1","typescript":"^4.7.2","@types/node":"^17.0.38","npm-run-all":"^4.1.5","@types/eslint":"^8.4.6","@types/rollup":"^0.54.0","@types/signale":"^1.4.4","@types/babel__core":"^7.1.19","@types/babel__traverse":"^7.18.1","eslint-config-prettier":"^8.5.0","@rollup/plugin-typescript":"^8.3.2","@typescript-eslint/parser":"^5.37.0","@typescript-eslint/eslint-plugin":"^5.37.0"},"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_0.7.0-3_1674114571311_0.704001238648849","host":"s3://npm-registry-packages"}},"0.7.0-4":{"name":"near-sdk-js","version":"0.7.0-4","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":"Near Inc <hello@nearprotocol.com>","license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@0.7.0-4","maintainers":[{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bin":{"near-sdk-js":"lib/cli/cli.js"},"dist":{"shasum":"d9d0b57bcdef20b127b6b1259f3e7b27543afc1d","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-0.7.0-4.tgz","fileCount":54,"integrity":"sha512-JdExwKWvMaTrQL/A30b5M18NM/4NF4G5vcAxTdrt1B6zevEL0hmTWPIUXc8KIFGj8xllyyqaJogL4kUsjAUC3Q==","signatures":[{"sig":"MEUCIQD7duXADQ0aR+Idmc3vYq8Id4nAm3R+6HCLJ8ahhF+qBgIgXJwTyCTprOOBaI2M+6hArPbUuoKePdna1yazybh5AeA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":250812,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjyQXRACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqdEQ/9HR6rrVIzzKGFGmwLbVqLvux0O0cOVGTbs6491Id2IODUt+jZ\r\nx4QKD5kHHLaMWNkXr9/NSYhL3Qt6kXcIocKYMYFw04WAvh5UV3wIxAwhIbaw\r\nln5qd6C1rQ7l8xHGoKhSVU4XeiC43r4sPspgqOCbRDrOu6awzT2kOb8iVgeT\r\n/lBvpH1QF+0GUqx6Dy27hke4rsH6YV4OtD4qIIln0rwp7WnvpJwGdsLcEfcY\r\n43K2xxGVa8LnAcwua7dBfsxP5soSuzaSBmauJGaxw4QWM8ty6PUfolHGEXqq\r\nkPSrLZBBxktoLr8Qm7aOfuAG29ri5ktrm2IOqR5FWSw3JOiVE3vAnaUIYwjN\r\n018jZxs/NSpK7qMcO62uZd9S9BDljF6HqbWLddOX90ufsXRLyFTmXkHdbv4Y\r\nVvxpmVWga1RWt1b6h2WhZZ5B8UKK6fMZbMvo4djNkxM/Q36QbvQpxSWZkBAr\r\nEz+dRDrN1WWpFjtkfrr3kbGwRHWs5zIgf1xpLIcfhTfdlxvW91yDWbtdy2Ly\r\nqzg8QD0jUVQXSV+dbFlPAFAZ/7Ddtb7u1sNmzJCLoGQJ8r4JL7bYv8PNp4oI\r\njRC+O/msxSz9Dpx+3o4Qj8AJPLGzlfch1D0+CFtL29RgvOTOUPcHHn3/fF+K\r\nVt21D2aWAObksfHdX37X7F+X06Ei/wH5hhQ=\r\n=Tn2Z\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","_from":"file:near-sdk-js-0.7.0-4.tgz","types":"lib/index.d.ts","scripts":{"lint":"eslint --fix .","build":"tsc -p ./tsconfig.json","format":"prettier --write .","preinstall":"npx only-allow pnpm","postinstall":"node lib/cli/post-install.js"},"_npmUser":{"name":"boatnear","email":"bo@near.org"},"_resolved":"/tmp/bf9562bbfac47b10c4ae2a70b46399d1/near-sdk-js-0.7.0-4.tgz","_integrity":"sha512-JdExwKWvMaTrQL/A30b5M18NM/4NF4G5vcAxTdrt1B6zevEL0hmTWPIUXc8KIFGj8xllyyqaJogL4kUsjAUC3Q==","repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.3.1","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"16.14.0","dependencies":{"eslint":"^8.20.0","rollup":"^2.61.1","signale":"^1.4.0","near-abi":"^0.1.0","ts-morph":"^16.0.0","commander":"^9.4.1","typescript":"~4.7.2","@babel/core":"^7.20.5","@scure/base":"^1.1.1","json-schema":"0.4.0","@babel/types":"^7.20.5","@types/estree":"^1.0.0","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@babel/preset-typescript":"^7.18.6","rollup-plugin-sourcemaps":"^0.6.3","@typescript-eslint/parser":"^5.31.0","@rollup/plugin-node-resolve":"^13.1.1","near-typescript-json-schema":"0.55.0","@typescript-eslint/eslint-plugin":"^5.31.0","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"devDependencies":{"chalk":"^5.1.0","json5":"^2.2.3","eslint":"^8.23.1","prettier":"^2.7.1","typescript":"^4.7.2","@types/node":"^17.0.38","npm-run-all":"^4.1.5","@types/eslint":"^8.4.6","@types/rollup":"^0.54.0","@types/signale":"^1.4.4","@types/babel__core":"^7.1.19","@types/babel__traverse":"^7.18.1","eslint-config-prettier":"^8.5.0","@rollup/plugin-typescript":"^8.3.2","@typescript-eslint/parser":"^5.37.0","@typescript-eslint/eslint-plugin":"^5.37.0"},"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_0.7.0-4_1674118608874_0.5630259960699675","host":"s3://npm-registry-packages"}},"0.7.0-5":{"name":"near-sdk-js","version":"0.7.0-5","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":"Near Inc <hello@nearprotocol.com>","license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@0.7.0-5","maintainers":[{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bin":{"near-sdk-js":"lib/cli/cli.js"},"dist":{"shasum":"a5949f100f0d847115a419080d2cbd749133ad31","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-0.7.0-5.tgz","fileCount":54,"integrity":"sha512-hb+93tBqGAJUNIWQFC8af4+Sl1MNg1ochtv4te3htWfUjyCXB6BOaTnY0SjaZZfphazwfl17lKOmhgMV4gSjNw==","signatures":[{"sig":"MEUCIBpvbNtgQucPCs1tzHPABkNeDMajbf3azdbWbfuWQZhtAiEAyN4Yzf5PXYns/SAM5vjsaZcw5PhQfP13OF2YX7LsMBE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":250969,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjyRXoACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqCwBAAlSyqxfC7Mgs2GLn9s+lVQr9Jj46QxOvCscKEZGaq4wd4fraA\r\n5q/AEi0cI3DJHxNrfiewsuTjRdTA/B59hKz2ReCTa6Euj/FS0ulMmatSWiMr\r\n34UYH9jOK+EANexPi/JgLue/piTW6Ev1IYn0iPUBK51+iaTty32wxpPu8ET2\r\nzWNSHWIQMhHfh/O2cxM3ebQVuV0wuTQWrwugmr0HHe6t48BwUdUfGhZu1IE9\r\nx/kvWiSb4y0nOf1x0vayE+ECEe7PJRgQoDFWg7ucWjrs82iYjwD30vk9OqxJ\r\njcSdnxjPinZZdGM5MXGb/vrbbyYjiF59r/INpekzn6awymdWyTeoYbXn8W6h\r\nzyWeYtLWQQD/06XOZ3NXW0rVtYYULsu4CgV9U7Vu3k+b6EZDjanS8QSnBuqb\r\nJduhj9k9x77mIwFI647bokN2zqHwI5407SYrMgY5vpW9xb7UTSJ5jEEbF5O6\r\n345w351Q41LnGQJIBqjIww5DvKPkxg0BLmkvlD7+b+uVEiw6/Td408vpBKzp\r\nJAZDt5slijJF5TI3kZ8N8jDANL1RvsCtXNf3583dtm2KqKNoUV3d76oM/hPr\r\nr2LAfmYiXsOoCB2Y9ZN3vMWYglVCoZnTfonAyQyrkFhk4FUwx2H1hopSOTFC\r\nkXY2Y+6UVnuJtWrRxTuu3odv4AdeMdDm/Wc=\r\n=dZlX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","_from":"file:near-sdk-js-0.7.0-5.tgz","types":"lib/index.d.ts","scripts":{"lint":"eslint --fix .","build":"tsc -p ./tsconfig.json","format":"prettier --write .","preinstall":"npx only-allow pnpm","postinstall":"node lib/cli/post-install.js"},"_npmUser":{"name":"boatnear","email":"bo@near.org"},"_resolved":"/tmp/32c08e855f7c059914a1fd36bb60ec6e/near-sdk-js-0.7.0-5.tgz","_integrity":"sha512-hb+93tBqGAJUNIWQFC8af4+Sl1MNg1ochtv4te3htWfUjyCXB6BOaTnY0SjaZZfphazwfl17lKOmhgMV4gSjNw==","repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.3.1","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"16.14.0","dependencies":{"eslint":"^8.20.0","rollup":"^2.61.1","signale":"^1.4.0","near-abi":"^0.1.0","ts-morph":"^16.0.0","commander":"^9.4.1","typescript":"~4.7.2","@babel/core":"^7.20.5","@scure/base":"^1.1.1","json-schema":"0.4.0","@babel/types":"^7.20.5","@types/estree":"^1.0.0","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@babel/preset-typescript":"^7.18.6","rollup-plugin-sourcemaps":"^0.6.3","@typescript-eslint/parser":"^5.31.0","@rollup/plugin-node-resolve":"^13.1.1","near-typescript-json-schema":"0.55.0","@typescript-eslint/eslint-plugin":"^5.31.0","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"devDependencies":{"chalk":"^5.1.0","json5":"^2.2.3","eslint":"^8.23.1","prettier":"^2.7.1","typescript":"^4.7.2","@types/node":"^17.0.38","npm-run-all":"^4.1.5","@types/eslint":"^8.4.6","@types/rollup":"^0.54.0","@types/signale":"^1.4.4","@types/babel__core":"^7.1.19","@types/babel__traverse":"^7.18.1","eslint-config-prettier":"^8.5.0","@rollup/plugin-typescript":"^8.3.2","@typescript-eslint/parser":"^5.37.0","@typescript-eslint/eslint-plugin":"^5.37.0"},"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_0.7.0-5_1674122728030_0.9267778504459954","host":"s3://npm-registry-packages"}},"0.7.0":{"name":"near-sdk-js","version":"0.7.0","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":"Near Inc <hello@nearprotocol.com>","license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@0.7.0","maintainers":[{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bin":{"near-sdk-js":"lib/cli/cli.js"},"dist":{"shasum":"b725a1922bf2327c73336b6fe7d294ab987aed73","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-0.7.0.tgz","fileCount":54,"integrity":"sha512-2hwYtzO8Yqt2nVMpyHcvcb1eQiVQwnFnAf6OCMS2mxHh5xwBNi7NCDYgpAT67NXPXD52sWfWq9sNT7w1lWB+vg==","signatures":[{"sig":"MEUCIQCtdfUjtRjiVVRTbuh8THib4geIx8HALgw1cUPBR1Is7AIgCzc6CDf6+v5KeZ1NdXjb7BAcyhOFN3Sw2vDQTItoJZ8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":251771,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj0dqTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq+BQ//bx/zkkHgHYrhLuC2e5LTu9DhKqNChbW5ZhlHbQeNQwnRY2M+\r\nzI+E0x1CZqfdqfUNJK0B+6W5vjWSIkiPlThqoOmv1H1gCkPXAE1OWd+nKi54\r\nEYQfjMB1tr+zLA0e2s2ptADZ64STLdWRGrzPHlF4naedfGGXzm17K9fQXnqA\r\nN0ixXm6yxmvGNAHp4R3XVdBMBBGJemsHk4hsKPtX1Mj1zZXUcCsuwjOp0L/f\r\niukASqs6EwBnFlrB4nIMgr5yIzvJ5elpJK33SQU3UIYRCdne/1uuKDR9Cuou\r\nywFSCi1g5nxzLz2XtQ8vOKOYRNQAM+jk3h8zWOlpR9EHmucstpG0pu+f32E2\r\n6Y6AdaqdknR3nNQg4SXO4d8r3Sk9Uy6PcEQMNzpHzt1db/Fgn1VHS4mWA5Ug\r\ncQ3dWi3oZU3DKmmCuf6nyS0g+eQ+exJkaHAblZbzdNBUhnQqbjDDGYpJpYo4\r\nu3LHgXpMN1jIHyP9vZb5tLQT+ezhqzXzKEZiRsIvBgk/dW0i+/gEdeRqBuAY\r\n4zpsM4UPOgMDARbDgUtumCV1EMkXGbLUjnFx+H+ICCOEWsQnlUVRT9/yMA/G\r\npKM8J5YFa+PGny0bu7vueezLi2qNFaOjgn41095nWtvR7scUsUmx7N04ycqW\r\nrehHJLrJSNpTUBbtFw57ZtNd+YN2tQ2uRm0=\r\n=5uWN\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","_from":"file:near-sdk-js-0.7.0.tgz","types":"lib/index.d.ts","scripts":{"lint":"eslint --fix .","build":"tsc -p ./tsconfig.json","format":"prettier --write .","preinstall":"npx only-allow pnpm","postinstall":"node lib/cli/post-install.js"},"_npmUser":{"name":"boatnear","email":"bo@near.org"},"_resolved":"/tmp/035a26752dc257e7613cd8babec028a5/near-sdk-js-0.7.0.tgz","_integrity":"sha512-2hwYtzO8Yqt2nVMpyHcvcb1eQiVQwnFnAf6OCMS2mxHh5xwBNi7NCDYgpAT67NXPXD52sWfWq9sNT7w1lWB+vg==","repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.3.1","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"16.14.0","dependencies":{"eslint":"^8.20.0","rollup":"^2.61.1","signale":"^1.4.0","near-abi":"^0.1.0","ts-morph":"^16.0.0","commander":"^9.4.1","typescript":"~4.7.2","@babel/core":"^7.20.5","@scure/base":"^1.1.1","json-schema":"0.4.0","@babel/types":"^7.20.5","@types/estree":"^1.0.0","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@babel/preset-typescript":"^7.18.6","rollup-plugin-sourcemaps":"^0.6.3","@typescript-eslint/parser":"^5.31.0","@rollup/plugin-node-resolve":"^13.1.1","near-typescript-json-schema":"0.55.0","@typescript-eslint/eslint-plugin":"^5.31.0","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"devDependencies":{"chalk":"^5.1.0","json5":"^2.2.3","eslint":"^8.23.1","prettier":"^2.7.1","typescript":"^4.7.2","@types/node":"^17.0.38","npm-run-all":"^4.1.5","@types/eslint":"^8.4.6","@types/rollup":"^0.54.0","@types/signale":"^1.4.4","@types/babel__core":"^7.1.19","@types/babel__traverse":"^7.18.1","eslint-config-prettier":"^8.5.0","@rollup/plugin-typescript":"^8.3.2","@typescript-eslint/parser":"^5.37.0","@typescript-eslint/eslint-plugin":"^5.37.0"},"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_0.7.0_1674697362855_0.20105388296197746","host":"s3://npm-registry-packages"}},"1.0.0-0":{"name":"near-sdk-js","version":"1.0.0-0","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@1.0.0-0","maintainers":[{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"bin":{"near-sdk-js":"lib/cli/cli.js"},"dist":{"shasum":"6e53ebe76d8b5f9ea2e111319327cdb46de39771","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-1.0.0-0.tgz","fileCount":54,"integrity":"sha512-2t/QZbTXYuYsDcaNKQtVOv4wrkfIehJIfYtnjwWriYugxom6ES7j3LBWjtJrzxvjsjgwyEZ1jYfdMzYFiKJf2Q==","signatures":[{"sig":"MEYCIQCriufqImCtrPeuMGVwrA0x7BSLML+P74GcGMDB+sipAAIhAM6pjVFuKRg9DGUek7Xl4l8N4auQvVGYu0DlH5wZHD5u","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":253240,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj+CzDACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp5hw/+N5RpC6UkDnS/SkNz+Jzv4lpqReYxexaQ8PyY9Lxw9ISCLAmC\r\nPVcXEj+jc7+/IaI7y/cxS9KADNwQQ4qd5kauyDrvPsEbOWAkB/IRzwBIzlmw\r\nhuwz9eexEFowgezMuz8VZbzVtRdgdOP6QnlkRAr4chdOBeI3PatOMH/R/5ms\r\nY+kr1O75VO4hZWoYtMSv+76PYIwLWmQXGEmNT2qIVgaQ/bHuuWWsn3j5lDu/\r\nyrFWmXTeMMBwexXgCk3x1ZqJVMKmNN1dt+a7CaPVcKBJkWlopxXis54AwZw9\r\nYw3n8U9x1ycNQUvX0X/B0PV35apnOOAuMIw49InYR37GTTPjbAPYTUhIA0H5\r\nNkNnJtCXlOO3bbw7DTbxlFbXUKxKg3gAc4kwZDMG1oyp/v64Xh2HT7malm3s\r\n0Wk4xRAUpEkxOMQ0gLWmU2XBhFoFPPQcuwdWZy0u+zW/YKVyw2Pfg+CRrP64\r\nBenEbYSy6s+lJJp6mjLDSpqFVUqqnzjFZvDmb5sHdcU+xAnOVuxdow2waBV3\r\nYxMTV0M9Q16QJvSGr6GGK3HGJiWYSDZhK+DnE/5BYRL9ckiZ0b+atAScw4Nm\r\nlfPHfnDkdZdQVeMt7ko3f1+2OVMo1ueiM3Sch0/miZ2lsFWSheG8bqwxqnxM\r\nweY2iaSxYizE+hQ/TNUTuIq7Z2SSobMBVuc=\r\n=b5gu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","_from":"file:near-sdk-js-1.0.0-0.tgz","types":"lib/index.d.ts","scripts":{"lint":"eslint --fix .","build":"tsc -p ./tsconfig.json","format":"prettier --write .","preinstall":"npx only-allow pnpm","postinstall":"node lib/cli/post-install.js"},"_npmUser":{"name":"boatnear","email":"bo@near.org"},"_resolved":"/private/var/folders/qp/h667m6rn0bxg6kfj564z759c0000gn/T/a8df1e8bb5394684e7b7bb2ef821955b/near-sdk-js-1.0.0-0.tgz","_integrity":"sha512-2t/QZbTXYuYsDcaNKQtVOv4wrkfIehJIfYtnjwWriYugxom6ES7j3LBWjtJrzxvjsjgwyEZ1jYfdMzYFiKJf2Q==","repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"9.3.1","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"18.14.1","dependencies":{"eslint":"^8.20.0","rollup":"^2.61.1","signale":"^1.4.0","near-abi":"^0.1.0","ts-morph":"^16.0.0","commander":"^9.4.1","typescript":"~4.7.2","@babel/core":"^7.20.5","@scure/base":"^1.1.1","json-schema":"0.4.0","@babel/types":"^7.20.5","@types/estree":"^1.0.0","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@babel/preset-typescript":"^7.18.6","rollup-plugin-sourcemaps":"^0.6.3","@typescript-eslint/parser":"^5.31.0","@rollup/plugin-node-resolve":"^13.1.1","near-typescript-json-schema":"0.55.0","@typescript-eslint/eslint-plugin":"^5.31.0","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"devDependencies":{"chalk":"^5.1.0","json5":"^2.2.3","eslint":"^8.23.1","prettier":"^2.7.1","typescript":"^4.7.2","@types/node":"^17.0.38","npm-run-all":"^4.1.5","@types/eslint":"^8.4.6","@types/rollup":"^0.54.0","@types/signale":"^1.4.4","@types/babel__core":"^7.1.19","@types/babel__traverse":"^7.18.1","eslint-config-prettier":"^8.5.0","@rollup/plugin-typescript":"^8.3.2","@typescript-eslint/parser":"^5.37.0","@typescript-eslint/eslint-plugin":"^5.37.0"},"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_1.0.0-0_1677208771192_0.005810341930346352","host":"s3://npm-registry-packages"}},"1.0.0":{"name":"near-sdk-js","version":"1.0.0","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@1.0.0","maintainers":[{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"bin":{"near-sdk-js":"lib/cli/cli.js"},"dist":{"shasum":"bc1e3d5727f065d9df928ba7831c36f3c46f698a","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-1.0.0.tgz","fileCount":54,"integrity":"sha512-kgZUxt+3GKv61tOGHTI1bjJo1/OkKYvKjZK6eoew9tdgp2FJ36VLJnn4gQ4yl9DgJB+vmT3EIUXHXhLTjFlLow==","signatures":[{"sig":"MEYCIQD/YpWlmHg9+mGGqyqpOrfnIAuQvCJ/XriwEL2BMeOgMAIhAN+ayOtqnQdzjFO3CJytZzCR7wjbEboUxCK9ZP+YVQOG","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":253263,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj/upDACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpXmA/+NzCHZJ5DHP287xgjfU4JvVEBvWqWs13ZMXUqZ2m5koWvelyR\r\n3XowaXPevLM0uhtQfq6p8C7DJNZLhvnMVZFS1hk98/htbEdk6qi3r3qX50Yg\r\nbtLrbV4BSu5qp8Ngh4RuSXcnIM2QFSVSwaoqExwHCurLxvT7zorMxeRR10Wg\r\nCwwsX3e/ZFjewmO+GiASZa5XeTcyiwVP9ihuQaDezodcjKIzctG3Whhp9/rD\r\nAk8Xs4LjwlI2FQ4eCt7VoB6DaUNh0/DeBKGvCADksHynnDcXzYrDGNOlucIz\r\nwPPA0QDMudP5GFEITscM00yJ152+ERYCkaRx3aIzgrx27Uf2JWIuJHNy5uu6\r\n/nTFelBDdpEAXyZTq41z+Nq5M28Cc6eXtcSpsWrhQ5KLKiOsrEk+9HxtX4t/\r\neSazzSlapa4bDjG+plMFPqsAl/zDjN+rFSBsEV8mirMFoX1VJ30UlN38C+Xu\r\nxNskYpVeFvA5mJZ0LBElwoFtNMDU3ZMAskfQd1sxAYrBUD4x05ojC153vR3C\r\nRBVtNnyuWcc85jQReOkOJSk0CqZl7tQ8CXHcbai7eZLn1azB52DfsDlppwBc\r\naHQMgem5yuFCJl/Bb7OWzl5sWP4sYvwfUwKCMLfrdLpfFJcis1onZTyAlsnF\r\n8rEkVH+DHQ9Gdd/fTi1pui7zrxB0Wx+2f34=\r\n=2kSa\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","_from":"file:near-sdk-js-1.0.0.tgz","types":"lib/index.d.ts","scripts":{"lint":"eslint --fix .","build":"tsc -p ./tsconfig.json","format":"prettier --write .","preinstall":"npx only-allow pnpm","postinstall":"node lib/cli/post-install.js"},"_npmUser":{"name":"boatnear","email":"bo@near.org"},"_resolved":"/private/var/folders/qp/h667m6rn0bxg6kfj564z759c0000gn/T/8e51acde1c9c79e4e855bed51371b949/near-sdk-js-1.0.0.tgz","_integrity":"sha512-kgZUxt+3GKv61tOGHTI1bjJo1/OkKYvKjZK6eoew9tdgp2FJ36VLJnn4gQ4yl9DgJB+vmT3EIUXHXhLTjFlLow==","repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"9.3.1","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"18.14.1","dependencies":{"eslint":"^8.20.0","rollup":"^2.61.1","signale":"^1.4.0","near-abi":"^0.1.0","ts-morph":"^16.0.0","commander":"^9.4.1","typescript":"~4.7.2","@babel/core":"^7.20.5","@scure/base":"^1.1.1","json-schema":"0.4.0","@babel/types":"^7.20.5","@types/estree":"^1.0.0","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@babel/preset-typescript":"^7.18.6","rollup-plugin-sourcemaps":"^0.6.3","@typescript-eslint/parser":"^5.31.0","@rollup/plugin-node-resolve":"^13.1.1","near-typescript-json-schema":"0.55.0","@typescript-eslint/eslint-plugin":"^5.31.0","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"devDependencies":{"chalk":"^5.1.0","json5":"^2.2.3","eslint":"^8.23.1","prettier":"^2.7.1","typescript":"^4.7.2","@types/node":"^17.0.38","npm-run-all":"^4.1.5","@types/eslint":"^8.4.6","@types/rollup":"^0.54.0","@types/signale":"^1.4.4","@types/babel__core":"^7.1.19","@types/babel__traverse":"^7.18.1","eslint-config-prettier":"^8.5.0","@rollup/plugin-typescript":"^8.3.2","@typescript-eslint/parser":"^5.37.0","@typescript-eslint/eslint-plugin":"^5.37.0"},"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_1.0.0_1677650499594_0.4732328375206447","host":"s3://npm-registry-packages"}},"2.0.0-0":{"name":"near-sdk-js","version":"2.0.0-0","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"license":"(MIT AND Apache-2.0)","_id":"near-sdk-js@2.0.0-0","maintainers":[{"name":"fospring","email":"fospring@outlook.com"},{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"homepage":"https://github.com/near/near-sdk-js","bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"bin":{"near-sdk-js":"lib/cli/cli.js"},"dist":{"shasum":"e99f6ae43e26e9da5352e2d70e4f4e1b0e39dda6","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-2.0.0-0.tgz","fileCount":55,"integrity":"sha512-DdlrN7PfWgp9JlUtjJZzqf/93qTX64xwqfthbR/libAgs+kTGjmnf+fAvOX5m7Px8xZtVPUVLqfVgIkeYgx5Vw==","signatures":[{"sig":"MEYCIQCBOHUsUkNp1AUIDwgspqlFi2RAObouQPewp06Z1DR8XgIhAJBLBv3lkVfoiJRUTOpJ8lHVf/2IIeCwlm2NAFtIn9c+","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":261027},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","gitHead":"37f2f786210da73b4ea6f87f8078bdaef1952265","scripts":{"lint":"eslint --fix .","build":"tsc -p ./tsconfig.json","format":"prettier --write .","preinstall":"npx only-allow pnpm","postinstall":"node lib/cli/post-install.js"},"_npmUser":{"name":"fospring","email":"fospring@outlook.com"},"repository":{"url":"git+https://github.com/near/near-sdk-js.git","type":"git"},"_npmVersion":"8.19.4","description":"High Level JavaScript SDK for building smart contracts on NEAR","directories":{},"_nodeVersion":"16.20.2","dependencies":{"eslint":"^8.20.0","rollup":"^2.61.1","signale":"^1.4.0","near-abi":"^0.1.0","ts-morph":"^16.0.0","commander":"^9.4.1","lodash-es":"^4.17.21","typescript":"~4.7.2","@babel/core":"^7.20.5","@scure/base":"^1.1.1","json-schema":"0.4.0","@babel/types":"^7.20.5","@types/estree":"^1.0.0","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@babel/preset-typescript":"^7.18.6","rollup-plugin-sourcemaps":"^0.6.3","@typescript-eslint/parser":"^5.31.0","@rollup/plugin-node-resolve":"^13.1.1","near-typescript-json-schema":"0.55.0","@typescript-eslint/eslint-plugin":"^5.31.0","@babel/plugin-proposal-decorators":"^7.17.2"},"_hasShrinkwrap":false,"devDependencies":{"chalk":"^5.1.0","json5":"^2.2.3","eslint":"^8.23.1","prettier":"^2.7.1","typescript":"^4.7.2","@types/node":"^17.0.38","npm-run-all":"^4.1.5","@types/eslint":"^8.4.6","@types/rollup":"^0.54.0","@types/signale":"^1.4.4","@types/babel__core":"^7.1.19","@types/babel__traverse":"^7.18.1","eslint-config-prettier":"^8.5.0","@rollup/plugin-typescript":"^8.3.2","@typescript-eslint/parser":"^5.37.0","@typescript-eslint/eslint-plugin":"^5.37.0"},"_npmOperationalInternal":{"tmp":"tmp/near-sdk-js_2.0.0-0_1714323458461_0.8635300881065198","host":"s3://npm-registry-packages"}},"2.0.0":{"name":"near-sdk-js","version":"2.0.0","description":"High Level JavaScript SDK for building smart contracts on NEAR","main":"lib/index.js","types":"lib/index.d.ts","type":"module","repository":{"type":"git","url":"git+https://github.com/near/near-sdk-js.git"},"homepage":"https://github.com/near/near-sdk-js","keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"license":"(MIT AND Apache-2.0)","bin":{"near-sdk-js":"lib/cli/cli.js"},"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"dependencies":{"@babel/core":"^7.20.5","@babel/plugin-proposal-decorators":"^7.17.2","@babel/preset-typescript":"^7.18.6","@babel/types":"^7.20.5","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-node-resolve":"^13.1.1","@scure/base":"^1.1.1","@types/estree":"^1.0.0","@typescript-eslint/eslint-plugin":"^5.31.0","@typescript-eslint/parser":"^5.31.0","commander":"^9.4.1","eslint":"^8.20.0","json-schema":"0.4.0","lodash-es":"^4.17.21","near-abi":"^0.1.0","near-typescript-json-schema":"0.55.0","rollup":"^2.61.1","rollup-plugin-sourcemaps":"^0.6.3","signale":"^1.4.0","ts-morph":"^16.0.0","typescript":"~4.7.2"},"devDependencies":{"@rollup/plugin-typescript":"^8.3.2","@types/babel__core":"^7.1.19","@types/babel__traverse":"^7.18.1","@types/eslint":"^8.4.6","@types/node":"^17.0.38","@types/rollup":"^0.54.0","@types/signale":"^1.4.4","@typescript-eslint/eslint-plugin":"^5.37.0","@typescript-eslint/parser":"^5.37.0","chalk":"^5.1.0","eslint":"^8.23.1","eslint-config-prettier":"^8.5.0","json5":"^2.2.3","npm-run-all":"^4.1.5","prettier":"^2.7.1","typescript":"^4.7.2"},"scripts":{"build":"tsc -p ./tsconfig.json","lint":"eslint --fix .","format":"prettier --write .","preinstall":"npx only-allow pnpm","postinstall":"node lib/cli/post-install.js"},"bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"_id":"near-sdk-js@2.0.0","_integrity":"sha512-mE+FAUI5uXJafdtWjHcar8ow7EAUcAK0WH+kuaxbN8KitbuCMVdY4b1GQT48p3qhg7EUYbFy6x+7+Sf6vNitMw==","_resolved":"/private/var/folders/qp/h667m6rn0bxg6kfj564z759c0000gn/T/cb25215af161c71e7fd9a677356786b5/near-sdk-js-2.0.0.tgz","_from":"file:near-sdk-js-2.0.0.tgz","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-mE+FAUI5uXJafdtWjHcar8ow7EAUcAK0WH+kuaxbN8KitbuCMVdY4b1GQT48p3qhg7EUYbFy6x+7+Sf6vNitMw==","shasum":"1ea0cee686cd8f2f3403f827daf37087002d8506","tarball":"https://registry.npmjs.org/near-sdk-js/-/near-sdk-js-2.0.0.tgz","fileCount":56,"unpackedSize":262486,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDgH/YZooZaZc07IXhvwiFjGPSNtrJMQJ0EZthkgQIzTAIhAMSdudOQICXBp0LiCq96F0wOtFpV7tppQOxaMfFtqp8h"}]},"_npmUser":{"name":"boatnear","email":"bo@near.org"},"directories":{},"maintainers":[{"name":"fospring","email":"fospring@outlook.com"},{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/near-sdk-js_2.0.0_1717724546071_0.41167755030401754"},"_hasShrinkwrap":false}},"time":{"created":"2022-05-19T10:45:11.038Z","modified":"2024-06-07T01:42:26.451Z","0.1.1":"2022-05-19T10:45:11.267Z","0.2.0":"2022-05-26T08:04:44.764Z","0.3.0":"2022-06-07T16:34:48.782Z","0.4.0-0":"2022-07-21T22:32:48.824Z","0.4.0-1":"2022-07-21T23:17:17.302Z","0.4.0-2":"2022-07-22T15:31:57.623Z","0.4.0-3":"2022-07-29T15:04:08.542Z","0.4.0-4":"2022-08-03T13:47:48.334Z","0.4.0-5":"2022-08-05T07:09:50.817Z","0.4.0":"2022-08-25T09:00:03.738Z","0.5.0-0":"2022-09-01T11:13:16.727Z","0.5.0-1":"2022-09-07T14:42:52.543Z","0.5.0":"2022-09-09T07:34:57.993Z","0.6.0-0":"2022-10-21T07:17:23.454Z","0.6.0":"2022-10-31T15:50:25.142Z","0.7.0-0":"2023-01-05T05:44:46.048Z","0.7.0-1":"2023-01-06T02:14:31.966Z","0.7.0-2":"2023-01-06T02:57:45.779Z","0.7.0-3":"2023-01-19T07:49:31.619Z","0.7.0-4":"2023-01-19T08:56:49.092Z","0.7.0-5":"2023-01-19T10:05:28.252Z","0.7.0":"2023-01-26T01:42:43.027Z","1.0.0-0":"2023-02-24T03:19:31.337Z","1.0.0":"2023-03-01T06:01:39.811Z","2.0.0-0":"2024-04-28T16:57:38.699Z","2.0.0":"2024-06-07T01:42:26.287Z"},"maintainers":[{"name":"fospring","email":"fospring@outlook.com"},{"name":"boatnear","email":"bo@near.org"},{"name":"volovyk-s","email":"sergeyvolovyk@gmail.com"}],"author":{"name":"Near Inc","email":"hello@nearprotocol.com"},"repository":{"type":"git","url":"git+https://github.com/near/near-sdk-js.git"},"keywords":["JS","JavaScript","NEAR","SDK","contract","smart","smart-contract"],"license":"(MIT AND Apache-2.0)","homepage":"https://github.com/near/near-sdk-js","bugs":{"url":"https://github.com/near/near-sdk-js/issues"},"readme":"# NEAR JavaScript SDK\n\n## Quick Start\n\nUse [`create-near-app`](https://github.com/near/create-near-app) to quickly get started writing smart contracts in JavaScript on NEAR.\n\n    npx create-near-app\n\nThis will scaffold a basic template for you 😎\n\nLearn more in our [Quick Start guide](https://docs.near.org/develop/quickstart-guide).\n\n## Running Examples\n\nThere are a couple of contract examples in the project:\n\n- [Clean contract state](https://github.com/near/near-sdk-js/tree/develop/examples/src/clean-state.js)\n- [Counter using low level API](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter-lowlevel.js)\n- [Counter in JavaScript](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter.js)\n- [Counter in TypeScript](https://github.com/near/near-sdk-js/tree/develop/examples/src/counter.ts)\n- [Doing cross contract call](https://github.com/near/near-sdk-js/tree/develop/examples/src/cross-contract-call.js)\n- [Fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/fungible-token.js)\n- [Lockable fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/fungible-token-lockable.js)\n- [Non fungible token](https://github.com/near/near-sdk-js/tree/develop/examples/src/non-fungible-token.js)\n- [Non fungible token receiver contract](https://github.com/near/near-sdk-js/tree/develop/examples/src/non-fungible-token-receiver.js)\n- [Status message board](https://github.com/near/near-sdk-js/tree/develop/examples/src/status-message.js)\n- [Status message board with unique messages](https://github.com/near/near-sdk-js/tree/develop/examples/src/status-message-collections.js)\n- [Programmatic Update After Locking The Contract](https://github.com/near/near-sdk-js/tree/develop/examples/src/programmatic-update.js)\n\nTo build all examples, run `pnpm build` in `examples/`. To test all examples, run `pnpm test`. You can also build and test one specific example with `pnpm build:<example-name>` and `pnpm test:<example-name>`, see `examples/package.json`.\n\nTo deploy and call a contract on a NEAR node, use near-cli's `near deploy` and `near call`.\n\n## Test\n\nWe recommend to use near-workspaces to write tests for your smart contracts. See any of the examples for how tests are setup and written.\n\n## Error Handling in NEAR-SDK-JS\n\nIf you want to indicate an error happened and fail the transaction, just throw an error object in JavaScript. The compiled JavaScript contract includes error handling capability. It will catch throwed errors and automatically invoke `panic_utf8` with `\"{error.message}\\n:{error.stack}\"`. As a result, transaction will fail with `\"Smart contract panicked: {error.message}\\n{error.stack}\"` error message. You can also use an error utilities library to organize your errors, such as verror.\n\nWhen your JS code or library throws an error, uncaught, the transaction will also fail with GuestPanic error, with the error message and stacktrace.\n\nWhen call host function with inappropriate type, means incorrect number of arguments or arg is not expected type:\n\n- if arguments less than params, remaining argument are set as 'undefined'\n- if arguments more than params, remaining argument are ignored\n- if argument is different than the required type, it'll be coerced to required type\n- if argument is different than the required type but cannot be coerced, will throw runtime type error, also with message and stacktrace\n\n## Migrating from near-sdk-js 0.6.0\n\nIf you have a near-sdk-js 0.6.0 contract, you need to drop the `babel.config.json` because it is now inlined in near-sdk-js CLI.\n\nAlso `Bytes` type in 0.6.0 is replaced with `string` and `Uint8Array`. Because `Bytes` was an alias to `string`, this doesn't affect all collection APIs and most low level APIs. Some low level APIs below now also comes with a raw version, which ends with `Raw` and takes `Uint8Array` instead of `string`, for example, `storageRead` vs `storageReadRaw`. Some low level APIs have more sense to use `Uint8Array` instead of `string`, such as `sha256` and arguments for a function call type of promise, these are **BREAKING** changes. Please refer to next section for details: look for functions with `Uint8Array` argument and return types.\n\n## NEAR-SDK-JS API Reference\n\nAll NEAR blockchain provided functionality (host functions) are defined in `src/api.ts` and exported as `near`. You can use them by:\n\n```js\nimport { near } from \"near-sdk-js\";\n\n// near.<api doucmented below>. e.g.:\nlet signer = near.signerAccountId();\n```\n\n### About Type\n\nNEAR-SDK-JS is written in TypeScript, so every API function has a type specified by signature that looks familiar to JavaScript/TypeScript Developers. Two types in the signature need a special attention:\n\n- Most of the API take `bigint` instead of Number as type. This because JavaScript Number cannot hold 64 bit and 128 bit integer without losing precision.\n- For those API that takes or returns raw bytes, it is a JavaScript `Uint8Array`. You can use standard `Uint8Array` methods on it or decode it to string with `decode` or `str`. The differece between `decode` and `str` is: `decode` decode the array as UTF-8 sequence. `str` simply converts each Uint8 to one char with that char code.\n\n### Context API\n\n```\nfunction currentAccountId(): string;\nfunction signerAccountId(): string;\nfunction signerAccountPk(): Uint8Array;\nfunction predecessorAccountId(): string;\nfunction inputRaw(): Uint8Array;\nfunction input(): string;\nfunction blockIndex(): bigint;\nfunction blockHeight(): bigint;\nfunction blockTimestamp(): bigint;\nfunction epochHeight(): bigint;\nfunction storageUsage(): bigint\n```\n\n### Economics API\n\n```\nfunction accountBalance(): bigint;\nfunction accountLockedBalance(): bigint;\nfunction attachedDeposit(): bigint;\nfunction prepaidGas(): bigint;\nfunction usedGas(): bigint;\n```\n\n### Math API\n\n```\nfunction altBn128G1Multiexp(value: Uint8Array): Uint8Array;\nfunction altBn128G1Sum(value: Uint8Array): Uint8Array;\nfunction altBn128PairingCheck(value: Uint8Array): boolean;\nfunction randomSeed(): Uint8Array;\nfunction sha256(value: Uint8Array): Uint8Array;\nfunction keccak256(value: Uint8Array): Uint8Array;\nfunction keccak512(value: Uint8Array): Uint8Array;\nfunction ripemd160(value: Uint8Array): Uint8Array;\nfunction ecrecover(hash: Uint8Array, sign: Uint8Array, v: bigint, malleability_flag: bigint): Uint8Array | null;\n```\n\n### Miscellaneous API\n\n```\nfunction valueReturnRaw(value: Uint8Array);\nfunction valueReturn(value: string);\nfunction panic(msg?: string);\nfunction panicUtf8(msg: Uint8Array);\nfunction logUtf8(msg: Uint8Array);\nfunction logUtf16(msg: Uint8Array);\nfunction log(...params: unknown[]);\n\n```\n\n### Promises API\n\n```\nfunction promiseCreate(account_id: string, method_name: string, arguments: Uint8Array, amount: bigint, gas: bigint): bigint;\nfunction promiseThen(promise_index: bigint, account_id: string, method_name: string, arguments: Uint8Array, amount: bigint, gas: bigint): bigint;\nfunction promiseAnd(...promise_idx: bigint): bigint;\nfunction promiseBatchCreate(account_id: string): bigint;\nfunction promiseBatchThen(promise_index: bigint, account_id: string): bigint;\n```\n\n### Promise API actions\n\n```\nfunction promiseBatchActionCreateAccount(promise_index: PromiseIndex);\nfunction promiseBatchActionDeployContract(promise_index: PromiseIndex, code: Uint8Array);\nfunction promiseBatchActionFunctionCall(promise_index: PromiseIndex, method_name: string, arguments: Uint8Array, amount: bigint, gas: bigint);\nfunction promiseBatchActionFunctionCallWeight(promise_index: PromiseIndex, method_name: string, arguments: Uint8Array, amount: bigint, gas: bigint, weight: bigint);\nfunction promiseBatchActionTransfer(promise_index: PromiseIndex, amount: bigint);\nfunction promiseBatchActionStake(promise_index: PromiseIndex, amount: bigint, public_key: Uint8Array);\nfunction promiseBatchActionAddKeyWithFullAccess(promise_index: PromiseIndex, public_key: Uint8Array, nonce: bigint);\nfunction promiseBatchActionAddKeyWithFunctionCall(promise_index: PromiseIndex, public_key: Uint8Array, nonce: bigint, allowance: bigint, receiver_id: string, method_names: string);\nfunction promiseBatchActionDeleteKey(promise_index: PromiseIndex, public_key: Uint8Array);\nfunction promiseBatchActionDeleteAccount(promise_index: PromiseIndex, beneficiary_id: string);\n```\n\n### Promise API results\n\n```\nfunction promiseResultsCount(): bigint;\nfunction promiseResultRaw(result_idx: PromiseIndex): Uint8Array;\nfunction promiseResult(result_idx: PromiseIndex): string;\nfunction promiseReturn(promise_idx: PromiseIndex);\n```\n\n### Storage API\n\n```\nfunction storageWriteRaw(key: Uint8Array, value: Uint8Array): boolean;\nfunction storageReadRaw(key: Uint8Array): Uint8Array | null;\nfunction storageRemoveRaw(key: Uint8Array): boolean;\nfunction storageHasKeyRaw(key: Uint8Array): boolean;\nfunction storageWrite(key: string, value: string): boolean;\nfunction storageRead(key: string): bigint;\nfunction storageRemove(key: string): bigint;\nfunction storageHasKey(key: string): bigint;\n```\n\n### Validator API\n\n```\nfunction validatorStake(account_id: string): bigint;\nfunction validatorTotalStake(): bigint;\n```\n\n### Alt BN128\n\n```\nfunction altBn128G1Multiexp(value: Uint8Array): Uint8Array;\nfunction altBn128G1Sum(value: Uint8Array): Uint8Array;\nfunction altBn128PairingCheck(value: Uint8Array): boolean;\n```\n\n### NearBindgen and other decorators\n\nYou can write a simple smart contract by only using low-level APIs, such as `near.input()`, `near.storageRead()`, etc. In this case, the API of your contract will consist of all the exported JS functions. You can find an example of such a contract [here](https://github.com/near/near-sdk-js/blob/develop/examples/src/counter-lowlevel.js).\n\nBut if you want to build a more complex contracts with ease, you can use decorators from this SDK that will handle serialization, deserialization, and other boilerplate operations for you.\n\nIn order to do that, your contract must be a class decorated with `@NearBindgen({})`. Each method in this class with `@call({})`, `@view({})`, and `@initialize({})` decorators will become functions of your smart contract. `call` functions can change state, and `view` functions can only read it.\n\nYour class must have a `constructor()`. You will not be able to call it, which is why it should not accept any parameters. You must declare all the parameters that you are planning to use in the constructor and set default values.\n\nThe simplest example of the contract that follows all these rules can be found [here](https://github.com/near/near-sdk-js/blob/develop/examples/src/status-message.js)\n\n`NearBindgen` decorator can accept `requireInit parameter`.\n\n```JS\n@NearBindgen({ requireInit: true })\nclass YourContract {\n    ...\n}\n```\n\nIt is `false` by default, but if you will set it to `true`, it will prevent all the `call` functions from being executed before you initialize the state of the contract.\n\nIn order to initialize the contract, you need to add functions flagged with `@initialize({})` decorator.\n\n`@call({})` decorator can accept two parameters: `privateFunction` and `payableFunction`. They are both `false` by default.\n\n`privateFunction: true` can restrict access to this function to the contract itself.\n\n`payableFunction: true` will allow the function to accept payments (deposit). Without this flag, it will panic if any deposit was provided.\n\n### Collections\n\nA few useful on-chain persistent collections are provided. All keys, values and elements are of type `string`.\n\n#### Vector\n\nVector is an iterable implementation of vector that stores its content on the trie. Usage:\n\n```js\nimport {Vector} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.v = new Vector('my_prefix_')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.v = Object.assign(new Vector, this.v)\n}\n\nsomeMethod() {\n    // insert\n    this.v.push('abc')\n    this.v.push('def')\n    this.v.push('ghi')\n\n    // batch insert, extend:\n    this.v.extend(['xyz', '123'])\n\n    // get\n    let first = this.v.get(0)\n\n    // remove, move the last element to the given index\n    this.v.swapRemove(0)\n\n    // replace\n    this.v.replace(1, 'jkl')\n\n    // remove the last\n    this.v.pop()\n\n    // len, isEmpty\n    let len = this.v.length\n    let isEmpty = this.v.isEmpty()\n\n    // iterate\n    for (let element of this.v) {\n        near.log(element)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.v.toArray()\n\n    // clear\n    ths.v.clear()\n}\n```\n\n#### LookupMap\n\nLookupMap is an non-iterable implementation of a map that stores its content directly on the trie. It's like a big hash map, but on trie. Usage:\n\n```js\nimport {LookupMap} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.m = new LookupMap('prefix_a')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.m = Object.assign(new LookupMap, this.m)\n}\n\nsomeMethod() {\n    // insert\n    this.m.set('abc', 'aaa')\n    this.m.set('def', 'bbb')\n    this.m.set('ghi', 'ccc')\n\n    // batch insert, extend:\n    this.m.extend([['xyz', '123'], ['key2', 'value2']])\n\n    // check exist\n    let exist = this.m.containsKey('abc')\n\n    // get\n    let value = this.m.get('abc')\n\n    // remove\n    this.m.remove('def')\n\n    // replace\n    this.m.set('ghi', 'ddd')\n}\n```\n\n#### LookupSet\n\nLookupSet is an non-iterable implementation of a set that stores its content directly on the trie. It's like LookupMap, but it only stores whether the value presents. Usage:\n\n```js\nimport {LookupSet} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.s = new LookupSet('prefix_b')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.s = Object.assign(new LookupSet, this.s)\n}\n\nsomeMethod() {\n    // insert\n    this.s.set('abc')\n    this.s.set('def')\n    this.s.set('ghi')\n\n    // batch insert, extend:\n    this.s.extend(['xyz', '123'])\n\n    // check exist\n    let exist = this.s.contains('abc')\n\n    // remove\n    this.s.remove('def')\n}\n```\n\n#### UnorderedMap\n\nUnorderedMap is an iterable implementation of a map that stores its content directly on the trie. Usage:\n\n```js\nimport {UnorderedMap} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.m = new UnorderedMap('prefix_c')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.m.keys = Object.assign(new Vector, this.m.keys)\n    this.m.values = Object.assign(new Vector, this.m.values)\n    this.m = Object.assign(new UnorderedMap, this.m)\n}\n\nsomeMethod() {\n    // insert\n    this.m.set('abc', 'aaa')\n    this.m.set('def', 'bbb')\n    this.m.set('ghi', 'ccc')\n\n    // batch insert, extend:\n    this.m.extend([['xyz', '123'], ['key2', 'value2']])\n\n    // get\n    let value = this.m.get('abc')\n\n    // remove\n    this.m.remove('def')\n\n    // replace\n    this.m.set('ghi', 'ddd')\n\n    // len, isEmpty\n    let len = this.m.length\n    let isEmpty = this.m.isEmpty()\n\n    // iterate\n    for (let [k, v] of this.m) {\n        near.log(k+v)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.m.toArray()\n\n    // clear\n    this.m.clear()\n}\n```\n\n#### UnorderedSet\n\nUnorderedSet is an iterable implementation of a set that stores its content directly on the trie. It's like UnorderedMap but it only stores whether the value presents. Usage:\n\n```js\nimport {UnorderedSet} from 'near-sdk-js'\n\n// in contract class constructor:\nconstructor() {\n    super()\n    this.s = new UnorderedSet('prefix_d')\n}\n\n// Override the deserializer to load vector from chain\ndeserialize() {\n    super.deserialize()\n    this.s.elements = Object.assign(new Vector, this.s.elements)\n    this.s = Object.assign(new UnorderedSet, this.s)\n}\n\nsomeMethod() {\n    // insert\n    this.s.set('abc')\n    this.s.set('def')\n    this.s.set('ghi')\n\n    // batch insert, extend:\n    this.s.extend(['xyz', '123'])\n\n    // check exist\n    let exist = this.s.contains('abc')\n\n    // remove\n    this.s.remove('def')\n\n    // len, isEmpty\n    let len = this.s.length\n    let isEmpty = this.s.isEmpty()\n\n    // iterate\n    for (let e of this.s) {\n        near.log(e)\n    }\n\n    // toArray, convert to JavaScript Array\n    let a = this.s.toArray()\n\n    // clear\n    this.s.clear()\n}\n```\n\n### Highlevel Promise APIs\n\nWithin a contract class that decorated by `@Nearbindgen`, you can work a high level JavaScript class, called `NearPromise`. It's equivalently expressive as promise batch APIs but much shorter to write and can be chained like a JavaScript Promise.\n\nIn a `@call` method, you can return either a JavaScript value or a `NearPromise` object. In the later case, `@NearBindgen` will automatically `promiseReturn` it for you.\n\nUsage:\n\n```js\n// create new promise\nimport { NearPromise, near, includeBytes } from \"near-sdk-js\";\nimport { PublicKey } from \"near-sdk-js/lib/types\";\n\nlet promise = NearPromise.new(\"account-to-run-promise\");\n\n// possible promise actions, choose and chain what you need:\npromise\n  .createAccount()\n  .transfer(1_000_000_000_000_000_000_000_000_000_000_000_000n)\n  .addFullAccessKey(new PublicKey(near.signerAccountPk()))\n  .addAccessKey(\n    new PublicKey(near.signerAccountPk()),\n    250000000000000000000000n, // allowance\n    \"receiver_account_id\",\n    \"allowed_function_names\"\n  )\n  .stake(100000000000000000000000000000n, new PublicKey(near.signerAccountPk()))\n  .deployContract(includeBytes(\"path/to/contract.wasm\"))\n  .functionCall(\n    \"callee_contract_account_id\",\n    inputArgs,\n    0, // amount\n    2 * Math.pow(10, 13) // gas\n  )\n  .functionCallWeight(\n    \"callee_contract_account_id\",\n    inputArgs,\n    0, // amount\n    2 * Math.pow(10, 13), // gas\n    1 // weight\n  )\n  .deleteKey(new PublicKey(near.signerAccountPk()))\n  .deleteAccount(\"beneficial_account_id\");\n\nreturn promise;\n```\n\nIn the case of deploy contract, `includeBytes` is a helpful build-time util. You can include the content of a wasm contract, by using `includeBytes('path/to/contract.wasm')`.\n\nIn the case of `addFullAccessKey`, `addAccessKey` and `stake`, it takes a `PublicKey` object, you can find more details about it in the Types sections below.\n\nBesides above APIs to build something on top of an API, you can also chain promises with `.then` and `.and`, they're equivalent to promiseThen, promiseAnd:\n\n```js\n// assume promise, promise2 and promise3 are create with above APIs, with several actions added like above.\npromise.and(promise2).then(promise3); // promiseAnd of [promise_id, promise2_id], then promiseThen(promise_and_id, promise3_id)\n\nreturn promise;\n```\n\n### Types\n\nNEAR-SDK-JS also includes type defintions that are equivalent to that in Rust SDK / nearcore. You can browse them in near-sdk-js/src/types. Most of them are just type alias to string and bigint.\n\n#### Public Key\n\nPublic Key is representing a NEAR account's public key in a JavaScript class. You can either initiate a Public Key from binary data, or from a human readable string.\n\nThe binary data is in the same format as nearcore in `Uint8Array`. That's one byte to represent the curve type of the public key, either ed25519 (`0x0`), or secp256k1 (`0x1`), follows by the curve-specific public key data in bytes. Examples:\n\n```js\nnew PublicKey(near.signerAccountPk());\nlet pk = new PublicKey(\n  new Uint8Array([\n    // CurveType.ED25519 = 0\n    0,\n    // ED25519 PublicKey data\n    186, 44, 216, 49, 157, 48, 151, 47, 23, 244, 137, 69, 78, 150, 54, 42, 30, 248,\n    110, 26, 205, 18, 137, 154, 10, 208, 26, 183, 65, 166, 223, 18,\n  ])\n);\nlet pk = new PublicKey(\n  new Uint8Array([\n    // CurveType.SECP256K1 = 1\n    1,\n    // SECP256K1 PublicKey data\n    242, 86, 198, 230, 200, 11, 33, 63, 42, 160, 176, 23, 68, 35, 93, 81, 92, 89,\n    68, 53, 190, 101, 27, 21, 136, 58, 16, 221, 71, 47, 166, 70, 206, 98, 234, 243,\n    103, 13, 197, 203, 145, 0, 160, 202, 42, 85, 178, 193, 71, 193, 233, 163, 140,\n    228, 40, 135, 142, 125, 70, 225, 251, 113, 74, 153,\n  ])\n);\n```\n\nThe human readable form is `ed25519:` or `secp256k1:` following base58-encoded public key. And initialize the Public Key with `PublicKey.fromString`:\n\n```js\nPublicKey.fromString('ed25519:DXkVZkHd7WUUejCK7i74uAoZWy1w9AZqshhTHxhmqHuB`)\nPublicKey.fromString('secp256k1:5r22SrjrDvgY3wdQsnjgxkeAbU1VcM71FYvALEQWihjM3Xk4Be1CpETTqFccChQr4iJwDroSDVmgaWZv2AcXvYeL`)\n```\n\nOnce a PublicKey object is created, it can be used in high level promise APIs that takes a public key, such as `addFullAccessKey`, `addAccessKey` and `stake`.\n\n## How to use NEAR SDK JS on Windows\n\nYou can develop smart contracts on Windows using Windows Subsystem for Linux (WSL2).\nIn order to use WSL2, follow the next steps:\n\n- Run `PowerShell` as Administrator\n- Execute `wsl --install` to install Ubuntu and do additional setup automatically. Check more details [here](https://learn.microsoft.com/en-us/windows/wsl/install)\n- Restart your machine\n- `WSL2` will continue setup process on start. Setup your username and password when prompted.\n- Check [this](https://learn.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-on-wsl) guide to setup `npm`, `node`, `npx`, `VSCode` and other tools of your choice in order to start developing.\n\nIn case of any issues of setting up WSL2 make sure that:\n\n- Your Windows OS is up to date\n- Virtualisation is turned on in BIOS\n- `Windows Subsystem for Linux` and `Virtual Machine Platform` are turned on in `Windows Features` (Start -> Search -> Turn Windows Feature On or Off)\n","readmeFilename":"README.md"}