Skip to content

Commit d61475e

Browse files
committed
FillOperationInformation -> TFRMWalletInformation
1 parent b55ef65 commit d61475e

File tree

5 files changed

+84
-74
lines changed

5 files changed

+84
-74
lines changed

src/gui-classic/UFRMWallet.dfm

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ object FRMWallet: TFRMWallet
3737
ExplicitWidth = 865
3838
inherited Panel1: TPanel
3939
inherited Image1: TImage
40+
Width = 71
41+
Height = 104
4042
ExplicitWidth = 75
4143
ExplicitHeight = 104
4244
end
@@ -175,11 +177,11 @@ object FRMWallet: TFRMWallet
175177
Height = 421
176178
Align = alClient
177179
TabOrder = 0
178-
ExplicitWidth = 857
179-
ExplicitHeight = 421
180+
ExplicitWidth = 296
181+
ExplicitHeight = 42
180182
inherited Panel2: TPanel
181183
Width = 857
182-
ExplicitWidth = 857
184+
ExplicitWidth = 296
183185
end
184186
inherited dgBlockChainExplorer: TDrawGrid
185187
Width = 857
@@ -317,8 +319,8 @@ object FRMWallet: TFRMWallet
317319
Height = 421
318320
Align = alClient
319321
TabOrder = 0
320-
ExplicitWidth = 857
321-
ExplicitHeight = 421
322+
ExplicitWidth = 296
323+
ExplicitHeight = 42
322324
inherited Splitter1: TSplitter
323325
Top = 168
324326
Width = 857
@@ -328,8 +330,8 @@ object FRMWallet: TFRMWallet
328330
inherited PanelBottom: TPanel
329331
Top = 171
330332
Width = 857
331-
ExplicitTop = 171
332-
ExplicitWidth = 857
333+
ExplicitTop = -208
334+
ExplicitWidth = 296
333335
inherited Panel1: TPanel
334336
Width = 857
335337
ExplicitWidth = 857
@@ -342,7 +344,7 @@ object FRMWallet: TFRMWallet
342344
inherited PanelTop: TPanel
343345
Width = 857
344346
Height = 168
345-
ExplicitWidth = 857
347+
ExplicitWidth = 296
346348
ExplicitHeight = 168
347349
inherited Splitter2: TSplitter
348350
Height = 168
@@ -359,7 +361,7 @@ object FRMWallet: TFRMWallet
359361
inherited PanelRight: TPanel
360362
Width = 566
361363
Height = 168
362-
ExplicitWidth = 566
364+
ExplicitWidth = 5
363365
ExplicitHeight = 168
364366
inherited memoMessageToSend: TMemo
365367
Width = 566

src/gui-classic/UFRMWallet.pas

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ TFRMWallet = class(TForm)
131131
FBackgroundLabel : TLabel;
132132
Procedure FinishedLoadingApp;
133133
// Procedure FillAccountInformation(Const Strings : TStrings; Const AccountNumber : Cardinal);
134-
Procedure FillOperationInformation(Const Strings : TStrings; Const OperationResume : TOperationResume);
135134
Procedure InitMacOSMenu;
136135
protected
137136
{ Private declarations }
@@ -687,64 +686,6 @@ procedure TFRMWallet.FinishedLoadingApp;
687686
end;
688687
end;
689688

