diff --git a/LEGAL.md b/LEGAL.md new file mode 100644 index 000000000..fe9be5d30 --- /dev/null +++ b/LEGAL.md @@ -0,0 +1,37 @@ +# Legal Notice + +**Summary**: This software is free to use and modify under the [MIT License](./LICENSE.md) for its source code. However, it includes patented technology that requires payment for use, facilitated through a cryptocurrency mechanism. You are responsible for complying with all applicable laws and bear full liability for your use of the software. + +## Patent and Payment Notice + +This software includes technology protected by US Patent Nos. 11694197 and 11188911. Using this patented technology, which forms a core part of the software’s functionality, requires payment through the software’s built-in cryptocurrency mechanism. The payment amount is determined automatically by the software, and the cryptocurrency used (e.g., BTC, LTC, DOGE) depends on the blockchain you select. For detailed payment instructions, please refer to the software's [documentation](https://github.com/bitcoin-computer/monorepo/blob/main/packages/docs/fees.md). + +You may modify the software freely under the MIT License, but any use of the patented functionality, including in modified versions, requires compliance with these payment terms or obtaining an alternative license. Bypassing the payment mechanism while still using the patented technology may constitute patent infringement. For alternative licensing options, please contact clemens@bitcoincomputer.io. + +You may use the software for free for testing purposes on testnet and regtest, as these environments use test coins with no real value. However, any use on mainnet or other production environments requires compliance with the payment terms outlined in this notice. + +## Disclaimer Regarding User Modifications + +**BCDB Does Not Endorse or Promote User Software Activity**. We are publishing certain portions of the Software, on an open-source basis, to demonstrate the utility of the Bitcoin Computer. As this Software is open-source, it may be modified and deployed for a wide range of uses that we may not have intended. We do not endorse or promote, and expressly disclaim liability for, any non-BCDB use or modification of the Software. + +## Legal and Regulatory Compliance + +**Sanctioned Users are Prohibited**. You may not access or use this software if you are (i) a resident of any country with which transactions or dealings are prohibited by governmental sanctions imposed by the U.S., the United Nations, the European Union, the United Kingdom, or any other applicable jurisdiction (collectively, “Sanctions Regimes”); (ii) a person, entity or government prohibited under an applicable Sanctions Regime (“Sanctioned Person”), including the Office of Foreign Assets Control, Specially Designated Nationals and Blocked Persons List; or (iii) prohibited from accessing or using the Software pursuant to the laws, rules, and regulations in the jurisdiction in which you reside or otherwise access and use the Software. + +**Users Must Comply with Applicable Law**. You may only access or use the Software in compliance with laws, rules, and regulations in the jurisdiction in which you reside or otherwise access and use the Software, including, as applicable, Sanctions Regimes, anti-money laundering laws and regulations, and securities laws and regulations. + +Additionally, you are solely responsible for ensuring that your cryptocurrency transactions comply with all applicable laws, including anti-money laundering and tax regulations in your jurisdiction. + +## Liability Disclaimer and Indemnification + +BCDB Inc. provides this software "as is," without any warranties, express or implied, including warranties of merchantability, fitness for a particular purpose, or non-infringement. BCDB Inc. shall not be liable for any direct, indirect, incidental, special, exemplary, or consequential damages resulting from your use or modification of the software. + +By using this software, you agree to indemnify, defend, and hold harmless BCDB Inc. and its affiliates from any claims, damages, liabilities, or expenses (including attorneys’ fees and costs) arising from your use or modification of the software, including but not limited to violations of applicable laws or infringement of third-party rights. + +## Intellectual Property + +The patented technology is protected under US Patent Nos. 11694197 and 11188911. This patent applies in the United States only. If you are outside the US, you should review your local patent laws to understand any additional obligations. + +## Contact Information + +For questions, alternative licensing options, or further clarification, please contact clemens@bitcoincomputer.io. diff --git a/packages/TBC20/LICENSE b/LICENSE.md similarity index 81% rename from packages/TBC20/LICENSE rename to LICENSE.md index 037b71e3f..d88b046e5 100644 --- a/packages/TBC20/LICENSE +++ b/LICENSE.md @@ -1,7 +1,11 @@ -Copyright 2022 BCDB Inc. +MIT License + +Copyright (c) 2025 BCDB Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**Note**: This license applies only to the copyright of the source code and documentation. For additional terms, including patent notices and payment requirements, see [LEGAL.md](./LEGAL.md). diff --git a/README.md b/README.md index e727138c2..6d93a3dcd 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,8 @@ See [here](https://docs.bitcoincomputer.io/start/). - [Docs](https://github.com/bitcoin-computer/monorepo/tree/main/packages/docs#readme) - The sources for the documentation - [Website](https://github.com/bitcoin-computer/monorepo/tree/main/packages/website#readme) - The sources for the website -## Legal Notice +## License -See [here](https://github.com/bitcoin-computer/monorepo/tree/main/packages/lib#legal-notice). +This software is licensed under the MIT License. See the [LICENSE.md](./LICENSE.md) file. + +This software includes patented technology that requires payment for use on mainnet or production environments. Please review the [LEGAL.md](./LEGAL.md) file for details on patent usage and payment requirements. diff --git a/package-lock.json b/package-lock.json index 35cdd44d9..e2b0b79a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1632,9 +1632,9 @@ } }, "node_modules/@img/sharp-darwin-arm64": { - "version": "0.34.2", - "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.34.2.tgz", - "integrity": "sha512-OfXHZPppddivUJnqyKoi5YVeHRkkNE2zUFT2gbpKxp/JZCFYEYubnMg+gOp6lWfasPrTS+KPosKqdI+ELYVDtg==", + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.34.3.tgz", + "integrity": "sha512-ryFMfvxxpQRsgZJqBd4wsttYQbCxsJksrv9Lw/v798JcQ8+w84mBWuXwl+TT0WJ/WrYOLaYpwQXi3sA9nTIaIg==", "cpu": [ "arm64" ], @@ -1650,13 +1650,13 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-libvips-darwin-arm64": "1.1.0" + "@img/sharp-libvips-darwin-arm64": "1.2.0" } }, "node_modules/@img/sharp-darwin-x64": { - "version": "0.34.2", - "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.34.2.tgz", - "integrity": "sha512-dYvWqmjU9VxqXmjEtjmvHnGqF8GrVjM2Epj9rJ6BUIXvk8slvNDJbhGFvIoXzkDhrJC2jUxNLz/GUjjvSzfw+g==", + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.34.3.tgz", + "integrity": "sha512-yHpJYynROAj12TA6qil58hmPmAwxKKC7reUqtGLzsOHfP7/rniNGTL8tjWX6L3CTV4+5P4ypcS7Pp+7OB+8ihA==", "cpu": [ "x64" ], @@ -1672,13 +1672,13 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-libvips-darwin-x64": "1.1.0" + "@img/sharp-libvips-darwin-x64": "1.2.0" } }, "node_modules/@img/sharp-libvips-darwin-arm64": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.1.0.tgz", - "integrity": "sha512-HZ/JUmPwrJSoM4DIQPv/BfNh9yrOA8tlBbqbLz4JZ5uew2+o22Ik+tHQJcih7QJuSa0zo5coHTfD5J8inqj9DA==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.2.0.tgz", + "integrity": "sha512-sBZmpwmxqwlqG9ueWFXtockhsxefaV6O84BMOrhtg/YqbTaRdqDE7hxraVE3y6gVM4eExmfzW4a8el9ArLeEiQ==", "cpu": [ "arm64" ], @@ -1692,9 +1692,9 @@ } }, "node_modules/@img/sharp-libvips-darwin-x64": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.1.0.tgz", - "integrity": "sha512-Xzc2ToEmHN+hfvsl9wja0RlnXEgpKNmftriQp6XzY/RaSfwD9th+MSh0WQKzUreLKKINb3afirxW7A0fz2YWuQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.2.0.tgz", + "integrity": "sha512-M64XVuL94OgiNHa5/m2YvEQI5q2cl9d/wk0qFTDVXcYzi43lxuiFTftMR1tOnFQovVXNZJ5TURSDK2pNe9Yzqg==", "cpu": [ "x64" ], @@ -1708,9 +1708,9 @@ } }, "node_modules/@img/sharp-libvips-linux-arm": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.1.0.tgz", - "integrity": "sha512-s8BAd0lwUIvYCJyRdFqvsj+BJIpDBSxs6ivrOPm/R7piTs5UIwY5OjXrP2bqXC9/moGsyRa37eYWYCOGVXxVrA==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.2.0.tgz", + "integrity": "sha512-mWd2uWvDtL/nvIzThLq3fr2nnGfyr/XMXlq8ZJ9WMR6PXijHlC3ksp0IpuhK6bougvQrchUAfzRLnbsen0Cqvw==", "cpu": [ "arm" ], @@ -1724,9 +1724,9 @@ } }, "node_modules/@img/sharp-libvips-linux-arm64": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.1.0.tgz", - "integrity": "sha512-IVfGJa7gjChDET1dK9SekxFFdflarnUB8PwW8aGwEoF3oAsSDuNUTYS+SKDOyOJxQyDC1aPFMuRYLoDInyV9Ew==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.2.0.tgz", + "integrity": "sha512-RXwd0CgG+uPRX5YYrkzKyalt2OJYRiJQ8ED/fi1tq9WQW2jsQIn0tqrlR5l5dr/rjqq6AHAxURhj2DVjyQWSOA==", "cpu": [ "arm64" ], @@ -1740,9 +1740,9 @@ } }, "node_modules/@img/sharp-libvips-linux-ppc64": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.1.0.tgz", - "integrity": "sha512-tiXxFZFbhnkWE2LA8oQj7KYR+bWBkiV2nilRldT7bqoEZ4HiDOcePr9wVDAZPi/Id5fT1oY9iGnDq20cwUz8lQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.2.0.tgz", + "integrity": "sha512-Xod/7KaDDHkYu2phxxfeEPXfVXFKx70EAFZ0qyUdOjCcxbjqyJOEUpDe6RIyaunGxT34Anf9ue/wuWOqBW2WcQ==", "cpu": [ "ppc64" ], @@ -1756,9 +1756,9 @@ } }, "node_modules/@img/sharp-libvips-linux-s390x": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.1.0.tgz", - "integrity": "sha512-xukSwvhguw7COyzvmjydRb3x/09+21HykyapcZchiCUkTThEQEOMtBj9UhkaBRLuBrgLFzQ2wbxdeCCJW/jgJA==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.2.0.tgz", + "integrity": "sha512-eMKfzDxLGT8mnmPJTNMcjfO33fLiTDsrMlUVcp6b96ETbnJmd4uvZxVJSKPQfS+odwfVaGifhsB07J1LynFehw==", "cpu": [ "s390x" ], @@ -1772,9 +1772,9 @@ } }, "node_modules/@img/sharp-libvips-linux-x64": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.1.0.tgz", - "integrity": "sha512-yRj2+reB8iMg9W5sULM3S74jVS7zqSzHG3Ol/twnAAkAhnGQnpjj6e4ayUz7V+FpKypwgs82xbRdYtchTTUB+Q==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.2.0.tgz", + "integrity": "sha512-ZW3FPWIc7K1sH9E3nxIGB3y3dZkpJlMnkk7z5tu1nSkBoCgw2nSRTFHI5pB/3CQaJM0pdzMF3paf9ckKMSE9Tg==", "cpu": [ "x64" ], @@ -1788,9 +1788,9 @@ } }, "node_modules/@img/sharp-libvips-linuxmusl-arm64": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.1.0.tgz", - "integrity": "sha512-jYZdG+whg0MDK+q2COKbYidaqW/WTz0cc1E+tMAusiDygrM4ypmSCjOJPmFTvHHJ8j/6cAGyeDWZOsK06tP33w==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.2.0.tgz", + "integrity": "sha512-UG+LqQJbf5VJ8NWJ5Z3tdIe/HXjuIdo4JeVNADXBFuG7z9zjoegpzzGIyV5zQKi4zaJjnAd2+g2nna8TZvuW9Q==", "cpu": [ "arm64" ], @@ -1804,9 +1804,9 @@ } }, "node_modules/@img/sharp-libvips-linuxmusl-x64": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.1.0.tgz", - "integrity": "sha512-wK7SBdwrAiycjXdkPnGCPLjYb9lD4l6Ze2gSdAGVZrEL05AOUJESWU2lhlC+Ffn5/G+VKuSm6zzbQSzFX/P65A==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.2.0.tgz", + "integrity": "sha512-SRYOLR7CXPgNze8akZwjoGBoN1ThNZoqpOgfnOxmWsklTGVfJiGJoC/Lod7aNMGA1jSsKWM1+HRX43OP6p9+6Q==", "cpu": [ "x64" ], @@ -1820,9 +1820,9 @@ } }, "node_modules/@img/sharp-linux-arm": { - "version": "0.34.2", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.34.2.tgz", - "integrity": "sha512-0DZzkvuEOqQUP9mo2kjjKNok5AmnOr1jB2XYjkaoNRwpAYMDzRmAqUIa1nRi58S2WswqSfPOWLNOr0FDT3H5RQ==", + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.34.3.tgz", + "integrity": "sha512-oBK9l+h6KBN0i3dC8rYntLiVfW8D8wH+NPNT3O/WBHeW0OQWCjfWksLUaPidsrDKpJgXp3G3/hkmhptAW0I3+A==", "cpu": [ "arm" ], @@ -1838,13 +1838,13 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-libvips-linux-arm": "1.1.0" + "@img/sharp-libvips-linux-arm": "1.2.0" } }, "node_modules/@img/sharp-linux-arm64": { - "version": "0.34.2", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.34.2.tgz", - "integrity": "sha512-D8n8wgWmPDakc83LORcfJepdOSN6MvWNzzz2ux0MnIbOqdieRZwVYY32zxVx+IFUT8er5KPcyU3XXsn+GzG/0Q==", + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.34.3.tgz", + "integrity": "sha512-QdrKe3EvQrqwkDrtuTIjI0bu6YEJHTgEeqdzI3uWJOH6G1O8Nl1iEeVYRGdj1h5I21CqxSvQp1Yv7xeU3ZewbA==", "cpu": [ "arm64" ], @@ -1860,13 +1860,35 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-libvips-linux-arm64": "1.1.0" + "@img/sharp-libvips-linux-arm64": "1.2.0" + } + }, + "node_modules/@img/sharp-linux-ppc64": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.34.3.tgz", + "integrity": "sha512-GLtbLQMCNC5nxuImPR2+RgrviwKwVql28FWZIW1zWruy6zLgA5/x2ZXk3mxj58X/tszVF69KK0Is83V8YgWhLA==", + "cpu": [ + "ppc64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-ppc64": "1.2.0" } }, "node_modules/@img/sharp-linux-s390x": { - "version": "0.34.2", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.34.2.tgz", - "integrity": "sha512-EGZ1xwhBI7dNISwxjChqBGELCWMGDvmxZXKjQRuqMrakhO8QoMgqCrdjnAqJq/CScxfRn+Bb7suXBElKQpPDiw==", + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.34.3.tgz", + "integrity": "sha512-3gahT+A6c4cdc2edhsLHmIOXMb17ltffJlxR0aC2VPZfwKoTGZec6u5GrFgdR7ciJSsHT27BD3TIuGcuRT0KmQ==", "cpu": [ "s390x" ], @@ -1882,13 +1904,13 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-libvips-linux-s390x": "1.1.0" + "@img/sharp-libvips-linux-s390x": "1.2.0" } }, "node_modules/@img/sharp-linux-x64": { - "version": "0.34.2", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.34.2.tgz", - "integrity": "sha512-sD7J+h5nFLMMmOXYH4DD9UtSNBD05tWSSdWAcEyzqW8Cn5UxXvsHAxmxSesYUsTOBmUnjtxghKDl15EvfqLFbQ==", + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.34.3.tgz", + "integrity": "sha512-8kYso8d806ypnSq3/Ly0QEw90V5ZoHh10yH0HnrzOCr6DKAPI6QVHvwleqMkVQ0m+fc7EH8ah0BB0QPuWY6zJQ==", "cpu": [ "x64" ], @@ -1904,13 +1926,13 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-libvips-linux-x64": "1.1.0" + "@img/sharp-libvips-linux-x64": "1.2.0" } }, "node_modules/@img/sharp-linuxmusl-arm64": { - "version": "0.34.2", - "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.34.2.tgz", - "integrity": "sha512-NEE2vQ6wcxYav1/A22OOxoSOGiKnNmDzCYFOZ949xFmrWZOVII1Bp3NqVVpvj+3UeHMFyN5eP/V5hzViQ5CZNA==", + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.34.3.tgz", + "integrity": "sha512-vAjbHDlr4izEiXM1OTggpCcPg9tn4YriK5vAjowJsHwdBIdx0fYRsURkxLG2RLm9gyBq66gwtWI8Gx0/ov+JKQ==", "cpu": [ "arm64" ], @@ -1926,13 +1948,13 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-libvips-linuxmusl-arm64": "1.1.0" + "@img/sharp-libvips-linuxmusl-arm64": "1.2.0" } }, "node_modules/@img/sharp-linuxmusl-x64": { - "version": "0.34.2", - "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.34.2.tgz", - "integrity": "sha512-DOYMrDm5E6/8bm/yQLCWyuDJwUnlevR8xtF8bs+gjZ7cyUNYXiSf/E8Kp0Ss5xasIaXSHzb888V1BE4i1hFhAA==", + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.34.3.tgz", + "integrity": "sha512-gCWUn9547K5bwvOn9l5XGAEjVTTRji4aPTqLzGXHvIr6bIDZKNTA34seMPgM0WmSf+RYBH411VavCejp3PkOeQ==", "cpu": [ "x64" ], @@ -1948,20 +1970,20 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-libvips-linuxmusl-x64": "1.1.0" + "@img/sharp-libvips-linuxmusl-x64": "1.2.0" } }, "node_modules/@img/sharp-wasm32": { - "version": "0.34.2", - "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.34.2.tgz", - "integrity": "sha512-/VI4mdlJ9zkaq53MbIG6rZY+QRN3MLbR6usYlgITEzi4Rpx5S6LFKsycOQjkOGmqTNmkIdLjEvooFKwww6OpdQ==", + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.34.3.tgz", + "integrity": "sha512-+CyRcpagHMGteySaWos8IbnXcHgfDn7pO2fiC2slJxvNq9gDipYBN42/RagzctVRKgxATmfqOSulgZv5e1RdMg==", "cpu": [ "wasm32" ], "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", "optional": true, "dependencies": { - "@emnapi/runtime": "^1.4.3" + "@emnapi/runtime": "^1.4.4" }, "engines": { "node": "^18.17.0 || ^20.3.0 || >=21.0.0" @@ -1971,9 +1993,9 @@ } }, "node_modules/@img/sharp-win32-arm64": { - "version": "0.34.2", - "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.34.2.tgz", - "integrity": "sha512-cfP/r9FdS63VA5k0xiqaNaEoGxBg9k7uE+RQGzuK9fHt7jib4zAVVseR9LsE4gJcNWgT6APKMNnCcnyOtmSEUQ==", + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.34.3.tgz", + "integrity": "sha512-MjnHPnbqMXNC2UgeLJtX4XqoVHHlZNd+nPt1kRPmj63wURegwBhZlApELdtxM2OIZDRv/DFtLcNhVbd1z8GYXQ==", "cpu": [ "arm64" ], @@ -1990,9 +2012,9 @@ } }, "node_modules/@img/sharp-win32-ia32": { - "version": "0.34.2", - "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.34.2.tgz", - "integrity": "sha512-QLjGGvAbj0X/FXl8n1WbtQ6iVBpWU7JO94u/P2M4a8CFYsvQi4GW2mRy/JqkRx0qpBzaOdKJKw8uc930EX2AHw==", + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.34.3.tgz", + "integrity": "sha512-xuCdhH44WxuXgOM714hn4amodJMZl3OEvf0GVTm0BEyMeA2to+8HEdRPShH0SLYptJY1uBw+SCFP9WVQi1Q/cw==", "cpu": [ "ia32" ], @@ -2009,9 +2031,9 @@ } }, "node_modules/@img/sharp-win32-x64": { - "version": "0.34.2", - "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.34.2.tgz", - "integrity": "sha512-aUdT6zEYtDKCaxkofmmJDJYGCf0+pJg3eU9/oBuqvEeoB9dKI6ZLc/1iLJCTuJQDO4ptntAlkUmHgGjyuobZbw==", + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.34.3.tgz", + "integrity": "sha512-OWwz05d++TxzLEv4VnsTz5CmZ6mI6S05sfQGEMrNrQcOEERbX46332IvE7pO/EUiw7jUrrS40z/M7kPyjfl04g==", "cpu": [ "x64" ], @@ -2573,16 +2595,16 @@ "license": "MIT" }, "node_modules/@napi-rs/wasm-runtime": { - "version": "0.2.11", - "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.11.tgz", - "integrity": "sha512-9DPkXtvHydrcOsopiYpUgPHpmj0HWZKMUnL2dZqpvC42lsratuBG06V5ipyno0fUek5VlFsNQ+AcFATSrJXgMA==", + "version": "0.2.12", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.12.tgz", + "integrity": "sha512-ZVWUcfwY4E/yPitQJl481FjFo3K22D6qF0DuFH6Y/nbnE11GY5uguDxZMGXPQ8WQ0128MXQD7TnfHyK4oWoIJQ==", "dev": true, "license": "MIT", "optional": true, "dependencies": { "@emnapi/core": "^1.4.3", "@emnapi/runtime": "^1.4.3", - "@tybys/wasm-util": "^0.9.0" + "@tybys/wasm-util": "^0.10.0" } }, "node_modules/@next/env": { @@ -4082,9 +4104,9 @@ "license": "MIT" }, "node_modules/@tybys/wasm-util": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.9.0.tgz", - "integrity": "sha512-6+7nlbMVX/PVDCwaIQ8nTOPveOcFLSt8GcXdx8hD0bt39uWxYT88uXzqTd4fTvqta7oeUJqudepapKNt2DYJFw==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.0.tgz", + "integrity": "sha512-VyyPYFlOMNylG45GoAe0xDoLwWuowvf92F9kySqzYh8vmYm7D2u4iUJKa1tOUpS70Ku13ASrOkS4ScXFsTaCNQ==", "dev": true, "license": "MIT", "optional": true, @@ -4284,9 +4306,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "20.19.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.6.tgz", - "integrity": "sha512-uYssdp9z5zH5GQ0L4zEJ2ZuavYsJwkozjiUzCRfGtaaQcyjAMJ34aP8idv61QlqTozu6kudyr6JMq9Chf09dfA==", + "version": "20.19.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.7.tgz", + "integrity": "sha512-1GM9z6BJOv86qkPvzh2i6VW5+VVrXxCLknfmTkWEqz+6DqosiY28XUWCTmBcJ0ACzKqx/iwdIREfo1fwExIlkA==", "license": "MIT", "dependencies": { "undici-types": "~6.21.0" @@ -8015,9 +8037,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.181", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.181.tgz", - "integrity": "sha512-+ISMj8OIQ+0qEeDj14Rt8WwcTOiqHyAB+5bnK1K7xNNLjBJ4hRCQfUkw8RWtcLbfBzDwc15ZnKH0c7SNOfwiyA==", + "version": "1.5.182", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.182.tgz", + "integrity": "sha512-Lv65Btwv9W4J9pyODI6EWpdnhfvrve/us5h1WspW8B2Fb0366REPtY3hX7ounk1CkV/TBjWCEvCBBbYbmV0qCA==", "license": "ISC" }, "node_modules/elliptic": { @@ -16161,9 +16183,9 @@ } }, "node_modules/sharp": { - "version": "0.34.2", - "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.34.2.tgz", - "integrity": "sha512-lszvBmB9QURERtyKT2bNmsgxXK0ShJrL/fvqlonCo7e6xBF8nT8xU6pW+PMIbLsz0RxQk3rgH9kd8UmvOzlMJg==", + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.34.3.tgz", + "integrity": "sha512-eX2IQ6nFohW4DbvHIOLRB3MHFpYqaqvXd3Tp5e/T/dSH83fxaNJQRvDMhASmkNTsNTVF2/OOopzRCt7xokgPfg==", "hasInstallScript": true, "license": "Apache-2.0", "optional": true, @@ -16179,27 +16201,28 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-darwin-arm64": "0.34.2", - "@img/sharp-darwin-x64": "0.34.2", - "@img/sharp-libvips-darwin-arm64": "1.1.0", - "@img/sharp-libvips-darwin-x64": "1.1.0", - "@img/sharp-libvips-linux-arm": "1.1.0", - "@img/sharp-libvips-linux-arm64": "1.1.0", - "@img/sharp-libvips-linux-ppc64": "1.1.0", - "@img/sharp-libvips-linux-s390x": "1.1.0", - "@img/sharp-libvips-linux-x64": "1.1.0", - "@img/sharp-libvips-linuxmusl-arm64": "1.1.0", - "@img/sharp-libvips-linuxmusl-x64": "1.1.0", - "@img/sharp-linux-arm": "0.34.2", - "@img/sharp-linux-arm64": "0.34.2", - "@img/sharp-linux-s390x": "0.34.2", - "@img/sharp-linux-x64": "0.34.2", - "@img/sharp-linuxmusl-arm64": "0.34.2", - "@img/sharp-linuxmusl-x64": "0.34.2", - "@img/sharp-wasm32": "0.34.2", - "@img/sharp-win32-arm64": "0.34.2", - "@img/sharp-win32-ia32": "0.34.2", - "@img/sharp-win32-x64": "0.34.2" + "@img/sharp-darwin-arm64": "0.34.3", + "@img/sharp-darwin-x64": "0.34.3", + "@img/sharp-libvips-darwin-arm64": "1.2.0", + "@img/sharp-libvips-darwin-x64": "1.2.0", + "@img/sharp-libvips-linux-arm": "1.2.0", + "@img/sharp-libvips-linux-arm64": "1.2.0", + "@img/sharp-libvips-linux-ppc64": "1.2.0", + "@img/sharp-libvips-linux-s390x": "1.2.0", + "@img/sharp-libvips-linux-x64": "1.2.0", + "@img/sharp-libvips-linuxmusl-arm64": "1.2.0", + "@img/sharp-libvips-linuxmusl-x64": "1.2.0", + "@img/sharp-linux-arm": "0.34.3", + "@img/sharp-linux-arm64": "0.34.3", + "@img/sharp-linux-ppc64": "0.34.3", + "@img/sharp-linux-s390x": "0.34.3", + "@img/sharp-linux-x64": "0.34.3", + "@img/sharp-linuxmusl-arm64": "0.34.3", + "@img/sharp-linuxmusl-x64": "0.34.3", + "@img/sharp-wasm32": "0.34.3", + "@img/sharp-win32-arm64": "0.34.3", + "@img/sharp-win32-ia32": "0.34.3", + "@img/sharp-win32-x64": "0.34.3" } }, "node_modules/shebang-command": { @@ -20206,6 +20229,7 @@ "packages/chat": { "name": "@bitcoin-computer/chat", "version": "0.25.0-beta.0", + "license": "MIT", "dependencies": { "@bitcoin-computer/components": "^0.25.0-beta.0", "@bitcoin-computer/lib": "^0.25.0-beta.0", @@ -20239,6 +20263,7 @@ "packages/chess-app": { "name": "@bitcoin-computer/chess-app", "version": "0.25.0-beta.0", + "license": "MIT", "dependencies": { "@bitcoin-computer/chess-contracts": "^0.25.0-beta.0", "@bitcoin-computer/components": "^0.25.0-beta.0", @@ -20282,9 +20307,9 @@ } }, "packages/chess-app/node_modules/@types/node": { - "version": "22.16.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.16.2.tgz", - "integrity": "sha512-Cdqa/eJTvt4fC4wmq1Mcc0CPUjp/Qy2FGqLza3z3pKymsI969TcZ54diNJv8UYUgeWxyb8FSbCkhdR6WqmUFhA==", + "version": "22.16.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.16.3.tgz", + "integrity": "sha512-sr4Xz74KOUeYadexo1r8imhRtlVXcs+j3XK3TcoiYk7B1t3YRVJgtaD3cwX73NYb71pmVuMLNRhJ9XKdoDB74g==", "dev": true, "license": "MIT", "dependencies": { @@ -20380,6 +20405,7 @@ "packages/explorer": { "name": "@bitcoin-computer/explorer", "version": "0.25.0-beta.0", + "license": "MIT", "dependencies": { "@bitcoin-computer/components": "^0.25.0-beta.0", "@bitcoin-computer/lib": "^0.25.0-beta.0", @@ -20413,7 +20439,7 @@ "packages/lib": { "name": "@bitcoin-computer/lib", "version": "0.25.0-beta.0", - "license": "CC-BY-ND-4.0", + "license": "MIT", "dependencies": { "@babel/parser": "^7.23.9", "@bitcoin-computer/nakamotojs": "^0.25.0-beta.0", @@ -20676,7 +20702,7 @@ "packages/node": { "name": "@bitcoin-computer/node", "version": "0.25.0-beta.0", - "license": "CC-BY-ND-4.0", + "license": "MIT", "dependencies": { "@babel/core": "^7.23.9", "@bitcoin-computer/lib": "^0.25.0-beta.0", @@ -20868,7 +20894,7 @@ "packages/TBC20": { "name": "@bitcoin-computer/TBC20", "version": "0.25.0-beta.0", - "license": "Apache-2.0", + "license": "MIT", "dependencies": { "@bitcoin-computer/lib": "^0.25.0-beta.0", "eslint-plugin-prettier": "^5.1.3", @@ -20977,6 +21003,7 @@ "packages/vite-template": { "name": "@bitcoin-computer/vite-project", "version": "0.25.0-beta.0", + "license": "MIT", "dependencies": { "@bitcoin-computer/components": "^0.25.0-beta.0", "@bitcoin-computer/lib": "^0.25.0-beta.0", @@ -21015,6 +21042,7 @@ "packages/wallet": { "name": "@bitcoin-computer/wallet", "version": "0.25.0-beta.0", + "license": "MIT", "dependencies": { "@bitcoin-computer/components": "^0.25.0-beta.0", "@bitcoin-computer/lib": "^0.25.0-beta.0", @@ -21048,6 +21076,7 @@ "packages/website": { "name": "@bitcoin-computer/website", "version": "0.25.0-beta.0", + "license": "MIT", "dependencies": { "@emotion/react": "^11.14.0", "@emotion/styled": "^11.14.0", diff --git a/packages/README.md b/packages/README.md index 71af7eedb..244c76eb7 100644 --- a/packages/README.md +++ b/packages/README.md @@ -32,6 +32,8 @@ This monorepo contains the following packages. - [Docs](https://github.com/bitcoin-computer/monorepo/tree/main/packages/docs#readme) - The sources for the documentation - [Website](https://github.com/bitcoin-computer/monorepo/tree/main/packages/website#readme) - The sources for the website -## Legal Notice +## License -See [here](https://github.com/bitcoin-computer/monorepo/tree/main/packages/lib#legal-notice). +This software is licensed under the MIT License. See the [LICENSE.md](../LICENSE.md) file. + +This software includes patented technology that requires payment for use on mainnet or production environments. Please review the [LEGAL.md](../LEGAL.md) file for details on patent usage and payment requirements. diff --git a/packages/TBC20/LEGAL.md b/packages/TBC20/LEGAL.md new file mode 100644 index 000000000..fe9be5d30 --- /dev/null +++ b/packages/TBC20/LEGAL.md @@ -0,0 +1,37 @@ +# Legal Notice + +**Summary**: This software is free to use and modify under the [MIT License](./LICENSE.md) for its source code. However, it includes patented technology that requires payment for use, facilitated through a cryptocurrency mechanism. You are responsible for complying with all applicable laws and bear full liability for your use of the software. + +## Patent and Payment Notice + +This software includes technology protected by US Patent Nos. 11694197 and 11188911. Using this patented technology, which forms a core part of the software’s functionality, requires payment through the software’s built-in cryptocurrency mechanism. The payment amount is determined automatically by the software, and the cryptocurrency used (e.g., BTC, LTC, DOGE) depends on the blockchain you select. For detailed payment instructions, please refer to the software's [documentation](https://github.com/bitcoin-computer/monorepo/blob/main/packages/docs/fees.md). + +You may modify the software freely under the MIT License, but any use of the patented functionality, including in modified versions, requires compliance with these payment terms or obtaining an alternative license. Bypassing the payment mechanism while still using the patented technology may constitute patent infringement. For alternative licensing options, please contact clemens@bitcoincomputer.io. + +You may use the software for free for testing purposes on testnet and regtest, as these environments use test coins with no real value. However, any use on mainnet or other production environments requires compliance with the payment terms outlined in this notice. + +## Disclaimer Regarding User Modifications + +**BCDB Does Not Endorse or Promote User Software Activity**. We are publishing certain portions of the Software, on an open-source basis, to demonstrate the utility of the Bitcoin Computer. As this Software is open-source, it may be modified and deployed for a wide range of uses that we may not have intended. We do not endorse or promote, and expressly disclaim liability for, any non-BCDB use or modification of the Software. + +## Legal and Regulatory Compliance + +**Sanctioned Users are Prohibited**. You may not access or use this software if you are (i) a resident of any country with which transactions or dealings are prohibited by governmental sanctions imposed by the U.S., the United Nations, the European Union, the United Kingdom, or any other applicable jurisdiction (collectively, “Sanctions Regimes”); (ii) a person, entity or government prohibited under an applicable Sanctions Regime (“Sanctioned Person”), including the Office of Foreign Assets Control, Specially Designated Nationals and Blocked Persons List; or (iii) prohibited from accessing or using the Software pursuant to the laws, rules, and regulations in the jurisdiction in which you reside or otherwise access and use the Software. + +**Users Must Comply with Applicable Law**. You may only access or use the Software in compliance with laws, rules, and regulations in the jurisdiction in which you reside or otherwise access and use the Software, including, as applicable, Sanctions Regimes, anti-money laundering laws and regulations, and securities laws and regulations. + +Additionally, you are solely responsible for ensuring that your cryptocurrency transactions comply with all applicable laws, including anti-money laundering and tax regulations in your jurisdiction. + +## Liability Disclaimer and Indemnification + +BCDB Inc. provides this software "as is," without any warranties, express or implied, including warranties of merchantability, fitness for a particular purpose, or non-infringement. BCDB Inc. shall not be liable for any direct, indirect, incidental, special, exemplary, or consequential damages resulting from your use or modification of the software. + +By using this software, you agree to indemnify, defend, and hold harmless BCDB Inc. and its affiliates from any claims, damages, liabilities, or expenses (including attorneys’ fees and costs) arising from your use or modification of the software, including but not limited to violations of applicable laws or infringement of third-party rights. + +## Intellectual Property + +The patented technology is protected under US Patent Nos. 11694197 and 11188911. This patent applies in the United States only. If you are outside the US, you should review your local patent laws to understand any additional obligations. + +## Contact Information + +For questions, alternative licensing options, or further clarification, please contact clemens@bitcoincomputer.io. diff --git a/packages/TBC721/LICENSE b/packages/TBC20/LICENSE.md similarity index 81% rename from packages/TBC721/LICENSE rename to packages/TBC20/LICENSE.md index 037b71e3f..d88b046e5 100644 --- a/packages/TBC721/LICENSE +++ b/packages/TBC20/LICENSE.md @@ -1,7 +1,11 @@ -Copyright 2022 BCDB Inc. +MIT License + +Copyright (c) 2025 BCDB Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**Note**: This license applies only to the copyright of the source code and documentation. For additional terms, including patent notices and payment requirements, see [LEGAL.md](./LEGAL.md). diff --git a/packages/TBC20/README.md b/packages/TBC20/README.md index 91d74fe1f..b2a805477 100644 --- a/packages/TBC20/README.md +++ b/packages/TBC20/README.md @@ -84,11 +84,8 @@ Have a look at the [docs](https://docs.bitcoincomputer.io/) of the Bitcoin Compu If you have any questions, please let us know on Telegram, Twitter, or by email clemens@bitcoincomputer.io. ## Development Status -See [here](https://github.com/bitcoin-computer/monorepo/tree/main/packages/lib#development-status). - -## Price -See [here](https://github.com/bitcoin-computer/monorepo/tree/main/packages/lib#price). +See [here](https://github.com/bitcoin-computer/monorepo/tree/main/packages/lib#development-status). ## Contributing @@ -96,18 +93,10 @@ This project is intended as a starting point for new development so we want to k If you want to add a feature we recommend to create a fork. Let us know if you have built something cool and we can link to your project. -## Legal Notice - -See [here](https://github.com/bitcoin-computer/monorepo/tree/main/packages/lib#legal-notice). - -## MIT License - -Copyright (c) 2022 BCDB Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +## License -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +This software is licensed under the MIT License. See the [LICENSE.md](./LICENSE.md) file. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +This software includes patented technology that requires payment for use on mainnet or production environments. Please review the [LEGAL.md](./LEGAL.md) file for details on patent usage and payment requirements. [node]: https://github.com/bitcoin-computer/monorepo/tree/main/packages/node diff --git a/packages/TBC20/package.json b/packages/TBC20/package.json index b435e5c5a..5cbfaee17 100644 --- a/packages/TBC20/package.json +++ b/packages/TBC20/package.json @@ -3,11 +3,15 @@ "version": "0.25.0-beta.0", "private": true, "description": "Standard for fungible tokens on Bitcoin", - "license": "Apache-2.0", + "license": "MIT", "author": "Clemens Ley ", "type": "module", "main": "./build/src/token.js", "types": "./build/src/token.d.ts", + "files": [ + "LICENSE.md", + "LEGAL.md" + ], "scripts": { "prebuild": "npm run lint", "build": "rm -rf build && tsc -p tsconfig.release.json", diff --git a/packages/TBC20/test/token.test.ts b/packages/TBC20/test/token.test.ts index bc25026df..423dca612 100644 --- a/packages/TBC20/test/token.test.ts +++ b/packages/TBC20/test/token.test.ts @@ -84,7 +84,7 @@ describe('Token', async () => { }) it('Receiver send token2 back to sender', async () => { - // Here we would like to call + // We would like to call // // await token2.transfer(sender.getPublicKey()) // diff --git a/packages/TBC721/LEGAL.md b/packages/TBC721/LEGAL.md new file mode 100644 index 000000000..fe9be5d30 --- /dev/null +++ b/packages/TBC721/LEGAL.md @@ -0,0 +1,37 @@ +# Legal Notice + +**Summary**: This software is free to use and modify under the [MIT License](./LICENSE.md) for its source code. However, it includes patented technology that requires payment for use, facilitated through a cryptocurrency mechanism. You are responsible for complying with all applicable laws and bear full liability for your use of the software. + +## Patent and Payment Notice + +This software includes technology protected by US Patent Nos. 11694197 and 11188911. Using this patented technology, which forms a core part of the software’s functionality, requires payment through the software’s built-in cryptocurrency mechanism. The payment amount is determined automatically by the software, and the cryptocurrency used (e.g., BTC, LTC, DOGE) depends on the blockchain you select. For detailed payment instructions, please refer to the software's [documentation](https://github.com/bitcoin-computer/monorepo/blob/main/packages/docs/fees.md). + +You may modify the software freely under the MIT License, but any use of the patented functionality, including in modified versions, requires compliance with these payment terms or obtaining an alternative license. Bypassing the payment mechanism while still using the patented technology may constitute patent infringement. For alternative licensing options, please contact clemens@bitcoincomputer.io. + +You may use the software for free for testing purposes on testnet and regtest, as these environments use test coins with no real value. However, any use on mainnet or other production environments requires compliance with the payment terms outlined in this notice. + +## Disclaimer Regarding User Modifications + +**BCDB Does Not Endorse or Promote User Software Activity**. We are publishing certain portions of the Software, on an open-source basis, to demonstrate the utility of the Bitcoin Computer. As this Software is open-source, it may be modified and deployed for a wide range of uses that we may not have intended. We do not endorse or promote, and expressly disclaim liability for, any non-BCDB use or modification of the Software. + +## Legal and Regulatory Compliance + +**Sanctioned Users are Prohibited**. You may not access or use this software if you are (i) a resident of any country with which transactions or dealings are prohibited by governmental sanctions imposed by the U.S., the United Nations, the European Union, the United Kingdom, or any other applicable jurisdiction (collectively, “Sanctions Regimes”); (ii) a person, entity or government prohibited under an applicable Sanctions Regime (“Sanctioned Person”), including the Office of Foreign Assets Control, Specially Designated Nationals and Blocked Persons List; or (iii) prohibited from accessing or using the Software pursuant to the laws, rules, and regulations in the jurisdiction in which you reside or otherwise access and use the Software. + +**Users Must Comply with Applicable Law**. You may only access or use the Software in compliance with laws, rules, and regulations in the jurisdiction in which you reside or otherwise access and use the Software, including, as applicable, Sanctions Regimes, anti-money laundering laws and regulations, and securities laws and regulations. + +Additionally, you are solely responsible for ensuring that your cryptocurrency transactions comply with all applicable laws, including anti-money laundering and tax regulations in your jurisdiction. + +## Liability Disclaimer and Indemnification + +BCDB Inc. provides this software "as is," without any warranties, express or implied, including warranties of merchantability, fitness for a particular purpose, or non-infringement. BCDB Inc. shall not be liable for any direct, indirect, incidental, special, exemplary, or consequential damages resulting from your use or modification of the software. + +By using this software, you agree to indemnify, defend, and hold harmless BCDB Inc. and its affiliates from any claims, damages, liabilities, or expenses (including attorneys’ fees and costs) arising from your use or modification of the software, including but not limited to violations of applicable laws or infringement of third-party rights. + +## Intellectual Property + +The patented technology is protected under US Patent Nos. 11694197 and 11188911. This patent applies in the United States only. If you are outside the US, you should review your local patent laws to understand any additional obligations. + +## Contact Information + +For questions, alternative licensing options, or further clarification, please contact clemens@bitcoincomputer.io. diff --git a/packages/chess-contracts/LICENSE b/packages/TBC721/LICENSE.md similarity index 81% rename from packages/chess-contracts/LICENSE rename to packages/TBC721/LICENSE.md index 037b71e3f..d88b046e5 100644 --- a/packages/chess-contracts/LICENSE +++ b/packages/TBC721/LICENSE.md @@ -1,7 +1,11 @@ -Copyright 2022 BCDB Inc. +MIT License + +Copyright (c) 2025 BCDB Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**Note**: This license applies only to the copyright of the source code and documentation. For additional terms, including patent notices and payment requirements, see [LEGAL.md](./LEGAL.md). diff --git a/packages/TBC721/README.md b/packages/TBC721/README.md index d9b74ef31..aa1465225 100644 --- a/packages/TBC721/README.md +++ b/packages/TBC721/README.md @@ -87,28 +87,16 @@ If you have any questions, please let us know on -![chat-screen](./imgs/chat-screen.png) + ## Prerequisites @@ -74,28 +74,16 @@ If you have any questions, please let us know on 0) { const { txId, vout, satoshis } = utxos.pop(); @@ -137,8 +137,8 @@ export class ChessContractHelper { if (paid < this.satoshis) throw new Error(NotEnoughFundError); // Add change - const fee = await this.computer.wallet.estimateFee(tx); - const publicKeyBuffer = this.computer.wallet.publicKey; + const fee = await this.computer.db.wallet.estimateFee(tx); + const publicKeyBuffer = this.computer.db.wallet.publicKey; const { output } = payments.p2pkh({ pubkey: publicKeyBuffer, network: n }); const changeSatoshis = Number(paid) - Number(this.satoshis) / 2 - 5 * fee; // todo: optimize the fee tx.addOutput(output, BigInt(Math.round(changeSatoshis))); @@ -158,7 +158,7 @@ export class ChessContractHelper { this.publicKeyW = chessContract.publicKeyW; this.publicKeyB = chessContract.publicKeyB; // Fund - const fee = await this.computer.wallet.estimateFee(tx); + const fee = await this.computer.db.wallet.estimateFee(tx); const txId = await this.computer.send(this.satoshis / 2n + 5n * BigInt(fee), this.computer.getAddress()); const txHash = bufferUtils.reverseBuffer(Buffer.from(txId, 'hex')); tx.addInput(txHash, 0); @@ -205,7 +205,7 @@ export class ChessContractHelper { const chain = this.computer.getChain(); const network = this.computer.getNetwork(); const n = networks.getNetwork(chain, network); - const { hdPrivateKey } = this.computer.wallet; + const { hdPrivateKey } = this.computer.db.wallet; // Create redeem tx const redeemTx = new Transaction(); redeemTx.addInput(Buffer.from(txId, 'hex').reverse(), 1); @@ -282,7 +282,7 @@ export const signRedeemTx = async (computer, chessContract, txWrapper) => { const network = computer.getNetwork(); const chain = computer.getChain(); const NETWORKOBJ = networks.getNetwork(chain, network); - const { privateKey: currentPlayerPrivateKey } = computer.wallet; + const { privateKey: currentPlayerPrivateKey } = computer.db.wallet; const currentPlayerKeyPair = ECPair.fromPrivateKey(currentPlayerPrivateKey, { network: NETWORKOBJ, }); diff --git a/packages/chess-contracts/build/src/chess-contract.js.map b/packages/chess-contracts/build/src/chess-contract.js.map index f2fde7655..ef1d91f58 100644 --- a/packages/chess-contracts/build/src/chess-contract.js.map +++ b/packages/chess-contracts/build/src/chess-contract.js.map @@ -1 +1 @@ -{"version":3,"file":"chess-contract.js","sourceRoot":"","sources":["../../src/chess-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,EACL,OAAO,EACP,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,MAAM,IAAI,OAAO,GAClB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAmB,MAAM,QAAQ,CAAA;AACvD,OAAO,KAAK,GAAG,MAAM,6BAA6B,CAAA;AAGlD,MAAM,MAAM,GAAG,aAAa,C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,GAAG,mBAAmB,CAAC,uBAAuB,CAChE,QAAQ,EACR,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,EACnC,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACV,qBAAqB,CACtB,CAAA;IAED,OAAO,cAAc,CAAA;AACvB,CAAC,CAAA"} \ No newline at end of file diff --git a/packages/chess-contracts/build/src/main.js b/packages/chess-contracts/build/src/main.js index 503b3ee83..3157a6e79 100644 --- a/packages/chess-contracts/build/src/main.js +++ b/packages/chess-contracts/build/src/main.js @@ -4,6 +4,6 @@ import{Transaction as e}from"@bitcoin-computer/lib";import*as t from"@bitcoin-co "${this.nameB}", "${this.publicKeyW}", "${this.publicKeyB}" - )`,mod:this.mod,fund:!1,sign:!1}),r=this.computer.getChain(),n=this.computer.getNetwork(),i=h.getNetwork(r,n),o=u.fromPublicKey(this.computer.wallet.publicKey,"p2pkh",i),s=await this.computer.wallet.restClient.getFormattedUtxos(o),a=0n;for(;a0;){let{txId:e,vout:r,satoshis:n}=s.pop(),i=eu.reverseBuffer(A.Buffer.from(e,"hex"));t.addInput(i,r),a+=n}if(a{let i=r._owners[0],o=t.getNetwork(),s=t.getChain(),a=h.getNetwork(s,o),{privateKey:f}=t.wallet,u=iS.fromPrivateKey(f,{network:a}),l=e.fromHex(n.redeemTxHex),c=k.fromASM(`OP_2 ${r.publicKeyW} ${r.publicKeyB} OP_2 OP_CHECKMULTISIG`),p=t.getPublicKey()===r.publicKeyW;return iB.validateAndSignRedeemTx(l,A.Buffer.from(i,"hex"),u,c,a,p)};class iO extends Contract{constructor(e){super({name:e,games:[]})}addGame(e){this.games.push(e)}}class iU{constructor({computer:e,mod:t}){this.computer=e,this.mod=t}async createUser(e){if(!e||!e.trim())throw Error("Name can not be empty");let{tx:t}=await this.computer.encode({exp:`new User("${e}")`,mod:this.mod});return this.computer.broadcast(t)}}class iR extends Contract{constructor(e,t){super({_owners:[t],chessGameTxHex:e,accepted:!1})}setAccepted(){this.accepted=!0}}class iN{constructor({computer:e,mod:t}){this.computer=e,this.mod=t}async createChessChallengeTxWrapper(e,t,r){let{tx:n}=await this.computer.encode({exp:`new ChessChallengeTxWrapper( + )`,mod:this.mod,fund:!1,sign:!1}),r=this.computer.getChain(),n=this.computer.getNetwork(),i=h.getNetwork(r,n),o=u.fromPublicKey(this.computer.db.wallet.publicKey,"p2pkh",i),s=await this.computer.db.wallet.restClient.getFormattedUtxos(o),a=0n;for(;a0;){let{txId:e,vout:r,satoshis:n}=s.pop(),i=eu.reverseBuffer(A.Buffer.from(e,"hex"));t.addInput(i,r),a+=n}if(a{let i=r._owners[0],o=t.getNetwork(),s=t.getChain(),a=h.getNetwork(s,o),{privateKey:f}=t.db.wallet,u=iS.fromPrivateKey(f,{network:a}),l=e.fromHex(n.redeemTxHex),c=k.fromASM(`OP_2 ${r.publicKeyW} ${r.publicKeyB} OP_2 OP_CHECKMULTISIG`),p=t.getPublicKey()===r.publicKeyW;return iB.validateAndSignRedeemTx(l,A.Buffer.from(i,"hex"),u,c,a,p)};class iO extends Contract{constructor(e){super({name:e,games:[]})}addGame(e){this.games.push(e)}}class iU{constructor({computer:e,mod:t}){this.computer=e,this.mod=t}async createUser(e){if(!e||!e.trim())throw Error("Name can not be empty");let{tx:t}=await this.computer.encode({exp:`new User("${e}")`,mod:this.mod});return this.computer.broadcast(t)}}class iR extends Contract{constructor(e,t){super({_owners:[t],chessGameTxHex:e,accepted:!1})}setAccepted(){this.accepted=!0}}class iN{constructor({computer:e,mod:t}){this.computer=e,this.mod=t}async createChessChallengeTxWrapper(e,t,r){let{tx:n}=await this.computer.encode({exp:`new ChessChallengeTxWrapper( "${e}", "${t}" )`,mod:this.mod,exclude:r});return this.computer.broadcast(n)}}let iL="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",iC={NORMAL:"n",CAPTURE:"c",BIG_PAWN:"b",EP_CAPTURE:"e",PROMOTION:"p",KSIDE_CASTLE:"k",QSIDE_CASTLE:"q"},iH={NORMAL:1,CAPTURE:2,BIG_PAWN:4,EP_CAPTURE:8,PROMOTION:16,KSIDE_CASTLE:32,QSIDE_CASTLE:64},iM={a8:0,b8:1,c8:2,d8:3,e8:4,f8:5,g8:6,h8:7,a7:16,b7:17,c7:18,d7:19,e7:20,f7:21,g7:22,h7:23,a6:32,b6:33,c6:34,d6:35,e6:36,f6:37,g6:38,h6:39,a5:48,b5:49,c5:50,d5:51,e5:52,f5:53,g5:54,h5:55,a4:64,b4:65,c4:66,d4:67,e4:68,f4:69,g4:70,h4:71,a3:80,b3:81,c3:82,d3:83,e3:84,f3:85,g3:86,h3:87,a2:96,b2:97,c2:98,d2:99,e2:100,f2:101,g2:102,h2:103,a1:112,b1:113,c1:114,d1:115,e1:116,f1:117,g1:118,h1:119},iD={b:[16,32,17,15],w:[-16,-32,-17,-15]},ij={n:[-18,-33,-31,-14,18,33,31,14],b:[-17,-15,17,15],r:[-16,1,16,-1],q:[-17,-16,-15,1,17,16,15,-1],k:[-17,-16,-15,1,17,16,15,-1]},iF=[20,0,0,0,0,0,0,24,0,0,0,0,0,0,20,0,0,20,0,0,0,0,0,24,0,0,0,0,0,20,0,0,0,0,20,0,0,0,0,24,0,0,0,0,20,0,0,0,0,0,0,20,0,0,0,24,0,0,0,20,0,0,0,0,0,0,0,0,20,0,0,24,0,0,20,0,0,0,0,0,0,0,0,0,0,20,2,24,2,20,0,0,0,0,0,0,0,0,0,0,0,2,53,56,53,2,0,0,0,0,0,0,24,24,24,24,24,24,56,0,56,24,24,24,24,24,24,0,0,0,0,0,0,2,53,56,53,2,0,0,0,0,0,0,0,0,0,0,0,20,2,24,2,20,0,0,0,0,0,0,0,0,0,0,20,0,0,24,0,0,20,0,0,0,0,0,0,0,0,20,0,0,0,24,0,0,0,20,0,0,0,0,0,0,20,0,0,0,0,24,0,0,0,0,20,0,0,0,0,20,0,0,0,0,0,24,0,0,0,0,0,20,0,0,20,0,0,0,0,0,0,24,0,0,0,0,0,0,20],iK=[17,0,0,0,0,0,0,16,0,0,0,0,0,0,15,0,0,17,0,0,0,0,0,16,0,0,0,0,0,15,0,0,0,0,17,0,0,0,0,16,0,0,0,0,15,0,0,0,0,0,0,17,0,0,0,16,0,0,0,15,0,0,0,0,0,0,0,0,17,0,0,16,0,0,15,0,0,0,0,0,0,0,0,0,0,17,0,16,0,15,0,0,0,0,0,0,0,0,0,0,0,0,17,16,15,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,-15,-16,-17,0,0,0,0,0,0,0,0,0,0,0,0,-15,0,-16,0,-17,0,0,0,0,0,0,0,0,0,0,-15,0,0,-16,0,0,-17,0,0,0,0,0,0,0,0,-15,0,0,0,-16,0,0,0,-17,0,0,0,0,0,0,-15,0,0,0,0,-16,0,0,0,0,-17,0,0,0,0,-15,0,0,0,0,0,-16,0,0,0,0,0,-17,0,0,-15,0,0,0,0,0,0,-16,0,0,0,0,0,0,-17],iV={p:1,n:2,b:4,r:8,q:16,k:32},iq=["n","b","r","q"],iG={k:iH.KSIDE_CASTLE,q:iH.QSIDE_CASTLE},iW={w:[{square:iM.a1,flag:iH.QSIDE_CASTLE},{square:iM.h1,flag:iH.KSIDE_CASTLE}],b:[{square:iM.a8,flag:iH.QSIDE_CASTLE},{square:iM.h8,flag:iH.KSIDE_CASTLE}]},i$={b:1,w:6},iz=["1-0","0-1","1/2-1/2","*"];function iY(e){return -1!=="0123456789".indexOf(e)}function iQ(e){let t=15&e,r=e>>4;return"abcdefgh".substring(t,t+1)+"87654321".substring(r,r+1)}function iX(e){return"w"===e?"b":"w"}function iJ(e,t,r,n,i,o,s=iH.NORMAL){let a=n>>4;if("p"===i&&(7===a||0===a))for(let a=0;a="a"&&t<="h"){if(e.match(/[a-h]\d.*[a-h]\d/))return;return"p"}return"o"===(t=t.toLowerCase())?"k":t}function i0(e){return e.replace(/=/,"").replace(/[+#]?[?!]*$/,"")}function i1(e){return e.split(" ").slice(0,4).join(" ")}class i2{constructor(e=iL){this._board=Array(128),this._turn="w",this._header={},this._kings={w:-1,b:-1},this._epSquare=-1,this._halfMoves=0,this._moveNumber=0,this._history=[],this._comments={},this._castling={w:0,b:0},this._positionCount={},this.load(e)}clear({preserveHeaders:e=!1}={}){this._board=Array(128),this._kings={w:-1,b:-1},this._turn="w",this._castling={w:0,b:0},this._epSquare=-1,this._halfMoves=0,this._moveNumber=1,this._history=[],this._comments={},this._header=e?this._header:{},this._positionCount={},delete this._header.SetUp,delete this._header.FEN}removeHeader(e){e in this._header&&delete this._header[e]}load(e,{skipValidation:t=!1,preserveHeaders:r=!1}={}){let n=e.split(/\s+/);if(n.length>=2&&n.length<6&&(e=n.concat(["-","-","0","1"].slice(-(6-n.length))).join(" ")),n=e.split(/\s+/),!t){let{ok:t,error:r}=function(e){let t=e.split(/\s+/);if(6!==t.length)return{ok:!1,error:"Invalid FEN: must contain six space-delimited fields"};let r=parseInt(t[5],10);if(isNaN(r)||r<=0)return{ok:!1,error:"Invalid FEN: move number must be a positive integer"};let n=parseInt(t[4],10);if(isNaN(n)||n<0)return{ok:!1,error:"Invalid FEN: half move counter number must be a non-negative integer"};if(!/^(-|[abcdefgh][36])$/.test(t[3]))return{ok:!1,error:"Invalid FEN: en-passant square is invalid"};if(/[^kKqQ-]/.test(t[2]))return{ok:!1,error:"Invalid FEN: castling availability is invalid"};if(!/^(w|b)$/.test(t[1]))return{ok:!1,error:"Invalid FEN: side-to-move is invalid"};let i=t[0].split("/");if(8!==i.length)return{ok:!1,error:"Invalid FEN: piece data does not contain 8 '/'-delimited rows"};for(let e=0;e1)return{ok:!1,error:`Invalid FEN: too many ${e} kings`}}return Array.from(i[0]+i[7]).some(e=>"P"===e.toUpperCase())?{ok:!1,error:"Invalid FEN: some pawns are on the edge rows"}:{ok:!0}}(e);if(!t)throw Error(r)}let i=n[0],o=0;this.clear({preserveHeaders:r});for(let e=0;e-1&&(this._castling.w|=iH.KSIDE_CASTLE),n[2].indexOf("Q")>-1&&(this._castling.w|=iH.QSIDE_CASTLE),n[2].indexOf("k")>-1&&(this._castling.b|=iH.KSIDE_CASTLE),n[2].indexOf("q")>-1&&(this._castling.b|=iH.QSIDE_CASTLE),this._epSquare="-"===n[3]?-1:iM[n[3]],this._halfMoves=parseInt(n[4],10),this._moveNumber=parseInt(n[5],10),this._updateSetup(e),this._incPositionCount(e)}fen(){let e=0,t="";for(let r=iM.a8;r<=iM.h1;r++){if(this._board[r]){e>0&&(t+=e,e=0);let{color:n,type:i}=this._board[r];t+="w"===n?i.toUpperCase():i.toLowerCase()}else e++;r+1&136&&(e>0&&(t+=e),r!==iM.h1&&(t+="/"),e=0,r+=8)}let r="";this._castling.w&iH.KSIDE_CASTLE&&(r+="K"),this._castling.w&iH.QSIDE_CASTLE&&(r+="Q"),this._castling.b&iH.KSIDE_CASTLE&&(r+="k"),this._castling.b&iH.QSIDE_CASTLE&&(r+="q"),r=r||"-";let n="-";if(-1!==this._epSquare){let e=this._epSquare+("w"===this._turn?16:-16);for(let t of[e+1,e-1]){if(136&t)continue;let e=this._turn;if(this._board[t]?.color===e&&this._board[t]?.type==="p"){this._makeMove({color:e,from:t,to:this._epSquare,piece:"p",captured:"p",flags:iH.EP_CAPTURE});let r=!this._isKingAttacked(e);if(this._undoMove(),r){n=iQ(this._epSquare);break}}}}return[t,this._turn,r,n,this._halfMoves,this._moveNumber].join(" ")}_updateSetup(e){this._history.length>0||(e!==iL?(this._header.SetUp="1",this._header.FEN=e):(delete this._header.SetUp,delete this._header.FEN))}reset(){this.load(iL)}get(e){return this._board[iM[e]]||!1}put({type:e,color:t},r){return!!this._put({type:e,color:t},r)&&(this._updateCastlingRights(),this._updateEnPassantSquare(),this._updateSetup(this.fen()),!0)}_put({type:e,color:t},r){if(-1==="pnbrqkPNBRQK".indexOf(e.toLowerCase())||!(r in iM))return!1;let n=iM[r];if("k"==e&&-1!=this._kings[t]&&this._kings[t]!=n)return!1;let i=this._board[n];return i&&"k"===i.type&&(this._kings[i.color]=-1),this._board[n]={type:e,color:t},"k"===e&&(this._kings[t]=n),!0}remove(e){let t=this.get(e);return delete this._board[iM[e]],t&&"k"===t.type&&(this._kings[t.color]=-1),this._updateCastlingRights(),this._updateEnPassantSquare(),this._updateSetup(this.fen()),t}_updateCastlingRights(){let e=this._board[iM.e1]?.type==="k"&&this._board[iM.e1]?.color==="w",t=this._board[iM.e8]?.type==="k"&&this._board[iM.e8]?.color==="b";e&&this._board[iM.a1]?.type==="r"&&this._board[iM.a1]?.color==="w"||(this._castling.w&=~iH.QSIDE_CASTLE),e&&this._board[iM.h1]?.type==="r"&&this._board[iM.h1]?.color==="w"||(this._castling.w&=~iH.KSIDE_CASTLE),t&&this._board[iM.a8]?.type==="r"&&this._board[iM.a8]?.color==="b"||(this._castling.b&=~iH.QSIDE_CASTLE),t&&this._board[iM.h8]?.type==="r"&&this._board[iM.h8]?.color==="b"||(this._castling.b&=~iH.KSIDE_CASTLE)}_updateEnPassantSquare(){if(-1===this._epSquare)return;let e=this._epSquare+("w"===this._turn?-16:16),t=this._epSquare+("w"===this._turn?16:-16);if(null!==this._board[e]||null!==this._board[this._epSquare]||this._board[t]?.color!==iX(this._turn)||this._board[t]?.type!=="p"){this._epSquare=-1;return}[t+1,t-1].some(e=>!(136&e)&&this._board[e]?.color===this._turn&&this._board[e]?.type==="p")||(this._epSquare=-1)}_attacked(e,t,r){let n=[];for(let i=iM.a8;i<=iM.h1;i++){if(136&i){i+=7;continue}if(void 0===this._board[i]||this._board[i].color!==e)continue;let o=this._board[i],s=i-t;if(0===s)continue;let a=s+119;if(iF[a]&iV[o.type]){if("p"===o.type){if(s>0&&"w"===o.color||s<=0&&"b"===o.color){if(!r)return!0;n.push(iQ(i))}continue}if("n"===o.type||"k"===o.type){if(!r)return!0;n.push(iQ(i));continue}let e=iK[a],f=i+e,u=!1;for(;f!==t;){if(null!=this._board[f]){u=!0;break}f+=e}if(!u){if(!r)return!0;n.push(iQ(i));continue}}}return!!r&&n}attackers(e,t){return t?this._attacked(t,iM[e],!0):this._attacked(this._turn,iM[e],!0)}_isKingAttacked(e){let t=this._kings[e];return -1!==t&&this._attacked(iX(e),t)}isAttacked(e,t){return this._attacked(t,iM[e])}isCheck(){return this._isKingAttacked(this._turn)}inCheck(){return this.isCheck()}isCheckmate(){return this.isCheck()&&0===this._moves().length}isStalemate(){return!this.isCheck()&&0===this._moves().length}isInsufficientMaterial(){let e={b:0,n:0,r:0,q:0,k:0,p:0},t=[],r=0,n=0;for(let i=iM.a8;i<=iM.h1;i++){if(n=(n+1)%2,136&i){i+=7;continue}let o=this._board[i];o&&(e[o.type]=o.type in e?e[o.type]+1:1,"b"===o.type&&t.push(n),r++)}if(2===r||3===r&&(1===e.b||1===e.n))return!0;if(r===e.b+2){let e=0,r=t.length;for(let n=0;n=3}isDraw(){return this._halfMoves>=100||this.isStalemate()||this.isInsufficientMaterial()||this.isThreefoldRepetition()}isGameOver(){return this.isCheckmate()||this.isStalemate()||this.isDraw()}moves({verbose:e=!1,square:t,piece:r}={}){let n=this._moves({square:t,piece:r});return e?n.map(e=>this._makePretty(e)):n.map(e=>this._moveToSan(e,n))}_moves({legal:e=!0,piece:t,square:r}={}){let n=r?r.toLowerCase():void 0,i=t?.toLowerCase(),o=[],s=this._turn,a=iX(s),f=iM.a8,u=iM.h1,h=!1;if(n){if(!(n in iM))return[];f=u=iM[n],h=!0}for(let e=f;e<=u;e++){let t;if(136&e){e+=7;continue}if(!this._board[e]||this._board[e].color===a)continue;let{type:r}=this._board[e];if("p"===r){if(i&&i!==r)continue;t=e+iD[s][0],!this._board[t]&&(iJ(o,s,e,t,"p"),t=e+iD[s][1],i$[s]!==e>>4||this._board[t]||iJ(o,s,e,t,"p",void 0,iH.BIG_PAWN));for(let r=2;r<4;r++)136&(t=e+iD[s][r])||(this._board[t]?.color===a?iJ(o,s,e,t,"p",this._board[t].type,iH.CAPTURE):t===this._epSquare&&iJ(o,s,e,t,"p","p",iH.EP_CAPTURE))}else{if(i&&i!==r)continue;for(let n=0,i=ij[r].length;n{let t=this._comments[this.fen()];if(void 0!==t){let r=e.length>0?" ":"";e=`${e}${r}{${t}}`}return e},o=[];for(;this._history.length>0;)o.push(this._undoMove());let s=[],a="";for(0===o.length&&s.push(i(""));o.length>0;){a=i(a);let e=o.pop();if(!e)break;if(this._history.length||"b"!==e.color)"w"===e.color&&(a.length&&s.push(a),a=`${this._moveNumber}.`);else{let e=`${this._moveNumber}. ...`;a=a?`${a} ${e}`:e}a=`${a} ${this._moveToSan(e,this._moves({legal:!0}))}`,this._makeMove(e)}if(a.length&&s.push(i(a)),void 0!==this._header.Result&&s.push(this._header.Result),0===t)return r.join("")+s.join(" ");let f=function(){return r.length>0&&" "===r[r.length-1]&&(r.pop(),!0)},u=0;for(let n=0;nt&&s[n].includes("{")){u=function(n,i){for(let o of i.split(" "))if(o){if(n+o.length>t){for(;f();)n--;r.push(e),n=0}r.push(o),n+=o.length,r.push(" "),n++}return f()&&n--,n}(u,s[n]);continue}u+s[n].length>t&&0!==n?(" "===r[r.length-1]&&r.pop(),r.push(e),u=0):0!==n&&(r.push(" "),u++),r.push(s[n]),u+=s[n].length}return r.join("")}header(...e){for(let t=0;t=2?i[1]:"";this.reset();let s=function(e){let t={},i=e.split(new RegExp(n(r))),o="",s="";for(let e=0;e0&&(t[o]=s)}return t}(o),a="";for(let e in s)"fen"===e.toLowerCase()&&(a=s[e]),this.header(e,s[e]);if(t){if("1"===s.SetUp){if(!("FEN"in s))throw Error("Invalid PGN: FEN tag must be supplied with SetUp tag");this.load(s.FEN,{preserveHeaders:!0})}}else a&&this.load(a,{preserveHeaders:!0});let f=function(e){return e=e.replace(RegExp(n(r),"g")," "),`{${Array.from(e.slice(1,e.length-1)).map(function(e){return 128>e.charCodeAt(0)?e.charCodeAt(0).toString(16):encodeURIComponent(e).replace(/%/g,"").toLowerCase()}).join("")}}`},u=e.replace(o,"").replace(RegExp(`({[^}]*})+?|;([^${n(r)}]*)`,"g"),function(e,t,r){return void 0!==t?f(t):` ${f(`{${r.slice(1)}}`)}`}).replace(RegExp(n(r),"g")," "),h=/(\([^()]+\))+?/g;for(;h.test(u);)u=u.replace(h,"");let l=(u=(u=(u=u.replace(/\d+\.(\.\.)?/g,"")).replace(/\.\.\./g,"")).replace(/\$\d+/g,"")).trim().split(new RegExp(/\s+/));l=l.filter(e=>""!==e);let c="";for(let e=0;e-1)c=l[e];else throw Error(`Invalid move in PGN: ${l[e]}`);else c="",this._makeMove(n),this._incPositionCount(this.fen())}c&&Object.keys(this._header).length&&!this._header.Result&&this.header("Result",c)}_moveToSan(e,t){let r="";if(e.flags&iH.KSIDE_CASTLE)r="O-O";else if(e.flags&iH.QSIDE_CASTLE)r="O-O-O";else{if("p"!==e.piece){let n=function(e,t){let{from:r}=e,{to:n}=e,{piece:i}=e,o=0,s=0,a=0;for(let e=0,f=t.length;e>4==f>>4&&s++,(15&r)==(15&f)&&a++)}return o>0?s>0&&a>0?iQ(r):a>0?iQ(r).charAt(1):iQ(r).charAt(0):""}(e,t);r+=e.piece.toUpperCase()+n}e.flags&(iH.CAPTURE|iH.EP_CAPTURE)&&("p"===e.piece&&(r+=iQ(e.from)[0]),r+="x"),r+=iQ(e.to),e.promotion&&(r+=`=${e.promotion.toUpperCase()}`)}return this._makeMove(e),this.isCheck()&&(this.isCheckmate()?r+="#":r+="+"),this._undoMove(),r}_moveFromSan(e,t=!1){let r,n,i,o,s,a=i0(e),f=iZ(a),u=this._moves({legal:!0,piece:f});for(let e=0,t=u.length;e>4]} |`),this._board[t]){let r=this._board[t].type,{color:n}=this._board[t],i="w"===n?r.toUpperCase():r.toLowerCase();e+=` ${i} `}else e+=" . ";t+1&136&&(e+="|\n",t+=8)}return e+" +------------------------+\n a b c d e f g h"}perft(e){let t=this._moves({legal:!1}),r=0,n=this._turn;for(let i=0,o=t.length;i0?r+=this.perft(e-1):r++),this._undoMove();return r}_makePretty(e){let{color:t,piece:r,from:n,to:i,flags:o,captured:s,promotion:a}=e,f="";for(let e in iH)iH[e]&o&&(f+=iC[e]);let u=iQ(n),h=iQ(i),l={color:t,piece:r,from:u,to:h,san:this._moveToSan(e,this._moves({legal:!0})),flags:f,lan:u+h,before:this.fen(),after:""};return this._makeMove(e),l.after=this.fen(),this._undoMove(),s&&(l.captured=s),a&&(l.promotion=a,l.lan+=a),l}turn(){return this._turn}board(){let e=[],t=[];for(let r=iM.a8;r<=iM.h1;r++)null==this._board[r]?t.push(null):t.push({square:iQ(r),type:this._board[r].type,color:this._board[r].color}),r+1&136&&(e.push(t),t=[],r+=8);return e}squareColor(e){if(e in iM){let t=iM[e];return((t>>4)+(15&t))%2==0?"light":"dark"}return null}history({verbose:e=!1}={}){let t=[],r=[];for(;this._history.length>0;)t.push(this._undoMove());for(;;){let n=t.pop();if(!n)break;e?r.push(this._makePretty(n)):r.push(this._moveToSan(n,this._moves())),this._makeMove(n)}return r}_getPositionCount(e){let t=i1(e);return this._positionCount[t]||0}_incPositionCount(e){let t=i1(e);void 0===this._positionCount[t]&&(this._positionCount[t]=0),this._positionCount[t]+=1}_decPositionCount(e){let t=i1(e);1===this._positionCount[t]?delete this._positionCount[t]:this._positionCount[t]-=1}_pruneComments(){let e=[],t={},r=e=>{e in this._comments&&(t[e]=this._comments[e])};for(;this._history.length>0;)e.push(this._undoMove());for(r(this.fen());;){let t=e.pop();if(!t)break;this._makeMove(t),r(this.fen())}this._comments=t}getComment(){return this._comments[this.fen()]}setComment(e){this._comments[this.fen()]=e.replace("{","[").replace("}","]")}deleteComment(){let e=this._comments[this.fen()];return delete this._comments[this.fen()],e}getComments(){return this._pruneComments(),Object.keys(this._comments).map(e=>({fen:e,comment:this._comments[e]}))}deleteComments(){return this._pruneComments(),Object.keys(this._comments).map(e=>{let t=this._comments[e];return delete this._comments[e],{fen:e,comment:t}})}setCastlingRights(e,t){for(let r of["k","q"])void 0!==t[r]&&(t[r]?this._castling[e]|=iG[r]:this._castling[e]&=~iG[r]);this._updateCastlingRights();let r=this.getCastlingRights(e);return(void 0===t.k||t.k===r.k)&&(void 0===t.q||t.q===r.q)}getCastlingRights(e){return{k:(this._castling[e]&iG.k)!=0,q:(this._castling[e]&iG.q)!=0}}moveNumber(){return this._moveNumber}}export{iT as ChessContract,iB as ChessContractHelper,ik as Payment,iA as WinnerTxWrapper,iI as NotEnoughFundError,iP as signRedeemTx,iO as User,iU as UserHelper,iR as ChessChallengeTxWrapper,iN as ChessChallengeTxWrapperHelper,i2 as Chess}; \ No newline at end of file diff --git a/packages/chess-contracts/build/test/chess-contract.test.js b/packages/chess-contracts/build/test/chess-contract.test.js index 36ea80d56..e31e55269 100644 --- a/packages/chess-contracts/build/test/chess-contract.test.js +++ b/packages/chess-contracts/build/test/chess-contract.test.js @@ -12,18 +12,18 @@ describe('Should create a deposit transaction for the Chess game with operator', const aliceComputer = new Computer({ url }); const bobComputer = new Computer({ url }); const operatorComputer = new Computer({ url }); - const alicePublicKey = aliceComputer.wallet.publicKey; - const bobPublicKey = bobComputer.wallet.publicKey; - const operatorPublicKey = operatorComputer.wallet.publicKey; + const alicePublicKey = aliceComputer.db.wallet.publicKey; + const bobPublicKey = bobComputer.db.wallet.publicKey; + const operatorPublicKey = operatorComputer.db.wallet.publicKey; const aliceAddress = aliceComputer.getAddress(); const bobAddress = bobComputer.getAddress(); const chain = aliceComputer.getChain(); const network = aliceComputer.getNetwork(); const NETWORKOBJ = networks.getNetwork(chain, network); const n = { network: NETWORKOBJ }; - const alicePrivateKey = aliceComputer.wallet.privateKey; - const bobPrivateKey = bobComputer.wallet.privateKey; - const operatorPrivateKey = operatorComputer.wallet.privateKey; + const alicePrivateKey = aliceComputer.db.wallet.privateKey; + const bobPrivateKey = bobComputer.db.wallet.privateKey; + const operatorPrivateKey = operatorComputer.db.wallet.privateKey; const aliceKeyPair = ECPair.fromPrivateKey(alicePrivateKey, n); const bobKeyPair = ECPair.fromPrivateKey(bobPrivateKey, n); const operatorKeyPair = ECPair.fromPrivateKey(operatorPrivateKey, n); @@ -45,17 +45,17 @@ describe('Should create a deposit transaction for the Chess game with operator', const createCommitTx = async () => { await aliceComputer.faucet(10e8); await bobComputer.faucet(10e8); - const [aliceUtxo] = await aliceComputer.wallet.restClient.getFormattedUtxos(aliceAddress); + const [aliceUtxo] = await aliceComputer.db.wallet.restClient.getFormattedUtxos(aliceAddress); const { vout: vout1, satoshis: amountPayment1, txId: txId1 } = aliceUtxo; const aliceUtxoHash = bufferUtils.reverseBuffer(Buffer.from(txId1, 'hex')); - const [bobUtxo] = await bobComputer.wallet.restClient.getFormattedUtxos(bobAddress); + const [bobUtxo] = await bobComputer.db.wallet.restClient.getFormattedUtxos(bobAddress); const { vout: vout2, satoshis: amountPayment2, txId: txId2 } = bobUtxo; const bobUtxoHash = bufferUtils.reverseBuffer(Buffer.from(txId2, 'hex')); const commitTx = new Transaction(); commitTx.addOutput(output, 2n * betAmount); commitTx.addInput(aliceUtxoHash, vout1); commitTx.addInput(bobUtxoHash, vout2); - const requiredFee = await aliceComputer.wallet.estimateFee(commitTx); + const requiredFee = await aliceComputer.db.wallet.estimateFee(commitTx); commitTx.addOutput(aliceChangeOutput, amountPayment1 - betAmount); commitTx.addOutput(bobChangeOutput, amountPayment2 - betAmount - BigInt(requiredFee)); await aliceComputer.sign(commitTx); diff --git a/packages/chess-contracts/build/test/chess-contract.test.js.map b/packages/chess-contracts/build/test/chess-contract.test.js.map index b00a6e54a..1a1a78942 100644 --- a/packages/chess-contracts/build/test/chess-contract.test.js.map +++ b/packages/chess-contracts/build/test/chess-contract.test.js.map @@ -1 +1 @@ -{"version":3,"file":"chess-contract.test.js","sourceRoot":"","sources":["../../test/chess-contract.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,8BAA8B,CAAA;AACjG,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D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ACf,eAAe,EACf,YAAY,EACZ,CAAC,CAAC,OAAO,CACV,CAAA;QACH,CAAC,CAAC,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAA;IAC/C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"} \ No newline at end of file diff --git a/packages/chess-contracts/package.json b/packages/chess-contracts/package.json index c2d6bf7a3..8e36709a6 100644 --- a/packages/chess-contracts/package.json +++ b/packages/chess-contracts/package.json @@ -10,6 +10,10 @@ "exports": { ".": "./build/src/main.js" }, + "files": [ + "LICENSE.md", + "LEGAL.md" + ], "types": "./build/src/index.d.ts", "scripts": { "prebuild": "npm run lint", diff --git a/packages/chess-contracts/src/chess-contract.ts b/packages/chess-contracts/src/chess-contract.ts index 0a2044d98..ad59ab5c0 100644 --- a/packages/chess-contracts/src/chess-contract.ts +++ b/packages/chess-contracts/src/chess-contract.ts @@ -209,8 +209,8 @@ export class ChessContractHelper { const chain = this.computer.getChain() const network = this.computer.getNetwork() const n = networks.getNetwork(chain, network) - const addy = address.fromPublicKey(this.computer.wallet.publicKey, 'p2pkh', n) - const utxos = await this.computer.wallet.restClient.getFormattedUtxos(addy) + const addy = address.fromPublicKey(this.computer.db.wallet.publicKey, 'p2pkh', n) + const utxos = await this.computer.db.wallet.restClient.getFormattedUtxos(addy) let paid = 0n while (paid < Number(this.satoshis) / 2 && utxos.length > 0) { const { txId, vout, satoshis } = utxos.pop()! @@ -222,8 +222,8 @@ export class ChessContractHelper { if (paid < this.satoshis) throw new Error(NotEnoughFundError) // Add change - const fee = await this.computer.wallet.estimateFee(tx) - const publicKeyBuffer = this.computer.wallet.publicKey + const fee = await this.computer.db.wallet.estimateFee(tx) + const publicKeyBuffer = this.computer.db.wallet.publicKey const { output } = payments.p2pkh({ pubkey: publicKeyBuffer, network: n }) const changeSatoshis = Number(paid) - Number(this.satoshis) / 2 - 5 * fee // todo: optimize the fee tx.addOutput(output!, BigInt(Math.round(changeSatoshis))) @@ -247,7 +247,7 @@ export class ChessContractHelper { this.publicKeyB = chessContract.publicKeyB // Fund - const fee = await this.computer.wallet.estimateFee(tx) + const fee = await this.computer.db.wallet.estimateFee(tx) const txId = await this.computer.send( this.satoshis / 2n + 5n * BigInt(fee), this.computer.getAddress(), @@ -311,7 +311,7 @@ export class ChessContractHelper { const chain = this.computer.getChain() const network = this.computer.getNetwork() const n = networks.getNetwork(chain, network) - const { hdPrivateKey } = this.computer.wallet + const { hdPrivateKey } = this.computer.db.wallet // Create redeem tx const redeemTx = new Transaction() @@ -418,7 +418,7 @@ export const signRedeemTx = async ( const chain = computer.getChain() const NETWORKOBJ = networks.getNetwork(chain, network) - const { privateKey: currentPlayerPrivateKey } = computer.wallet + const { privateKey: currentPlayerPrivateKey } = computer.db.wallet const currentPlayerKeyPair = ECPair.fromPrivateKey(currentPlayerPrivateKey, { network: NETWORKOBJ, }) diff --git a/packages/chess-contracts/test/chess-contract.test.ts b/packages/chess-contracts/test/chess-contract.test.ts index b839726d9..9a9664778 100644 --- a/packages/chess-contracts/test/chess-contract.test.ts +++ b/packages/chess-contracts/test/chess-contract.test.ts @@ -15,9 +15,9 @@ describe('Should create a deposit transaction for the Chess game with operator', const bobComputer = new Computer({ url }) const operatorComputer = new Computer({ url }) - const alicePublicKey = aliceComputer.wallet.publicKey - const bobPublicKey = bobComputer.wallet.publicKey - const operatorPublicKey = operatorComputer.wallet.publicKey + const alicePublicKey = aliceComputer.db.wallet.publicKey + const bobPublicKey = bobComputer.db.wallet.publicKey + const operatorPublicKey = operatorComputer.db.wallet.publicKey const aliceAddress = aliceComputer.getAddress() const bobAddress = bobComputer.getAddress() const chain = aliceComputer.getChain() @@ -25,9 +25,9 @@ describe('Should create a deposit transaction for the Chess game with operator', const NETWORKOBJ = networks.getNetwork(chain, network) const n = { network: NETWORKOBJ } - const alicePrivateKey = aliceComputer.wallet.privateKey - const bobPrivateKey = bobComputer.wallet.privateKey - const operatorPrivateKey = operatorComputer.wallet.privateKey + const alicePrivateKey = aliceComputer.db.wallet.privateKey + const bobPrivateKey = bobComputer.db.wallet.privateKey + const operatorPrivateKey = operatorComputer.db.wallet.privateKey const aliceKeyPair = ECPair.fromPrivateKey(alicePrivateKey, n) const bobKeyPair = ECPair.fromPrivateKey(bobPrivateKey, n) const operatorKeyPair = ECPair.fromPrivateKey(operatorPrivateKey, n) @@ -55,11 +55,11 @@ describe('Should create a deposit transaction for the Chess game with operator', await aliceComputer.faucet(10e8) await bobComputer.faucet(10e8) - const [aliceUtxo] = await aliceComputer.wallet.restClient.getFormattedUtxos(aliceAddress) + const [aliceUtxo] = await aliceComputer.db.wallet.restClient.getFormattedUtxos(aliceAddress) const { vout: vout1, satoshis: amountPayment1, txId: txId1 } = aliceUtxo const aliceUtxoHash = bufferUtils.reverseBuffer(Buffer.from(txId1, 'hex')) - const [bobUtxo] = await bobComputer.wallet.restClient.getFormattedUtxos(bobAddress) + const [bobUtxo] = await bobComputer.db.wallet.restClient.getFormattedUtxos(bobAddress) const { vout: vout2, satoshis: amountPayment2, txId: txId2 } = bobUtxo const bobUtxoHash = bufferUtils.reverseBuffer(Buffer.from(txId2, 'hex')) @@ -67,7 +67,7 @@ describe('Should create a deposit transaction for the Chess game with operator', commitTx.addOutput(output as Buffer, 2n * betAmount) commitTx.addInput(aliceUtxoHash, vout1) commitTx.addInput(bobUtxoHash, vout2) - const requiredFee = await aliceComputer.wallet.estimateFee(commitTx) + const requiredFee = await aliceComputer.db.wallet.estimateFee(commitTx) commitTx.addOutput(aliceChangeOutput as Buffer, amountPayment1 - betAmount) commitTx.addOutput(bobChangeOutput as Buffer, amountPayment2 - betAmount - BigInt(requiredFee)) await aliceComputer.sign(commitTx) diff --git a/packages/chess-server/LEGAL.md b/packages/chess-server/LEGAL.md new file mode 100644 index 000000000..fe9be5d30 --- /dev/null +++ b/packages/chess-server/LEGAL.md @@ -0,0 +1,37 @@ +# Legal Notice + +**Summary**: This software is free to use and modify under the [MIT License](./LICENSE.md) for its source code. However, it includes patented technology that requires payment for use, facilitated through a cryptocurrency mechanism. You are responsible for complying with all applicable laws and bear full liability for your use of the software. + +## Patent and Payment Notice + +This software includes technology protected by US Patent Nos. 11694197 and 11188911. Using this patented technology, which forms a core part of the software’s functionality, requires payment through the software’s built-in cryptocurrency mechanism. The payment amount is determined automatically by the software, and the cryptocurrency used (e.g., BTC, LTC, DOGE) depends on the blockchain you select. For detailed payment instructions, please refer to the software's [documentation](https://github.com/bitcoin-computer/monorepo/blob/main/packages/docs/fees.md). + +You may modify the software freely under the MIT License, but any use of the patented functionality, including in modified versions, requires compliance with these payment terms or obtaining an alternative license. Bypassing the payment mechanism while still using the patented technology may constitute patent infringement. For alternative licensing options, please contact clemens@bitcoincomputer.io. + +You may use the software for free for testing purposes on testnet and regtest, as these environments use test coins with no real value. However, any use on mainnet or other production environments requires compliance with the payment terms outlined in this notice. + +## Disclaimer Regarding User Modifications + +**BCDB Does Not Endorse or Promote User Software Activity**. We are publishing certain portions of the Software, on an open-source basis, to demonstrate the utility of the Bitcoin Computer. As this Software is open-source, it may be modified and deployed for a wide range of uses that we may not have intended. We do not endorse or promote, and expressly disclaim liability for, any non-BCDB use or modification of the Software. + +## Legal and Regulatory Compliance + +**Sanctioned Users are Prohibited**. You may not access or use this software if you are (i) a resident of any country with which transactions or dealings are prohibited by governmental sanctions imposed by the U.S., the United Nations, the European Union, the United Kingdom, or any other applicable jurisdiction (collectively, “Sanctions Regimes”); (ii) a person, entity or government prohibited under an applicable Sanctions Regime (“Sanctioned Person”), including the Office of Foreign Assets Control, Specially Designated Nationals and Blocked Persons List; or (iii) prohibited from accessing or using the Software pursuant to the laws, rules, and regulations in the jurisdiction in which you reside or otherwise access and use the Software. + +**Users Must Comply with Applicable Law**. You may only access or use the Software in compliance with laws, rules, and regulations in the jurisdiction in which you reside or otherwise access and use the Software, including, as applicable, Sanctions Regimes, anti-money laundering laws and regulations, and securities laws and regulations. + +Additionally, you are solely responsible for ensuring that your cryptocurrency transactions comply with all applicable laws, including anti-money laundering and tax regulations in your jurisdiction. + +## Liability Disclaimer and Indemnification + +BCDB Inc. provides this software "as is," without any warranties, express or implied, including warranties of merchantability, fitness for a particular purpose, or non-infringement. BCDB Inc. shall not be liable for any direct, indirect, incidental, special, exemplary, or consequential damages resulting from your use or modification of the software. + +By using this software, you agree to indemnify, defend, and hold harmless BCDB Inc. and its affiliates from any claims, damages, liabilities, or expenses (including attorneys’ fees and costs) arising from your use or modification of the software, including but not limited to violations of applicable laws or infringement of third-party rights. + +## Intellectual Property + +The patented technology is protected under US Patent Nos. 11694197 and 11188911. This patent applies in the United States only. If you are outside the US, you should review your local patent laws to understand any additional obligations. + +## Contact Information + +For questions, alternative licensing options, or further clarification, please contact clemens@bitcoincomputer.io. diff --git a/packages/chess-server/LICENSE.md b/packages/chess-server/LICENSE.md new file mode 100644 index 000000000..d88b046e5 --- /dev/null +++ b/packages/chess-server/LICENSE.md @@ -0,0 +1,11 @@ +MIT License + +Copyright (c) 2025 BCDB Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**Note**: This license applies only to the copyright of the source code and documentation. For additional terms, including patent notices and payment requirements, see [LEGAL.md](./LEGAL.md). diff --git a/packages/components/LEGAL.md b/packages/components/LEGAL.md new file mode 100644 index 000000000..fe9be5d30 --- /dev/null +++ b/packages/components/LEGAL.md @@ -0,0 +1,37 @@ +# Legal Notice + +**Summary**: This software is free to use and modify under the [MIT License](./LICENSE.md) for its source code. However, it includes patented technology that requires payment for use, facilitated through a cryptocurrency mechanism. You are responsible for complying with all applicable laws and bear full liability for your use of the software. + +## Patent and Payment Notice + +This software includes technology protected by US Patent Nos. 11694197 and 11188911. Using this patented technology, which forms a core part of the software’s functionality, requires payment through the software’s built-in cryptocurrency mechanism. The payment amount is determined automatically by the software, and the cryptocurrency used (e.g., BTC, LTC, DOGE) depends on the blockchain you select. For detailed payment instructions, please refer to the software's [documentation](https://github.com/bitcoin-computer/monorepo/blob/main/packages/docs/fees.md). + +You may modify the software freely under the MIT License, but any use of the patented functionality, including in modified versions, requires compliance with these payment terms or obtaining an alternative license. Bypassing the payment mechanism while still using the patented technology may constitute patent infringement. For alternative licensing options, please contact clemens@bitcoincomputer.io. + +You may use the software for free for testing purposes on testnet and regtest, as these environments use test coins with no real value. However, any use on mainnet or other production environments requires compliance with the payment terms outlined in this notice. + +## Disclaimer Regarding User Modifications + +**BCDB Does Not Endorse or Promote User Software Activity**. We are publishing certain portions of the Software, on an open-source basis, to demonstrate the utility of the Bitcoin Computer. As this Software is open-source, it may be modified and deployed for a wide range of uses that we may not have intended. We do not endorse or promote, and expressly disclaim liability for, any non-BCDB use or modification of the Software. + +## Legal and Regulatory Compliance + +**Sanctioned Users are Prohibited**. You may not access or use this software if you are (i) a resident of any country with which transactions or dealings are prohibited by governmental sanctions imposed by the U.S., the United Nations, the European Union, the United Kingdom, or any other applicable jurisdiction (collectively, “Sanctions Regimes”); (ii) a person, entity or government prohibited under an applicable Sanctions Regime (“Sanctioned Person”), including the Office of Foreign Assets Control, Specially Designated Nationals and Blocked Persons List; or (iii) prohibited from accessing or using the Software pursuant to the laws, rules, and regulations in the jurisdiction in which you reside or otherwise access and use the Software. + +**Users Must Comply with Applicable Law**. You may only access or use the Software in compliance with laws, rules, and regulations in the jurisdiction in which you reside or otherwise access and use the Software, including, as applicable, Sanctions Regimes, anti-money laundering laws and regulations, and securities laws and regulations. + +Additionally, you are solely responsible for ensuring that your cryptocurrency transactions comply with all applicable laws, including anti-money laundering and tax regulations in your jurisdiction. + +## Liability Disclaimer and Indemnification + +BCDB Inc. provides this software "as is," without any warranties, express or implied, including warranties of merchantability, fitness for a particular purpose, or non-infringement. BCDB Inc. shall not be liable for any direct, indirect, incidental, special, exemplary, or consequential damages resulting from your use or modification of the software. + +By using this software, you agree to indemnify, defend, and hold harmless BCDB Inc. and its affiliates from any claims, damages, liabilities, or expenses (including attorneys’ fees and costs) arising from your use or modification of the software, including but not limited to violations of applicable laws or infringement of third-party rights. + +## Intellectual Property + +The patented technology is protected under US Patent Nos. 11694197 and 11188911. This patent applies in the United States only. If you are outside the US, you should review your local patent laws to understand any additional obligations. + +## Contact Information + +For questions, alternative licensing options, or further clarification, please contact clemens@bitcoincomputer.io. diff --git a/packages/components/LICENSE.md b/packages/components/LICENSE.md new file mode 100644 index 000000000..d88b046e5 --- /dev/null +++ b/packages/components/LICENSE.md @@ -0,0 +1,11 @@ +MIT License + +Copyright (c) 2025 BCDB Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**Note**: This license applies only to the copyright of the source code and documentation. For additional terms, including patent notices and payment requirements, see [LEGAL.md](./LEGAL.md). diff --git a/packages/components/README.md b/packages/components/README.md index 4ebb66ced..72f520d68 100644 --- a/packages/components/README.md +++ b/packages/components/README.md @@ -42,6 +42,8 @@ npm run types You might have to restart the applications. -## Legal Notice +## License -See [here](https://github.com/bitcoin-computer/monorepo/tree/main/packages/lib#legal-notice). +This software is licensed under the MIT License. See the [LICENSE.md](./LICENSE.md) file. + +This software includes patented technology that requires payment for use on mainnet or production environments. Please review the [LEGAL.md](./LEGAL.md) file for details on patent usage and payment requirements. diff --git a/packages/components/built/Drawer.d.ts b/packages/components/built/Drawer.d.ts index fa07485a1..fed46a443 100644 --- a/packages/components/built/Drawer.d.ts +++ b/packages/components/built/Drawer.d.ts @@ -2,7 +2,12 @@ declare function ShowDrawer({ text, id }: { text: string; id: string; }): import("react/jsx-runtime").JSX.Element; -declare function Component({ Content, id }: any): import("react/jsx-runtime").JSX.Element; +declare function Component({ Content, id, }: { + Content: (props: { + isOpen: boolean; + }) => JSX.Element; + id: string; +}): import("react/jsx-runtime").JSX.Element; export declare const Drawer: { Component: typeof Component; ShowDrawer: typeof ShowDrawer; diff --git a/packages/components/built/Drawer.js b/packages/components/built/Drawer.js index 92630bddc..f598098af 100644 --- a/packages/components/built/Drawer.js +++ b/packages/components/built/Drawer.js @@ -1,9 +1,26 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; +import { useState, useEffect, useRef } from 'react'; function ShowDrawer({ text, id }) { return (_jsx("button", { "data-drawer-target": id, "data-drawer-show": id, "data-drawer-placement": "right", "aria-controls": id, children: text })); } -function Component({ Content, id }) { - return (_jsxs("div", { id: id, className: "fixed top-0 right-0 z-40 h-screen p-4 overflow-y-auto transition-transform translate-x-full bg-white w-80 dark:bg-gray-800", tabIndex: -1, "aria-labelledby": "drawer-right-label", children: [_jsxs("button", { type: "button", "data-drawer-hide": id, "aria-controls": id, className: "text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 absolute top-2.5 end-2.5 inline-flex items-center justify-center dark:hover:bg-gray-600 dark:hover:text-white", children: [_jsx("svg", { className: "w-3 h-3", "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 14 14", children: _jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6" }) }), _jsx("span", { className: "sr-only", children: "Close menu" })] }), Content()] })); +function Component({ Content, id, }) { + const [isOpen, setIsOpen] = useState(false); + const drawerRef = useRef(null); + useEffect(() => { + const drawerElement = drawerRef.current; + if (drawerElement) { + const onTransitionEnd = (event) => { + if (event.propertyName === 'transform') + setIsOpen(!drawerElement.classList.contains('translate-x-full')); + }; + drawerElement.addEventListener('transitionend', onTransitionEnd); + return () => { + drawerElement.removeEventListener('transitionend', onTransitionEnd); + }; + } + return undefined; + }, []); + return (_jsxs("div", { ref: drawerRef, id: id, className: "fixed top-0 right-0 z-40 h-screen p-4 overflow-y-auto transition-transform duration-300 translate-x-full bg-white w-80 dark:bg-gray-800", tabIndex: -1, "aria-labelledby": "drawer-right-label", children: [_jsxs("button", { type: "button", "data-drawer-hide": id, "aria-controls": id, className: "text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 absolute top-2.5 end-2.5 inline-flex items-center justify-center dark:hover:bg-gray-600 dark:hover:text-white", children: [_jsx("svg", { className: "w-3 h-3", "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 14 14", children: _jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6" }) }), _jsx("span", { className: "sr-only", children: "Close menu" })] }), Content({ isOpen })] })); } export const Drawer = { Component, diff --git a/packages/components/built/SmartObject.js b/packages/components/built/SmartObject.js index cfddd54b6..01e609467 100644 --- a/packages/components/built/SmartObject.js +++ b/packages/components/built/SmartObject.js @@ -68,21 +68,14 @@ function Component({ title }) { }; useEffect(() => { const fetch = async () => { - try { - const synced = await computer.sync(rev); - setSmartObject(synced); - } - catch (error) { - const [txId] = rev.split(':'); - navigate(`/transactions/${txId}`); - } - try { - setPrev(await computer.prev(rev)); - setNext(await computer.next(rev)); - } - catch (error) { - console.log({ error }); - } + const [o, p, n] = await Promise.all([ + computer.sync(rev), + computer.prev(rev), + computer.next(rev), + ]); + setSmartObject(o); + setPrev(p); + setNext(n); }; fetch(); }, [computer, rev, location, navigate]); diff --git a/packages/components/built/Transaction.js b/packages/components/built/Transaction.js index 5f702cf97..ed2bd422a 100644 --- a/packages/components/built/Transaction.js +++ b/packages/components/built/Transaction.js @@ -27,7 +27,7 @@ function Component() { useEffect(() => { const fetch = async () => { setTxn(params.txn); - const [hex] = await computer.wallet.restClient.getRawTxs([params.txn]); + const [hex] = await computer.db.wallet.restClient.getRawTxs([params.txn]); const tx = Computer.txFromHex({ hex }); setTxnData(tx); const { result } = await computer.rpcCall('getrawtransaction', `${params.txn} 2`); diff --git a/packages/components/built/Wallet.d.ts b/packages/components/built/Wallet.d.ts index a2cdd7b8f..ba522e56f 100644 --- a/packages/components/built/Wallet.d.ts +++ b/packages/components/built/Wallet.d.ts @@ -3,9 +3,10 @@ export declare function Wallet({ modSpecs }: { modSpecs?: string[]; }): import("react/jsx-runtime").JSX.Element; export declare const WalletComponents: { - Balance: ({ computer, modSpecs }: { + Balance: ({ computer, modSpecs, isOpen, }: { computer: Computer; modSpecs: string[]; + isOpen: boolean; }) => import("react/jsx-runtime").JSX.Element; Address: ({ computer }: any) => import("react/jsx-runtime").JSX.Element; PublicKey: ({ computer }: any) => import("react/jsx-runtime").JSX.Element; diff --git a/packages/components/built/Wallet.js b/packages/components/built/Wallet.js index 043c36c4e..5d723ad1d 100644 --- a/packages/components/built/Wallet.js +++ b/packages/components/built/Wallet.js @@ -7,7 +7,7 @@ import { Drawer } from './Drawer'; import { UtilsContext } from './UtilsContext'; import { ComputerContext } from './ComputerContext'; import { getEnv, bigIntToStr } from './common/utils'; -const Balance = ({ computer, modSpecs }) => { +const Balance = ({ computer, modSpecs, isOpen, }) => { const [balance, setBalance] = useState(0n); const [, setChain] = useState(localStorage.getItem('CHAIN') || 'LTC'); const { showSnackBar, showLoader } = UtilsContext.useUtilsComponents(); @@ -16,11 +16,11 @@ const Balance = ({ computer, modSpecs }) => { showLoader(true); const publicKey = computer.getPublicKey(); const balances = await Promise.all(modSpecs.map(async (mod) => { - const paymentRevs = modSpecs ? await computer.query({ publicKey, mod }) : []; - const payments = (await Promise.all(paymentRevs.map((rev) => computer.sync(rev)))); + const revs = modSpecs ? await computer.query({ publicKey, mod }) : []; + const payments = (await Promise.all(revs.map((rev) => computer.sync(rev)))); return payments && payments.length ? payments.reduce((total, pay) => total + (pay._satoshis - BigInt(computer.getMinimumFees())), 0n) - : 0; + : 0n; })); const amountsInPayments = balances.reduce((acc, curr) => acc + BigInt(curr), 0n); const walletBalance = await computer.getBalance(); @@ -32,14 +32,15 @@ const Balance = ({ computer, modSpecs }) => { showLoader(false); showSnackBar('Error fetching wallet details', false); } - }, [computer]); + }, [computer, modSpecs]); const fund = async () => { await computer.faucet(1e8); setBalance((await computer.getBalance()).balance); }; useEffect(() => { - refreshBalance(); - }, []); + if (isOpen) + refreshBalance(); + }, [isOpen, refreshBalance]); return (_jsxs("div", { id: "dropdown-cta", className: "relative flex flex-col p-6 my-4 rounded-lg bg-blue-50 dark:bg-blue-900", role: "alert", children: [_jsxs("div", { className: "text-center mb-1 text-2xl font-bold text-blue-800 dark:text-blue-400", children: [bigIntToStr(balance), " ", computer.getChain(), ' ', _jsx(HiRefresh, { onClick: refreshBalance, className: "w-4 h-4 ml-1 mb-1 inline cursor-pointer hover:text-slate-700 dark:hover:text-slate-100" })] }), _jsx("div", { className: "text-center uppercase text-xs text-blue-800 dark:text-blue-400", children: computer.getNetwork() }), computer.getNetwork() === 'regtest' && (_jsx("button", { id: "fund-wallet", type: "button", onClick: fund, className: "absolute bottom-2 right-2 px-1 py-1 text-center text-xs font-medium text-center text-blue-700 hover:text-white border border-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg dark:border-blue-500 dark:text-blue-500 dark:hover:text-white dark:hover:bg-blue-500 dark:focus:ring-blue-800", children: "Fund" }))] })); }; const Address = ({ computer }) => { @@ -47,7 +48,7 @@ const Address = ({ computer }) => { const handleCopy = () => { navigator.clipboard.writeText(computer.getAddress()); setCopied(true); - setTimeout(() => setCopied(false), 2000); // Reset icon color after 2 seconds + setTimeout(() => setCopied(false), 2000); }; return (_jsxs("div", { className: "mb-4", children: [_jsxs("div", { className: "flex items-center", children: [_jsx("h6", { className: "text-lg font-bold dark:text-white", children: "Address" }), _jsx("button", { onClick: handleCopy, className: `ml-1 p-1 text-gray-500 dark:text-gray-400 hover:text-gray-800 dark:hover:text-white`, "aria-label": "Copy address", children: copied ? (_jsx(FiCheck, { className: "w-4 h-4 text-green-500 dark:text-green-400" })) : (_jsx(FiCopy, { className: "w-4 h-4" })) })] }), _jsx("p", { className: "mb-4 font-mono text-xs text-gray-500 dark:text-gray-400", children: computer.getAddress() })] })); }; @@ -56,13 +57,13 @@ const PublicKey = ({ computer }) => { const handleCopy = () => { navigator.clipboard.writeText(computer.getPublicKey()); setCopied(true); - setTimeout(() => setCopied(false), 2000); // Reset icon color after 2 seconds + setTimeout(() => setCopied(false), 2000); }; return (_jsxs("div", { className: "mb-4", children: [_jsxs("div", { className: "flex items-center", children: [_jsx("h6", { className: "text-lg font-bold dark:text-white", children: "Public Key" }), _jsx("button", { onClick: handleCopy, className: `ml-1 p-1 text-gray-500 dark:text-gray-400 hover:text-gray-800 dark:hover:text-white`, "aria-label": "Copy public key", children: copied ? (_jsx(FiCheck, { className: "w-4 h-4 text-green-500 dark:text-green-400" })) : (_jsx(FiCopy, { className: "w-4 h-4" })) })] }), _jsx("p", { className: "mb-4 text-xs font-mono text-gray-500 dark:text-gray-400 break-words", children: computer.getPublicKey() })] })); }; const Mnemonic = ({ computer }) => { const [mnemonicShown, setMnemonicShown] = useState(false); - return (_jsxs("div", { className: "mb-4", children: [_jsxs("h6", { className: "text-lg font-bold dark:text-white", children: ["Mnemonic\u00A0", _jsx("button", { onClick: () => setMnemonicShown(!mnemonicShown), className: "text-xs font-mono font-normal text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-500 underline", children: mnemonicShown ? 'hide' : 'show' })] }), _jsx("p", { className: "text-xs font-mono text-gray-500 dark:text-gray-400 break-words", children: mnemonicShown ? computer.getMnemonic() : '' })] })); + return (_jsxs("div", { className: "mb-4", children: [_jsxs("h6", { className: "text-lg font-bold dark:text-white", children: ["Mnemonic", ' ', _jsx("button", { onClick: () => setMnemonicShown(!mnemonicShown), className: "text-xs font-mono font-normal text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-500 underline", children: mnemonicShown ? 'hide' : 'show' })] }), _jsx("p", { className: "text-xs font-mono text-gray-500 dark:text-gray-400 break-words", children: mnemonicShown ? computer.getMnemonic() : '' })] })); }; const Url = ({ computer }) => (_jsxs("div", { className: "mb-4", children: [_jsx("h6", { className: "text-lg font-bold dark:text-white", children: "Node Url" }), _jsx("p", { className: "mb-4 font-mono text-xs text-gray-500 dark:text-gray-400 break-words", children: computer.getUrl() })] })); const Chain = ({ computer }) => (_jsxs("div", { className: "mb-4", children: [_jsx("h6", { className: "text-lg font-bold dark:text-white", children: "Chain" }), _jsx("p", { className: "mb-4 font-mono text-xs text-gray-500 dark:text-gray-400 break-words", children: computer.getChain() })] })); @@ -71,7 +72,7 @@ const Path = ({ computer }) => (_jsxs("div", { className: "mb-4", children: [_js const LogOut = () => (_jsxs(_Fragment, { children: [_jsxs("div", { className: "mb-6", children: [_jsx("h6", { className: "text-lg font-bold dark:text-white", children: "Log out" }), _jsx("p", { className: "mb-1 text-sm text-gray-500 dark:text-gray-400", children: "Logging out will delete your mnemonic. Make sure to write it down." })] }), _jsx("div", { className: "grid grid-cols-2 gap-4", children: _jsx("button", { onClick: Auth.logout, className: "rounded-lg border border-gray-200 bg-white px-4 py-2 text-center text-sm font-medium text-gray-900 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white dark:focus:ring-gray-700", children: "Log out" }) })] })); export function Wallet({ modSpecs }) { const computer = useContext(ComputerContext); - const Content = () => (_jsxs(_Fragment, { children: [_jsx("h4", { className: "text-2xl font-bold dark:text-white", children: "Wallet" }), _jsx(Balance, { computer: computer, modSpecs: modSpecs || [] }), _jsx(Address, { computer: computer }), _jsx(PublicKey, { computer: computer }), _jsx(Mnemonic, { computer: computer }), !getEnv('CHAIN') && _jsx(Chain, { computer: computer }), !getEnv('NETWORK') && _jsx(Network, { computer: computer }), !getEnv('URL') && _jsx(Url, { computer: computer }), !getEnv('PATH') && _jsx(Path, { computer: computer }), _jsx("hr", { className: "h-px my-6 bg-gray-200 border-0 dark:bg-gray-700" }), _jsx(LogOut, {})] })); + const Content = ({ isOpen }) => (_jsxs(_Fragment, { children: [_jsx("h4", { className: "text-2xl font-bold dark:text-white", children: "Wallet" }), _jsx(Balance, { computer: computer, modSpecs: modSpecs || [], isOpen: isOpen }), _jsx(Address, { computer: computer }), _jsx(PublicKey, { computer: computer }), _jsx(Mnemonic, { computer: computer }), !getEnv('CHAIN') && _jsx(Chain, { computer: computer }), !getEnv('NETWORK') && _jsx(Network, { computer: computer }), !getEnv('URL') && _jsx(Url, { computer: computer }), !getEnv('PATH') && _jsx(Path, { computer: computer }), _jsx("hr", { className: "h-px my-6 bg-gray-200 border-0 dark:bg-gray-700" }), _jsx(LogOut, {})] })); return _jsx(Drawer.Component, { Content: Content, id: "wallet-drawer" }); } export const WalletComponents = { diff --git a/packages/components/built/common/SmartCallExecutionResult.js b/packages/components/built/common/SmartCallExecutionResult.js index ff8b57632..f78507e0c 100644 --- a/packages/components/built/common/SmartCallExecutionResult.js +++ b/packages/components/built/common/SmartCallExecutionResult.js @@ -3,10 +3,10 @@ import { Link, useNavigate } from 'react-router-dom'; export function FunctionResultModalContent({ functionResult }) { const navigate = useNavigate(); if (functionResult && typeof functionResult === 'object' && !Array.isArray(functionResult)) - return (_jsx(_Fragment, { children: _jsxs("div", { id: "smart-call-execution-success", className: "p-4 md:p-5 dark:text-gray-400", children: ["You created a\u00A0", _jsx(Link, { id: "smart-call-execution-counter-link", to: `/objects/${functionResult._rev}`, className: "font-medium text-blue-600 dark:text-blue-500 hover:underline", onClick: () => { + return (_jsx(_Fragment, { children: _jsxs("div", { id: "smart-call-execution-success", className: "p-4 md:p-5 dark:text-gray-400", children: ["You created an\u00A0", _jsx(Link, { id: "smart-call-execution-counter-link", to: `/objects/${functionResult._rev}`, className: "font-medium text-blue-600 dark:text-blue-500 hover:underline", onClick: () => { navigate(`/objects/${functionResult._rev}`); window.location.reload(); - }, children: "smart object" }), "."] }) })); + }, children: "on chain object" }), "."] }) })); if (functionResult._rev && functionResult.res.toString()) return (_jsxs("p", { className: "text-base leading-relaxed text-gray-500 dark:text-gray-400", children: ["You created the value below at Revision ", functionResult._rev, _jsx("pre", { children: functionResult.res.toString() })] })); return (_jsx("p", { className: "text-base leading-relaxed text-gray-500 dark:text-gray-400 p-2", children: functionResult })); diff --git a/packages/components/package.json b/packages/components/package.json index 0cbece1f3..a5772e734 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -23,6 +23,10 @@ ], "main": "built/index.js", "types": "built/index.d.ts", + "files": [ + "LICENSE.md", + "LEGAL.md" + ], "scripts": { "build": "npm run tsc:compile", "build:turbo": "turbo run build", diff --git a/packages/components/src/Drawer.tsx b/packages/components/src/Drawer.tsx index b7efe1c95..929e038d3 100644 --- a/packages/components/src/Drawer.tsx +++ b/packages/components/src/Drawer.tsx @@ -1,3 +1,5 @@ +import { useState, useEffect, useRef } from 'react' + function ShowDrawer({ text, id }: { text: string; id: string }) { return ( - {Content()} + {Content({ isOpen })} ) } diff --git a/packages/components/src/SmartObject.tsx b/packages/components/src/SmartObject.tsx index 75a7d6866..db350e516 100644 --- a/packages/components/src/SmartObject.tsx +++ b/packages/components/src/SmartObject.tsx @@ -228,19 +228,20 @@ function Component({ title }: { title?: string }) { useEffect(() => { const fetch = async () => { try { - const synced = await computer.sync(rev) - setSmartObject(synced) - } catch (error) { + const [o, p, n] = await Promise.all([ + computer.sync(rev), + computer.prev(rev), + computer.next(rev), + ]) + + setSmartObject(o) + setPrev(p) + setNext(n) + } catch (err) { + if (err instanceof Error) console.log('Error syncing to object:', err.message) const [txId] = rev.split(':') navigate(`/transactions/${txId}`) } - - try { - setPrev(await computer.prev(rev)) - setNext(await computer.next(rev)) - } catch (error) { - console.log({ error }) - } } fetch() }, [computer, rev, location, navigate]) diff --git a/packages/components/src/Transaction.tsx b/packages/components/src/Transaction.tsx index 4d6caafcb..eb11933e7 100644 --- a/packages/components/src/Transaction.tsx +++ b/packages/components/src/Transaction.tsx @@ -37,7 +37,7 @@ function Component() { useEffect(() => { const fetch = async () => { setTxn(params.txn) - const [hex] = await computer.wallet.restClient.getRawTxs([params.txn as string]) + const [hex] = await computer.db.wallet.restClient.getRawTxs([params.txn as string]) const tx = Computer.txFromHex({ hex }) setTxnData(tx) diff --git a/packages/components/src/Wallet.tsx b/packages/components/src/Wallet.tsx index 67f3468fa..8d2047f63 100644 --- a/packages/components/src/Wallet.tsx +++ b/packages/components/src/Wallet.tsx @@ -8,7 +8,15 @@ import { UtilsContext } from './UtilsContext' import { ComputerContext } from './ComputerContext' import { getEnv, bigIntToStr } from './common/utils' -const Balance = ({ computer, modSpecs }: { computer: Computer; modSpecs: string[] }) => { +const Balance = ({ + computer, + modSpecs, + isOpen, +}: { + computer: Computer + modSpecs: string[] + isOpen: boolean +}) => { const [balance, setBalance] = useState(0n) const [, setChain] = useState(localStorage.getItem('CHAIN') || 'LTC') const { showSnackBar, showLoader } = UtilsContext.useUtilsComponents() @@ -19,16 +27,14 @@ const Balance = ({ computer, modSpecs }: { computer: Computer; modSpecs: string[ const publicKey = computer.getPublicKey() const balances: bigint[] = await Promise.all( modSpecs.map(async (mod) => { - const paymentRevs = modSpecs ? await computer.query({ publicKey, mod }) : [] - const payments = (await Promise.all( - paymentRevs.map((rev: string) => computer.sync(rev)), - )) as any[] + const revs = modSpecs ? await computer.query({ publicKey, mod }) : [] + const payments = (await Promise.all(revs.map((rev) => computer.sync(rev)))) as any[] return payments && payments.length ? payments.reduce( (total, pay) => total + (pay._satoshis - BigInt(computer.getMinimumFees())), 0n, ) - : 0 + : 0n }), ) const amountsInPayments: bigint = balances.reduce((acc, curr) => acc + BigInt(curr), 0n) @@ -40,7 +46,7 @@ const Balance = ({ computer, modSpecs }: { computer: Computer; modSpecs: string[ showLoader(false) showSnackBar('Error fetching wallet details', false) } - }, [computer]) + }, [computer, modSpecs]) const fund = async () => { await computer.faucet(1e8) @@ -48,8 +54,8 @@ const Balance = ({ computer, modSpecs }: { computer: Computer; modSpecs: string[ } useEffect(() => { - refreshBalance() - }, []) + if (isOpen) refreshBalance() + }, [isOpen, refreshBalance]) return (
{ const handleCopy = () => { navigator.clipboard.writeText(computer.getAddress()) setCopied(true) - setTimeout(() => setCopied(false), 2000) // Reset icon color after 2 seconds + setTimeout(() => setCopied(false), 2000) } return ( @@ -119,7 +125,7 @@ const PublicKey = ({ computer }: any) => { const handleCopy = () => { navigator.clipboard.writeText(computer.getPublicKey()) setCopied(true) - setTimeout(() => setCopied(false), 2000) // Reset icon color after 2 seconds + setTimeout(() => setCopied(false), 2000) } return ( @@ -150,7 +156,7 @@ const Mnemonic = ({ computer }: any) => { return (
- Mnemonic  + Mnemonic{' '}