diff --git a/composer.json b/composer.json index b5f5b41..e0b5555 100644 --- a/composer.json +++ b/composer.json @@ -9,18 +9,18 @@ ], "homepage": "https://github.com/AElfProject/aelf-sdk.php", "require": { - "php": ">=5.6", + "php": ">=7.1", "ext-gmp": "*", "ext-curl": "*", "kornrunner/secp256k1": "^0.1.2", "hhxsv5/php-multi-curl": "~1.0", "stephenhill/base58": "^1.1", "bitcoin-php/bitcoin-ecdsa" : "^1.3", - "google/protobuf": "^3.11", + "google/protobuf": "^3.24", "tuupola/base58": "^2.0" }, "require-dev": { - "phpunit/phpunit": "^10" + "phpunit/phpunit": "^10.0" }, "autoload": { "classmap": [ diff --git a/composer.lock b/composer.lock index 408c82a..1ce7c4e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "dfcd5452973cf0f88cf2c1437a6c1594", + "content-hash": "ee80453c4da2d2be3edb4cf281e727ad", "packages": [ { "name": "bitcoin-php/bitcoin-ecdsa", @@ -129,16 +129,16 @@ }, { "name": "google/protobuf", - "version": "v3.22.0", + "version": "v3.24.4", "source": { "type": "git", "url": "https://github.com/protocolbuffers/protobuf-php.git", - "reference": "66495c7f8be461c4a65d697e0705a7ef55ca8c19" + "reference": "672d69e25f71b9364fdf1810eb8a8573defdc404" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/66495c7f8be461c4a65d697e0705a7ef55ca8c19", - "reference": "66495c7f8be461c4a65d697e0705a7ef55ca8c19", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/672d69e25f71b9364fdf1810eb8a8573defdc404", + "reference": "672d69e25f71b9364fdf1810eb8a8573defdc404", "shasum": "" }, "require": { @@ -167,9 +167,9 @@ "proto" ], "support": { - "source": "https://github.com/protocolbuffers/protobuf-php/tree/v3.22.0" + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v3.24.4" }, - "time": "2023-02-10T20:00:39+00:00" + "time": "2023-10-04T17:22:47+00:00" }, { "name": "hhxsv5/php-multi-curl", @@ -454,16 +454,16 @@ "packages-dev": [ { "name": "myclabs/deep-copy", - "version": "1.11.0", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { @@ -501,7 +501,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" }, "funding": [ { @@ -509,20 +509,20 @@ "type": "tidelift" } ], - "time": "2022-03-03T13:19:32+00:00" + "time": "2023-03-08T13:26:56+00:00" }, { "name": "nikic/php-parser", - "version": "v4.15.3", + "version": "v4.17.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", "shasum": "" }, "require": { @@ -563,9 +563,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" }, - "time": "2023-01-16T22:05:37+00:00" + "time": "2023-08-13T19:53:39+00:00" }, { "name": "phar-io/manifest", @@ -680,16 +680,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "10.0.1", + "version": "10.1.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "b9c21a93dd8c8eed79879374884ee733259475cc" + "reference": "355324ca4980b8916c18b9db29f3ef484078f26e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/b9c21a93dd8c8eed79879374884ee733259475cc", - "reference": "b9c21a93dd8c8eed79879374884ee733259475cc", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/355324ca4980b8916c18b9db29f3ef484078f26e", + "reference": "355324ca4980b8916c18b9db29f3ef484078f26e", "shasum": "" }, "require": { @@ -708,16 +708,16 @@ "theseer/tokenizer": "^1.2.0" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^10.1" }, "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "10.0-dev" + "dev-main": "10.1-dev" } }, "autoload": { @@ -745,7 +745,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.0.1" + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.7" }, "funding": [ { @@ -753,20 +754,20 @@ "type": "github" } ], - "time": "2023-02-25T05:35:03+00:00" + "time": "2023-10-04T15:34:17+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "4.0.1", + "version": "4.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "fd9329ab3368f59fe1fe808a189c51086bd4b6bd" + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/fd9329ab3368f59fe1fe808a189c51086bd4b6bd", - "reference": "fd9329ab3368f59fe1fe808a189c51086bd4b6bd", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a95037b6d9e608ba092da1b23931e537cadc3c3c", + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c", "shasum": "" }, "require": { @@ -805,7 +806,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.0.1" + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.1.0" }, "funding": [ { @@ -813,7 +815,7 @@ "type": "github" } ], - "time": "2023-02-10T16:53:14+00:00" + "time": "2023-08-31T06:24:48+00:00" }, { "name": "phpunit/php-invoker", @@ -880,16 +882,16 @@ }, { "name": "phpunit/php-text-template", - "version": "3.0.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "9f3d3709577a527025f55bcf0f7ab8052c8bb37d" + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/9f3d3709577a527025f55bcf0f7ab8052c8bb37d", - "reference": "9f3d3709577a527025f55bcf0f7ab8052c8bb37d", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/0c7b06ff49e3d5072f057eb1fa59258bf287a748", + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748", "shasum": "" }, "require": { @@ -927,7 +929,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.0" + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.1" }, "funding": [ { @@ -935,7 +938,7 @@ "type": "github" } ], - "time": "2023-02-03T06:56:46+00:00" + "time": "2023-08-31T14:07:24+00:00" }, { "name": "phpunit/php-timer", @@ -998,16 +1001,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.0.13", + "version": "10.4.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c37a88d7a905266eab6498817a1bf1170043313f" + "reference": "62bd7af13d282deeb95650077d28ba3600ca321c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c37a88d7a905266eab6498817a1bf1170043313f", - "reference": "c37a88d7a905266eab6498817a1bf1170043313f", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/62bd7af13d282deeb95650077d28ba3600ca321c", + "reference": "62bd7af13d282deeb95650077d28ba3600ca321c", "shasum": "" }, "require": { @@ -1021,7 +1024,7 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=8.1", - "phpunit/php-code-coverage": "^10.0", + "phpunit/php-code-coverage": "^10.1.5", "phpunit/php-file-iterator": "^4.0", "phpunit/php-invoker": "^4.0", "phpunit/php-text-template": "^3.0", @@ -1031,15 +1034,15 @@ "sebastian/comparator": "^5.0", "sebastian/diff": "^5.0", "sebastian/environment": "^6.0", - "sebastian/exporter": "^5.0", - "sebastian/global-state": "^6.0", + "sebastian/exporter": "^5.1", + "sebastian/global-state": "^6.0.1", "sebastian/object-enumerator": "^5.0", "sebastian/recursion-context": "^5.0", "sebastian/type": "^4.0", "sebastian/version": "^4.0" }, "suggest": { - "ext-soap": "*" + "ext-soap": "To be able to generate mocks based on WSDL files" }, "bin": [ "phpunit" @@ -1047,7 +1050,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "10.0-dev" + "dev-main": "10.4-dev" } }, "autoload": { @@ -1078,7 +1081,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.0.13" + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.4.1" }, "funding": [ { @@ -1094,7 +1098,7 @@ "type": "tidelift" } ], - "time": "2023-02-27T13:07:57+00:00" + "time": "2023-10-08T05:01:11+00:00" }, { "name": "sebastian/cli-parser", @@ -1265,16 +1269,16 @@ }, { "name": "sebastian/comparator", - "version": "5.0.0", + "version": "5.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "72f01e6586e0caf6af81297897bd112eb7e9627c" + "reference": "2db5010a484d53ebf536087a70b4a5423c102372" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/72f01e6586e0caf6af81297897bd112eb7e9627c", - "reference": "72f01e6586e0caf6af81297897bd112eb7e9627c", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2db5010a484d53ebf536087a70b4a5423c102372", + "reference": "2db5010a484d53ebf536087a70b4a5423c102372", "shasum": "" }, "require": { @@ -1285,7 +1289,7 @@ "sebastian/exporter": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^10.3" }, "type": "library", "extra": { @@ -1329,7 +1333,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.0" + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.1" }, "funding": [ { @@ -1337,20 +1342,20 @@ "type": "github" } ], - "time": "2023-02-03T07:07:16+00:00" + "time": "2023-08-14T13:18:12+00:00" }, { "name": "sebastian/complexity", - "version": "3.0.0", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "e67d240970c9dc7ea7b2123a6d520e334dd61dc6" + "reference": "68cfb347a44871f01e33ab0ef8215966432f6957" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/e67d240970c9dc7ea7b2123a6d520e334dd61dc6", - "reference": "e67d240970c9dc7ea7b2123a6d520e334dd61dc6", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68cfb347a44871f01e33ab0ef8215966432f6957", + "reference": "68cfb347a44871f01e33ab0ef8215966432f6957", "shasum": "" }, "require": { @@ -1363,7 +1368,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.1-dev" } }, "autoload": { @@ -1386,7 +1391,8 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/3.0.0" + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/3.1.0" }, "funding": [ { @@ -1394,20 +1400,20 @@ "type": "github" } ], - "time": "2023-02-03T06:59:47+00:00" + "time": "2023-09-28T11:50:59+00:00" }, { "name": "sebastian/diff", - "version": "5.0.0", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "70dd1b20bc198da394ad542e988381b44e64e39f" + "reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/70dd1b20bc198da394ad542e988381b44e64e39f", - "reference": "70dd1b20bc198da394ad542e988381b44e64e39f", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/912dc2fbe3e3c1e7873313cc801b100b6c68c87b", + "reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b", "shasum": "" }, "require": { @@ -1452,7 +1458,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/5.0.0" + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/5.0.3" }, "funding": [ { @@ -1460,20 +1467,20 @@ "type": "github" } ], - "time": "2023-02-03T07:00:31+00:00" + "time": "2023-05-01T07:48:21+00:00" }, { "name": "sebastian/environment", - "version": "6.0.0", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "b6f3694c6386c7959915a0037652e0c40f6f69cc" + "reference": "43c751b41d74f96cbbd4e07b7aec9675651e2951" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/b6f3694c6386c7959915a0037652e0c40f6f69cc", - "reference": "b6f3694c6386c7959915a0037652e0c40f6f69cc", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/43c751b41d74f96cbbd4e07b7aec9675651e2951", + "reference": "43c751b41d74f96cbbd4e07b7aec9675651e2951", "shasum": "" }, "require": { @@ -1515,7 +1522,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/6.0.0" + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/6.0.1" }, "funding": [ { @@ -1523,20 +1531,20 @@ "type": "github" } ], - "time": "2023-02-03T07:03:04+00:00" + "time": "2023-04-11T05:39:26+00:00" }, { "name": "sebastian/exporter", - "version": "5.0.0", + "version": "5.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0" + "reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0", - "reference": "f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/64f51654862e0f5e318db7e9dcc2292c63cdbddc", + "reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc", "shasum": "" }, "require": { @@ -1550,7 +1558,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -1592,7 +1600,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/5.0.0" + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.1" }, "funding": [ { @@ -1600,20 +1609,20 @@ "type": "github" } ], - "time": "2023-02-03T07:06:49+00:00" + "time": "2023-09-24T13:22:09+00:00" }, { "name": "sebastian/global-state", - "version": "6.0.0", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "aab257c712de87b90194febd52e4d184551c2d44" + "reference": "7ea9ead78f6d380d2a667864c132c2f7b83055e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/aab257c712de87b90194febd52e4d184551c2d44", - "reference": "aab257c712de87b90194febd52e4d184551c2d44", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/7ea9ead78f6d380d2a667864c132c2f7b83055e4", + "reference": "7ea9ead78f6d380d2a667864c132c2f7b83055e4", "shasum": "" }, "require": { @@ -1653,7 +1662,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.0" + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.1" }, "funding": [ { @@ -1661,20 +1671,20 @@ "type": "github" } ], - "time": "2023-02-03T07:07:38+00:00" + "time": "2023-07-19T07:19:23+00:00" }, { "name": "sebastian/lines-of-code", - "version": "2.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "17c4d940ecafb3d15d2cf916f4108f664e28b130" + "reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/17c4d940ecafb3d15d2cf916f4108f664e28b130", - "reference": "17c4d940ecafb3d15d2cf916f4108f664e28b130", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/649e40d279e243d985aa8fb6e74dd5bb28dc185d", + "reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d", "shasum": "" }, "require": { @@ -1710,7 +1720,8 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.0" + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.1" }, "funding": [ { @@ -1718,7 +1729,7 @@ "type": "github" } ], - "time": "2023-02-03T07:08:02+00:00" + "time": "2023-08-31T09:25:50+00:00" }, { "name": "sebastian/object-enumerator", @@ -2061,7 +2072,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.6", + "php": ">=7.1", "ext-gmp": "*", "ext-curl": "*" }, diff --git a/scripts/aelf-node/start-mac.sh b/scripts/aelf-node/start-mac.sh index 7d6d2b1..3087546 100644 --- a/scripts/aelf-node/start-mac.sh +++ b/scripts/aelf-node/start-mac.sh @@ -3,7 +3,7 @@ brew services start redis brew install unzip mkdir -p ~/.local/share/aelf/keys cd ../../ -wget https://github.com/AElfProject/AElf/releases/download/v1.2.3/aelf.zip && unzip aelf.zip +wget https://github.com/AElfProject/AElf/releases/download/v1.6.0/aelf.zip && unzip aelf.zip cp scripts/aelf-node/keys/SD6BXDrKT2syNd1WehtPyRo3dPBiXqfGUj8UJym7YP9W9RynM.json ~/.local/share/aelf/keys/ cp scripts/aelf-node/app* aelf/ echo "start node" diff --git a/scripts/aelf-node/start-window.ps1 b/scripts/aelf-node/start-window.ps1 index e48a36b..a4571b1 100644 --- a/scripts/aelf-node/start-window.ps1 +++ b/scripts/aelf-node/start-window.ps1 @@ -4,7 +4,7 @@ $job1 = Start-Job -ScriptBlock { cd D:\a\1\s\redis; .\redis-server.exe; } sleep 30 mkdir -p C:\Users\VssAdministrator\AppData\Local\aelf\keys cp -r scripts\aelf-node\keys\* C:\Users\VssAdministrator\AppData\Local\aelf\keys; -wget https://github.com/AElfProject/AElf/releases/download/v1.2.3/aelf.zip -OutFile aelf.zip ; +wget https://github.com/AElfProject/AElf/releases/download/v1.6.0/aelf.zip -OutFile aelf.zip ; Expand-Archive -Path aelf.zip -DestinationPath aelf ; cp scripts\aelf-node\appsettings.json aelf\aelf\appsettings.json ; cp scripts\aelf-node\appsettings.MainChain.TestNet.json aelf\aelf\appsettings.MainChain.TestNet.json ; diff --git a/scripts/aelf-node/start.sh b/scripts/aelf-node/start.sh index a7225c8..3a0a41c 100644 --- a/scripts/aelf-node/start.sh +++ b/scripts/aelf-node/start.sh @@ -3,7 +3,7 @@ ip=`ip a | grep eth0 |grep 'inet' | awk -F/ '{print $1}'| awk '{print $2}'` sudo apt update && apt install unzip sudo mkdir -p /home/ubuntu/.ssh/aelf/keys && sudo mkdir -p /root/.ssh/aelf/keys cd ../../ -wget https://github.com/AElfProject/AElf/releases/download/v1.2.3/aelf.zip +wget https://github.com/AElfProject/AElf/releases/download/v1.6.0/aelf.zip sudo unzip aelf.zip sed -i "s/127.0.0.1/$ip/g" scripts/aelf-node/appsettings.json sudo mkdir -p /root/.local/share/aelf/keys/ diff --git a/src/AElf.php b/src/AElf.php index a8b39ed..e6e1e6a 100644 --- a/src/AElf.php +++ b/src/AElf.php @@ -4,6 +4,9 @@ use AElf\Api\NetSdk; use AElf\Bytes\Bytes; +use AElf\Protobuf\Generated\CrossChainReceived; +use AElf\Protobuf\Generated\CrossChainTransferred; +use AElf\Protobuf\Generated\Transferred; use GPBMetadata\Types; use StephenHill\Base58; use kornrunner\Secp256k1; @@ -434,20 +437,20 @@ public function getTransactionFees($transactionResult) if ($log['Name'] == 'TransactionFeeCharged') { $transactionFee = new TransactionFeeCharged(); $transactionFee->mergeFromString(base64_decode($log['NonIndexed'])); - array_push($transactionFees, [ + $transactionFees[] = [ 'name' => 'transaction_fee_charged', 'symbol' => $transactionFee->getSymbol(), 'amount' => $transactionFee->getAmount(), - ]); + ]; } if ($log['Name'] == 'ResourceTokenCharged') { $resourceTokenFee = new ResourceTokenCharged(); $resourceTokenFee->mergeFromString(base64_decode($log['NonIndexed'])); - array_push($transactionFees, [ + $transactionFees[] = [ 'name' => 'resource_token_charged', 'symbol' => $resourceTokenFee->getSymbol(), 'amount' => $resourceTokenFee->getAmount(), - ]); + ]; } } } @@ -463,4 +466,108 @@ public function calculateTransactionFee($input) { return $this->getBlockChainSdkObj()->calculateTransactionFee($input); } + + + /** + * @param $privateKey + * @param $transactionId + * @return array + */ + public function getTransferred($privateKey, $transactionId): array + { + $items = []; + $response = $this->getTransactionResult($transactionId); + if (empty($response) || empty($response['Logs'])) return $items; + $contractNames = new Hash(); + $contractNames->setValue(hex2bin(sha256('AElf.ContractNames.Token'))); + $toAddress = $this->getContractAddressByName($privateKey, $contractNames); + foreach ($response['Logs'] as $log) { + if ($log['Name'] == 'Transferred' && $log['Address'] == $toAddress) { + $transferred = new Transferred(); + $transferred->mergeFromString(base64_decode($log['NonIndexed'])); + + $tmpTransferred = new Transferred(); + $tmpTransferred->mergeFromString(base64_decode($log['Indexed'][0])); + $transferred->setFrom($tmpTransferred->getFrom()); + + $tmpTransferred1 = new Transferred(); + $tmpTransferred1->mergeFromString(base64_decode($log['Indexed'][1])); + $transferred->setTo($tmpTransferred1->getTo()); + + $tmpTransferred2 = new Transferred(); + + $tmpTransferred2->mergeFromString(base64_decode($log['Indexed'][2])); + $transferred->setSymbol($tmpTransferred2->getSymbol()); + $items[] = [ + 'from' => encodeChecked($transferred->getFrom()->getValue()), + 'to' => encodeChecked($transferred->getTo()->getValue()), + 'symbol' => $transferred->getSymbol(), + 'amount' => $transferred->getAmount(), + 'memo' => $transferred->getMemo() + ]; + } + } + return $items; + } + + + public function getCrossChainTransferred($privateKey, $transactionId): array + { + $items = []; + $response = $this->getTransactionResult($transactionId); + if (empty($response) || empty($response['Logs'])) return $items; + + $contractNames = new Hash(); + $contractNames->setValue(hex2bin(sha256('AElf.ContractNames.Token'))); + $toAddress = $this->getContractAddressByName($privateKey, $contractNames); + + foreach ($response['Logs'] as $log) { + if ($log['Name'] == 'CrossChainTransferred' && $log['Address'] == $toAddress) { + $transferred = new CrossChainTransferred(); + $transferred -> mergeFromString(base64_decode($log['NonIndexed'])); + $items = [ + 'from' => encodeChecked($transferred->getFrom()->getValue()), + 'to' => encodeChecked($transferred->getTo()->getValue()), + 'symbol'=> $transferred->getSymbol(), + 'amount'=> $transferred->getAmount(), + 'memo'=> $transferred->getMemo(), + 'issueChainId'=> $transferred->getIssueChainId(), + 'toChainId'=> $transferred->getToChainId() + ]; + } + } + return $items; + } + + public function getCrossChainReceived($privateKey, $transactionId): array + { + $items = []; + $response = $this->getTransactionResult($transactionId); + if (empty($response) || empty($response['Logs'])) return $items; + + $contractNames = new Hash(); + $contractNames->setValue(hex2bin(sha256('AElf.ContractNames.Token'))); + $toAddress = $this->getContractAddressByName($privateKey, $contractNames); + + foreach ($response['Logs'] as $log) { + if ($log['Name'] == 'CrossChainReceived' && $log['Address'] == $toAddress) { + $transferred = new CrossChainReceived(); + $transferred -> mergeFromString(base64_decode($log['NonIndexed'])); + $items = [ + 'from' => encodeChecked($transferred->getFrom()->getValue()), + 'to' => encodeChecked($transferred->getTo()->getValue()), + 'symbol'=> $transferred->getSymbol(), + 'amount'=> $transferred->getAmount(), + 'memo'=> $transferred->getMemo(), + 'issueChainId'=> $transferred->getIssueChainId(), + 'fromChainId'=> $transferred->getFromChainId(), + 'parentChainHeight'=> $transferred->getParentChainHeight(), + 'transferTransactionId'=> $transferred->getTransferTransactionId() + ]; + } + } + return $items; + } + + } diff --git a/src/protobuf/AElf/Protobuf/Generated/CandidateVote.php b/src/protobuf/AElf/Protobuf/Generated/CandidateVote.php index a6a9338..c570d4e 100644 --- a/src/protobuf/AElf/Protobuf/Generated/CandidateVote.php +++ b/src/protobuf/AElf/Protobuf/Generated/CandidateVote.php @@ -62,17 +62,17 @@ class CandidateVote extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type \AElf\Protobuf\Generated\Hash[]|\Google\Protobuf\Internal\RepeatedField $obtained_active_voting_record_ids + * @type array<\AElf\Protobuf\Generated\Hash>|\Google\Protobuf\Internal\RepeatedField $obtained_active_voting_record_ids * The active voting record ids obtained. - * @type \AElf\Protobuf\Generated\Hash[]|\Google\Protobuf\Internal\RepeatedField $obtained_withdrawn_voting_record_ids + * @type array<\AElf\Protobuf\Generated\Hash>|\Google\Protobuf\Internal\RepeatedField $obtained_withdrawn_voting_record_ids * The active voting record ids that were withdrawn. * @type int|string $obtained_active_voted_votes_amount * The total number of active votes obtained. * @type int|string $all_obtained_voted_votes_amount * The total number of votes obtained. - * @type \AElf\Protobuf\Generated\ElectionVotingRecord[]|\Google\Protobuf\Internal\RepeatedField $obtained_active_voting_records + * @type array<\AElf\Protobuf\Generated\ElectionVotingRecord>|\Google\Protobuf\Internal\RepeatedField $obtained_active_voting_records * The active voting records. - * @type \AElf\Protobuf\Generated\ElectionVotingRecord[]|\Google\Protobuf\Internal\RepeatedField $obtained_withdrawn_votes_records + * @type array<\AElf\Protobuf\Generated\ElectionVotingRecord>|\Google\Protobuf\Internal\RepeatedField $obtained_withdrawn_votes_records * The voting records that were withdrawn. * @type string $pubkey * Public key for candidate. @@ -98,7 +98,7 @@ public function getObtainedActiveVotingRecordIds() * The active voting record ids obtained. * * Generated from protobuf field repeated .AElf.protobuf.generated.Hash obtained_active_voting_record_ids = 1; - * @param \AElf\Protobuf\Generated\Hash[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\AElf\Protobuf\Generated\Hash>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setObtainedActiveVotingRecordIds($var) @@ -124,7 +124,7 @@ public function getObtainedWithdrawnVotingRecordIds() * The active voting record ids that were withdrawn. * * Generated from protobuf field repeated .AElf.protobuf.generated.Hash obtained_withdrawn_voting_record_ids = 2; - * @param \AElf\Protobuf\Generated\Hash[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\AElf\Protobuf\Generated\Hash>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setObtainedWithdrawnVotingRecordIds($var) @@ -202,7 +202,7 @@ public function getObtainedActiveVotingRecords() * The active voting records. * * Generated from protobuf field repeated .AElf.protobuf.generated.ElectionVotingRecord obtained_active_voting_records = 5; - * @param \AElf\Protobuf\Generated\ElectionVotingRecord[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\AElf\Protobuf\Generated\ElectionVotingRecord>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setObtainedActiveVotingRecords($var) @@ -228,7 +228,7 @@ public function getObtainedWithdrawnVotesRecords() * The voting records that were withdrawn. * * Generated from protobuf field repeated .AElf.protobuf.generated.ElectionVotingRecord obtained_withdrawn_votes_records = 6; - * @param \AElf\Protobuf\Generated\ElectionVotingRecord[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\AElf\Protobuf\Generated\ElectionVotingRecord>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setObtainedWithdrawnVotesRecords($var) diff --git a/src/protobuf/AElf/Protobuf/Generated/ContractUpdateInput.php b/src/protobuf/AElf/Protobuf/Generated/ContractUpdateInput.php index 6696a8a..4562c79 100644 --- a/src/protobuf/AElf/Protobuf/Generated/ContractUpdateInput.php +++ b/src/protobuf/AElf/Protobuf/Generated/ContractUpdateInput.php @@ -47,13 +47,23 @@ public function __construct($data = NULL) { * The contract address that needs to be updated. * * Generated from protobuf field .AElf.protobuf.generated.Address address = 1; - * @return \AElf\Protobuf\Generated\Address + * @return \AElf\Protobuf\Generated\Address|null */ public function getAddress() { return $this->address; } + public function hasAddress() + { + return isset($this->address); + } + + public function clearAddress() + { + unset($this->address); + } + /** * The contract address that needs to be updated. * diff --git a/src/protobuf/AElf/Protobuf/Generated/CrossChainReceiveTokenInput.php b/src/protobuf/AElf/Protobuf/Generated/CrossChainReceiveTokenInput.php index aee780a..68bc5d8 100644 --- a/src/protobuf/AElf/Protobuf/Generated/CrossChainReceiveTokenInput.php +++ b/src/protobuf/AElf/Protobuf/Generated/CrossChainReceiveTokenInput.php @@ -141,13 +141,23 @@ public function setTransferTransactionBytes($var) * The merkle path created from the transfer transaction. * * Generated from protobuf field .AElf.protobuf.generated.MerklePath merkle_path = 4; - * @return \AElf\Protobuf\Generated\MerklePath + * @return \AElf\Protobuf\Generated\MerklePath|null */ public function getMerklePath() { return $this->merkle_path; } + public function hasMerklePath() + { + return isset($this->merkle_path); + } + + public function clearMerklePath() + { + unset($this->merkle_path); + } + /** * The merkle path created from the transfer transaction. * diff --git a/src/protobuf/AElf/Protobuf/Generated/CrossChainReceived.php b/src/protobuf/AElf/Protobuf/Generated/CrossChainReceived.php new file mode 100644 index 0000000..fbd5f28 --- /dev/null +++ b/src/protobuf/AElf/Protobuf/Generated/CrossChainReceived.php @@ -0,0 +1,367 @@ +AElf.protobuf.generated.CrossChainReceived + */ +class CrossChainReceived extends \Google\Protobuf\Internal\Message +{ + /** + * The source address of the transferred token. + * + * Generated from protobuf field .AElf.protobuf.generated.Address from = 1; + */ + protected $from = null; + /** + * The destination address of the transferred token. + * + * Generated from protobuf field .AElf.protobuf.generated.Address to = 2; + */ + protected $to = null; + /** + * The symbol of the received token. + * + * Generated from protobuf field string symbol = 3; + */ + protected $symbol = ''; + /** + * The amount of the received token. + * + * Generated from protobuf field int64 amount = 4; + */ + protected $amount = 0; + /** + * The memo. + * + * Generated from protobuf field string memo = 5; + */ + protected $memo = ''; + /** + * The destination chain id. + * + * Generated from protobuf field int32 from_chain_id = 6; + */ + protected $from_chain_id = 0; + /** + * The chain id of the token. + * + * Generated from protobuf field int32 issue_chain_id = 7; + */ + protected $issue_chain_id = 0; + /** + * The parent chain height of the transfer transaction. + * + * Generated from protobuf field int64 parent_chain_height = 8; + */ + protected $parent_chain_height = 0; + /** + * The id of transfer transaction. + * + * Generated from protobuf field .AElf.protobuf.generated.Hash transfer_transaction_id = 9; + */ + protected $transfer_transaction_id = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \AElf\Protobuf\Generated\Address $from + * The source address of the transferred token. + * @type \AElf\Protobuf\Generated\Address $to + * The destination address of the transferred token. + * @type string $symbol + * The symbol of the received token. + * @type int|string $amount + * The amount of the received token. + * @type string $memo + * The memo. + * @type int $from_chain_id + * The destination chain id. + * @type int $issue_chain_id + * The chain id of the token. + * @type int|string $parent_chain_height + * The parent chain height of the transfer transaction. + * @type \AElf\Protobuf\Generated\Hash $transfer_transaction_id + * The id of transfer transaction. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Types::initOnce(); + parent::__construct($data); + } + + /** + * The source address of the transferred token. + * + * Generated from protobuf field .AElf.protobuf.generated.Address from = 1; + * @return \AElf\Protobuf\Generated\Address|null + */ + public function getFrom() + { + return $this->from; + } + + public function hasFrom() + { + return isset($this->from); + } + + public function clearFrom() + { + unset($this->from); + } + + /** + * The source address of the transferred token. + * + * Generated from protobuf field .AElf.protobuf.generated.Address from = 1; + * @param \AElf\Protobuf\Generated\Address $var + * @return $this + */ + public function setFrom($var) + { + GPBUtil::checkMessage($var, \AElf\Protobuf\Generated\Address::class); + $this->from = $var; + + return $this; + } + + /** + * The destination address of the transferred token. + * + * Generated from protobuf field .AElf.protobuf.generated.Address to = 2; + * @return \AElf\Protobuf\Generated\Address|null + */ + public function getTo() + { + return $this->to; + } + + public function hasTo() + { + return isset($this->to); + } + + public function clearTo() + { + unset($this->to); + } + + /** + * The destination address of the transferred token. + * + * Generated from protobuf field .AElf.protobuf.generated.Address to = 2; + * @param \AElf\Protobuf\Generated\Address $var + * @return $this + */ + public function setTo($var) + { + GPBUtil::checkMessage($var, \AElf\Protobuf\Generated\Address::class); + $this->to = $var; + + return $this; + } + + /** + * The symbol of the received token. + * + * Generated from protobuf field string symbol = 3; + * @return string + */ + public function getSymbol() + { + return $this->symbol; + } + + /** + * The symbol of the received token. + * + * Generated from protobuf field string symbol = 3; + * @param string $var + * @return $this + */ + public function setSymbol($var) + { + GPBUtil::checkString($var, True); + $this->symbol = $var; + + return $this; + } + + /** + * The amount of the received token. + * + * Generated from protobuf field int64 amount = 4; + * @return int|string + */ + public function getAmount() + { + return $this->amount; + } + + /** + * The amount of the received token. + * + * Generated from protobuf field int64 amount = 4; + * @param int|string $var + * @return $this + */ + public function setAmount($var) + { + GPBUtil::checkInt64($var); + $this->amount = $var; + + return $this; + } + + /** + * The memo. + * + * Generated from protobuf field string memo = 5; + * @return string + */ + public function getMemo() + { + return $this->memo; + } + + /** + * The memo. + * + * Generated from protobuf field string memo = 5; + * @param string $var + * @return $this + */ + public function setMemo($var) + { + GPBUtil::checkString($var, True); + $this->memo = $var; + + return $this; + } + + /** + * The destination chain id. + * + * Generated from protobuf field int32 from_chain_id = 6; + * @return int + */ + public function getFromChainId() + { + return $this->from_chain_id; + } + + /** + * The destination chain id. + * + * Generated from protobuf field int32 from_chain_id = 6; + * @param int $var + * @return $this + */ + public function setFromChainId($var) + { + GPBUtil::checkInt32($var); + $this->from_chain_id = $var; + + return $this; + } + + /** + * The chain id of the token. + * + * Generated from protobuf field int32 issue_chain_id = 7; + * @return int + */ + public function getIssueChainId() + { + return $this->issue_chain_id; + } + + /** + * The chain id of the token. + * + * Generated from protobuf field int32 issue_chain_id = 7; + * @param int $var + * @return $this + */ + public function setIssueChainId($var) + { + GPBUtil::checkInt32($var); + $this->issue_chain_id = $var; + + return $this; + } + + /** + * The parent chain height of the transfer transaction. + * + * Generated from protobuf field int64 parent_chain_height = 8; + * @return int|string + */ + public function getParentChainHeight() + { + return $this->parent_chain_height; + } + + /** + * The parent chain height of the transfer transaction. + * + * Generated from protobuf field int64 parent_chain_height = 8; + * @param int|string $var + * @return $this + */ + public function setParentChainHeight($var) + { + GPBUtil::checkInt64($var); + $this->parent_chain_height = $var; + + return $this; + } + + /** + * The id of transfer transaction. + * + * Generated from protobuf field .AElf.protobuf.generated.Hash transfer_transaction_id = 9; + * @return \AElf\Protobuf\Generated\Hash|null + */ + public function getTransferTransactionId() + { + return $this->transfer_transaction_id; + } + + public function hasTransferTransactionId() + { + return isset($this->transfer_transaction_id); + } + + public function clearTransferTransactionId() + { + unset($this->transfer_transaction_id); + } + + /** + * The id of transfer transaction. + * + * Generated from protobuf field .AElf.protobuf.generated.Hash transfer_transaction_id = 9; + * @param \AElf\Protobuf\Generated\Hash $var + * @return $this + */ + public function setTransferTransactionId($var) + { + GPBUtil::checkMessage($var, \AElf\Protobuf\Generated\Hash::class); + $this->transfer_transaction_id = $var; + + return $this; + } + +} + diff --git a/src/protobuf/AElf/Protobuf/Generated/CrossChainTransferInput.php b/src/protobuf/AElf/Protobuf/Generated/CrossChainTransferInput.php index fdf079b..56a513b 100644 --- a/src/protobuf/AElf/Protobuf/Generated/CrossChainTransferInput.php +++ b/src/protobuf/AElf/Protobuf/Generated/CrossChainTransferInput.php @@ -79,13 +79,23 @@ public function __construct($data = NULL) { * The receiver of transfer. * * Generated from protobuf field .AElf.protobuf.generated.Address to = 1; - * @return \AElf\Protobuf\Generated\Address + * @return \AElf\Protobuf\Generated\Address|null */ public function getTo() { return $this->to; } + public function hasTo() + { + return isset($this->to); + } + + public function clearTo() + { + unset($this->to); + } + /** * The receiver of transfer. * diff --git a/src/protobuf/AElf/Protobuf/Generated/CrossChainTransferred.php b/src/protobuf/AElf/Protobuf/Generated/CrossChainTransferred.php new file mode 100644 index 0000000..0b08974 --- /dev/null +++ b/src/protobuf/AElf/Protobuf/Generated/CrossChainTransferred.php @@ -0,0 +1,289 @@ +AElf.protobuf.generated.CrossChainTransferred + */ +class CrossChainTransferred extends \Google\Protobuf\Internal\Message +{ + /** + * The source address of the transferred token. + * + * Generated from protobuf field .AElf.protobuf.generated.Address from = 1; + */ + protected $from = null; + /** + * The destination address of the transferred token. + * + * Generated from protobuf field .AElf.protobuf.generated.Address to = 2; + */ + protected $to = null; + /** + * The symbol of the transferred token. + * + * Generated from protobuf field string symbol = 3; + */ + protected $symbol = ''; + /** + * The amount of the transferred token. + * + * Generated from protobuf field int64 amount = 4; + */ + protected $amount = 0; + /** + * The memo. + * + * Generated from protobuf field string memo = 5; + */ + protected $memo = ''; + /** + * The destination chain id. + * + * Generated from protobuf field int32 to_chain_id = 6; + */ + protected $to_chain_id = 0; + /** + * The chain id of the token. + * + * Generated from protobuf field int32 issue_chain_id = 7; + */ + protected $issue_chain_id = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \AElf\Protobuf\Generated\Address $from + * The source address of the transferred token. + * @type \AElf\Protobuf\Generated\Address $to + * The destination address of the transferred token. + * @type string $symbol + * The symbol of the transferred token. + * @type int|string $amount + * The amount of the transferred token. + * @type string $memo + * The memo. + * @type int $to_chain_id + * The destination chain id. + * @type int $issue_chain_id + * The chain id of the token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Types::initOnce(); + parent::__construct($data); + } + + /** + * The source address of the transferred token. + * + * Generated from protobuf field .AElf.protobuf.generated.Address from = 1; + * @return \AElf\Protobuf\Generated\Address|null + */ + public function getFrom() + { + return $this->from; + } + + public function hasFrom() + { + return isset($this->from); + } + + public function clearFrom() + { + unset($this->from); + } + + /** + * The source address of the transferred token. + * + * Generated from protobuf field .AElf.protobuf.generated.Address from = 1; + * @param \AElf\Protobuf\Generated\Address $var + * @return $this + */ + public function setFrom($var) + { + GPBUtil::checkMessage($var, \AElf\Protobuf\Generated\Address::class); + $this->from = $var; + + return $this; + } + + /** + * The destination address of the transferred token. + * + * Generated from protobuf field .AElf.protobuf.generated.Address to = 2; + * @return \AElf\Protobuf\Generated\Address|null + */ + public function getTo() + { + return $this->to; + } + + public function hasTo() + { + return isset($this->to); + } + + public function clearTo() + { + unset($this->to); + } + + /** + * The destination address of the transferred token. + * + * Generated from protobuf field .AElf.protobuf.generated.Address to = 2; + * @param \AElf\Protobuf\Generated\Address $var + * @return $this + */ + public function setTo($var) + { + GPBUtil::checkMessage($var, \AElf\Protobuf\Generated\Address::class); + $this->to = $var; + + return $this; + } + + /** + * The symbol of the transferred token. + * + * Generated from protobuf field string symbol = 3; + * @return string + */ + public function getSymbol() + { + return $this->symbol; + } + + /** + * The symbol of the transferred token. + * + * Generated from protobuf field string symbol = 3; + * @param string $var + * @return $this + */ + public function setSymbol($var) + { + GPBUtil::checkString($var, True); + $this->symbol = $var; + + return $this; + } + + /** + * The amount of the transferred token. + * + * Generated from protobuf field int64 amount = 4; + * @return int|string + */ + public function getAmount() + { + return $this->amount; + } + + /** + * The amount of the transferred token. + * + * Generated from protobuf field int64 amount = 4; + * @param int|string $var + * @return $this + */ + public function setAmount($var) + { + GPBUtil::checkInt64($var); + $this->amount = $var; + + return $this; + } + + /** + * The memo. + * + * Generated from protobuf field string memo = 5; + * @return string + */ + public function getMemo() + { + return $this->memo; + } + + /** + * The memo. + * + * Generated from protobuf field string memo = 5; + * @param string $var + * @return $this + */ + public function setMemo($var) + { + GPBUtil::checkString($var, True); + $this->memo = $var; + + return $this; + } + + /** + * The destination chain id. + * + * Generated from protobuf field int32 to_chain_id = 6; + * @return int + */ + public function getToChainId() + { + return $this->to_chain_id; + } + + /** + * The destination chain id. + * + * Generated from protobuf field int32 to_chain_id = 6; + * @param int $var + * @return $this + */ + public function setToChainId($var) + { + GPBUtil::checkInt32($var); + $this->to_chain_id = $var; + + return $this; + } + + /** + * The chain id of the token. + * + * Generated from protobuf field int32 issue_chain_id = 7; + * @return int + */ + public function getIssueChainId() + { + return $this->issue_chain_id; + } + + /** + * The chain id of the token. + * + * Generated from protobuf field int32 issue_chain_id = 7; + * @param int $var + * @return $this + */ + public function setIssueChainId($var) + { + GPBUtil::checkInt32($var); + $this->issue_chain_id = $var; + + return $this; + } + +} + diff --git a/src/protobuf/AElf/Protobuf/Generated/ElectionVotingRecord.php b/src/protobuf/AElf/Protobuf/Generated/ElectionVotingRecord.php index ede9018..78b16dd 100644 --- a/src/protobuf/AElf/Protobuf/Generated/ElectionVotingRecord.php +++ b/src/protobuf/AElf/Protobuf/Generated/ElectionVotingRecord.php @@ -127,13 +127,23 @@ public function __construct($data = NULL) { * The address of voter. * * Generated from protobuf field .AElf.protobuf.generated.Address voter = 1; - * @return \AElf\Protobuf\Generated\Address + * @return \AElf\Protobuf\Generated\Address|null */ public function getVoter() { return $this->voter; } + public function hasVoter() + { + return isset($this->voter); + } + + public function clearVoter() + { + unset($this->voter); + } + /** * The address of voter. * @@ -231,13 +241,23 @@ public function setTermNumber($var) * The vote id. * * Generated from protobuf field .AElf.protobuf.generated.Hash vote_id = 5; - * @return \AElf\Protobuf\Generated\Hash + * @return \AElf\Protobuf\Generated\Hash|null */ public function getVoteId() { return $this->vote_id; } + public function hasVoteId() + { + return isset($this->vote_id); + } + + public function clearVoteId() + { + unset($this->vote_id); + } + /** * The vote id. * @@ -283,13 +303,23 @@ public function setLockTime($var) * The unlock timestamp. * * Generated from protobuf field .google.protobuf.Timestamp unlock_timestamp = 7; - * @return \Google\Protobuf\Timestamp + * @return \Google\Protobuf\Timestamp|null */ public function getUnlockTimestamp() { return $this->unlock_timestamp; } + public function hasUnlockTimestamp() + { + return isset($this->unlock_timestamp); + } + + public function clearUnlockTimestamp() + { + unset($this->unlock_timestamp); + } + /** * The unlock timestamp. * @@ -309,13 +339,23 @@ public function setUnlockTimestamp($var) * The withdraw timestamp. * * Generated from protobuf field .google.protobuf.Timestamp withdraw_timestamp = 8; - * @return \Google\Protobuf\Timestamp + * @return \Google\Protobuf\Timestamp|null */ public function getWithdrawTimestamp() { return $this->withdraw_timestamp; } + public function hasWithdrawTimestamp() + { + return isset($this->withdraw_timestamp); + } + + public function clearWithdrawTimestamp() + { + unset($this->withdraw_timestamp); + } + /** * The withdraw timestamp. * @@ -335,13 +375,23 @@ public function setWithdrawTimestamp($var) * The vote timestamp. * * Generated from protobuf field .google.protobuf.Timestamp vote_timestamp = 9; - * @return \Google\Protobuf\Timestamp + * @return \Google\Protobuf\Timestamp|null */ public function getVoteTimestamp() { return $this->vote_timestamp; } + public function hasVoteTimestamp() + { + return isset($this->vote_timestamp); + } + + public function clearVoteTimestamp() + { + unset($this->vote_timestamp); + } + /** * The vote timestamp. * diff --git a/src/protobuf/AElf/Protobuf/Generated/ElectorVote.php b/src/protobuf/AElf/Protobuf/Generated/ElectorVote.php index 271d836..9658806 100644 --- a/src/protobuf/AElf/Protobuf/Generated/ElectorVote.php +++ b/src/protobuf/AElf/Protobuf/Generated/ElectorVote.php @@ -62,17 +62,17 @@ class ElectorVote extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type \AElf\Protobuf\Generated\Hash[]|\Google\Protobuf\Internal\RepeatedField $active_voting_record_ids + * @type array<\AElf\Protobuf\Generated\Hash>|\Google\Protobuf\Internal\RepeatedField $active_voting_record_ids * The active voting record ids. - * @type \AElf\Protobuf\Generated\Hash[]|\Google\Protobuf\Internal\RepeatedField $withdrawn_voting_record_ids + * @type array<\AElf\Protobuf\Generated\Hash>|\Google\Protobuf\Internal\RepeatedField $withdrawn_voting_record_ids * The voting record ids that were withdrawn. * @type int|string $active_voted_votes_amount * The total number of active votes. * @type int|string $all_voted_votes_amount * The total number of votes (including the number of votes withdrawn). - * @type \AElf\Protobuf\Generated\ElectionVotingRecord[]|\Google\Protobuf\Internal\RepeatedField $active_voting_records + * @type array<\AElf\Protobuf\Generated\ElectionVotingRecord>|\Google\Protobuf\Internal\RepeatedField $active_voting_records * The active voting records. - * @type \AElf\Protobuf\Generated\ElectionVotingRecord[]|\Google\Protobuf\Internal\RepeatedField $withdrawn_votes_records + * @type array<\AElf\Protobuf\Generated\ElectionVotingRecord>|\Google\Protobuf\Internal\RepeatedField $withdrawn_votes_records * The voting records that were withdrawn. * @type string $pubkey * Public key for voter. @@ -98,7 +98,7 @@ public function getActiveVotingRecordIds() * The active voting record ids. * * Generated from protobuf field repeated .AElf.protobuf.generated.Hash active_voting_record_ids = 1; - * @param \AElf\Protobuf\Generated\Hash[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\AElf\Protobuf\Generated\Hash>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setActiveVotingRecordIds($var) @@ -124,7 +124,7 @@ public function getWithdrawnVotingRecordIds() * The voting record ids that were withdrawn. * * Generated from protobuf field repeated .AElf.protobuf.generated.Hash withdrawn_voting_record_ids = 2; - * @param \AElf\Protobuf\Generated\Hash[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\AElf\Protobuf\Generated\Hash>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setWithdrawnVotingRecordIds($var) @@ -202,7 +202,7 @@ public function getActiveVotingRecords() * The active voting records. * * Generated from protobuf field repeated .AElf.protobuf.generated.ElectionVotingRecord active_voting_records = 5; - * @param \AElf\Protobuf\Generated\ElectionVotingRecord[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\AElf\Protobuf\Generated\ElectionVotingRecord>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setActiveVotingRecords($var) @@ -228,7 +228,7 @@ public function getWithdrawnVotesRecords() * The voting records that were withdrawn. * * Generated from protobuf field repeated .AElf.protobuf.generated.ElectionVotingRecord withdrawn_votes_records = 6; - * @param \AElf\Protobuf\Generated\ElectionVotingRecord[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\AElf\Protobuf\Generated\ElectionVotingRecord>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setWithdrawnVotesRecords($var) diff --git a/src/protobuf/AElf/Protobuf/Generated/GetBalanceInput.php b/src/protobuf/AElf/Protobuf/Generated/GetBalanceInput.php index 5ffad37..d919a4f 100644 --- a/src/protobuf/AElf/Protobuf/Generated/GetBalanceInput.php +++ b/src/protobuf/AElf/Protobuf/Generated/GetBalanceInput.php @@ -73,13 +73,23 @@ public function setSymbol($var) * The target address of the query. * * Generated from protobuf field .AElf.protobuf.generated.Address owner = 2; - * @return \AElf\Protobuf\Generated\Address + * @return \AElf\Protobuf\Generated\Address|null */ public function getOwner() { return $this->owner; } + public function hasOwner() + { + return isset($this->owner); + } + + public function clearOwner() + { + unset($this->owner); + } + /** * The target address of the query. * diff --git a/src/protobuf/AElf/Protobuf/Generated/GetBalanceOutput.php b/src/protobuf/AElf/Protobuf/Generated/GetBalanceOutput.php index e23e12a..7cdc65d 100644 --- a/src/protobuf/AElf/Protobuf/Generated/GetBalanceOutput.php +++ b/src/protobuf/AElf/Protobuf/Generated/GetBalanceOutput.php @@ -81,13 +81,23 @@ public function setSymbol($var) * The target address of the query. * * Generated from protobuf field .AElf.protobuf.generated.Address owner = 2; - * @return \AElf\Protobuf\Generated\Address + * @return \AElf\Protobuf\Generated\Address|null */ public function getOwner() { return $this->owner; } + public function hasOwner() + { + return isset($this->owner); + } + + public function clearOwner() + { + unset($this->owner); + } + /** * The target address of the query. * diff --git a/src/protobuf/AElf/Protobuf/Generated/IssueInput.php b/src/protobuf/AElf/Protobuf/Generated/IssueInput.php index 48bfe9c..6725da0 100644 --- a/src/protobuf/AElf/Protobuf/Generated/IssueInput.php +++ b/src/protobuf/AElf/Protobuf/Generated/IssueInput.php @@ -141,13 +141,23 @@ public function setMemo($var) * The target address to issue. * * Generated from protobuf field .AElf.protobuf.generated.Address to = 4; - * @return \AElf\Protobuf\Generated\Address + * @return \AElf\Protobuf\Generated\Address|null */ public function getTo() { return $this->to; } + public function hasTo() + { + return isset($this->to); + } + + public function clearTo() + { + unset($this->to); + } + /** * The target address to issue. * diff --git a/src/protobuf/AElf/Protobuf/Generated/MerklePath.php b/src/protobuf/AElf/Protobuf/Generated/MerklePath.php index bb283d9..2c91937 100644 --- a/src/protobuf/AElf/Protobuf/Generated/MerklePath.php +++ b/src/protobuf/AElf/Protobuf/Generated/MerklePath.php @@ -24,7 +24,7 @@ class MerklePath extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type \AElf\Protobuf\Generated\MerklePathNode[]|\Google\Protobuf\Internal\RepeatedField $merkle_path_nodes + * @type array<\AElf\Protobuf\Generated\MerklePathNode>|\Google\Protobuf\Internal\RepeatedField $merkle_path_nodes * } */ public function __construct($data = NULL) { @@ -43,7 +43,7 @@ public function getMerklePathNodes() /** * Generated from protobuf field repeated .AElf.protobuf.generated.MerklePathNode merkle_path_nodes = 1; - * @param \AElf\Protobuf\Generated\MerklePathNode[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\AElf\Protobuf\Generated\MerklePathNode>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setMerklePathNodes($var) diff --git a/src/protobuf/AElf/Protobuf/Generated/MerklePathNode.php b/src/protobuf/AElf/Protobuf/Generated/MerklePathNode.php index 1d40398..9ad7f89 100644 --- a/src/protobuf/AElf/Protobuf/Generated/MerklePathNode.php +++ b/src/protobuf/AElf/Protobuf/Generated/MerklePathNode.php @@ -39,13 +39,23 @@ public function __construct($data = NULL) { /** * Generated from protobuf field .AElf.protobuf.generated.Hash hash = 1; - * @return \AElf\Protobuf\Generated\Hash + * @return \AElf\Protobuf\Generated\Hash|null */ public function getHash() { return $this->hash; } + public function hasHash() + { + return isset($this->hash); + } + + public function clearHash() + { + unset($this->hash); + } + /** * Generated from protobuf field .AElf.protobuf.generated.Hash hash = 1; * @param \AElf\Protobuf\Generated\Hash $var diff --git a/src/protobuf/AElf/Protobuf/Generated/MinerList.php b/src/protobuf/AElf/Protobuf/Generated/MinerList.php index 7ddae52..9393e69 100644 --- a/src/protobuf/AElf/Protobuf/Generated/MinerList.php +++ b/src/protobuf/AElf/Protobuf/Generated/MinerList.php @@ -26,7 +26,7 @@ class MinerList extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type string[]|\Google\Protobuf\Internal\RepeatedField $pubkeys + * @type array|\Google\Protobuf\Internal\RepeatedField $pubkeys * The miners public key list. * } */ @@ -50,7 +50,7 @@ public function getPubkeys() * The miners public key list. * * Generated from protobuf field repeated bytes pubkeys = 1; - * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setPubkeys($var) diff --git a/src/protobuf/AElf/Protobuf/Generated/ResourceTokenCharged.php b/src/protobuf/AElf/Protobuf/Generated/ResourceTokenCharged.php index 2533f4a..5456454 100644 --- a/src/protobuf/AElf/Protobuf/Generated/ResourceTokenCharged.php +++ b/src/protobuf/AElf/Protobuf/Generated/ResourceTokenCharged.php @@ -88,13 +88,23 @@ public function setAmount($var) /** * Generated from protobuf field .AElf.protobuf.generated.Address contract_address = 3; - * @return \AElf\Protobuf\Generated\Address + * @return \AElf\Protobuf\Generated\Address|null */ public function getContractAddress() { return $this->contract_address; } + public function hasContractAddress() + { + return isset($this->contract_address); + } + + public function clearContractAddress() + { + unset($this->contract_address); + } + /** * Generated from protobuf field .AElf.protobuf.generated.Address contract_address = 3; * @param \AElf\Protobuf\Generated\Address $var diff --git a/src/protobuf/AElf/Protobuf/Generated/TokenInfo.php b/src/protobuf/AElf/Protobuf/Generated/TokenInfo.php index b4d2ed1..0142076 100644 --- a/src/protobuf/AElf/Protobuf/Generated/TokenInfo.php +++ b/src/protobuf/AElf/Protobuf/Generated/TokenInfo.php @@ -233,13 +233,23 @@ public function setDecimals($var) * The address that created the token. * * Generated from protobuf field .AElf.protobuf.generated.Address issuer = 6; - * @return \AElf\Protobuf\Generated\Address + * @return \AElf\Protobuf\Generated\Address|null */ public function getIssuer() { return $this->issuer; } + public function hasIssuer() + { + return isset($this->issuer); + } + + public function clearIssuer() + { + unset($this->issuer); + } + /** * The address that created the token. * diff --git a/src/protobuf/AElf/Protobuf/Generated/Transaction.php b/src/protobuf/AElf/Protobuf/Generated/Transaction.php index f193ebd..c8a5ffc 100644 --- a/src/protobuf/AElf/Protobuf/Generated/Transaction.php +++ b/src/protobuf/AElf/Protobuf/Generated/Transaction.php @@ -64,13 +64,23 @@ public function __construct($data = NULL) { /** * Generated from protobuf field .AElf.protobuf.generated.Address from_address = 1; - * @return \AElf\Protobuf\Generated\Address + * @return \AElf\Protobuf\Generated\Address|null */ public function getFromAddress() { return $this->from_address; } + public function hasFromAddress() + { + return isset($this->from_address); + } + + public function clearFromAddress() + { + unset($this->from_address); + } + /** * Generated from protobuf field .AElf.protobuf.generated.Address from_address = 1; * @param \AElf\Protobuf\Generated\Address $var @@ -86,13 +96,23 @@ public function setFromAddress($var) /** * Generated from protobuf field .AElf.protobuf.generated.Address to_address = 2; - * @return \AElf\Protobuf\Generated\Address + * @return \AElf\Protobuf\Generated\Address|null */ public function getToAddress() { return $this->to_address; } + public function hasToAddress() + { + return isset($this->to_address); + } + + public function clearToAddress() + { + unset($this->to_address); + } + /** * Generated from protobuf field .AElf.protobuf.generated.Address to_address = 2; * @param \AElf\Protobuf\Generated\Address $var diff --git a/src/protobuf/AElf/Protobuf/Generated/TransferFromInput.php b/src/protobuf/AElf/Protobuf/Generated/TransferFromInput.php index bc13ea5..57550d1 100644 --- a/src/protobuf/AElf/Protobuf/Generated/TransferFromInput.php +++ b/src/protobuf/AElf/Protobuf/Generated/TransferFromInput.php @@ -71,13 +71,23 @@ public function __construct($data = NULL) { * The source address of the token. * * Generated from protobuf field .AElf.protobuf.generated.Address from = 1; - * @return \AElf\Protobuf\Generated\Address + * @return \AElf\Protobuf\Generated\Address|null */ public function getFrom() { return $this->from; } + public function hasFrom() + { + return isset($this->from); + } + + public function clearFrom() + { + unset($this->from); + } + /** * The source address of the token. * @@ -97,13 +107,23 @@ public function setFrom($var) * The destination address of the token. * * Generated from protobuf field .AElf.protobuf.generated.Address to = 2; - * @return \AElf\Protobuf\Generated\Address + * @return \AElf\Protobuf\Generated\Address|null */ public function getTo() { return $this->to; } + public function hasTo() + { + return isset($this->to); + } + + public function clearTo() + { + unset($this->to); + } + /** * The destination address of the token. * diff --git a/src/protobuf/AElf/Protobuf/Generated/TransferInput.php b/src/protobuf/AElf/Protobuf/Generated/TransferInput.php index 9f5c65d..be9a439 100644 --- a/src/protobuf/AElf/Protobuf/Generated/TransferInput.php +++ b/src/protobuf/AElf/Protobuf/Generated/TransferInput.php @@ -63,13 +63,23 @@ public function __construct($data = NULL) { * The receiver of the token. * * Generated from protobuf field .AElf.protobuf.generated.Address to = 1; - * @return \AElf\Protobuf\Generated\Address + * @return \AElf\Protobuf\Generated\Address|null */ public function getTo() { return $this->to; } + public function hasTo() + { + return isset($this->to); + } + + public function clearTo() + { + unset($this->to); + } + /** * The receiver of the token. * diff --git a/src/protobuf/AElf/Protobuf/Generated/Transferred.php b/src/protobuf/AElf/Protobuf/Generated/Transferred.php new file mode 100644 index 0000000..593b56f --- /dev/null +++ b/src/protobuf/AElf/Protobuf/Generated/Transferred.php @@ -0,0 +1,221 @@ +AElf.protobuf.generated.Transferred + */ +class Transferred extends \Google\Protobuf\Internal\Message +{ + /** + * The source address of the transferred token. + * + * Generated from protobuf field .AElf.protobuf.generated.Address from = 1 [(.client.is_indexed) = true]; + */ + protected $from = null; + /** + * The destination address of the transferred token. + * + * Generated from protobuf field .AElf.protobuf.generated.Address to = 2 [(.client.is_indexed) = true]; + */ + protected $to = null; + /** + * The symbol of the transferred token. + * + * Generated from protobuf field string symbol = 3 [(.client.is_indexed) = true]; + */ + protected $symbol = ''; + /** + * The amount of the transferred token. + * + * Generated from protobuf field int64 amount = 4; + */ + protected $amount = 0; + /** + * The memo. + * + * Generated from protobuf field string memo = 5; + */ + protected $memo = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \AElf\Protobuf\Generated\Address $from + * The source address of the transferred token. + * @type \AElf\Protobuf\Generated\Address $to + * The destination address of the transferred token. + * @type string $symbol + * The symbol of the transferred token. + * @type int|string $amount + * The amount of the transferred token. + * @type string $memo + * The memo. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Types::initOnce(); + parent::__construct($data); + } + + /** + * The source address of the transferred token. + * + * Generated from protobuf field .AElf.protobuf.generated.Address from = 1 [(.client.is_indexed) = true]; + * @return \AElf\Protobuf\Generated\Address|null + */ + public function getFrom() + { + return $this->from; + } + + public function hasFrom() + { + return isset($this->from); + } + + public function clearFrom() + { + unset($this->from); + } + + /** + * The source address of the transferred token. + * + * Generated from protobuf field .AElf.protobuf.generated.Address from = 1 [(.client.is_indexed) = true]; + * @param \AElf\Protobuf\Generated\Address $var + * @return $this + */ + public function setFrom($var) + { + GPBUtil::checkMessage($var, \AElf\Protobuf\Generated\Address::class); + $this->from = $var; + + return $this; + } + + /** + * The destination address of the transferred token. + * + * Generated from protobuf field .AElf.protobuf.generated.Address to = 2 [(.client.is_indexed) = true]; + * @return \AElf\Protobuf\Generated\Address|null + */ + public function getTo() + { + return $this->to; + } + + public function hasTo() + { + return isset($this->to); + } + + public function clearTo() + { + unset($this->to); + } + + /** + * The destination address of the transferred token. + * + * Generated from protobuf field .AElf.protobuf.generated.Address to = 2 [(.client.is_indexed) = true]; + * @param \AElf\Protobuf\Generated\Address $var + * @return $this + */ + public function setTo($var) + { + GPBUtil::checkMessage($var, \AElf\Protobuf\Generated\Address::class); + $this->to = $var; + + return $this; + } + + /** + * The symbol of the transferred token. + * + * Generated from protobuf field string symbol = 3 [(.client.is_indexed) = true]; + * @return string + */ + public function getSymbol() + { + return $this->symbol; + } + + /** + * The symbol of the transferred token. + * + * Generated from protobuf field string symbol = 3 [(.client.is_indexed) = true]; + * @param string $var + * @return $this + */ + public function setSymbol($var) + { + GPBUtil::checkString($var, True); + $this->symbol = $var; + + return $this; + } + + /** + * The amount of the transferred token. + * + * Generated from protobuf field int64 amount = 4; + * @return int|string + */ + public function getAmount() + { + return $this->amount; + } + + /** + * The amount of the transferred token. + * + * Generated from protobuf field int64 amount = 4; + * @param int|string $var + * @return $this + */ + public function setAmount($var) + { + GPBUtil::checkInt64($var); + $this->amount = $var; + + return $this; + } + + /** + * The memo. + * + * Generated from protobuf field string memo = 5; + * @return string + */ + public function getMemo() + { + return $this->memo; + } + + /** + * The memo. + * + * Generated from protobuf field string memo = 5; + * @param string $var + * @return $this + */ + public function setMemo($var) + { + GPBUtil::checkString($var, True); + $this->memo = $var; + + return $this; + } + +} + diff --git a/src/protobuf/GPBMetadata/Options.php b/src/protobuf/GPBMetadata/Options.php new file mode 100644 index 0000000..9cd77e2 --- /dev/null +++ b/src/protobuf/GPBMetadata/Options.php @@ -0,0 +1,26 @@ +internalAddGeneratedFile( + ' +A + options.protoclient google/protobuf/descriptor.protobproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/src/protobuf/GPBMetadata/Types.php b/src/protobuf/GPBMetadata/Types.php index 5da00fa..af11135 100644 --- a/src/protobuf/GPBMetadata/Types.php +++ b/src/protobuf/GPBMetadata/Types.php @@ -14,10 +14,152 @@ public static function initOnce() { if (static::$is_initialized == true) { return; } - \GPBMetadata\Timestamp::initOnce(); - $pool->internalAddGeneratedFile(hex2bin( - "0aed190a0b74797065732e70726f746f121741456c662e70726f746f6275662e67656e65726174656422230a0b537472696e67496e70757412140a0c737472696e675f76616c7565180120012809221c0a094d696e65724c697374120f0a077075626b65797318012003280c22150a0448617368120d0a0576616c756518012001280c22180a0741646472657373120d0a0576616c756518012001280c22e8010a0b5472616e73616374696f6e12360a0c66726f6d5f6164647265737318012001280b32202e41456c662e70726f746f6275662e67656e6572617465642e4164647265737312340a0a746f5f6164647265737318022001280b32202e41456c662e70726f746f6275662e67656e6572617465642e4164647265737312180a107265665f626c6f636b5f6e756d62657218032001280312180a107265665f626c6f636b5f70726566697818042001280c12130a0b6d6574686f645f6e616d65180520012809120e0a06706172616d7318062001280c12120a097369676e617475726518904e2001280c22a4030a14456c656374696f6e566f74696e675265636f7264122f0a05766f74657218012001280b32202e41456c662e70726f746f6275662e67656e6572617465642e4164647265737312110a0963616e646964617465180220012809120e0a06616d6f756e7418032001280312130a0b7465726d5f6e756d626572180420012803122e0a07766f74655f696418052001280b321d2e41456c662e70726f746f6275662e67656e6572617465642e4861736812110a096c6f636b5f74696d6518062001280312340a10756e6c6f636b5f74696d657374616d7018072001280b321a2e676f6f676c652e70726f746f6275662e54696d657374616d7012360a1277697468647261775f74696d657374616d7018082001280b321a2e676f6f676c652e70726f746f6275662e54696d657374616d7012320a0e766f74655f74696d657374616d7018092001280b321a2e676f6f676c652e70726f746f6275662e54696d657374616d7012140a0c69735f77697468647261776e180a20012808120e0a06776569676874180b2001280312180a1069735f6368616e67655f746172676574180c200128082283030a0b456c6563746f72566f7465123f0a186163746976655f766f74696e675f7265636f72645f69647318012003280b321d2e41456c662e70726f746f6275662e67656e6572617465642e4861736812420a1b77697468647261776e5f766f74696e675f7265636f72645f69647318022003280b321d2e41456c662e70726f746f6275662e67656e6572617465642e4861736812210a196163746976655f766f7465645f766f7465735f616d6f756e74180320012803121e0a16616c6c5f766f7465645f766f7465735f616d6f756e74180420012803124c0a156163746976655f766f74696e675f7265636f72647318052003280b322d2e41456c662e70726f746f6275662e67656e6572617465642e456c656374696f6e566f74696e675265636f7264124e0a1777697468647261776e5f766f7465735f7265636f72647318062003280b322d2e41456c662e70726f746f6275662e67656e6572617465642e456c656374696f6e566f74696e675265636f7264120e0a067075626b657918072001280c22bb030a0d43616e646964617465566f746512480a216f627461696e65645f6163746976655f766f74696e675f7265636f72645f69647318012003280b321d2e41456c662e70726f746f6275662e67656e6572617465642e48617368124b0a246f627461696e65645f77697468647261776e5f766f74696e675f7265636f72645f69647318022003280b321d2e41456c662e70726f746f6275662e67656e6572617465642e48617368122a0a226f627461696e65645f6163746976655f766f7465645f766f7465735f616d6f756e7418032001280312270a1f616c6c5f6f627461696e65645f766f7465645f766f7465735f616d6f756e7418042001280312550a1e6f627461696e65645f6163746976655f766f74696e675f7265636f72647318052003280b322d2e41456c662e70726f746f6275662e67656e6572617465642e456c656374696f6e566f74696e675265636f726412570a206f627461696e65645f77697468647261776e5f766f7465735f7265636f72647318062003280b322d2e41456c662e70726f746f6275662e67656e6572617465642e456c656374696f6e566f74696e675265636f7264120e0a067075626b657918072001280c22390a17436f6e74726163744465706c6f796d656e74496e70757412100a0863617465676f7279180120012811120c0a04636f646518022001280c22560a13436f6e7472616374557064617465496e70757412310a076164647265737318012001280b32202e41456c662e70726f746f6275662e67656e6572617465642e41646472657373120c0a04636f646518022001280c22a2010a1743726f7373436861696e5472616e73666572496e707574122c0a02746f18012001280b32202e41456c662e70726f746f6275662e67656e6572617465642e41646472657373120e0a0673796d626f6c180220012809120e0a06616d6f756e74180320012803120c0a046d656d6f18042001280912130a0b746f5f636861696e5f696418052001280512160a0e69737375655f636861696e5f696418062001280522500a0a4d65726b6c655061746812420a116d65726b6c655f706174685f6e6f64657318012003280b32272e41456c662e70726f746f6275662e67656e6572617465642e4d65726b6c65506174684e6f646522590a0e4d65726b6c65506174684e6f6465122b0a046861736818012001280b321d2e41456c662e70726f746f6275662e67656e6572617465642e48617368121a0a1269735f6c6566745f6368696c645f6e6f646518022001280822af010a1b43726f7373436861696e52656365697665546f6b656e496e70757412150a0d66726f6d5f636861696e5f6964180120012805121b0a13706172656e745f636861696e5f68656967687418022001280312220a1a7472616e736665725f7472616e73616374696f6e5f627974657318032001280c12380a0b6d65726b6c655f7061746818042001280b32232e41456c662e70726f746f6275662e67656e6572617465642e4d65726b6c655061746822230a11476574546f6b656e496e666f496e707574120e0a0673796d626f6c18012001280922520a0f47657442616c616e6365496e707574120e0a0673796d626f6c180120012809122f0a056f776e657218022001280b32202e41456c662e70726f746f6275662e67656e6572617465642e4164647265737322640a1047657442616c616e63654f7574707574120e0a0673796d626f6c180120012809122f0a056f776e657218022001280b32202e41456c662e70726f746f6275662e67656e6572617465642e41646472657373120f0a0762616c616e636518032001280322680a0a4973737565496e707574120e0a0673796d626f6c180120012809120e0a06616d6f756e74180220012803120c0a046d656d6f180320012809122c0a02746f18042001280b32202e41456c662e70726f746f6275662e67656e6572617465642e41646472657373226b0a0d5472616e73666572496e707574122c0a02746f18012001280b32202e41456c662e70726f746f6275662e67656e6572617465642e41646472657373120e0a0673796d626f6c180220012809120e0a06616d6f756e74180320012803120c0a046d656d6f180420012809229f010a115472616e7366657246726f6d496e707574122e0a0466726f6d18012001280b32202e41456c662e70726f746f6275662e67656e6572617465642e41646472657373122c0a02746f18022001280b32202e41456c662e70726f746f6275662e67656e6572617465642e41646472657373120e0a0673796d626f6c180320012809120e0a06616d6f756e74180420012803120c0a046d656d6f18052001280922370a155472616e73616374696f6e46656543686172676564120e0a0673796d626f6c180120012809120e0a06616d6f756e7418022001280322720a145265736f75726365546f6b656e43686172676564120e0a0673796d626f6c180120012809120e0a06616d6f756e74180220012803123a0a10636f6e74726163745f6164647265737318032001280b32202e41456c662e70726f746f6275662e67656e6572617465642e4164647265737322d6010a09546f6b656e496e666f120e0a0673796d626f6c18012001280912120a0a746f6b656e5f6e616d65180220012809120e0a06737570706c7918032001280312140a0c746f74616c5f737570706c7918042001280312100a08646563696d616c7318052001280512300a0669737375657218062001280b32202e41456c662e70726f746f6275662e67656e6572617465642e4164647265737312130a0b69735f6275726e61626c6518072001280812160a0e69737375655f636861696e5f6964180820012805120e0a06697373756564180920012803620670726f746f33" - ), true); + \GPBMetadata\Google\Protobuf\Timestamp::initOnce(); + \GPBMetadata\Options::initOnce(); + $pool->internalAddGeneratedFile( + ' + + types.protoAElf.protobuf.generated options.proto"# + StringInput + string_value ( " + MinerList +pubkeys ( " +Hash +value ( " +Address +value ( " + Transaction6 + from_address ( 2 .AElf.protobuf.generated.Address4 + +to_address ( 2 .AElf.protobuf.generated.Address +ref_block_number ( +ref_block_prefix (  + method_name (  +params (  + signatureN ( " +ElectionVotingRecord/ +voter ( 2 .AElf.protobuf.generated.Address + candidate (  +amount ( + term_number (. +vote_id ( 2.AElf.protobuf.generated.Hash + lock_time (4 +unlock_timestamp ( 2.google.protobuf.Timestamp6 +withdraw_timestamp ( 2.google.protobuf.Timestamp2 +vote_timestamp ( 2.google.protobuf.Timestamp + is_withdrawn + ( +weight ( +is_change_target (" + ElectorVote? +active_voting_record_ids ( 2.AElf.protobuf.generated.HashB +withdrawn_voting_record_ids ( 2.AElf.protobuf.generated.Hash! +active_voted_votes_amount ( +all_voted_votes_amount (L +active_voting_records ( 2-.AElf.protobuf.generated.ElectionVotingRecordN +withdrawn_votes_records ( 2-.AElf.protobuf.generated.ElectionVotingRecord +pubkey ( " + CandidateVoteH +!obtained_active_voting_record_ids ( 2.AElf.protobuf.generated.HashK +$obtained_withdrawn_voting_record_ids ( 2.AElf.protobuf.generated.Hash* +"obtained_active_voted_votes_amount (\' +all_obtained_voted_votes_amount (U +obtained_active_voting_records ( 2-.AElf.protobuf.generated.ElectionVotingRecordW + obtained_withdrawn_votes_records ( 2-.AElf.protobuf.generated.ElectionVotingRecord +pubkey ( "9 +ContractDeploymentInput +category ( +code ( "V +ContractUpdateInput1 +address ( 2 .AElf.protobuf.generated.Address +code ( " +CrossChainTransferInput, +to ( 2 .AElf.protobuf.generated.Address +symbol (  +amount ( +memo (  + to_chain_id ( +issue_chain_id ("P + +MerklePathB +merkle_path_nodes ( 2\'.AElf.protobuf.generated.MerklePathNode"Y +MerklePathNode+ +hash ( 2.AElf.protobuf.generated.Hash +is_left_child_node (" +CrossChainReceiveTokenInput + from_chain_id ( +parent_chain_height (" +transfer_transaction_bytes ( 8 + merkle_path ( 2#.AElf.protobuf.generated.MerklePath"# +GetTokenInfoInput +symbol ( "R +GetBalanceInput +symbol ( / +owner ( 2 .AElf.protobuf.generated.Address"d +GetBalanceOutput +symbol ( / +owner ( 2 .AElf.protobuf.generated.Address +balance ("h + +IssueInput +symbol (  +amount ( +memo ( , +to ( 2 .AElf.protobuf.generated.Address"k + TransferInput, +to ( 2 .AElf.protobuf.generated.Address +symbol (  +amount ( +memo ( " +TransferFromInput. +from ( 2 .AElf.protobuf.generated.Address, +to ( 2 .AElf.protobuf.generated.Address +symbol (  +amount ( +memo ( "7 +TransactionFeeCharged +symbol (  +amount ("r +ResourceTokenCharged +symbol (  +amount (: +contract_address ( 2 .AElf.protobuf.generated.Address" + TokenInfo +symbol (  + +token_name (  +supply ( + total_supply ( +decimals (0 +issuer ( 2 .AElf.protobuf.generated.Address + is_burnable ( +issue_chain_id ( +issued (" + Transferred5 +from ( 2 .AElf.protobuf.generated.AddressB3 +to ( 2 .AElf.protobuf.generated.AddressB +symbol ( B +amount ( +memo ( :" +CrossChainTransferred. +from ( 2 .AElf.protobuf.generated.Address, +to ( 2 .AElf.protobuf.generated.Address +symbol (  +amount ( +memo (  + to_chain_id ( +issue_chain_id (:" +CrossChainReceived. +from ( 2 .AElf.protobuf.generated.Address, +to ( 2 .AElf.protobuf.generated.Address +symbol (  +amount ( +memo (  + from_chain_id ( +issue_chain_id ( +parent_chain_height (> +transfer_transaction_id ( 2.AElf.protobuf.generated.Hash:bproto3' + , true); static::$is_initialized = true; } diff --git a/src/protobuf/options.proto b/src/protobuf/options.proto new file mode 100644 index 0000000..ec1fef3 --- /dev/null +++ b/src/protobuf/options.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; + +package client; + +import "google/protobuf/descriptor.proto"; + +// All aelf custom options field numbers are like 50yxxx +// where y stands for the custom options type: +// 0 - FileOptions +// 1 - MessageOptions +// 2 - FieldOptions +// 3 - EnumOptions +// 4 - EnumValueOptions +// 5 - ServiceOptions +// 6 - MethodOptions + +extend google.protobuf.FileOptions { + string identity = 500001; +} + +extend google.protobuf.ServiceOptions { + repeated string base = 505001; + string csharp_state = 505030; +} + +extend google.protobuf.MethodOptions { + bool is_view = 506001; +} + +extend google.protobuf.MessageOptions { + bool is_event = 50100; +} + +extend google.protobuf.FieldOptions { + bool is_indexed = 502001; +} \ No newline at end of file diff --git a/src/protobuf/types.proto b/src/protobuf/types.proto index 0a1d964..33443bb 100644 --- a/src/protobuf/types.proto +++ b/src/protobuf/types.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package AElf.protobuf.generated; -import "timestamp.proto"; +import "google/protobuf/timestamp.proto"; +import "options.proto"; message StringInput { string string_value = 1; @@ -225,4 +226,60 @@ message TokenInfo { int32 issue_chain_id = 8; // The amount of issued tokens. int64 issued = 9; +} + +message Transferred { + option (client.is_event) = true; + // The source address of the transferred token. + Address from = 1 [(client.is_indexed) = true]; + // The destination address of the transferred token. + Address to = 2 [(client.is_indexed) = true]; + // The symbol of the transferred token. + string symbol = 3 [(client.is_indexed) = true]; + // The amount of the transferred token. + int64 amount = 4; + // The memo. + string memo = 5; +} + + + +message CrossChainTransferred { + option (client.is_event) = true; + // The source address of the transferred token. + Address from = 1; + // The destination address of the transferred token. + Address to = 2; + // The symbol of the transferred token. + string symbol = 3; + // The amount of the transferred token. + int64 amount = 4; + // The memo. + string memo = 5; + // The destination chain id. + int32 to_chain_id = 6; + // The chain id of the token. + int32 issue_chain_id = 7; +} + +message CrossChainReceived { + option (client.is_event) = true; + // The source address of the transferred token. + Address from = 1; + // The destination address of the transferred token. + Address to = 2; + // The symbol of the received token. + string symbol = 3; + // The amount of the received token. + int64 amount = 4; + // The memo. + string memo = 5; + // The destination chain id. + int32 from_chain_id = 6; + // The chain id of the token. + int32 issue_chain_id = 7; + // The parent chain height of the transfer transaction. + int64 parent_chain_height = 8; + // The id of transfer transaction. + Hash transfer_transaction_id = 9; } \ No newline at end of file diff --git a/src/sdk/BlockChainSdk.php b/src/sdk/BlockChainSdk.php index bc8ae12..5b49ae9 100644 --- a/src/sdk/BlockChainSdk.php +++ b/src/sdk/BlockChainSdk.php @@ -3,10 +3,14 @@ namespace AElf\Api; use AElf\Bytes\Bytes; +use AElf\Protobuf\Generated\CrossChainTransferInput; +use AElf\Protobuf\Generated\Hash; +use AElf\Protobuf\Generated\Transaction; use StephenHill\Base58; use Hhxsv5\PhpMultiCurl\Curl as Curl; +use function Sodium\add; -Class BlockChainSdk +class BlockChainSdk { private $curl; private $base58; @@ -364,6 +368,8 @@ public function calculateTransactionFee($input) } + + private function createBlockDto($block, $includeTransactions) { if ($block == null) { diff --git a/tests/AElfTest.php b/tests/AElfTest.php index 02ba131..1564201 100644 --- a/tests/AElfTest.php +++ b/tests/AElfTest.php @@ -1,4 +1,5 @@ "; $networkInfo = $this->aelf->getNetworkInfo(); - $this->assertEquals("1.2.3.0", $networkInfo['Version']); + $this->assertEquals("1.6.0.0", $networkInfo['Version']); print_r($this->aelf->getNetworkInfo()); echo "
"; print('remove_peer'); @@ -240,7 +241,8 @@ public function testGetFormattedAddress() $this->assertEquals($nowAddress, $addressVal); } - public function testCalculateTransactionFee(){ + public function testCalculateTransactionFee() + { $status = $this->aelf->getChainStatus(); $params = base64_encode(hex2bin(hash('sha256', 'AElf.ContractNames.Consensus'))); $param = array('value' => $params); @@ -261,11 +263,48 @@ public function testCalculateTransactionFee(){ $result = $this->aelf->calculateTransactionFee($calculateTransactionFeeInputParam); print_r($result); $this->assertTrue($result['Success']); - $this->assertGreaterThan(17000000,$result['TransactionFee']['ELF']); - $this->assertLessThan(19000000,$result['TransactionFee']['ELF']); + $this->assertGreaterThan(17000000, $result['TransactionFee']['ELF']); + $this->assertLessThan(19000000, $result['TransactionFee']['ELF']); + + } + + public function testGetTransferLogEvent() + { + $pairInfo = $this->aelf->generateKeyPairInfo(); + + $toAddress = new Address(); + $toAddressStr = $pairInfo['address']; + $toAddress -> setValue(decodeChecked($toAddressStr)); + $methodName = "Transfer"; + $param = new TransferInput(); + $param -> setMemo('transfer'); + $param -> setTo($toAddress); + $param -> setAmount(10); + $param -> setSymbol('ELF'); + + $contractNames = new Hash(); + $contractNames->setValue(hex2bin(sha256('AElf.ContractNames.Token'))); + $tokenContractAddress = $this->aelf->getContractAddressByName($this->privateKey, $contractNames); + + $transaction = $this->buildTransaction($tokenContractAddress, $methodName, $param); + $executeTransactionDtoObj = ['RawTransaction' => bin2hex($transaction->serializeToString())]; + $result = $this->aelf->sendTransaction($executeTransactionDtoObj); + + $this->assertTrue(!empty($result)); + print_r($result['TransactionId']); + time() . sleep(8); + $logEvents = $this->aelf->getTransferred($this->privateKey, $result['TransactionId']); + + var_dump($logEvents); + + $this->assertEquals($logEvents[0]['amount'], 10); + $this->assertEquals($logEvents[0]['symbol'],'ELF'); + $this->assertEquals($logEvents[0]['memo'],'transfer'); + $this->assertEquals($logEvents[0]['to'],$pairInfo['address']); } + private function buildTransaction($toaddress, $methodName, $params) { $transactionObj = $this->aelf->generateTransaction($this->address, $toaddress, $methodName, $params);