690-
procedure TFRMWallet.FillOperationInformation(const Strings: TStrings;
691-
const OperationResume: TOperationResume);
692-
var i : Integer;
693-
jsonObj : TPCJSONObject;
694-
LEPASA : TEPasa;
695-
begin
696-
If (not OperationResume.valid) then exit;
697-
If OperationResume.Block<FNode.Bank.BlocksCount then
698-
if (OperationResume.NOpInsideBlock>=0) then begin
699-
Strings.Add(Format('Block: %d/%d',[OperationResume.Block,OperationResume.NOpInsideBlock]))
700-
end else begin
701-
Strings.Add(Format('Block: %d',[OperationResume.Block]))
702-
end
703-
else Strings.Add('** Pending operation not included on blockchain **');
704-
Strings.Add(Format('%s',[OperationResume.OperationTxt]));
705-
If (OperationResume.isMultiOperation) then begin
706-
Strings.Add('Multioperation:');
707-
For i := 0 to High(OperationResume.Senders) do begin
708-
Strings.Add(Format(' Sender (%d/%d): %s %s PASC Payload(%d):%s',[i+1,length(OperationResume.Senders),TAccountComp.AccountNumberToAccountTxtNumber(OperationResume.Senders[i].Account),TAccountComp.FormatMoney(OperationResume.Senders[i].Amount),OperationResume.Senders[i].Payload.payload_type,OperationResume.Senders[i].Payload.payload_raw.ToHexaString]));
709-
end;
710-
For i := 0 to High(OperationResume.Receivers) do begin
711-
Strings.Add(Format(' Receiver (%d/%d): %s %s PASC Payload(%d):%s',[i+1,length(OperationResume.Receivers),TAccountComp.AccountNumberToAccountTxtNumber(OperationResume.Receivers[i].Account),TAccountComp.FormatMoney(OperationResume.Receivers[i].Amount),OperationResume.Receivers[i].Payload.payload_type,OperationResume.Receivers[i].Payload.payload_raw.ToHexaString]));
712-
end;
713-
For i := 0 to High(OperationResume.Changers) do begin
714-
Strings.Add(Format(' Change info (%d/%d): %s [%s]',[i+1,length(OperationResume.Changers),TAccountComp.AccountNumberToAccountTxtNumber(OperationResume.Changers[i].Account),TOpMultiOperation.OpChangeAccountInfoTypesToText(OperationResume.Changers[i].Changes_type)]));
715-
end;
716-
717-
end;
718-
Strings.Add(Format('OpType:%d Subtype:%d',[OperationResume.OpType,OperationResume.OpSubtype]));
719-
Strings.Add(Format('Operation Hash (ophash): %s',[TCrypto.ToHexaString(OperationResume.OperationHash)]));
720-
If (Length(OperationResume.OperationHash_OLD)>0) then begin
721-
Strings.Add(Format('Old Operation Hash (old_ophash): %s',[TCrypto.ToHexaString(OperationResume.OperationHash_OLD)]));
722-
end;
723-
if TEPasaDecoder.TryDecodeEPASA(OperationResume.DestAccount,OperationResume.OriginalPayload,FNode,FWalletKeys,Nil,LEPASA) then begin
724-
Strings.Add('EPASA: '+LEPASA.ToString);
725-
end else Strings.Add('No EPASA format');
726-
Strings.Add(Format('Payload type:%s length:%d',['0x'+IntToHex(OperationResume.OriginalPayload.payload_type,2), length(OperationResume.OriginalPayload.payload_raw)]));
727-
if (Length(OperationResume.OriginalPayload.payload_raw)>0) then begin
728-
If OperationResume.PrintablePayload<>'' then begin
729-
Strings.Add(Format('Payload (human): %s',[OperationResume.PrintablePayload]));
730-
end;
731-
Strings.Add(Format('Payload (Hexadecimal): %s',[TCrypto.ToHexaString(OperationResume.OriginalPayload.payload_raw)]));
732-
end;
733-
If OperationResume.Balance>=0 then begin
734-
Strings.Add(Format('Final balance: %s',[TAccountComp.FormatMoney(OperationResume.Balance)]));
735-
end;
736-
jsonObj := TPCJSONObject.Create;
737-
Try
738-
TPascalCoinJSONComp.FillOperationObject(OperationResume,FNode.Bank.BlocksCount,
739-
FNode,FWalletKeys,Nil,
740-
jsonObj);
741-
Strings.Add('OPERATION JSON:');
742-
Strings.Add(jsonObj.ToJSON(False));
743-
Finally
744-
jsonObj.Free;
745-
end;
746-
end;
747-
748689
procedure TFRMWallet.MiOperationsExplorerClick(Sender: TObject);
749690
begin
750691
With TFRMOperationsExplorer.Create(Self) do
@@ -877,7 +818,7 @@ procedure TFRMWallet.MiAccountInformationClick(Sender: TObject);
877818
if accn>=0 then strings.Add('')
878819
else title := 'Operation info';
879820
strings.Add('Operation info:');
880-
FillOperationInformation(strings,opr);
821+
TFRMWalletInformation.FillOperationInformation(strings,opr);
881822
end else if accn<0 then Raise Exception.Create('No info available');
882823
F := TFRMMemoText.Create(Self);
883824
Try

