33interface
44
55uses
6- UFRMWallet, Classes;
6+ UFRMWallet, Classes, UBlockChain ;
77
88type
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-
2326implementation
2427
2528uses
26- UPCDataTypes, UJSONFunctions, SysUtils, UAccounts, UBaseTypes, URPC;
29+ UPCDataTypes, UJSONFunctions, SysUtils, UAccounts, UBaseTypes, URPC,
30+ UEPasa, UTxMultiOperation, UCrypto, UEPasaDecoder;
2731
2832class procedure TFRMWalletInformation.FillAccountInformation
2933(
@@ -117,5 +121,66 @@ class procedure TFRMWalletInformation.FillAccountInformation
117121
118122end ;
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
121186end .
0 commit comments