{"_id":"@creatajs/etherosjs-ts-wallet","name":"@creatajs/etherosjs-ts-wallet","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@creatajs/etherosjs-ts-wallet","version":"1.0.0","description":"etherosjs ts/js wallet to sign and broadcast messages created with etherosjs","repository":{"type":"git","url":"git+https://github.com/magnusmage/etherosjs-ts-wallet.git"},"source":"src/signer.ts","main":"lib/signer.js","module":"./lib/signer.module.js","types":"lib/signer.d.ts","license":"MIT","publishConfig":{"access":"public"},"author":{"name":"Usman Ramay","email":"usman.ramay@magnusmage.com"},"lint-staged":{"*.{js,jsx,ts,tsx}":["eslint --fix"],"*.md":["yarn format:md"]},"scripts":{"build":"microbundle","lint":"eslint -c './.eslintrc.js' './packages/**/*.{ts,js}'","lint:ci":"yarn lint . --format junit","lint:md":"markdownlint --ignore node_modules --ignore .git","format":"yarn lint --fix","format:md":"yarn lint:md --fix"},"devDependencies":{"@babel/core":"^7.18.2","@babel/preset-env":"^7.18.2","@babel/preset-typescript":"^7.17.12","@commitlint/cli":"^16.2.0","@commitlint/config-conventional":"^16.2.1","@types/jest":"^27.0.1","@types/node":"^16.9.2","@types/node-fetch":"^2.6.1","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","babel-jest":"^28.1.1","cross-env":"^7.0.3","eslint":"^7.32.0","eslint-config-airbnb":"^18.2.1","eslint-config-airbnb-base":"^14.2.1","eslint-config-prettier":"^8.3.0","eslint-import-resolver-typescript":"^2.5.0","eslint-plugin-import":"^2.24.2","eslint-plugin-jest":"^24.4.2","eslint-plugin-markdown":"^2.2.1","eslint-plugin-prettier":"^4.0.0","husky":"^7.0.4","jest":"^27.5.1","jest-junit":"^13.0.0","link-module-alias":"^1.2.0","lint-staged":"^11.1.2","markdownlint-cli":"^0.31.1","microbundle":"^0.15.0","prettier":"^2.4.1","shx":"^0.3.4","ts-jest":"^27.0.5","ts-node-dev":"^1.1.8","tsconfig-paths":"^3.11.0","typescript":"^4.4.3"},"dependencies":{"@creatajs/address-converter":"^1.0.0","@creatajs/proto":"^1.0.0","@ethersproject/bytes":"^5.6.1","@ethersproject/wallet":"^5.6.2","@hanchon/signature-to-pubkey":"^1.0.0","@metamask/eth-sig-util":"^4.0.1","@tharsis/transactions":"^0.2.3","node-fetch":"2"},"gitHead":"6994123ff6d397c190a4d42da5c1e7779df0407d","bugs":{"url":"https://github.com/magnusmage/etherosjs-ts-wallet/issues"},"homepage":"https://github.com/magnusmage/etherosjs-ts-wallet#readme","_id":"@creatajs/etherosjs-ts-wallet@1.0.0","_nodeVersion":"19.2.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-rdOe4qMIboMZ3DKcd6Vw/TyVekha4HyWsqw2sIgwNwNgs/F5miEO2kXRhyTp5UXql8S6QOURhRB0i8mxi5/2fA==","shasum":"25eda71638ebba9311b6c9da2dc2428684505651","tarball":"https://registry.npmjs.org/@creatajs/etherosjs-ts-wallet/-/etherosjs-ts-wallet-1.0.0.tgz","fileCount":14,"unpackedSize":61421,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDnH/QKe0UoRPGcUOJL/Q45aasaxgMf6Qm0vBCgkNp4NAIhAIHrWGpEX4uWuxxmizhXDcYHq8J1kkZcOrLtggcgNQc9"}]},"_npmUser":{"name":"usmanramay","email":"usman.ramay@magnusmage.com"},"directories":{},"maintainers":[{"name":"usmanramay","email":"usman.ramay@magnusmage.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/etherosjs-ts-wallet_1.0.0_1704144884362_0.6950159271883116"},"_hasShrinkwrap":false}},"time":{"created":"2024-01-01T21:34:44.274Z","1.0.0":"2024-01-01T21:34:44.562Z","modified":"2024-01-01T21:34:44.878Z"},"maintainers":[{"name":"usmanramay","email":"usman.ramay@magnusmage.com"}],"description":"etherosjs ts/js wallet to sign and broadcast messages created with etherosjs","homepage":"https://github.com/magnusmage/etherosjs-ts-wallet#readme","repository":{"type":"git","url":"git+https://github.com/magnusmage/etherosjs-ts-wallet.git"},"author":{"name":"Usman Ramay","email":"usman.ramay@magnusmage.com"},"bugs":{"url":"https://github.com/magnusmage/etherosjs-ts-wallet/issues"},"license":"MIT","readme":"# Evmos TS Wallet\n\nEvmos ts/js wallet to sign and broadcast messages created with evmosjs\n\n## Usage\n\n```sh\nyarn add @hanchon/evmos-ts-wallet\n```\n\nSome constants are exported as helpers but the values may not be updated for the current state of the network:\n\n- MAINNET_FEE\n- TESTNET_FEE\n- LOCALNET_FEE\n- MAINNET_CHAIN\n- TESTNET_CHAIN\n- LOCALNET_CHAIN\n\n## Configuration\n\nThe constants for `fee` and `chain` should be updated by the user to follow the network upgrade and the fee changes, I'll try to keep it up to date, but probably you want to control this values in your code.\n\nBoth `getSender` and `brodcast` should set the option parameter called `url`, this should be pointing to the port `1317` of your node or a public rest endpoint. By default is using `localhost:1317`.\n\nBoth `signing` functions have the optional parameter `broadcastMode` that by default is `BROADCAST_MODE_BLOCK`.\n\n## Example using keplr signature\n\n```ts\nimport { Wallet } from '@ethersproject/wallet'\nimport { createMessageSend } from '@tharsis/transactions'\nimport {\n  broadcast,\n  getSender,\n  LOCALNET_CHAIN,\n  LOCALNET_FEE,\n  signTransaction,\n} from '@hanchon/evmos-ts-wallet'\n;(async () => {\n  const privateMnemonic =\n    'pluck view carry maid bamboo river major where dutch wood certain oval order wise awkward clerk adult summer because number raven coil crunch hat'\n  const wallet = Wallet.fromMnemonic(privateMnemonic)\n\n  const sender = await getSender(wallet)\n  const txSimple = createMessageSend(LOCALNET_CHAIN, sender, LOCALNET_FEE, '', {\n    destinationAddress: 'evmos1pmk2r32ssqwps42y3c9d4clqlca403yd9wymgr',\n    amount: '1',\n    denom: 'aevmos',\n  })\n\n  const resKeplr = await signTransaction(wallet, txSimple)\n  const broadcastRes = await broadcast(resKeplr)\n  if (broadcastRes.tx_response.code === 0) {\n    console.log('Success')\n  } else {\n    console.log('Error')\n  }\n})()\n```\n\n## Example using eip712\n\n```ts\nimport { Wallet } from '@ethersproject/wallet'\nimport { createMessageSend } from '@tharsis/transactions'\nimport {\n  broadcast,\n  getSender,\n  LOCALNET_CHAIN,\n  LOCALNET_FEE,\n  signTransactionUsingEIP712,\n} from '@hanchon/evmos-ts-wallet'\n;(async () => {\n  const privateMnemonic =\n    'pluck view carry maid bamboo river major where dutch wood certain oval order wise awkward clerk adult summer because number raven coil crunch hat'\n  const wallet = Wallet.fromMnemonic(privateMnemonic)\n  const sender = await getSender(wallet)\n\n  const txSimple = createMessageSend(LOCALNET_CHAIN, sender, LOCALNET_FEE, '', {\n    destinationAddress: 'evmos1pmk2r32ssqwps42y3c9d4clqlca403yd9wymgr',\n    amount: '1',\n    denom: 'aevmos',\n  })\n\n  const resMM = await signTransactionUsingEIP712(\n    wallet,\n    sender.accountAddress,\n    txSimple,\n  )\n\n  const broadcastRes = await broadcast(resMM)\n  if (broadcastRes.tx_response.code === 0) {\n    console.log('Success')\n  } else {\n    console.log('Error')\n  }\n})()\n```\n\n## NOTE\n\n- If your wallet didn't get any transaction, it won't be registered in the blockchain and the `getSender` function will throw an error.\n- The `getSender` function should be called before sending each transaction to update the nonce or manually increment the value in the sender object.\n\n## Dependencies\n\n- @ethersproject\n- @metamask/eth-sig-util\n- @creatajs/proto\n- @tharsis/transactions\n- node-fetch (using `v2` that is limited but should work without enforcing `ESM`. In `src/helper.ts` there is a basic implementation of `fetch` and `post` that can be used to replace `node-fetch`, in case that lib is not working for your case)\n","readmeFilename":"README.md"}