|
@@ -73,7 +73,8 @@ type
|
|
class function ChangeKeyFinalizeAndDisplayMessage(const AOperationsTxt, AOperationToString: string; ANoOfOperations: integer; APublicKey: TAccountKey; ATotalFee: int64; AOperationsHashTree: TOperationsHashTree; var AErrorMessage: string): boolean; static;
|
|
class function ChangeKeyFinalizeAndDisplayMessage(const AOperationsTxt, AOperationToString: string; ANoOfOperations: integer; APublicKey: TAccountKey; ATotalFee: int64; AOperationsHashTree: TOperationsHashTree; var AErrorMessage: string): boolean; static;
|
|
class function UpdateChangeKeyPayload(const ASenderAccount: TAccount; const APublicKey: TAccountKey; const APayloadEncryptionMode: TExecuteOperationsModel.TPayloadEncryptionMode; const APayloadContent: string; var AEncodedPayloadBytes: TRawBytes; const APayloadEncryptionPassword: string; var AErrorMessage: string): boolean;
|
|
class function UpdateChangeKeyPayload(const ASenderAccount: TAccount; const APublicKey: TAccountKey; const APayloadEncryptionMode: TExecuteOperationsModel.TPayloadEncryptionMode; const APayloadContent: string; var AEncodedPayloadBytes: TRawBytes; const APayloadEncryptionPassword: string; var AErrorMessage: string): boolean;
|
|
public
|
|
public
|
|
- class function GetOperationShortText(const OpType, OpSubType : DWord) : AnsiString; static; inline;
|
|
|
|
|
|
+ class function ExecuteOperations(const ANewOps: TExecuteOperationsModel; AHandler: TExecuteOperationsModel.TOperationExecuteResultHandler; var errors: ansistring): boolean; static;
|
|
|
|
+ class function GetOperationShortText(const OpType, OpSubType: DWord): ansistring; static; inline;
|
|
class function ExecuteSendPASC(const ASelectedAccounts: TArray<TAccount>; const ADestinationAccount, ASignerAccount: TAccount; AAmount, AFee: int64; const ASendPASCMode: TExecuteOperationsModel.TSendPASCMode; const APayloadEncryptionMode: TExecuteOperationsModel.TPayloadEncryptionMode; const APayloadContent, APayloadEncryptionPassword: string; var AErrorMessage: string): boolean; static;
|
|
class function ExecuteSendPASC(const ASelectedAccounts: TArray<TAccount>; const ADestinationAccount, ASignerAccount: TAccount; AAmount, AFee: int64; const ASendPASCMode: TExecuteOperationsModel.TSendPASCMode; const APayloadEncryptionMode: TExecuteOperationsModel.TPayloadEncryptionMode; const APayloadContent, APayloadEncryptionPassword: string; var AErrorMessage: string): boolean; static;
|
|
class function ExecuteChangeKey(const ASelectedAccounts: TArray<TAccount>; const ASignerAccount: TAccount; APublicKey: TAccountKey; AFee: int64; const APayloadEncryptionMode: TExecuteOperationsModel.TPayloadEncryptionMode; const APayloadContent, APayloadEncryptionPassword: string; var AErrorMessage: string): boolean; static;
|
|
class function ExecuteChangeKey(const ASelectedAccounts: TArray<TAccount>; const ASignerAccount: TAccount; APublicKey: TAccountKey; AFee: int64; const APayloadEncryptionMode: TExecuteOperationsModel.TPayloadEncryptionMode; const APayloadContent, APayloadEncryptionPassword: string; var AErrorMessage: string): boolean; static;
|
|
class procedure ExecuteEnlistAccountForSale(); static;
|
|
class procedure ExecuteEnlistAccountForSale(); static;
|
|
@@ -83,20 +84,20 @@ type
|
|
|
|
|
|
TOrderedAccountKeysListHelper = class helper for TOrderedAccountKeysList
|
|
TOrderedAccountKeysListHelper = class helper for TOrderedAccountKeysList
|
|
public
|
|
public
|
|
- function GetBalance(IncludePending : boolean = false) : TBalanceSummary;
|
|
|
|
- function GetAccounts(IncludePending : boolean = false) : TArray<TAccount>;
|
|
|
|
- function GetAccountNumbers : TArray<Cardinal>;
|
|
|
|
|
|
+ function GetBalance(IncludePending: boolean = False): TBalanceSummary;
|
|
|
|
+ function GetAccounts(IncludePending: boolean = False): TArray<TAccount>;
|
|
|
|
+ function GetAccountNumbers: TArray<cardinal>;
|
|
end;
|
|
end;
|
|
|
|
|
|
{ TSafeBoxHelper }
|
|
{ TSafeBoxHelper }
|
|
|
|
|
|
TSafeBoxHelper = class helper for TPCSafeBox
|
|
TSafeBoxHelper = class helper for TPCSafeBox
|
|
private
|
|
private
|
|
- function GetBalanceInternal(const AKeys: array of TAccountKey; IncludePending : boolean = false): TBalanceSummary;
|
|
|
|
|
|
+ function GetBalanceInternal(const AKeys: array of TAccountKey; IncludePending: boolean = False): TBalanceSummary;
|
|
public
|
|
public
|
|
function GetModifiedAccounts(const AAccounts: array of TAccount): TArray<TAccount>;
|
|
function GetModifiedAccounts(const AAccounts: array of TAccount): TArray<TAccount>;
|
|
- function GetBalance(const AKey: TAccountKey; IncludePending : boolean = false): TBalanceSummary; overload;
|
|
|
|
- function GetBalance(const AKeys: array of TAccountKey; IncludePending : boolean = false): TBalanceSummary; overload;
|
|
|
|
|
|
+ function GetBalance(const AKey: TAccountKey; IncludePending: boolean = False): TBalanceSummary; overload;
|
|
|
|
+ function GetBalance(const AKeys: array of TAccountKey; IncludePending: boolean = False): TBalanceSummary; overload;
|
|
end;
|
|
end;
|
|
|
|
|
|
{ TNodeHelper }
|
|
{ TNodeHelper }
|
|
@@ -379,8 +380,15 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-class function TOperationsManager.GetOperationShortText(const OpType,
|
|
|
|
- OpSubType: DWord): AnsiString;
|
|
|
|
|
|
+class function TOperationsManager.ExecuteOperations(
|
|
|
|
+ const ANewOps: TExecuteOperationsModel;
|
|
|
|
+ AHandler: TExecuteOperationsModel.TOperationExecuteResultHandler;
|
|
|
|
+ var errors: ansistring): boolean;
|
|
|
|
+begin
|
|
|
|
+
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+class function TOperationsManager.GetOperationShortText(const OpType, OpSubType: DWord): ansistring;
|
|
begin
|
|
begin
|
|
Result := TCellRenderers.OperationShortText(OpType, OpSubType);
|
|
Result := TCellRenderers.OperationShortText(OpType, OpSubType);
|
|
end;
|
|
end;
|
|
@@ -522,12 +530,7 @@ begin
|
|
|
|
|
|
end;
|
|
end;
|
|
|
|
|
|
-class function TOperationsManager.ExecuteChangeKey(
|
|
|
|
- const ASelectedAccounts: TArray<TAccount>; const ASignerAccount: TAccount;
|
|
|
|
- APublicKey: TAccountKey; AFee: int64;
|
|
|
|
- const APayloadEncryptionMode: TExecuteOperationsModel.TPayloadEncryptionMode;
|
|
|
|
- const APayloadContent, APayloadEncryptionPassword: string;
|
|
|
|
- var AErrorMessage: string): boolean;
|
|
|
|
|
|
+class function TOperationsManager.ExecuteChangeKey(const ASelectedAccounts: TArray<TAccount>; const ASignerAccount: TAccount; APublicKey: TAccountKey; AFee: int64; const APayloadEncryptionMode: TExecuteOperationsModel.TPayloadEncryptionMode; const APayloadContent, APayloadEncryptionPassword: string; var AErrorMessage: string): boolean;
|
|
var
|
|
var
|
|
LWalletKey: TWalletKey;
|
|
LWalletKey: TWalletKey;
|
|
LWalletKeys: TWalletKeys;
|
|
LWalletKeys: TWalletKeys;
|
|
@@ -540,7 +543,8 @@ var
|
|
LIdx, LAccountIdx, LSignerNoOfOperations: integer;
|
|
LIdx, LAccountIdx, LSignerNoOfOperations: integer;
|
|
LCurrentAccount, LSignerAccount: TAccount;
|
|
LCurrentAccount, LSignerAccount: TAccount;
|
|
LPayloadEncodedBytes: TRawBytes;
|
|
LPayloadEncodedBytes: TRawBytes;
|
|
- label loop_start;
|
|
|
|
|
|
+label
|
|
|
|
+ loop_start;
|
|
begin
|
|
begin
|
|
if Length(ASelectedAccounts) = 0 then
|
|
if Length(ASelectedAccounts) = 0 then
|
|
begin
|
|
begin
|
|
@@ -732,50 +736,54 @@ end;
|
|
|
|
|
|
{ TOrderedAccountKeysListHelper }
|
|
{ TOrderedAccountKeysListHelper }
|
|
|
|
|
|
-function TOrderedAccountKeysListHelper.GetBalance(IncludePending : boolean = false) : TBalanceSummary;
|
|
|
|
|
|
+function TOrderedAccountKeysListHelper.GetBalance(IncludePending: boolean = False): TBalanceSummary;
|
|
var
|
|
var
|
|
- i : Integer;
|
|
|
|
- LAccs : TArray<TAccount>;
|
|
|
|
|
|
+ i: integer;
|
|
|
|
+ LAccs: TArray<TAccount>;
|
|
begin
|
|
begin
|
|
Result := CT_BalanceSummary_Nil;
|
|
Result := CT_BalanceSummary_Nil;
|
|
LAccs := Self.GetAccounts(IncludePending);
|
|
LAccs := Self.GetAccounts(IncludePending);
|
|
- for i := Low(LAccs) to High(LAccs) do begin
|
|
|
|
|
|
+ for i := Low(LAccs) to High(LAccs) do
|
|
|
|
+ begin
|
|
Inc(Result.TotalPASA);
|
|
Inc(Result.TotalPASA);
|
|
Inc(Result.TotalPASC, LAccs[i].Balance);
|
|
Inc(Result.TotalPASC, LAccs[i].Balance);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TOrderedAccountKeysListHelper.GetAccounts(IncludePending : boolean = false) : TArray<TAccount>;
|
|
|
|
|
|
+function TOrderedAccountKeysListHelper.GetAccounts(IncludePending: boolean = False): TArray<TAccount>;
|
|
var
|
|
var
|
|
- i, j : integer;
|
|
|
|
- LAccs : TList<TAccount>;
|
|
|
|
- LAcc : TAccount;
|
|
|
|
- LList : TOrderedCardinalList;
|
|
|
|
- Disposables : TDisposables;
|
|
|
|
-begin
|
|
|
|
- LAccs := Disposables.AddObject( TList<TAccount>.Create ) as TList<TAccount>;
|
|
|
|
- for i := 0 to Self.Count - 1 do begin
|
|
|
|
|
|
+ i, j: integer;
|
|
|
|
+ LAccs: TList<TAccount>;
|
|
|
|
+ LAcc: TAccount;
|
|
|
|
+ LList: TOrderedCardinalList;
|
|
|
|
+ Disposables: TDisposables;
|
|
|
|
+begin
|
|
|
|
+ LAccs := Disposables.AddObject(TList<TAccount>.Create) as TList<TAccount>;
|
|
|
|
+ for i := 0 to Self.Count - 1 do
|
|
|
|
+ begin
|
|
LList := Self.AccountKeyList[i];
|
|
LList := Self.AccountKeyList[i];
|
|
- for j := 0 to LList.Count - 1 do begin
|
|
|
|
|
|
+ for j := 0 to LList.Count - 1 do
|
|
|
|
+ begin
|
|
if IncludePending then
|
|
if IncludePending then
|
|
LAcc := TNode.Node.Operations.SafeBoxTransaction.Account(j)
|
|
LAcc := TNode.Node.Operations.SafeBoxTransaction.Account(j)
|
|
else
|
|
else
|
|
- LAcc := TNode.Node.Bank.SafeBox.Account(LList.Get(j));
|
|
|
|
|
|
+ LAcc := TNode.Node.Bank.SafeBox.Account(LList.Get(j));
|
|
LAccs.Add(LAcc);
|
|
LAccs.Add(LAcc);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
Result := LAccs.ToArray;
|
|
Result := LAccs.ToArray;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TOrderedAccountKeysListHelper.GetAccountNumbers : TArray<Cardinal>;
|
|
|
|
|
|
+function TOrderedAccountKeysListHelper.GetAccountNumbers: TArray<cardinal>;
|
|
var
|
|
var
|
|
- i, j : integer;
|
|
|
|
- LAccs : TList<Cardinal>;
|
|
|
|
- LList : TOrderedCardinalList;
|
|
|
|
- Disposables : TDisposables;
|
|
|
|
|
|
+ i, j: integer;
|
|
|
|
+ LAccs: TList<cardinal>;
|
|
|
|
+ LList: TOrderedCardinalList;
|
|
|
|
+ Disposables: TDisposables;
|
|
begin
|
|
begin
|
|
- LAccs := Disposables.AddObject( TList<Cardinal>.Create ) as TList<Cardinal>;
|
|
|
|
- for i := 0 to Self.Count - 1 do begin
|
|
|
|
|
|
+ LAccs := Disposables.AddObject(TList<cardinal>.Create) as TList<cardinal>;
|
|
|
|
+ for i := 0 to Self.Count - 1 do
|
|
|
|
+ begin
|
|
LList := Self.AccountKeyList[i];
|
|
LList := Self.AccountKeyList[i];
|
|
for j := 0 to LList.Count - 1 do
|
|
for j := 0 to LList.Count - 1 do
|
|
LAccs.Add(j);
|
|
LAccs.Add(j);
|
|
@@ -838,7 +846,8 @@ begin
|
|
|
|
|
|
// Build the results
|
|
// Build the results
|
|
Result := CT_BalanceSummary_Nil;
|
|
Result := CT_BalanceSummary_Nil;
|
|
- for LAcc in LAccs do begin
|
|
|
|
|
|
+ for LAcc in LAccs do
|
|
|
|
+ begin
|
|
Inc(Result.TotalPASA);
|
|
Inc(Result.TotalPASA);
|
|
Inc(Result.TotalPASC, LAcc.Balance);
|
|
Inc(Result.TotalPASC, LAcc.Balance);
|
|
end;
|
|
end;
|