src/gui-classic/UFRMWalletInformation.pas

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
interface
44

55
uses
6-
UFRMWallet, Classes;
6+
UFRMWallet, Classes, UBlockChain;
77

88
type
99
TFRMWalletInformation = class
@@ -16,14 +16,18 @@ TFRMWalletInformation = class
1616
const AccountNumber: Cardinal
1717
);
1818

19+
class procedure FillOperationInformation
20+
(
21+
const Strings: TStrings;
22+
const OperationResume: TOperationResume
23+
);
1924
end;
2025

21-
22-
2326
implementation
2427

2528
uses
26-
UPCDataTypes, UJSONFunctions, SysUtils, UAccounts, UBaseTypes, URPC;
29+
UPCDataTypes, UJSONFunctions, SysUtils, UAccounts, UBaseTypes, URPC,
30+
UEPasa, UTxMultiOperation, UCrypto, UEPasaDecoder;
2731

2832
class procedure TFRMWalletInformation.FillAccountInformation
2933
(
@@ -117,5 +121,66 @@ class procedure TFRMWalletInformation.FillAccountInformation
117121

118122
end;
119123

124+
class procedure TFRMWalletInformation.FillOperationInformation
125+
(
126+
const Strings: TStrings;
127+
const OperationResume: TOperationResume
128+
);
129+
var i : Integer;
130+
jsonObj : TPCJSONObject;
131+
LEPASA : TEPasa;
132+
begin
133+
If (not OperationResume.valid) then exit;
134+
If OperationResume.Block<FRMWallet.Node.Bank.BlocksCount then
135+
if (OperationResume.NOpInsideBlock>=0) then begin
136+
Strings.Add(Format('Block: %d/%d',[OperationResume.Block,OperationResume.NOpInsideBlock]))
137+
end else begin
138+
Strings.Add(Format('Block: %d',[OperationResume.Block]))
139+
end
140+
else Strings.Add('** Pending operation not included on blockchain **');
141+
Strings.Add(Format('%s',[OperationResume.OperationTxt]));
142+
If (OperationResume.isMultiOperation) then begin
143+
Strings.Add('Multioperation:');
144+
For i := 0 to High(OperationResume.Senders) do begin
145+
Strings.Add(Format(' Sender (%d/%d): %s %s PASC Payload(%d):%s',[i+1,length(OperationResume.Senders),TAccountComp.AccountNumberToAccountTxtNumber(OperationResume.Senders[i].Account),TAccountComp.FormatMoney(OperationResume.Senders[i].Amount),OperationResume.Senders[i].Payload.payload_type,OperationResume.Senders[i].Payload.payload_raw.ToHexaString]));
146+
end;
147+
For i := 0 to High(OperationResume.Receivers) do begin
148+
Strings.Add(Format(' Receiver (%d/%d): %s %s PASC Payload(%d):%s',[i+1,length(OperationResume.Receivers),TAccountComp.AccountNumberToAccountTxtNumber(OperationResume.Receivers[i].Account),TAccountComp.FormatMoney(OperationResume.Receivers[i].Amount),OperationResume.Receivers[i].Payload.payload_type,OperationResume.Receivers[i].Payload.payload_raw.ToHexaString]));
149+
end;
150+
For i := 0 to High(OperationResume.Changers) do begin
151+
Strings.Add(Format(' Change info (%d/%d): %s [%s]',[i+1,length(OperationResume.Changers),TAccountComp.AccountNumberToAccountTxtNumber(OperationResume.Changers[i].Account),TOpMultiOperation.OpChangeAccountInfoTypesToText(OperationResume.Changers[i].Changes_type)]));
152+
end;
153+
154+
end;
155+
Strings.Add(Format('OpType:%d Subtype:%d',[OperationResume.OpType,OperationResume.OpSubtype]));
156+
Strings.Add(Format('Operation Hash (ophash): %s',[TCrypto.ToHexaString(OperationResume.OperationHash)]));
157+
If (Length(OperationResume.OperationHash_OLD)>0) then begin
158+
Strings.Add(Format('Old Operation Hash (old_ophash): %s',[TCrypto.ToHexaString(OperationResume.OperationHash_OLD)]));
159+
end;
160+
if TEPasaDecoder.TryDecodeEPASA(OperationResume.DestAccount,OperationResume.OriginalPayload,FRMWallet.Node,FRMWallet.WalletKeys,Nil,LEPASA) then begin
161+
Strings.Add('EPASA: '+LEPASA.ToString);
162+
end else Strings.Add('No EPASA format');
163+
Strings.Add(Format('Payload type:%s length:%d',['0x'+IntToHex(OperationResume.OriginalPayload.payload_type,2), length(OperationResume.OriginalPayload.payload_raw)]));
164+
if (Length(OperationResume.OriginalPayload.payload_raw)>0) then begin
165+
If OperationResume.PrintablePayload<>'' then begin
166+
Strings.Add(Format('Payload (human): %s',[OperationResume.PrintablePayload]));
167+
end;
168+
Strings.Add(Format('Payload (Hexadecimal): %s',[TCrypto.ToHexaString(OperationResume.OriginalPayload.payload_raw)]));
169+
end;
170+
If OperationResume.Balance>=0 then begin
171+
Strings.Add(Format('Final balance: %s',[TAccountComp.FormatMoney(OperationResume.Balance)]));
172+
end;
173+
jsonObj := TPCJSONObject.Create;
174+
Try
175+
TPascalCoinJSONComp.FillOperationObject(OperationResume,FRMWallet.Node.Bank.BlocksCount,
176+
FRMWallet.Node,FRMWallet.WalletKeys,Nil,
177+
jsonObj);
178+
Strings.Add('OPERATION JSON:');
179+
Strings.Add(jsonObj.ToJSON(False));
180+
Finally
181+
jsonObj.Free;
182+
end;
183+
end;
184+
120185

121186
end.

src/pascalcoin_wallet_classic.dpr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ uses
101101
UFrameInfo in 'gui-classic\Frames\UFrameInfo.pas' {FrameInfo: TFrame},
102102
UFRMWalletUserMessages in 'gui-classic\UFRMWalletUserMessages.pas',
103103
UFRMWalletInformation in 'gui-classic\UFRMWalletInformation.pas',
104-
UJSONFunctions in 'libraries\pascalcoin\UJSONFunctions.pas';
104+
UJSONFunctions in 'libraries\pascalcoin\UJSONFunctions.pas',
105+
UEPasaDecoder in 'core\UEPasaDecoder.pas';
105106

106107
{$R *.res}
107108

src/pascalcoin_wallet_classic.dproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@
282282
<DCCReference Include="gui-classic\UFRMWalletUserMessages.pas"/>
283283
<DCCReference Include="gui-classic\UFRMWalletInformation.pas"/>
284284
<DCCReference Include="libraries\pascalcoin\UJSONFunctions.pas"/>
285+
<DCCReference Include="core\UEPasaDecoder.pas"/>
285286
<None Include="config.inc"/>
286287
<BuildConfiguration Include="Debug">
287288
<Key>Cfg_2</Key>

0 commit comments

Comments
 (0)