{"_id":"@axecute-official/axecute-sdk","_rev":"2-2855087fe6ac5cc5d7955c3f3a81e1da","name":"@axecute-official/axecute-sdk","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@axecute-official/axecute-sdk","version":"1.0.0","description":"Typescript SDK for Axecute","main":"src/index.ts","scripts":{"test":"jest"},"repository":{"type":"git","url":"git+https://github.com/Axecute-official/axecute-sdk.git"},"keywords":["Axecute"],"author":{"name":"Axecute"},"license":"MIT","bugs":{"url":"https://github.com/Axecute-official/axecute-sdk/issues"},"homepage":"https://github.com/Axecute-official/axecute-sdk#readme","dependencies":{"ethers":"^6.7.0"},"devDependencies":{"@types/jest":"^29.5.3","jest":"^29.6.2","ts-jest":"^29.1.1"},"preset":"ts-jest","testEnvironment":"node","gitHead":"ee893b1ccf2e889390e5198c01a049ec709bb74a","_id":"@axecute-official/axecute-sdk@1.0.0","_nodeVersion":"18.14.0","_npmVersion":"9.3.1","dist":{"integrity":"sha512-bKsZ/BoC8LRbMWy9GG9WqSfqvFIiGWJvk8/OhfxlJhwB3gVnOAiyEIUcFMy36Yq2UEOAh4UtPmEv0thDbPaddQ==","shasum":"fb3a4a35fb8febbd9d2746f438e43ea84cc14468","tarball":"https://registry.npmjs.org/@axecute-official/axecute-sdk/-/axecute-sdk-1.0.0.tgz","fileCount":8,"unpackedSize":8772,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC454Q360vUzWM/ENjtDlo2xL5bIrxxgdmIimN1k56JQQIhAJIiZk345iIItPtFxFpIVo/QfHOqz2DbBzAgF7E3Wt1v"}]},"_npmUser":{"name":"tanakorn0412","email":"tanakorn0412@gmail.com"},"directories":{},"maintainers":[{"name":"tanakorn0412","email":"tanakorn0412@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/axecute-sdk_1.0.0_1691374343561_0.517203482222701"},"_hasShrinkwrap":false},"1.0.1":{"name":"@axecute-official/axecute-sdk","version":"1.0.1","description":"Typescript SDK for Axecute","main":"dist/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","test":"jest"},"repository":{"type":"git","url":"git+https://github.com/Axecute-official/axecute-sdk.git"},"keywords":["Axecute"],"author":{"name":"Axecute"},"license":"MIT","bugs":{"url":"https://github.com/Axecute-official/axecute-sdk/issues"},"homepage":"https://github.com/Axecute-official/axecute-sdk#readme","dependencies":{"ethers":"^6.7.0"},"devDependencies":{"@types/jest":"^29.5.3","jest":"^29.6.2","ts-jest":"^29.1.1"},"preset":"ts-jest","testEnvironment":"node","gitHead":"ee893b1ccf2e889390e5198c01a049ec709bb74a","_id":"@axecute-official/axecute-sdk@1.0.1","_nodeVersion":"18.14.0","_npmVersion":"9.3.1","dist":{"integrity":"sha512-bcwQkYkZoQVRlNRXxN3H6Ga5cm7E1eFfYP5CtqQh+5WgPCWkQtoxWXMWcaBxUbwDpmTd6zBr+DxzubVugxmaOQ==","shasum":"edc0d0dd89a02dd08caf2c86636c499b0bf32dc9","tarball":"https://registry.npmjs.org/@axecute-official/axecute-sdk/-/axecute-sdk-1.0.1.tgz","fileCount":7,"unpackedSize":7631,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFGxgaRSYrMbCtZYs1g1FCh7vGZUmDSLI4X8+G6lS0PzAiBYCOA2K5knbAp1yiaGW2pSBdQGqugoUnZduyeh1nSHNg=="}]},"_npmUser":{"name":"tanakorn0412","email":"tanakorn0412@gmail.com"},"directories":{},"maintainers":[{"name":"satosheep","email":"warunsinx@gmail.com"},{"name":"tanakorn0412","email":"tanakorn0412@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/axecute-sdk_1.0.1_1691508269822_0.9021769831445279"},"_hasShrinkwrap":false}},"time":{"created":"2023-08-07T02:12:23.503Z","1.0.0":"2023-08-07T02:12:23.745Z","modified":"2023-08-08T15:24:30.098Z","1.0.1":"2023-08-08T15:24:29.985Z"},"maintainers":[{"name":"satosheep","email":"warunsinx@gmail.com"},{"name":"tanakorn0412","email":"tanakorn0412@gmail.com"}],"description":"Typescript SDK for Axecute","homepage":"https://github.com/Axecute-official/axecute-sdk#readme","keywords":["Axecute"],"repository":{"type":"git","url":"git+https://github.com/Axecute-official/axecute-sdk.git"},"author":{"name":"Axecute"},"bugs":{"url":"https://github.com/Axecute-official/axecute-sdk/issues"},"license":"MIT","readme":"# Axecute TypeScript SDK\n\nThe Axecute SDK is a library that allows developers to interact with Axecute smart contracts more easily. It provides the necessary tools to construct cross-chain multicall transactions. The SDK's core functionality is encapsulated within the `Call` class.\n\n## Installation\n\nInclude the SDK in your project by adding it to your dependencies:\n\n```bash\nnpm install --save @axecute-official/axecute-sdk\n```\n\n## Features\n\n- **Simple Transaction Construction:** Easily create transactions for interaction with Axecute smart contracts.\n- **Sub-Calls Management:** Add, remove, and manage sub-calls within a call.\n- **Fee Calculation:** Automatically calculate the total fee for the call and its sub-calls.\n- **Call Encoding:** Encode the call for transaction submission.\n\n## Quickstart\n\n### Create a Call\n\n```typescript\nasync function createCall(source, destination) {\n    const chainName = destination.name;\n    const target = destination.loggerContract.address;\n    const callData = getLogCallData(`Call from ${source.name} to ${destination.name}.`);\n    const axecutor = destination.contract.address;\n    const fee = await calculateCallFee(source, destination);\n    return new Call(chainName, target, callData, axecutor, fee);\n}\n```\n\n### Construct Calls and Sub-Calls\n\n```typescript\nconst call1 = await createCall(source, moonbeam);\ncall1.addSubCall(await createCall(moonbeam, fantom));\ncall1.addSubCall(await createCall(moonbeam, ethereum));\n// ...\n```\n\n### Calculate Total Fee and Encode Calls\n\n```typescript\nconst fee = calls.reduce((a, b) => (Number(a) + Number(b.calculateTotalFee())), 0).toString();\nconst encodedCalls = calls.map(call => call.encode());\n```\n\n### Submit Transaction\n\n```typescript\nconst tx = await source.contract.aggregate(encodedCalls, { value: fee });\nconsole.log(\"Submit transaction successfully: \", tx.hash);\n```\n\n## API Reference\n\n### `Call` Class\n\n#### Properties\n\n- `chain`: String representing the blockchain chain.\n- `target`: String representing the target contract address.\n- `callData`: String representing the call data.\n- `subCalls`: Array of sub-call instances (`Call[]`).\n- `axecutor`: String representing the axecutor's address.\n- `fee`: String representing the fee.\n\n#### Methods\n\n- `getSubCall(index)`: Retrieve a sub-call by index.\n- `addSubCall(subCall)`: Add a sub-call.\n- `removeSubCall(index)`: Remove a sub-call by index.\n- `calculateTotalFee()`: Calculate the total fee for this call and its sub-calls.\n- `encode()`: Encode the call for transaction submission.\n\n## Support\n\nFor issues and feature requests, please [open an issue](link-to-your-issue-tracker) on GitHub.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.","readmeFilename":"Readme.md"}