{"_id":"@arthuravianna/cartesi-client","name":"@arthuravianna/cartesi-client","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@arthuravianna/cartesi-client","version":"0.1.0","description":"A typescript package that abstracts the complexity of the interaction with a Cartesi Rollups DApp.","homepage":"https://github.com/prototyp3-dev/cartesi-client#readme","bugs":{"url":"https://github.com/prototyp3-dev/cartesi-client/issues"},"repository":{"type":"git","url":"git+https://github.com/prototyp3-dev/cartesi-client.git"},"license":"Apache-2.0","author":{"name":"Arthur Vianna"},"type":"commonjs","main":"dist/index.js","types":"dist/index.d.ts","directories":{"test":"tests"},"scripts":{"build":"npm run codegen:graphql && tsc && tsc-alias","clean":"rm -r dist","codegen:graphql":"npx graphql-code-generator","test":"jest"},"dependencies":{"@cartesi/rollups":"^1.3.1","graphql":"~16.6.0","graphql-request":"^6.1.0","graphql-tag":"~2.12.6","react":"^18.2.0"},"devDependencies":{"@ethersproject/providers":"^5.7.1","@graphql-codegen/cli":"^5.0.0","@graphql-codegen/typed-document-node":"^5.0.6","@graphql-codegen/typescript-operations":"^4.0.1","@types/jest":"^29.5.7","ethers":"^5.7.2","ts-jest":"^29.1.1","tsc-alias":"^1.8.8"},"overrides":{"@graphql-codegen/cli":{"graphql":"~16.6.0"},"@graphql-codegen/typescript-operations":{"graphql":"~16.6.0"}},"_id":"@arthuravianna/cartesi-client@0.1.0","gitHead":"ad5c535c015853c7419880e14e6f1f9317035625","_nodeVersion":"22.14.0","_npmVersion":"11.2.0","dist":{"integrity":"sha512-NfIRYUO05bSt887C0uJqhLpL8zSPnruP2oql2g7mH2H5mTJBWwa02Qcji/dNawIR1P9d/dqHyjm4bCW0UFZluw==","shasum":"8f27e209b937564a86c3136858def3fa5e090099","tarball":"https://registry.npmjs.org/@arthuravianna/cartesi-client/-/cartesi-client-0.1.0.tgz","fileCount":29,"unpackedSize":158527,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFWrHHm4MiFCFz23wI7NVkPlkJ1AO2matTn5TZ7f7asgAiAxKJuk1mZvtU4RACVKNdcgdbJtNTIknEtT4K+cx2X0sQ=="}]},"_npmUser":{"name":"arthuravianna","email":"arthurvianna@id.uff.br"},"maintainers":[{"name":"arthuravianna","email":"arthurvianna@id.uff.br"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cartesi-client_0.1.0_1753730036029_0.5688560368211699"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-28T19:13:55.964Z","0.1.0":"2025-07-28T19:13:56.213Z","modified":"2025-07-28T19:13:56.448Z"},"maintainers":[{"name":"arthuravianna","email":"arthurvianna@id.uff.br"}],"description":"A typescript package that abstracts the complexity of the interaction with a Cartesi Rollups DApp.","homepage":"https://github.com/prototyp3-dev/cartesi-client#readme","repository":{"type":"git","url":"git+https://github.com/prototyp3-dev/cartesi-client.git"},"author":{"name":"Arthur Vianna"},"bugs":{"url":"https://github.com/prototyp3-dev/cartesi-client/issues"},"license":"Apache-2.0","readme":"# Cartesi Client\nA typescript package that abstracts the complexity of the interaction with a Cartesi Rollups DApp.\n\n## Table of Contents\n- [Build](#build)\n- [Import it locally](#import-it-locally)\n- [Input Functions](#input-functions)\n    - [Advance](#advance)\n        - [advanceInput](#advanceinput)\n        - [advanceEtherDeposit](#advanceetherdeposit)\n        - [advanceERC20Deposit](#advanceerc20deposit)\n        - [advanceERC721Deposit](#advanceerc721deposit)\n    - [Inspect](#inspect)\n        - [inspect](#inspect-1)\n- [Output Functions](#output-functions)\n    - [Reports](#reports)\n        - [getReports](#getreports)\n        - [getReport](#getreport)\n    - [Notices](#notices)\n        - [getNotices](#getnotices)\n        - [getNotice](#getnotice)\n    - [Vouchers](#vouchers)\n        - [getUnexecutedVouchers](#getunexecutedvouchers)\n        - [getVouchersReady](#getvouchersready)\n        - [executeVoucher](#executevoucher)\n\n# Build\n```shell\nnpm install\nnpm run build\nnpm link\n```\n\n# Import it locally\n```shell\ncd \\<path_to_my_project\\>\nnpm link cartesi-client\n```\nIn your code\n```typescript\nimport { advanceInput } from \"cartesi-client\";\n```\n# Input Functions\n## Advance\nFunctions in this subsection trigger an advance state in the Cartesi DApp. The return type of the functions depends on the value of the optional parameter **sync**.\n\n| sync  | return value                                                               | return description                                                               |\n|-------|----------------------------------------------------------------------------|----------------------------------------------------------------------------------|\n| true  | {notices: Array\\<Notice>, reports: Array\\<Report>, vouchers: Array\\<Voucher>} | An object containing the notices, reports, and vouchers  generated by the input. |\n| false | ContractReceipt                                                            | The layer-1 confirmation of the input (web3 transaction receipt).                |\n### advanceInput\nSends a generic input (payload) to the Cartesi DApp.\n\n| Parameter               | Required | Type    | Default                                    |\n|-------------------------|----------|---------|--------------------------------------------|\n| client                  | true     | Signer  | -                                          |\n| dappAddress             | true     | string  | -                                          |\n| payload                 | true     | string  | -                                          |\n| options.sync            | false    | boolean | true                                       |\n| options.cartessiNodeUrl | false    | string  | http://localhost:8080                      |\n| options.inputBoxAddress | false    | string  | 0x59b22D57D4f067708AB0c00552767405926dc768 |\n\n### advanceEtherDeposit\nSends a deposit of **amount** ETHERs to the Cartesi DApp.\n\n| Parameter                  | Required | Type    | Default                                    |\n|----------------------------|----------|---------|--------------------------------------------|\n| client                     | true     | Signer  | -                                          |\n| dappAddress                | true     | string  | -                                          |\n| amount                     | true     | number  | -                                          |\n| options.sync               | false    | boolean | true                                       |\n| options.cartessiNodeUrl    | false    | string  | http://localhost:8080                      |\n| options.etherPortalAddress | false    | string  | 0xFfdbe43d4c855BF7e0f105c400A50857f53AB044 |\n\n\n### advanceERC20Deposit\nSends a deposit of **amount** ERC20 tokens to the Cartesi DApp.\n\n| Parameter                  | Required | Type    | Default                                    |\n|----------------------------|----------|---------|--------------------------------------------|\n| client                     | true     | Signer  | -                                          |\n| dappAddress                | true     | string  | -                                          |\n| tokenAddress               | true     | string  | -                                          |\n| amount                     | true     | number  | -                                          |\n| options.sync               | false    | boolean | true                                       |\n| options.cartessiNodeUrl    | false    | string  | http://localhost:8080                      |\n| options.erc20PortalAddress | false    | string  | 0x9C21AEb2093C32DDbC53eEF24B873BDCd1aDa1DB |\n\n### advanceERC721Deposit\nDeposit the ERC721 token with address **tokenAddress** and id **tokenId** to the Cartesi DApp.\n\n| Parameter                   | Required | Type    | Default                                    |\n|-----------------------------|----------|---------|--------------------------------------------|\n| client                      | true     | Signer  | -                                          |\n| dappAddress                 | true     | string  | -                                          |\n| tokenAddress                | true     | string  | -                                          |\n| tokenId                     | true     | number  | -                                          |\n| options.sync                | false    | boolean | true                                       |\n| options.cartessiNodeUrl     | false    | string  | http://localhost:8080                      |\n| options.erc721PortalAddress | false    | string  | 0x237F8DD094C0e47f4236f12b4Fa01d6Dae89fb87 |\n\n### advanceDAppRelay\nSends the dapp address to the Cartesi DApp.\n\n| Parameter                  | Required | Type    | Default                                    |\n|----------------------------|----------|---------|--------------------------------------------|\n| client                     | true     | Signer  | -                                          |\n| dappAddress                | true     | string  | -                                          |\n| options.sync               | false    | boolean | true                                       |\n| options.cartessiNodeUrl    | false    | string  | http://localhost:8080                      |\n| options.dappRelayAddress   | false    | string  | 0xF5DE34d6BbC0446E2a45719E718efEbaaE179daE |\n\n## Inspect\n### inspect\nSends an inspect to a Cartesi Node with input payload\n\n| Parameter              | Required | Type    | Default               |\n|------------------------|----------|---------|-----------------------|\n| cartesiNodeUrl         | true     | string  | -                     |\n| payload                | true     | string  | -                     |\n| options.aggregate      | false    | boolean | false                 |\n| options.decodeTo       | false    | string  | utf-8                 |\n\n# Output Functions\n## Vouchers\n\n### getVouchers\nQueries Cartesi Node's GraphQL server for vouchers.\n\n| Parameter  | Required | Type   | Default   |\n|------------|----------|--------|-----------|\n| url        | true     | string | -         |\n| inputIndex | false    | number | undefined |\n\n### getVoucher\nQueries Cartesi Node's GraphQL server looking for a specific voucher.\n\n| Parameter    | Required | Type   | Default |\n|--------------|----------|--------|---------|\n| url          | true     | string | -       |\n| voucherIndex | true     | number | -       |\n| inputIndex   | true     | number | -       |\n\n### getUnexecutedVouchers\nRetrieve all vouchers not executed.\n\n| Parameter      | Required | Type             | Default               |\n|----------------|----------|------------------|-----------------------|\n| signOrProvider | true     | Signer\\|Provider | -                     |\n| dappAddress    | true     | string           | -                     |\n| cartesiNodeUrl | false    | string           | http://localhost:8080 |\n\n### getVouchersReady\nRetrieve all vouchers ready to be executed.\n\n| Parameter      | Required | Type             | Default               |\n|----------------|----------|------------------|-----------------------|\n| signOrProvider | true     | Signer\\|Provider | -                     |\n| dappAddress    | true     | string           | -                     |\n| cartesiNodeUrl | false    | string           | http://localhost:8080 |\n\n### executeVoucher\nExecute a voucher given its inputIndex and voucherIndex.\n\n| Parameter      | Required | Type   | Default               |\n|----------------|----------|--------|-----------------------|\n| signer         | true     | Signer | -                     |\n| dappAddress    | true     | string | -                     |\n| inputIndex     | true     | number | -                     |\n| voucherIndex   | true     | number | -                     |\n| cartesiNodeUrl | false    | string | http://localhost:8080 |\n\n## Notices\n\n### getNotices\nQueries Cartesi Node's GraphQL server for notices.\n\n| Parameter  | Required | Type   | Default   |\n|------------|----------|--------|-----------|\n| url        | true     | string | -         |\n| inputIndex | false    | number | undefined |\n\n### getNotice\nQueries Cartesi Node's GraphQL server looking for a specific notice.\n\n| Parameter   | Required | Type   | Default |\n|-------------|----------|--------|---------|\n| url         | true     | string | -       |\n| inputIndex  | true     | number | -       |\n| noticeIndex | false    | number | 0       |\n\n## Reports\n\n### getReports\nQueries Cartesi Node's GraphQL server for reports.\n\n| Parameter  | Required | Type   | Default   |\n|------------|----------|--------|-----------|\n| url        | true     | string | -         |\n| inputIndex | false    | number | undefined |\n\n### getReport\nQueries Cartesi Node's GraphQL server looking for a specific report.\n\n| Parameter   | Required | Type   | Default |\n|-------------|----------|--------|---------|\n| url         | true     | string | -       |\n| inputIndex  | true     | number | -       |\n| reportIndex | false    | number | 0       |\n\n# Run package Tests\n\n1. Run the test backend in one of the terminals\n```shell\ncd backend\nsunodo build\nsunodo run\n```\n\n2. Open a new terminal to deploy the ERC721 contract and mint the NFT used for tests\n```shell\nexport MNEMONIC=\"test test test test test test test test test test test junk\"\nexport RPC_URL=\"http://localhost:8545\"\nexport PUBLIC_KEY=\"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC\"\nexport ERC721_ADDRESS=\"0xc6e7DF5E7b4f2A278906862b61205850344D4e7d\"\n```\n\n```shell\ncd backend/contracts\n```\n\n```shell\nforge build\n```\n\n```shell\nforge create --rpc-url \"${RPC_URL}\" --mnemonic \"${MNEMONIC}\" --json src/simpleERC721.sol:SimpleERC721\n```\n\n```shell\ncast send --mnemonic \"${MNEMONIC}\" --rpc-url \"${RPC_URL}\" ${ERC721_ADDRESS} \"mintTo(address)\" ${PUBLIC_KEY}\n```\n\n3. Go Back to cartesi-client root dir and run the tests\n\n```shell\ncd ../../\n```\n\n```shell\nnpm run test\n```\n","readmeFilename":"README.md","_rev":"1-eae53599dc8abcf8d87c3450d4d03f96"}