-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bfe7d5b
commit 81ea37d
Showing
61 changed files
with
2,586 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
service_name: travis-ci | ||
coverage_clover: build/logs/clover.xml | ||
json_path: coveralls-upload.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
composer.phar | ||
/vendor/ | ||
|
||
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control | ||
# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file | ||
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file | ||
# composer.lock | ||
nbproject/ | ||
build/ | ||
infection.log | ||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
language: php | ||
|
||
php: | ||
- 7.2 | ||
- 7.3 | ||
- 7.4 | ||
- nightly | ||
|
||
matrix: | ||
allow_failures: | ||
- php: nightly | ||
|
||
install: | ||
- phpenv config-rm xdebug.ini || true | ||
- travis_retry composer install --prefer-dist -n | ||
|
||
script: | ||
- mkdir -p build/logs | ||
- phpdbg -qrr vendor/bin/phpunit | ||
|
||
after_success: | ||
- composer require php-coveralls/php-coveralls | ||
- travis_retry vendor/bin/php-coveralls -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,45 @@ | ||
# php-ethereum-token | ||
# php-ethereum-token [![Build Status](https://travis-ci.org/kornrunner/php-ethereum-uttokenil.svg?branch=master)](https://travis-ci.org/kornrunner/php-ethereum-token) [![Build status](https://ci.appveyor.com/api/projects/status/d1qm90h668elbtc4/branch/master?svg=true)](https://ci.appveyor.com/project/kornrunner/php-ethereum-token/branch/master) [![Coverage Status](https://coveralls.io/repos/github/kornrunner/php-ethereum-token/badge.svg?branch=master)](https://coveralls.io/github/kornrunner/php-ethereum-token?branch=master) [![Latest Stable Version](https://poser.pugx.org/kornrunner/ethereum-token/v/stable)](https://packagist.org/packages/kornrunner/ethereum-token) | ||
|
||
PHP Ethereum Token Utils | ||
|
||
## Installation | ||
|
||
```sh | ||
$ composer require kornrunner/ethereum-token | ||
``` | ||
|
||
## Usage | ||
|
||
To prepare a offline transaction, using `kornrunner/ethereum-offline-raw-tx` | ||
|
||
```php | ||
use kornrunner\Ethereum\Token; | ||
use kornrunner\Ethereum\Transaction; | ||
|
||
$nonce = '04'; | ||
$gasPrice = '03f5476a00'; | ||
$gasLimit = '027f4b'; | ||
$to = '1a8c8adfbe1c59e8b58cc0d515f07b7225f51c72'; | ||
|
||
$privateKey = 'b2f2698dd7343fa5afc96626dee139cb92e58e5d04e855f4c712727bf198e898'; | ||
|
||
$token = new Token; | ||
$usdt = new Token\USDT; | ||
|
||
$amount = 20; | ||
$hexAmount = $token->hexAmount($usdt, $amount); | ||
// 0x1312d00 | ||
|
||
$data = $token->getTransferData($to, $hexAmount); | ||
// 0xa9059cbb0000000000000000000000001a8c8adfbe1c59e8b58cc0d515f07b7225f51c720000000000000000000000000000000000000000000000000000000001312d00 | ||
|
||
$transaction = new Transaction($nonce, $gasPrice, $gasLimit, $usdt::ADDRESS, $data); | ||
$transaction->getRaw($privateKey); | ||
// f8a9048503f5476a0083027f4b94dac17f958d2ee523a2206206994597c13d831ec7b844a9059cbb0000000000000000000000001a8c8adfbe1c59e8b58cc0d515f07b7225f51c720000000000000000000000000000000000000000000000000000000001312d00801ba03e141ea4233ec00bb3a80d7fea5f774b736772851b7bad18453d0f3c6097c42e9fa6eb47b6bead6a76d7db12809e2c916df999d7b99b613fcaa135abd8a0078e | ||
``` | ||
|
||
## Crypto | ||
|
||
[![Ethereum](https://user-images.githubusercontent.com/725986/61891022-0d0c7f00-af09-11e9-829f-096c039bbbfa.png) 0x9c7b7a00972121fb843af7af74526d7eb585b171][Ethereum] | ||
|
||
[Ethereum]: https://etherscan.io/address/0x9c7b7a00972121fb843af7af74526d7eb585b171 "Donate with Ethereum" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
build: false | ||
shallow_clone: true | ||
clone_folder: c:\php-ethereum-token | ||
platform: x64 | ||
|
||
cache: | ||
- c:\php -> appveyor.yml | ||
- vendor -> composer.lock | ||
|
||
environment: | ||
matrix: | ||
- PHP_VERSION: '7.2.19' | ||
- PHP_VERSION: '7.3.7' | ||
|
||
matrix: | ||
fast_finish: true | ||
|
||
init: | ||
- SET PATH=c:\php\%PHP_VERSION%;%PATH% | ||
- set COMPOSER_NO_INTERACTION=1 | ||
|
||
install: | ||
- IF NOT EXIST c:\php mkdir c:\php | ||
- IF NOT EXIST c:\php\%PHP_VERSION% mkdir c:\php\%PHP_VERSION% | ||
- cd c:\php\%PHP_VERSION% | ||
- IF NOT EXIST php-installed.txt curl --fail --location --silent --show-error -o php.zip https://windows.php.net/downloads/releases/archives/php-%PHP_VERSION%-nts-Win32-VC15-x64.zip | ||
- IF NOT EXIST php-installed.txt 7z x php.zip -y | ||
- IF NOT EXIST php-installed.txt del /Q *.zip | ||
- IF NOT EXIST php-installed.txt copy /Y php.ini-development php.ini | ||
- IF NOT EXIST php-installed.txt echo max_execution_time=1200 >> php.ini | ||
- IF NOT EXIST php-installed.txt echo date.timezone="UTC" >> php.ini | ||
- IF NOT EXIST php-installed.txt echo extension_dir=ext >> php.ini | ||
- IF NOT EXIST php-installed.txt echo extension=php_openssl.dll >> php.ini | ||
- IF NOT EXIST php-installed.txt echo extension=php_mbstring.dll >> php.ini | ||
- IF NOT EXIST php-installed.txt appveyor DownloadFile https://getcomposer.org/composer.phar | ||
- IF NOT EXIST php-installed.txt echo @php %%~dp0composer.phar %%* > composer.bat | ||
- IF NOT EXIST php-installed.txt type nul >> php-installed.txt | ||
- cd c:\php-ethereum-token | ||
|
||
test_script: | ||
- composer install | ||
- vendor/bin/phpunit.bat --coverage-text | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "kornrunner/ethereum-token", | ||
"description": "PHP Ethereum Token Utils", | ||
"keywords": ["ethereum", "offline", "transaction", "eth", "tx"], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Boris Momcilovic", | ||
"homepage": "https://github.com/kornrunner/php-ethereum-token" | ||
} | ||
], | ||
"require": { | ||
"php": ">=7.2", | ||
"ext-bcmath": "*" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"kornrunner\\": "src" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"kornrunner\\": "test" | ||
} | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^8.2" | ||
} | ||
} |
Oops, something went wrong.