{"dist":{"shasum":"8c42e89c3a474e163ec6b055eb6e0eac1ddb9792","tarball":"https://registry.npmjs.org/@cosmjs/launchpad/-/launchpad-0.24.0-alpha.0.tgz","fileCount":93,"integrity":"sha512-u5qP/YjDGyEMV3FusQlE2cYN7XB1VGd5Mz8tQ8bNewN2HkQ8T45+VPe5IigHCSbPPoVeOtfsIU/xa/9ioDYSog==","signatures":[{"sig":"MEYCIQC8nn2O6omIgFkdZvcUBWpPUBDriIa7V0BRGXlwwIOV7gIhAKsYiLxi+LOqEPfm1/QI1KKZ0sPse6XrX+87jDR2Stgo","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":210484,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfm0KPCRA9TVsSAnZWagAA9F4P/1O7D2yN2DIaXOf7E0Lg\n+5EaZBBBIjfJ3Q5+EOfe2/7ymsXaR3PGLcE1T7AiA7a9nMwDbyzoqgQKi028\n60OumrVWTYyHWepWSvQX9zGP/4F3NZdEihYdI/LHQ/1rJ9FmywWEkvbHUcZN\nqw7pijLRevizyfQRpayqWXHDmfEWyOyBDvB7t16w5lvG3kpS9dgD9U2EJYix\n+inmWqOJNBxffGgLGL5S2pLldMXKUY3TvpFaDBea1+JoKoMJ9jFAcWbzfO9x\n/v/dWkGyagGl2SyG9FIa+lx4dTOnVXRUfTgmFK1TFaTUmg1KlW2dYXNaLPKJ\nr5UeUTi1orjxvRRhYiSrT61vKGQcMZtyL3dEVnTlE701RYB9nBjG+/1O6AhE\nwZQCIj5dZ6WuOl3hS6SLt3TP1ii0wOr5kigIl+qDAHZnjcyCdFT6zvX+4clk\nhqydpu2B+9m98CUBYhMaDvmTPMJXHouLFb5uuU7d2EblqLAxneiWsAOCvnfm\nzheRFfHXcexJDPceMIg4im4Oaoz3y4Tn6M1VMcmrZDh4hrAStvVtxLejIbHl\nhP9uAkl8GvMoZg7I3cqbPSQyOGQzh8oiENJ3J52P+kCISkX/z80duucv/Hvl\nEjw+dNBsTQqyZ9tdH4rBnjkMMZGX5jZjwJoqJB8otsrz7dMjClW4ZfWA2+l+\nyq1h\r\n=ZTfo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"build/index.js","name":"@cosmjs/launchpad","types":"types/index.d.ts","readme":"# @cosmjs/launchpad\n\n[![npm version](https://img.shields.io/npm/v/@cosmjs/launchpad.svg)](https://www.npmjs.com/package/@cosmjs/launchpad)\n\nA client library for the Cosmos SDK 0.37 (cosmoshub-3), 0.38 and 0.39\n(Launchpad). See the article\n[Launchpad — A pre-stargate stable version of the Cosmos SDK](https://blog.cosmos.network/launchpad-a-pre-stargate-stable-version-of-the-cosmos-sdk-e0c58d8c4e24)\nto learn more about launchpad.\n\n## Cosmos SDK module support\n\nThis client library supports connecting to standard Cosmos SDK modules as well\nas custom modules. The modularity has two sides that are handled separately:\n\n- Queries are for reading data from the chain;\n- Messages are for writing data to chain as part of the transaction signing.\n\n### Query support\n\n@cosmjs/launchpad now has a flexible\n[LcdClient](https://cosmwasm.github.io/cosmjs/latest/launchpad/classes/lcdclient.html),\nwhich can be extended with all the standard Cosmos SDK modules in a type-safe\nway. With\n\n```ts\nimport { LcdClient } from \"@cosmjs/launchpad\";\n\nconst client = new LcdClient(apiUrl);\nconst response = await client.nodeInfo();\n```\n\nyou only get access to blocks, transaction lists and node info. In order to sign\ntransactions, you need to setup the auth extension with:\n\n```ts\nimport { LcdClient, setupAuthExtension } from \"@cosmjs/launchpad\";\n\nconst client = LcdClient.withExtensions({ apiUrl }, setupAuthExtension);\nconst { account_number, sequence } = (\n  await client.auth.account(myAddress)\n).result.value;\n```\n\nA full client can use all of the following extensions:\n\n```ts\nimport {\n  LcdClient,\n  setupAuthExtension,\n  setupBankExtension,\n  setupDistributionExtension,\n  setupGovExtension,\n  setupMintExtension,\n  setupSlashingExtension,\n  setupStakingExtension,\n  setupSupplyExtension,\n} from \"@cosmjs/launchpad\";\n\nconst client = LcdClient.withExtensions(\n  { apiUrl },\n  setupAuthExtension,\n  setupBankExtension,\n  setupDistributionExtension,\n  setupGovExtension,\n  setupMintExtension,\n  setupSlashingExtension,\n  setupStakingExtension,\n  setupSupplyExtension,\n);\n\n// Example queries\nconst balances = await client.bank.balances(myAddress);\nconst distParameters = await client.distribution.parameters();\nconst proposals = await client.gov.proposals();\nconst inflation = await client.mint.inflation();\nconst signingInfos = await client.slashing.signingInfos();\nconst redelegations = await client.staking.redelegations();\nconst supply = await client.supply.totalAll();\n```\n\n### Messages suppport\n\nEvery Amino-JSON compatible message can be used for the\n[Msg](https://cosmwasm.github.io/cosmjs/latest/launchpad/interfaces/msg.html)\ninterface like this:\n\n```ts\nconst voteMsg: Msg = {\n  type: \"cosmos-sdk/MsgVote\",\n  value: {\n    proposal_id: proposalId,\n    voter: faucet.address,\n    option: \"Yes\",\n  },\n};\n```\n\nThis is most flexible since you are not restricted to known messages, but gives\nyou very little type safety. For improved type safety, we added TypeScript\ndefinitions for all common Cosmos SDK messages:\n\n- MsgSend\n- MsgMultiSend\n- MsgVerifyInvariant\n- MsgSetWithdrawAddress\n- MsgWithdrawDelegatorReward\n- MsgWithdrawValidatorCommission\n- MsgFundCommunityPool\n- MsgSubmitEvidence\n- MsgSubmitProposal\n- MsgVote\n- MsgDeposit\n- MsgUnjail\n- MsgCreateValidator\n- MsgEditValidator\n- MsgDelegate\n- MsgBeginRedelegate\n- MsgUndelegate\n\nThose can be signed and broadcast the manual way or by using a higher level\n[SigningCosmosClient](https://cosmwasm.github.io/cosmjs/latest/launchpad/classes/signingcosmosclient.html):\n\n```ts\nimport {\n  coins,\n  BroadcastTxResult,\n  MsgSubmitProposal,\n  OfflineSigner,\n  SigningCosmosClient,\n  StdFee,\n} from \"@cosmjs/launchpad\";\n\nasync function publishProposal(\n  apiUrl: string,\n  signer: OfflineSigner,\n): Promise<BroadcastTxResult> {\n  const [{ address: authorAddress }] = await signer.getAccounts();\n\n  const memo = \"My first proposal on chain\";\n  const msg: MsgSubmitProposal = {\n    type: \"cosmos-sdk/MsgSubmitProposal\",\n    value: {\n      content: {\n        type: \"cosmos-sdk/TextProposal\",\n        value: {\n          description:\n            \"This proposal proposes to test whether this proposal passes\",\n          title: \"Test Proposal\",\n        },\n      },\n      proposer: authorAddress,\n      initial_deposit: coins(25000000, \"ustake\"),\n    },\n  };\n  const fee: StdFee = {\n    amount: coins(5000000, \"ucosm\"),\n    gas: \"89000000\",\n  };\n\n  const client = new SigningCosmosClient(apiUrl, authorAddress, signer);\n  return client.signAndBroadcast([msg], fee, memo);\n}\n```\n\n### Custom modules\n\nBoth query and message support is implemented in a decentralized fashion, which\nallows applications to add their extensions without changing CosmJS. As an\nexample we show how to build a client for a blockchain with a wasm module:\n\n```ts\nimport { MsgExecuteContract, setupWasmExtension } from \"@cosmjs/cosmwasm\";\nimport {\n  assertIsBroadcastTxResult,\n  LcdClient,\n  makeSignDoc,\n  setupAuthExtension,\n  StdFee,\n  StdTx,\n} from \"@cosmjs/launchpad\";\n\nconst client = LcdClient.withExtensions(\n  { apiUrl },\n  setupAuthExtension,\n  // 👇 this extension can come from a chain-specific package or the application itself\n  setupWasmExtension,\n);\n\n// 👇 this message type can come from a chain-specific package or the application itself\nconst msg: MsgExecuteContract = {\n  type: \"wasm/MsgExecuteContract\",\n  value: {\n    sender: myAddress,\n    contract: contractAddress,\n    msg: wasmMsg,\n    sent_funds: [],\n  },\n};\n\nconst fee: StdFee = {\n  amount: coins(5000000, \"ucosm\"),\n  gas: \"89000000\",\n};\nconst memo = \"Time for action\";\nconst { account_number, sequence } = (\n  await client.auth.account(myAddress)\n).result.value;\nconst signDoc = makeSignDoc([msg], fee, apiUrl, memo, account_number, sequence);\nconst { signed, signature } = await signer.sign(myAddress, signDoc);\nconst signedTx = makeStdTx(signed, signature);\nconst result = await client.broadcastTx(signedTx);\nassertIsBroadcastTxResult(result);\n```\n\n## Secure key storage\n\n[Secp256k1HdWallet](https://cosmwasm.github.io/cosmjs/latest/launchpad/classes/secp256k1hdwallet.html)\nsupports securely encrypted serialization/deserialization using Argon2 for key\nderivation and XChaCha20Poly1305 for authenticated encryption. It can be used as\neasily as:\n\n```ts\n// generate an 18 word mnemonic\nconst wallet = await Secp256k1HdWallet.generate(18);\nconst serialized = await original.serialize(\"my password\");\n\n// serialized is encrypted and can now be stored in an application-specific way\n\nconst restored = await Secp256k1HdWallet.deserialize(serialized, \"my password\");\n```\n\nIf you want to use really strong KDF parameters in a user interface, you should\noffload the KDF execution to a separate thread in order to avoid freezing the\nUI. This can be done in the advanced mode:\n\n**Session 1 (main thread)**\n\n```ts\nconst wallet = await Secp256k1HdWallet.generate(18);\n```\n\n**Session 1 (WebWorker)**\n\nThis operation can now run a couple of seconds without freezing the UI.\n\n```ts\nimport { executeKdf } from \"@cosmjs/launchpad\";\n\n// pass password to the worker\n\nconst strongKdfParams: KdfConfiguration = {\n  algorithm: \"argon2id\",\n  params: {\n    outputLength: 32,\n    opsLimit: 5000,\n    memLimitKib: 15 * 1024,\n  },\n};\nconst encryptionKey = await executeKdf(password, strongKdfParams);\n\n// pass encryptionKey to the main thread\n```\n\n**Session 1 (main thread)**\n\n```ts\nconst serialized = await wallet.serializeWithEncryptionKey(\n  encryptionKey,\n  anyKdfParams,\n);\n```\n\n**Session 2 (WebWorker)**\n\n```ts\nimport { executeKdf, extractKdfConfiguration } from \"@cosmjs/launchpad\";\n\n// pass serialized and password to the worker\n\nconst kdfConfiguration = extractKdfConfiguration(serialized);\nconst encryptionKey = await executeKdf(password, kdfConfiguration);\n\n// pass encryptionKey to the main thread\n```\n\n**Session 2 (main thead)**\n\n```ts\nconst restored = await Secp256k1HdWallet.deserializeWithEncryptionKey(\n  serialized,\n  encryptionKey,\n);\n\n// use restored for signing\n```\n\n## License\n\nThis package is part of the cosmjs repository, licensed under the Apache License\n2.0 (see [NOTICE](https://github.com/CosmWasm/cosmjs/blob/master/NOTICE) and\n[LICENSE](https://github.com/CosmWasm/cosmjs/blob/master/LICENSE)).\n","gitHead":"b77dc03eb7fd8d5ae88c9e0f7e776893b5d37986","license":"Apache-2.0","scripts":{"docs":"typedoc --options typedoc.js","lint":"eslint --max-warnings 0 \"**/*.{js,ts}\"","test":"yarn build-or-skip && yarn test-node","build":"tsc","format":"prettier --write --loglevel warn \"./src/**/*.ts\"","coverage":"nyc --reporter=text --reporter=lcov yarn test --quiet","lint-fix":"eslint --max-warnings 0 \"**/*.{js,ts}\" --fix","pack-web":"yarn build-or-skip && webpack --mode development --config webpack.web.config.js","prebuild":"shx rm -rf ./build","postbuild":"yarn move-types && yarn format-types","test-node":"node jasmine-testrunner.js","move-types":"shx rm -rf ./types/* && shx mv build/types/* ./types && rm -rf ./types/testdata && shx rm -f ./types/*.spec.d.ts && shx rm ./types/**/*.spec.d.ts","format-text":"prettier --write --prose-wrap always --print-width 80 \"./*.md\"","test-chrome":"yarn pack-web && karma start --single-run --browsers ChromeHeadless","format-types":"prettier --write --loglevel warn \"./types/**/*.d.ts\"","test-firefox":"yarn pack-web && karma start --single-run --browsers Firefox","build-or-skip":"[ -n \"$SKIP_BUILD\" ] || yarn build"},"_npmUser":{"name":"webmaster128","email":"simon@warta.it"},"repository":{"url":"https://github.com/CosmWasm/cosmjs/tree/master/packages/launchpad","type":"git"},"_npmVersion":"lerna/3.22.1/node@v15.0.1+x64 (darwin)","description":"A client library for the Cosmos SDK 0.37 (cosmoshub-3), 0.38 and 0.39 (Launchpad)","directories":{},"maintainers":[{"name":"webmaster128","email":"simon@warta.it"}],"_nodeVersion":"15.0.1","contributors":[{"name":"Ethan Frey","email":"ethanfrey@users.noreply.github.com"},{"name":"Simon Warta","email":"webmaster128@users.noreply.github.com"}],"dependencies":{"axios":"^0.19.0","@cosmjs/math":"^0.24.0-alpha.0","@cosmjs/utils":"^0.24.0-alpha.0","@cosmjs/crypto":"^0.24.0-alpha.0","@cosmjs/encoding":"^0.24.0-alpha.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"readonly-date":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/launchpad_0.24.0-alpha.0_1604010639489_0.19468616848627063","host":"s3://npm-registry-packages"},"_id":"@cosmjs/launchpad@0.24.0-alpha.0","version":"0.24.0-alpha.0"}