Delphereum is a Delphi interface to the
Ethereum, but one must choose proper Delphi version to compile projects in learning.
Unit scope names are prefixes that are prepended to unit names, this feature appeared in
Delphi XE2 (VER230).
Delpherium uses
Unit scope names, for example,
web3.eth.
That means Delphi version must be XE2 or higher.
Rudy Velthuis, one of the co-author, writes in comments section in the heads of units "Delphi version XE2 or later".
Well, but in unit
web3.json.pas Stefan van As uses inline variable declarations, for instance,
var I := value.EstimatedByteSize;
such syntax appeared only in
Delphi 10.3 Rio (VER330)!
Now I have a choice: either to update Delphi to a version higher than
10.2 Tokyo, or try to correct the sources using conditional compile directives, hiding variable declarations inside lines for versions 230-320 and assuming a role of co-author, needless to say if such activity does not require a serious alteration of the sources, which can lead to other errors.
I am newbie in
Delphereum, but not newbie in programming, and I foresee the effect of editing someone's code when you are not good at a subject area.
First I will write to the author,
Stefan van As, perhaps, his opinion will be useful or decisive.
unit
web3.coincap;
In
Delphi XE6 System.NetEncoding in
Uses clause was not resolved.
In
Delphi XE7 appeared.
Again
unit
web3.coincap;
There was
System.Types.IAsyncResult neither in
Delphi XE6 nor in
Delphi XE7.
Present in
Delphi XE8, and is in
Embarcadero Delphi 11 Alexandria for certain.
I decided to refuse from
directive {$IFEND}, leaving the only {$ENDIF} and remove the conditional compilation directive
{$LEGACYIFEND ON} at the beginning of the units. I only managed to spoil it with my edits in
web3.json.
web3.json unit has copyright (c) 2018 of
Stefan van As.
The directive
{$ENDIF} was introduced in
Delphi XE4, but versions earlier than
Delphi X4 with
{$IFEND} are out for
Delpherium, because now I found out, that at least
Delphi XE8 is to continue.
Delphi XE8 and unit
web3.http
'THTTPClient' does not contain a member named 'BeginGet'...
'THTTPClient' does not contain a member named 'EndAsyncHttp'...
'THTTPClient' does not contain a member named 'StatusCode'...
In
Delphi 10.2 Tokyo there appeared:
functions
BeginGet,
EndAsyncHTTP and property
StatusCode
in
THTTPClient, unit
System.Net.HttpClientent.
But the
Delphi 10.2 Tokyo compiler in gave out the next errors, unit
web3.http:
E2250 There is no overloaded version of 'get' that can be called with these arguments
in function call
const response = get(URL, [TNetHeader.Create('Content-Type', 'application/json')], backoff);
Embarcadero Delphi 10.3 Rio brings
inline variable declarations and now there is no need to insert compiler directives, where
inline variable declarations were.
Units web3.http, web3.coincap, web3.json, web3.sync were replaced with original copies.
But the
Delphi 10.3 failed to compile, reported two errors in unit
web3.coincap:
[dcc32 Error] E2149 Class does not have a default property
in line:
Result := TAsset.Create(TJsonArray(FJsonValue)[Index]);
Class - TJSONArray.
and
[dcc32 Error] E2010 Incompatible types: 'IAsyncResult' and 'web3.IResult'
in
function assets(const callback: TProc, IError>): IAsyncResult;
Embarcadero Delphi 10.4 complied and launched the project
Connecting Delphi to a local (in-memory) blockchain
Summing up!
Delphereum with the first example
Connecting Delphi to a local (in-memory) blockchain was test in
Embarcadero Delphi XE6,
Delphi XE7,
Delphi XE8,
Delphi 10.2 Tokyo,
Delphi 10.3 Rio,
Delphi 10.4 Sydney,
Delphi 11.3 Alexandria.
Delphereum can be compiled and run in
Embarcadero Delphi 10.4 Sydney or
Delphi 11.3 Alexandria environment.
I got an idea it is wrong for
Delphereum to be without a logo and me proposed it.
P.S.
Thanks to my schoolkid son for giving me his old computer for testing.
Made the
github repositories for source code examples for Ethereum for Delphi Developers (Ethereum programming on Embarcadero Technologies Delphi). All of this was possible due to tutorials of Stefan van As