{"_id":"@brandonbryant1212/handcash-connect","name":"@brandonbryant1212/handcash-connect","dist-tags":{"latest":"0.5.0"},"versions":{"0.5.0":{"name":"@brandonbryant1212/handcash-connect","version":"0.5.0","description":"HandCash Connect SDK","main":"src/index.js","types":"types/index.d.ts","scripts":{"test":"NODE_ENV=test mocha \"test/**/*.test.js\" --timeout 10000 --file test/setup.js --exit","start":"node src/app/app.js","lint_src":"eslint --ext .js src/","lint_test":"eslint --ext .test.js test/","coverage":"NODE_ENV=test nyc mocha \"test/**/*.test.js\" --timeout 10000 --exit --file test/setup.js"},"keywords":[],"author":{"name":"HandCash Labs S.L"},"license":"ISC","dependencies":{"awilix":"^4.2.2","axios":"^0.21.1","bsv":"^1.5.4","crypto-js":"^3.1.9-1","dotenv":"^8.1.0","dotenv-flow":"^3.1.0","esm":"^3.2.25","lodash":"^4.17.19","run-sdk":"^0.6.41","underscore":"^1.9.1","win-node-env":"^0.4.0"},"devDependencies":{"@babel/core":"^7.17.12","@typescript-eslint/eslint-plugin":"^5.29.0","@typescript-eslint/parser":"^5.29.0","b64-lite":"^1.4.0","chai":"^4.2.0","chai-as-promised":"^7.1.1","eslint":"^7.1.1","eslint-config-airbnb-base":"^15.0.0","eslint-config-airbnb-typescript":"^17.0.0","eslint-config-prettier":"^8.5.0","eslint-import-resolver-webpack":"^0.11.1","eslint-plugin-import":"^2.18.2","eslint-plugin-mocha":"^5.3.0","mocha":"^6.2.0","npm-run-all":"^4.1.5","nyc":"^13.3.0","prettier-eslint":"^9.0.0","sinon":"^7.5.0","supertest":"^4.0.2","typescript":"^4.7.4"},"optionalDependencies":{"win-node-env":"^0.4.0"},"directories":{"test":"test"},"repository":{"type":"git","url":"git+https://github.com/HandCash/handcash-connect-sdk-js.git"},"bugs":{"url":"https://github.com/HandCash/handcash-connect-sdk-js/issues"},"homepage":"https://github.com/HandCash/handcash-connect-sdk-js#readme","gitHead":"37f0bc33939c3962f709226b5f101a78a550a11d","_id":"@brandonbryant1212/handcash-connect@0.5.0","_nodeVersion":"16.3.0","_npmVersion":"7.15.1","dist":{"integrity":"sha512-E2Oi2N49EM36oGkRRw/aeRrx5mI89xZ/xlO1VASAYF17uJmmWjG9QDBSHHmWGJBD0rJ2hHWjyF6CSdUSdnb34g==","shasum":"b1302f0a9d7a5f88d187d35bf1efcb851c3d3d0e","tarball":"https://registry.npmjs.org/@brandonbryant1212/handcash-connect/-/handcash-connect-0.5.0.tgz","fileCount":58,"unpackedSize":75777,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCWUS/SMupaZeQlEIgjKJ5qfcPo/f1WZc74uG5aSi4YtwIhAMn800h+Sg8DcRlzfmp38rSDy5FqP09owIK2SwAPHkoj"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjXB85ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqIfw//Z0OuCdaGwoNJlxYKF/CtCMS5zNTvo/8Cax6Tu7qZHuI/uSoM\r\n3HogaxJoj9O+AnfkPp26FVDdrngRm6Q3GusTwo2swJEmh4VFa3F8S5nhWRiF\r\n3s63uSdKEfCAC2wb5pWWSxDzp1PnT133Tc8w53O52qDZK++z9vF4UT6rENE4\r\nTnpWlRZj80tvIQGl38n2tRNxT3OMseAOt02NQ6vETuMxtzd43FQSGarCfivM\r\nWVA1FsLYZNg+wO4q+GMbF5LxgCUcI+hs0yvnr/hJWV5LBlbe1wmhfVc0ZLN1\r\n3RrID8zuvo2ay/PszkRkaPaiBDHByP7UogLOM3kOZSvkZC0BuHrru2yxvA6b\r\n41x6akCaEr2W5JmWqbBK4LE+01X55jYmrN6ieVHRBdni7mDYkBAx0ITDUscJ\r\n7s/Ea3dfufW5DcWXlElmzOMPtglou6VpVM6eIsx02RgpHOHjcnraXmo7fXWZ\r\naUa2buXNAWhhoCTR8PXKudd0GIBMGWJML6yt/hupg4cu1zNTJOzeZ3l7kaFW\r\nvZmFJfEPGUeHClhfkB4Jtnq2UhWrBEryMs5k9wJkDy6CIO09qjCAQ0fpz4Y2\r\nexlSVGWoGjO88BClstJZmf7YcJNmQErYyAMMjA5+W5OuVUU1CH35mQCdCU6w\r\nH2KVb7MgBggv+6aowyTtMB/gF8V6W/84bVU=\r\n=KyHw\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"brandonbryant1212","email":"b.bryant@handcash.io"},"maintainers":[{"name":"brandonbryant1212","email":"b.bryant@handcash.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/handcash-connect_0.5.0_1666981688938_0.8492798442524379"},"_hasShrinkwrap":false}},"time":{"created":"2022-10-28T18:28:08.871Z","0.5.0":"2022-10-28T18:28:09.188Z","modified":"2022-10-28T18:28:09.318Z"},"maintainers":[{"name":"brandonbryant1212","email":"b.bryant@handcash.io"}],"description":"HandCash Connect SDK","homepage":"https://github.com/HandCash/handcash-connect-sdk-js#readme","keywords":[],"repository":{"type":"git","url":"git+https://github.com/HandCash/handcash-connect-sdk-js.git"},"author":{"name":"HandCash Labs S.L"},"bugs":{"url":"https://github.com/HandCash/handcash-connect-sdk-js/issues"},"license":"ISC","readme":"## Install\n\n`npm i @handcash/handcash-connect`\n\n## Initialize the SDK\n\nTo start, you will need to create an instance of `HandCashConnect`. This object allows you to interact with the SDK.\n\n> Don't have an app yet? Sign-up for [dashboard.handcash.dev](https://dashboard.handcash.dev) and create your first app.\n\nA `HandCashConnect` requires a `appId` that represents your application, as well as an `appSecret` to ensure the SDK is invoked under your domain.\n\n\n```javascript\nconst { HandCashConnect } = require('@handcash/handcash-connect');\n\nconst handCashConnect = new HandCashConnect({ \n   appId: 'your-app-id', \n   appSecret: 'your-app-secret',\n});\n```\n\n## Accessing User Accounts\nIn order to access to user account and trigger payments on their behalf, you need to obtain an `authToken` that represents such permissions. You can find more about [the user authorization process](https://handcash.github.io/handcash-connect-sdk-js-beta-docs/#/user-authorization).\n\n1) Get the `redirectionUrl` that redirects to HandCash to obtain the `authToken`\n2) Redirect the user to the `redirectionUrl`.\n\n```javascript\nconst redirectionUrl = handCashConnect.getRedirectionUrl();\n```\n\n3) Once the user is redirected back to your app with the authToken, you are ready to go!\n\n```javascript\nconst account = handCashConnect.getAccountFromAuthToken(authToken);\n`````\n\n## Your first payment\n\nThe following code shows how to make a simple payment:\n\n```javascript\nconst { HandCashConnect } = require('@handcash/handcash-connect');\n\nconst handCashConnect = new HandCashConnect({ appId: 'your-app-id', appSecret: 'your-app-secret' });\nconst account = handCashConnect.getAccountFromAuthToken(authToken);\n\nconst paymentParameters = {\n  description: 'Hold my beer!🍺',\n  appAction: 'drink',\n  payments: [\n    { to: 'eyeone', currencyCode: 'USD', amount: 0.25 },\n    { to: 'apagut', currencyCode: 'EUR', amount: 0.05 },\n    { to: 'satoshi', currencyCode: 'SAT', amount: 50000 },\n  ]\n};\n\nconst paymentResult = await account.wallet.pay(paymentParameters);\nconsole.log(paymentResult);\n```\n\n```json\n{\n   \"transactionId\":\"0a25cc07953de261e2f7dbc3601a61d4e74f96b99cd55c0755df9b9888cdccbc\",\n   \"note\":\"Hold my beer!🍺\",\n   \"appAction\":\"drink\",\n   \"type\":\"send\",\n   \"time\":1599223479,\n   \"satoshiFees\":288,\n   \"satoshiAmount\":5332,\n   \"fiatExchangeRate\":165.4370470109637,\n   \"fiatCurrencyCode\":\"EUR\",\n   \"participants\":[\n      {\n         \"type\":\"user\",\n         \"alias\":\"eyeone\",\n         \"displayName\":\"Eye One\",\n         \"profilePictureUrl\":\"https://handcash-cloud-production.herokuapp.com/users/profilePicture/eyeone\"\n      },\n      {\n         \"type\":\"user\",\n         \"alias\":\"apagut\",\n         \"displayName\":\"Alex\",\n         \"profilePictureUrl\":\"https://handcash-cloud-production.herokuapp.com/users/profilePicture/apagut\"\n      },\n      {\n         \"type\":\"user\",\n         \"alias\":\"satoshi\",\n         \"displayName\":\"Satoshi Nakamoto\",\n         \"profilePictureUrl\":\"https://handcash-cloud-production.herokuapp.com/users/profilePicture/satoshi\"\n      }\n   ],\n   \"attachments\":[]\n}\n```\n","readmeFilename":"README.md"}