diff --git a/Core/abi.class.php b/Core/ABI.php similarity index 100% rename from Core/abi.class.php rename to Core/ABI.php diff --git a/Core/sweb3.class.php b/Core/SWeb3.php similarity index 97% rename from Core/sweb3.class.php rename to Core/SWeb3.php index b5847ee..4b0e5e0 100644 --- a/Core/sweb3.class.php +++ b/Core/SWeb3.php @@ -9,11 +9,7 @@ * @license MIT */ -namespace SWeb3; - -include_once("../vendor/autoload.php"); -include_once("abi.class.php"); -include_once("sweb3_utils.class.php"); +namespace SWeb3; use SWeb3\Utils; use kornrunner\Ethereum\Transaction; diff --git a/Core/sweb3_contract.class.php b/Core/SWeb3_Contract.php similarity index 99% rename from Core/sweb3_contract.class.php rename to Core/SWeb3_Contract.php index 7f8b663..c1a6b48 100644 --- a/Core/sweb3_contract.class.php +++ b/Core/SWeb3_Contract.php @@ -10,8 +10,7 @@ */ namespace SWeb3; - -include_once("sweb3.class.php"); + use SWeb3\Utils; use SWeb3\SWeb3; diff --git a/Core/sweb3_utils.class.php b/Core/Utils.php similarity index 100% rename from Core/sweb3_utils.class.php rename to Core/Utils.php diff --git a/Example/example.call.php b/Example/example.call.php index 2536d0d..b78ad5a 100644 --- a/Example/example.call.php +++ b/Example/example.call.php @@ -1,5 +1,4 @@ $sweb3->getNonce(SWP_ADDRESS)]; - //$contract->send always populates: gasPrice, gasPrice, IF AND ONLY IF they are not already defined in $extra_data + //$contract->send always populates: gasPrice, gasLimit, IF AND ONLY IF they are not already defined in $extra_data //$contract->send always populates: to (contract address), data (ABI encoded $sendData), these can NOT be defined from outside $result = $contract->send('Set_public_uint', time(), $extra_data); diff --git a/LICENCE b/LICENCE new file mode 100644 index 0000000..abd86a8 --- /dev/null +++ b/LICENCE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Kuan-Cheng,Lai + +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. \ No newline at end of file diff --git a/README.md b/README.md index 528c4d9..95d6e45 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,6 @@ # simple-web3-php - -[![PHP](https://github.com/drlecks/Simple-Web3-Php/actions/workflows/php.yml/badge.svg)](https://github.com/drlecks/Simple-Web3-Php/actions/workflows/php.yml) -[![Build Status](https://travis-ci.org/drlecks/Simple-Web3-Php.svg?branch=master)](https://travis-ci.org/drlecks/simple-web3-php) -[![codecov](https://codecov.io/gh/drlecks/Simple-Web3-Php/branch/master/graph/badge.svg)](https://codecov.io/gh/drlecks/Simple-Web3-Php) -[![Join the chat at https://gitter.im/drlecks/Simple-Web3-Php](https://img.shields.io/badge/gitter-join%20chat-brightgreen.svg)](https://gitter.im/drlecks/Simple-Web3-Php) + +[![Join the chat at https://gitter.im/drlecks/Simple-Web3-Php](https://img.shields.io/badge/gitter-join%20chat-brightgreen.svg)](https://gitter.im/Simple-Web3-Php/community) [![Licensed under the MIT License](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/drlecks/Simple-Web3-Php/blob/master/LICENSE) @@ -34,7 +31,7 @@ composer require drlecks/simple-web3-php dev-master Or you can add this line in composer.json ``` -"drlecks/simple-web3-php": "dev-master" +"drlecks/simple-web3-php": "~1" ``` @@ -144,7 +141,7 @@ define('SWP_Contract_ABI', $SWP_Contract_ABI); To enable transaction sending & signing, enter a valid pair of address and private key. Please take this advises before continuing: - The address must be active on the ropsten network and have some ether available to send the transactions. - Double check that you are using a test endpoint, otherwise you will be spending real eth to send the transactions -- Be sure to keep you private key secret! +- Be sure to keep your private key secret! ```php //SIGNING diff --git a/composer.json b/composer.json index 13c6afb..71080a4 100644 --- a/composer.json +++ b/composer.json @@ -1,20 +1,28 @@ { "name": "drlecks/simple-web3-php", - "description": "Web3 library in PHP.", + "description": "Web3 library in PHP", + "keywords": ["ethereum", "transaction", "jsonRPC", "eth", "signed transaction", "php", "web3", "contract"], "type": "library", "license": "MIT", + "authors": [ { "name": "drlecks", - "email": "contacte@powdercode.com" + "email": "contacte@powdercode.com", + "homepage": "https://github.com/drlecks/Simple-Web3-Php" } ], - "require-dev": { - "phpunit/phpunit": "~7|~8.0" - }, + "require": { "kornrunner/ethereum-offline-raw-tx": "^0.4.0", "kornrunner/keccak": "~1", "phpseclib/phpseclib": "~2.0.30" + }, + + "autoload": { + "psr-4": { + "SWeb3\\": "Core/" + } } + }