forked from Militereum/Militereum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunverified.pas
78 lines (66 loc) · 1.78 KB
/
unverified.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
unit unverified;
interface
uses
// Delphi
System.Classes,
System.SysUtils,
// FireMonkey
FMX.Controls,
FMX.Controls.Presentation,
FMX.Objects,
FMX.StdCtrls,
FMX.Types,
// web3
web3,
// project
base,
transaction;
type
TFrmUnverified = class(TFrmBase)
lblTitle: TLabel;
lblContractText: TLabel;
Label1: TLabel;
Label2: TLabel;
procedure lblContractTextClick(Sender: TObject);
strict private
procedure SetContract(value: TAddress);
public
property Contract: TAddress write SetContract;
end;
procedure show(const chain: TChain; const tx: transaction.ITransaction; const contract: TAddress; const callback: TProc<Boolean>; const log: TLog);
implementation
uses
// project
cache,
common,
thread;
{$R *.fmx}
procedure show(const chain: TChain; const tx: transaction.ITransaction; const contract: TAddress; const callback: TProc<Boolean>; const log: TLog);
begin
const frmUnverified = TFrmUnverified.Create(chain, tx, callback, log);
frmUnverified.Contract := contract;
frmUnverified.Show;
end;
{ TFrmUnverified }
procedure TFrmUnverified.SetContract(value: TAddress);
begin
lblContractText.Text := string(value);
cache.getFriendlyName(Self.Chain, value, procedure(friendly: string; err: IError)
begin
if Assigned(err) then Self.Log(err) else thread.synchronize(procedure
begin
lblContractText.Text := friendly;
end);
end);
end;
procedure TFrmUnverified.lblContractTextClick(Sender: TObject);
begin
cache.fromName(lblContractText.Text, procedure(address: TAddress; err: IError)
begin
if not Assigned(err) then
common.Open(Self.Chain.Explorer + '/address/' + string(address) + '#code')
else
common.Open(Self.Chain.Explorer + '/address/' + lblContractText.Text + '#code');
end);
end;
end.