{"_id":"@calindra/web3-client","_rev":"2-de6fe389737ac23f94e175d6a6f5961d","name":"@calindra/web3-client","description":"Web3 Client to Send Input to dApp","dist-tags":{"latest":"0.2.0"},"versions":{"0.0.1":{"name":"@calindra/web3-client","version":"0.0.1","author":{"name":"Calindra"},"license":"MIT","_id":"@calindra/web3-client@0.0.1","maintainers":[{"name":"sandhilt","email":"hilt@outlook.com.br"},{"name":"fabio.oshiro","email":"fabio.oshiro@gmail.com"}],"dist":{"shasum":"7d801567364ff60d366a3a2c91be8f1a340a1377","tarball":"https://registry.npmjs.org/@calindra/web3-client/-/web3-client-0.0.1.tgz","fileCount":10,"integrity":"sha512-YV4znhck2kAtt4ZaohreTtLI+Fbr2/KMi5F2QuiFyWj+tj9iLlosvIJ5z0heucHyfKausE6Lbn9kD6/3LwRiGg==","signatures":[{"sig":"MEUCICEI6e+bxziVW7vrP6dIvX7bcuay7a+0jPz4htd5Q1faAiEAmp0kggH4Zqwc4IOwQv1hgdkyumKpRS0usZJYUtk5dLU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":31269},"main":"src/main.ts","type":"module","source":"src/main.ts","engines":{"node":"^20"},"gitHead":"2a62ba0fc4a6dd396e7ac5d60eddd9317eafc5d9","scripts":{"test":"jest --detectOpenHandles","build":"parcel build","watch":"parcel watch"},"_npmUser":{"name":"sandhilt","email":"hilt@outlook.com.br"},"_npmVersion":"10.2.0","description":"Web3 Client to Send Input To Dapp","directories":{"test":"tests"},"_nodeVersion":"20.10.0","dependencies":{"ethers":"^6.8.1","@cartesi/rollups":"^1.1.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","parcel":"^2.10.1","ts-jest":"^29.1.1","typescript":"^5.2.2","http-request-mock":"^1.8.17","jest-environment-jsdom":"^29.7.0"},"_npmOperationalInternal":{"tmp":"tmp/web3-client_0.0.1_1702516372808_0.32994369225979514","host":"s3://npm-registry-packages"}},"0.1.0":{"name":"@calindra/web3-client","version":"0.1.0","author":{"name":"Calindra"},"license":"MIT","_id":"@calindra/web3-client@0.1.0","maintainers":[{"name":"sandhilt","email":"hilt@outlook.com.br"},{"name":"fabio.oshiro","email":"fabio.oshiro@gmail.com"}],"dist":{"shasum":"595821aef39ce4329364b52961aa01af842b43bd","tarball":"https://registry.npmjs.org/@calindra/web3-client/-/web3-client-0.1.0.tgz","fileCount":13,"integrity":"sha512-IoidJ8SWU0RCiMMJaX1Oz6vngdN0KXedMhmhPz8dQNOYH6KlHeP2Dl4D7y3ZjL2oT0yJBSPvhygDTwnTOo2C9Q==","signatures":[{"sig":"MEQCICvXyY6Kso5HRLMpeI1n4gIvdd7GqU+EmIGduDp/KPNmAiB7Jr8r4P6lB3gRgn0RAS5YjSsgQkESGotF+PDc+mbrcA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":50648},"main":"src/main.js","type":"module","source":"src/main.ts","engines":{"node":">=20.0.0"},"gitHead":"11dcbad05695e7f64f4cd8e9990a83261f478f96","scripts":{"test":"jest --detectOpenHandles","build":"parcel build","watch":"parcel watch"},"_npmUser":{"name":"fabio.oshiro","email":"fabio.oshiro@gmail.com"},"_npmVersion":"10.2.3","description":"Web3 Client to Send Input to dApp","directories":{"test":"tests"},"_nodeVersion":"20.10.0","dependencies":{"ethers":"^6.8.1","@cartesi/rollups":"^1.1.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","parcel":"^2.10.1","ts-jest":"^29.1.1","ts-node":"^10.9.2","typescript":"^5.2.2","http-request-mock":"^1.8.17","jest-environment-jsdom":"^29.7.0"},"_npmOperationalInternal":{"tmp":"tmp/web3-client_0.1.0_1706137137350_0.7154625648533786","host":"s3://npm-registry-packages"}},"0.2.0":{"name":"@calindra/web3-client","version":"0.2.0","description":"Web3 Client to Send Input to dApp","source":"src/main.ts","main":"src/main.js","type":"module","scripts":{"watch":"parcel watch","build":"parcel build","test":"jest --detectOpenHandles"},"author":{"name":"Calindra"},"license":"MIT","devDependencies":{"http-request-mock":"^1.8.17","jest":"^29.7.0","jest-environment-jsdom":"^29.7.0","parcel":"^2.10.1","ts-jest":"^29.1.1","ts-node":"^10.9.2","typescript":"^5.2.2"},"engines":{"node":">=20.0.0"},"dependencies":{"@cartesi/rollups":"^1.4.0","ethers":"^6.13.0"},"directories":{"test":"tests"},"_id":"@calindra/web3-client@0.2.0","gitHead":"5cd4c2e2d2573dd8c7df2a45aba0927765c54ee9","_nodeVersion":"20.14.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-xH8E8H4w9LTCbvRznELM7zjGLR6aX9NYxGQ4/EmI5mgWD2szsubd3hPMNwXKU/RPDbfw+Bl1LEREnQtuoF4KXQ==","shasum":"96ee3bc74f20beebf494b249d2b0e1eb02c16998","tarball":"https://registry.npmjs.org/@calindra/web3-client/-/web3-client-0.2.0.tgz","fileCount":13,"unpackedSize":50649,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC+lB+gWAxn/t/sxGyVwLhPfNjyIr9xbTvUIr8thnV96wIgFcFgmu6w2ymW2xJSEnTgGSh8uGDUY1JrdxymHtVOkyM="}]},"_npmUser":{"name":"fabio.oshiro","email":"fabio.oshiro@gmail.com"},"maintainers":[{"name":"sandhilt","email":"hilt@outlook.com.br"},{"name":"fabio.oshiro","email":"fabio.oshiro@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/web3-client_0.2.0_1718176136669_0.32107247345453693"},"_hasShrinkwrap":false}},"time":{"created":"2023-12-14T01:12:52.737Z","modified":"2024-06-12T07:08:57.050Z","0.0.1":"2023-12-14T01:12:53.058Z","0.1.0":"2024-01-24T22:58:57.542Z","0.2.0":"2024-06-12T07:08:56.833Z"},"maintainers":[{"name":"sandhilt","email":"hilt@outlook.com.br"},{"name":"fabio.oshiro","email":"fabio.oshiro@gmail.com"}],"author":{"name":"Calindra"},"license":"MIT","readme":"# Web3 Client\n\n## Introduction\n\nWeb3 Client is a powerful tool that allows you to interact with the Cartesi Machine. It enables you to send transactions, query data, and interact with your backend seamlessly.\n\n## Getting Started\n\n### Installation\n\nTo use our web3 client, follow these simple installation steps:\n\n```shell\nnpm install @calindra/web3-client\n```\n\n### Usage\n\n1. Import and configure the Web3 library into your project:\n\n   ```ts\n   import { type CartesiClient, CartesiClientBuilder } from \"@calindra/web3-client\";\n\n   const CARTESI_INSPECT_ENDPOINT=\"http://localhost:8080/inspect\";\n\n   // replace with the content of your dapp address (it could be found on dapp.json)\n   const DAPP_ADDRESS=\"0x70ac08179605AF2D9e75782b8DEcDD3c22aA4D0C\";\n\n   const cartesiClient: CartesiClient = new CartesiClientBuilder()\n    .withEndpoint(CARTESI_INSPECT_ENDPOINT)\n    .withLogger({\n      info: console.log,\n      error: console.error,\n    })\n    .withDappAddress(DAPP_ADDRESS)\n    .build();\n    ```\n2. When available set the provider and the signer\n    ```ts\n    cartesiClient.setProvider(provider);\n    cartesiClient.setSigner(signer);\n   ```\n\n3. Start interacting with the Cartesi Machine:\n\n   ```ts\n   const payload = { foo: \"bar\" };\n\n   // send an advance command\n   cartesiClient.advance(payload);\n\n   // send an inspect command\n   cartesiClient.inspect(payload);\n   ```\n\n## Examples\n\nHere are some examples to get started:\n\n### Sending a Transaction\n\nExample: Sending an advance input\n```ts\nconst payload = { \"action\": \"start_game\", \"game_id\": \"123\" };\nawait cartesiClient.advance(payload);\n```\n\n### Querying Data\n\nExample: Getting the player\n```ts\nconst payload = { \"action\": \"show_player\", \"address\": \"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266\" };\nconst player = await cartesiClient.inspect(payload);\n```\n\n## Future Work\n\n- REST client interface.\n","readmeFilename":"README.md"}