{"_id":"@akhmetovdev/terra.js","name":"@akhmetovdev/terra.js","dist-tags":{"latest":"3.1.7"},"versions":{"3.1.7":{"name":"@akhmetovdev/terra.js","publishConfig":{"access":"public"},"version":"3.1.7","description":"The JavaScript SDK for Terra","license":"MIT","author":{"name":"Terraform Labs, PTE."},"keywords":["terra","stablecoin","cryptocurrency","blockchain","smart-contracts","wasm","altcoin","altcoins","wallet"],"repository":{"type":"git","url":"git://github.com/terra-money/terra.js.git"},"main":"dist/index.js","typings":"dist/index.d.ts","engines":{"node":">=14"},"scripts":{"build":"tsc --module commonjs && webpack --mode production","test":"jest","format":"prettier --check ./src/**/*.ts","format:fix":"prettier --write ./src/**/*.ts","lint":"eslint src --ext .js,.ts","lint:fix":"eslint src --ext .js,.ts --fix","doc":"typedoc","prepublishOnly":"npm run build"},"lint-staged":{"./src/**/*.ts":["npm run lint:fix","npm run format:fix"]},"husky":{"hooks":{"pre-commit":"lint-staged","post-checkout":"npm i"}},"prettier":{"semi":true,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"devDependencies":{"@types/jest":"^27.0.1","@types/node":"^16.11.7","@types/readable-stream":"^2.3.9","@types/secp256k1":"^4.0.1","@types/tmp":"^0.2.0","@types/ws":"^7.4.7","@typescript-eslint/eslint-plugin":"^5.3.1","@typescript-eslint/parser":"^5.3.1","buffer":"^6.0.3","eslint":"^8.2.0","husky":"^4.3.6","jest":"^27.4.7","lint-staged":"^10.5.3","prettier":"^2.2.1","process":"^0.11.10","stream-browserify":"^3.0.0","ts-jest":"^27.1.3","ts-loader":"^9.2.3","ts-node":"^10.0.0","tsconfig-paths-webpack-plugin":"^3.3.0","typedoc":"^0.22.11","typescript":"^4.5.5","webpack":"^5.11.1","webpack-bundle-analyzer":"^4.3.0","webpack-cli":"^4.3.0"},"dependencies":{"@terra-money/legacy.proto":"npm:@terra-money/terra.proto@^0.1.7","@terra-money/terra.proto":"^2.1.0","axios":"^0.27.2","bech32":"^2.0.0","bip32":"^2.0.6","bip39":"^3.0.3","bufferutil":"^4.0.3","decimal.js":"^10.2.1","jscrypto":"^1.0.1","readable-stream":"^3.6.0","secp256k1":"^4.0.2","tmp":"^0.2.1","utf-8-validate":"^5.0.5","ws":"^7.5.9"},"gitHead":"168afed3f48cb14607406355d1d62f30411e36a1","bugs":{"url":"https://github.com/terra-money/terra.js/issues"},"homepage":"https://github.com/terra-money/terra.js#readme","_id":"@akhmetovdev/terra.js@3.1.7","_nodeVersion":"14.20.0","_npmVersion":"6.14.17","dist":{"integrity":"sha512-7R5TB8P5GCfkOM47X8vpS7HTdl+snMRJZRYJpMfUBf2MWkHoSB9BnHlbj+aNFacFT1g7DRNs8mhi+dVLQhtMfw==","shasum":"6c5cc30099ca3dcfa5b9f1aefae33963d5b862bb","tarball":"https://registry.npmjs.org/@akhmetovdev/terra.js/-/terra.js-3.1.7.tgz","fileCount":693,"unpackedSize":18621515,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD6YojDQ2Il6jcX5N60mFZvJgq97y3V1aeNAff5/FKwNQIgS4SkVSIe30XwjmMVaHi0RjBU5e1d2CHjaAqQ39q1/94="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj0pLSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqBKA/+NztFmOk0zq4Cnk+T9KQIQJAH3cuf6KaESrein9cadCDxs8yc\r\nOY9jgaNvEi/J2GA41U3ybLG342H5YEYgVqaTdlWZOgO55dtsB6k+gpWP1/AN\r\nS7q0g5jS31F4N+V8VsJ26hOpvh4yXn6ZeOVTxp4Gjn1+yJaxiitBd5SMVPVy\r\nktRVob8Sc/tmkrDKeqkEtX5o56XnwkOH+iP/G1CvmStt/wlUmkd8tCRToJxC\r\nxDqLI4c9alENQhv+bPjFthxdQ0MemaA7pWSbhi/vk7gcrufNLWU6w+mseucO\r\n6NsDYz7FqHhYRrrLcsm7uui8TSQpyAV05005WJcSfe87yK/D3zNQVLyEpXFO\r\nmkDGjnaTqLRkax+JbAwVSmE3eGWTCh0QsXs1kUgPxPNQ77EbxLZViwG0j6yg\r\n4OU7CS9QcPK3hDdKmdR/+spaqDV8oDMgymPKbOXPqtxLTvHgW/dkLJnfA6jl\r\nYIRUq4K2VA11sZtcjpH1TRpsZJt5kZcoAcKbECLRAJC9mQaudP/gHTq8EePx\r\neu3Gd37iVpZEo34fHRDO6zk4B/H0L5P9uxIoMFRs2GGnqBgiml0bbw6Z2KBC\r\neuuFwTCcvd2Av89Mq8yvIxPsg5GWYXOxV1yI3aekrFk44Ij4kUmzkszYoh67\r\nA7EHWG16cCYQhq1LW2xSatB7WJj8oZH11bo=\r\n=vUAB\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"akhmetovdev","email":"akhmetovdev@gmail.com"},"directories":{},"maintainers":[{"name":"akhmetovdev","email":"akhmetovdev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/terra.js_3.1.7_1674744530250_0.8679975763608008"},"_hasShrinkwrap":false}},"time":{"created":"2023-01-26T14:48:50.164Z","3.1.7":"2023-01-26T14:48:50.553Z","modified":"2023-01-26T14:48:50.814Z"},"maintainers":[{"name":"akhmetovdev","email":"akhmetovdev@gmail.com"}],"description":"The JavaScript SDK for Terra","homepage":"https://github.com/terra-money/terra.js#readme","keywords":["terra","stablecoin","cryptocurrency","blockchain","smart-contracts","wasm","altcoin","altcoins","wallet"],"repository":{"type":"git","url":"git://github.com/terra-money/terra.js.git"},"author":{"name":"Terraform Labs, PTE."},"bugs":{"url":"https://github.com/terra-money/terra.js/issues"},"license":"MIT","readme":"<p>&nbsp;</p>\n<p align=\"center\">\n<img src=\"https://raw.githubusercontent.com/terra-money/terra.js/master/img/terrajs.svg\" width=500>\n</p>\n\n<p align=\"center\">\nThe JavaScript SDK for Terra\n</p>\n\n![diagram](https://raw.githubusercontent.com/terra-money/terra.js/master/img/terrajs-diagram.png)\n\n<br/>\n\n<p align=\"center\">\n  <img alt=\"GitHub\" src=\"https://img.shields.io/github/license/terra-money/terra.js\">\n  <img alt=\"npm (scoped)\" src=\"https://img.shields.io/npm/v/@terra-money/terra.js\">\n</p>\n\n<p align=\"center\">\n  <a href=\"https://docs.terra.money/docs/develop/sdks/terra-js/README.html\"><strong>Explore the Docs »</strong></a>\n  <br />\n  <br/>\n  <a href=\"https://docs.terra.money/docs/develop/sdks/terra-js/common-examples.html\">Examples</a>\n  ·\n  <a href=\"https://terra-money.github.io/terra.js/\">API Reference</a>\n  ·\n  <a href=\"https://www.npmjs.com/package/@terra-money/terra.js\">NPM Package</a>\n  ·\n  <a href=\"https://github.com/terra-money/terra.js\">GitHub</a>\n</p>\n\nTerra.js is a JavaScript SDK for writing applications that interact with the Terra blockchain from either Node.js, browser, or React Native environments and provides simple abstractions over core data structures, serialization, key management, and API request generation.\n\n## Features\n\n- **Written in TypeScript**, with type definitions\n- Versatile support for [key management](https://docs.terra.money/docs/develop/sdks/terra-js/keys.html) solutions\n- Works in Node.js, in the browser, and React Native\n- Exposes the Terra API through [`LCDClient`](https://docs.terra.money/docs/develop/sdks/terra-js/query-data.html)\n- Parses responses into native JavaScript types\n\nWe highly suggest using Terra.js with TypeScript, or JavaScript in a code editor that has support for type declarations, so you can take advantage of the helpful type hints that are included with the package.\n\n## Installation\n\nGrab the latest version off [NPM](https://www.npmjs.com/package/@terra-money/terra.js):\n\n```sh\nnpm install @terra-money/terra.js\n```\n\n## Usage\n\nTerra.js can be used in Node.js, as well as inside the browser. Please check the [docs](https://docs.terra.money/docs/develop/sdks/terra-js/README.html) for notes on how to get up and running.\n\n### Getting blockchain data\n:exclamation: terra.js can connect both terra-classic and terra network. If you want to communicate with classic chain, you have to set isClassic as `true`.\n```ts\nimport { LCDClient, Coin } from '@terra-money/terra.js';\n\n// connect to pisco testnet\nconst terra = new LCDClient({\n  URL: 'https://pisco-lcd.terra.dev',\n  chainID: 'pisco-1',\n  isClassic: false  // if it is unset, LCDClient assumes the flag is false.\n});\n\n// connect to columbus-5 terra classic network\nconst terra = new LCDClient({\n  URL: 'https://columbus-lcd.terra.dev',\n  chainID: 'columbus-5',\n  isClassic: true  // *set to true to connect terra-classic chain*\n});\n\n// To use LocalTerra\n// const terra = new LCDClient({\n//   URL: 'http://localhost:1317',\n//   chainID: 'localterra'\n// });\n\n// get the current balance of `terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v`\nconst balance = terra.bank.balance('terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v');\nconsole.log(balance);\n```\n\n### Broadcasting transactions\n\nFirst, [get](https://faucet.terra.money/) some testnet tokens for `terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v`, or use [LocalTerra](https://www.github.com/terra-money/LocalTerra).\n\n```ts\nimport { LCDClient, MsgSend, MnemonicKey } from '@terra-money/terra.js';\n\n// create a key out of a mnemonic\nconst mk = new MnemonicKey({\n  mnemonic:\n    'notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius',\n});\n\n// connect to bombay testnet\nconst terra = new LCDClient({\n  URL: 'https://pisco-lcd.terra.dev',\n  chainID: 'pisco-1',\n});\n\n// To use LocalTerra\n// const terra = new LCDClient({\n//   URL: 'http://localhost:1317',\n//   chainID: 'localterra'\n// });\n\n// a wallet can be created out of any key\n// wallets abstract transaction building\nconst wallet = terra.wallet(mk);\n\n// create a simple message that moves coin balances\nconst send = new MsgSend(\n  'terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v',\n  'terra17lmam6zguazs5q5u6z5mmx76uj63gldnse2pdp',\n  { uluna: 1200000}\n);\n\nwallet\n  .createAndSignTx({\n    msgs: [send],\n    memo: 'test from terra.js!',\n  })\n  .then(tx => terra.tx.broadcast(tx))\n  .then(result => {\n    console.log(`TX hash: ${result.txhash}`);\n  });\n```\n\n## Terra.js in the browser\n\nYou can access all the objects of the `@terra-money/terra.js` from the global `Terra` object if you load Terra.js with a `<script>` tag.\n\nInclude the following in your browser:\n\n```html\n<script\n  crossorigin\n  src=\"https://unpkg.com/@terra-money/terra.js/dist/bundle.js\"\n></script>\n```\n\nYou can find a small JSFiddle example that refreshes current Oracle votes [here](https://jsfiddle.net/tLm1b527/1/).\n\n## Terra.js in React Native\n\nIn order to use Terra.js inside React Native, you need to add the [`node-libs-react-native`](https://github.com/parshap/node-libs-react-native) package and [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values) package to your React Native app's `package.json`.\n\n```sh\nyarn add node-libs-react-native react-native-get-random-values\n```\n\nYou will need to register Node.js native modules in an entry point of your application, such as `index.tsx`:\n\n```js\nimport 'node-libs-react-native/globals';\nimport 'react-native-get-random-values';\n```\n\nAlso, add resolvers to your `metro.config.js`\n\n```js\nmodule.exports {\n  // ...\n  resolver: {\n    // ...\n    extraNodeModules: require('node-libs-react-native'),\n  },\n  // ...\n}\n```\n\n## License\n\nThis software is licensed under the MIT license. See [LICENSE](./LICENSE) for full disclosure.\n\n© 2020 Terraform Labs, PTE.\n\n<hr/>\n\n<p>&nbsp;</p>\n<p align=\"center\">\n    <a href=\"https://terra.money/\"><img src=\"https://assets.website-files.com/611153e7af981472d8da199c/61794f2b6b1c7a1cb9444489_symbol-terra-blue.svg\" align=\"center\" width=200/></a>\n</p>\n","readmeFilename":"README.md"}