Selaa lähdekoodia

BUG: Remove dangling source files and fix some bugs

Herman Schoenfeld 7 vuotta sitten
vanhempi
commit
04b329fc1d
43 muutettua tiedostoa jossa 55 lisäystä ja 4056 poistoa
  1. 0 2
      src/core.utils/UDataSources.pas
  2. 0 34
      src/gui/wizards/UWIZAddKey_SelectEncryption.lfm
  3. 0 81
      src/gui/wizards/UWIZAddKey_SelectEncryption.pas
  4. 0 66
      src/gui/wizards/UWIZAddKey_Start.lfm
  5. 0 55
      src/gui/wizards/UWIZAddKey_Start.pas
  6. 0 455
      src/gui/wizards/UWIZChangeAccountPrivateKey.pas
  7. 0 48
      src/gui/wizards/UWIZChangeAccountPrivateKey_Confirmation.lfm
  8. 0 144
      src/gui/wizards/UWIZChangeAccountPrivateKey_Confirmation.pas
  9. 0 106
      src/gui/wizards/UWIZChangeAccountPrivateKey_Transaction.lfm
  10. 0 210
      src/gui/wizards/UWIZChangeAccountPrivateKey_Transaction.pas
  11. 0 98
      src/gui/wizards/UWIZChangeAccountPrivateKey_TransactionPayload.lfm
  12. 0 84
      src/gui/wizards/UWIZChangeAccountPrivateKey_TransactionPayload.pas
  13. 0 431
      src/gui/wizards/UWIZSendPASC.pas
  14. 0 32
      src/gui/wizards/UWIZSendPASC_ConfirmSender.lfm
  15. 0 113
      src/gui/wizards/UWIZSendPASC_ConfirmSender.pas
  16. 0 64
      src/gui/wizards/UWIZSendPASC_Confirmation.lfm
  17. 0 144
      src/gui/wizards/UWIZSendPASC_Confirmation.pas
  18. 0 63
      src/gui/wizards/UWIZSendPASC_EnterQuantity.lfm
  19. 0 138
      src/gui/wizards/UWIZSendPASC_EnterQuantity.pas
  20. 0 151
      src/gui/wizards/UWIZSendPASC_Transaction.lfm
  21. 0 258
      src/gui/wizards/UWIZSendPASC_Transaction.pas
  22. 0 98
      src/gui/wizards/UWIZSendPASC_TransactionPayload.lfm
  23. 0 84
      src/gui/wizards/UWIZSendPASC_TransactionPayload.pas
  24. 0 451
      src/gui/wizards/UWIZTransferAccount.pas
  25. 0 48
      src/gui/wizards/UWIZTransferAccount_Confirmation.lfm
  26. 0 137
      src/gui/wizards/UWIZTransferAccount_Confirmation.pas
  27. 0 93
      src/gui/wizards/UWIZTransferAccount_Transaction.lfm
  28. 0 148
      src/gui/wizards/UWIZTransferAccount_Transaction.pas
  29. 0 98
      src/gui/wizards/UWIZTransferAccount_TransactionPayload.lfm
  30. 0 84
      src/gui/wizards/UWIZTransferAccount_TransactionPayload.pas
  31. 4 4
      src/gui/wizards/operations/UWIZChangeAccountPrivateKey.pas
  32. 9 10
      src/gui/wizards/operations/UWIZChangeAccountPrivateKey_Confirmation.pas
  33. 2 2
      src/gui/wizards/operations/UWIZChangeAccountPrivateKey_Transaction.pas
  34. 1 1
      src/gui/wizards/operations/UWIZEnlistAccountForSale_Transaction.lfm
  35. 1 1
      src/gui/wizards/operations/UWIZEnlistAccountForSale_Transaction.pas
  36. 1 0
      src/gui/wizards/operations/UWIZSendPASC_Confirmation.lfm
  37. 7 7
      src/gui/wizards/operations/UWIZSendPASC_Confirmation.pas
  38. 1 0
      src/gui/wizards/operations/UWIZSendPASC_EnterQuantity.lfm
  39. 1 1
      src/gui/wizards/operations/UWIZSendPASC_EnterQuantity.pas
  40. 4 4
      src/gui/wizards/operations/UWIZTransferAccount.pas
  41. 6 6
      src/gui/wizards/operations/UWIZTransferAccount_Confirmation.pas
  42. 2 2
      src/gui/wizards/operations/UWIZTransferAccount_Transaction.pas
  43. 16 0
      src/pascalcoin_wallet.lpi

+ 0 - 2
src/core.utils/UDataSources.pas

@@ -17,7 +17,6 @@ type
       function GetItemDisposePolicy : TDisposePolicy; override;
       function GetColumns : TDataColumns; override;
     public
-      function GetEntityKey(constref AItem: TAccount) : Variant; override;
       function GetItemField(constref AItem: TAccount; const ABindingName : AnsiString) : Variant; override;
   end;
 
@@ -60,7 +59,6 @@ type
       property TimeSpan : TTimeSpan read GetTimeSpan write SetTimeSpan;
       property StartBlock : Cardinal read FStart write FStart;
       property EndBlock : Cardinal read FEnd write FEnd;
-      function GetEntityKey(constref AItem: TOperationResume) : Variant; override;
       function GetItemField(constref AItem: TOperationResume; const ABindingName : AnsiString) : Variant; override;
   end;
 

+ 0 - 34
src/gui/wizards/UWIZAddKey_SelectEncryption.lfm

@@ -1,34 +0,0 @@
-object WIZAddKey_SelectEncryption: TWIZAddKey_SelectEncryption
-  Left = -1207
-  Height = 240
-  Top = 90
-  Width = 320
-  Caption = 'WIZAddKey_SelectEncryption'
-  ClientHeight = 240
-  ClientWidth = 320
-  OnCreate = FormCreate
-  LCLVersion = '1.8.2.0'
-  Visible = False
-  object rgKeyType: TRadioGroup
-    Left = 24
-    Height = 209
-    Top = 16
-    Width = 278
-    Anchors = [akTop, akLeft, akRight, akBottom]
-    AutoFill = True
-    Caption = 'Select the type of encryption:'
-    ChildSizing.LeftRightSpacing = 6
-    ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
-    ChildSizing.EnlargeVertical = crsHomogenousChildResize
-    ChildSizing.ShrinkHorizontal = crsScaleChilds
-    ChildSizing.ShrinkVertical = crsScaleChilds
-    ChildSizing.Layout = cclLeftToRightThenTopToBottom
-    ChildSizing.ControlsPerLine = 1
-    ClientHeight = 189
-    ClientWidth = 274
-    Items.Strings = (
-      'asdf'
-    )
-    TabOrder = 0
-  end
-end

+ 0 - 81
src/gui/wizards/UWIZAddKey_SelectEncryption.pas

@@ -1,81 +0,0 @@
-unit UWIZAddKey_SelectEncryption;
-
-{$mode delphi}
-
-interface
-
-uses
-  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, UWizard, UWIZAddKey, UWIZModels;
-
-type
-
-  { TWIZAddKey_SelectEncryption }
-
-  TWIZAddKey_SelectEncryption = class(TWizardForm<TWIZAddKeyModel>)
-    rgKeyType: TRadioGroup;
-    procedure FormCreate(Sender: TObject);
-    class function GetOptionText(const EC_OpenSSL_NID: Word): AnsiString;
-  public
-    procedure OnNext; override;
-    function Validate(out message : AnsiString) : boolean; override;
-  end;
-
-implementation
-
-{$R *.lfm}
-
-uses UAccounts, UConst, UMemory;
-
-{ TWIZAddKey_SelectEncryption }
-
-procedure TWIZAddKey_SelectEncryption.FormCreate(Sender: TObject);
-var
-  i : Integer;
-  GC : TDisposables;
-  availableEncryptionTypes : TList;
-  name, desc : UTF8String;
-begin
-  rgKeyType.Items.Clear;
-  availableEncryptionTypes := GC.AddObject( TList.Create ) as TList;
-  TAccountComp.ValidsEC_OpenSSL_NID(availableEncryptionTypes);
-  for i := 0 to availableEncryptionTypes.Count - 1 do begin
-    rgKeyType.Items.AddObject(GetOptionText(PtrInt(availableEncryptionTypes[i])),availableEncryptionTypes[i]);
-  end;
-end;
-
-procedure TWIZAddKey_SelectEncryption.OnNext;
-begin
-  Self.Model.EncryptionTypeNID := PtrInt(rgKeyType.Items.Objects[rgKeyType.ItemIndex]);
-end;
-
-function TWIZAddKey_SelectEncryption.Validate(out message : AnsiString) : boolean;
-begin
-  Result := true;
-  if rgKeyType.ItemIndex < 0 then begin
-    message := 'A type of encryption must be selected';
-    Result := false;
-  end;
-end;
-
-
-class function TWIZAddKey_SelectEncryption.GetOptionText(const EC_OpenSSL_NID: Word): AnsiString;
-begin
-  case EC_OpenSSL_NID of
-    CT_NID_secp256k1 : begin
-      Result := 'SECP256K1 - Cryptocurrency Standard (same as Bitcoin)';
-    end;
-    CT_NID_secp384r1 : begin
-      Result := 'SECP384R1 - Stronger, different algorithm (larger key) ';
-    end;
-    CT_NID_sect283k1 : Begin
-      Result := 'SECP283K1 - Even stronger (larger key)';
-    End;
-    CT_NID_secp521r1 : begin
-      Result := 'SECP521R1 - Quantum-resistant (largest key)';
-    end
-    else Result := '(Unknown ID:'+inttostr(EC_OpenSSL_NID)+')';
-  end;
-end;
-
-end.
-

+ 0 - 66
src/gui/wizards/UWIZAddKey_Start.lfm

@@ -1,66 +0,0 @@
-object WIZAddKey_Start: TWIZAddKey_Start
-  Left = 26
-  Height = 300
-  Top = 27
-  Width = 437
-  Caption = 'Add Key'
-  ClientHeight = 300
-  ClientWidth = 437
-  LCLVersion = '1.8.2.0'
-  Visible = False
-  object rbPrivateKey: TRadioButton
-    Left = 32
-    Height = 19
-    Top = 56
-    Width = 84
-    Caption = 'Private Key'
-    Checked = True
-    Font.Style = [fsBold]
-    ParentFont = False
-    TabOrder = 1
-    TabStop = True
-  end
-  object rbPublicKey: TRadioButton
-    Left = 32
-    Height = 19
-    Top = 168
-    Width = 144
-    Caption = 'Watch-only Public Key'
-    Font.Style = [fsBold]
-    ParentFont = False
-    TabOrder = 0
-  end
-  object Label1: TLabel
-    Left = 32
-    Height = 32
-    Top = 16
-    Width = 370
-    Anchors = [akTop, akLeft, akRight]
-    AutoSize = False
-    Caption = 'What type of key would you like to add into your wallet?'
-    ParentColor = False
-    WordWrap = True
-  end
-  object Label2: TLabel
-    Left = 52
-    Height = 64
-    Top = 80
-    Width = 352
-    Anchors = [akTop, akLeft, akRight]
-    AutoSize = False
-    Caption = 'Adding a private key allows you to send operations from accounts bound to this key. Please ensure your wallet is adequately protected if using this option since sensitive information is stored on your machine.'
-    ParentColor = False
-    WordWrap = True
-  end
-  object Label3: TLabel
-    Left = 48
-    Height = 66
-    Top = 192
-    Width = 350
-    Anchors = [akTop, akLeft, akRight]
-    AutoSize = False
-    Caption = 'A watch-only key allows you to track accounts that are bound to this key but without the ability to authorize new operations. There is no sensitive information kept on your machine when using this option.'
-    ParentColor = False
-    WordWrap = True
-  end
-end

+ 0 - 55
src/gui/wizards/UWIZAddKey_Start.pas

@@ -1,55 +0,0 @@
-unit UWIZAddKey_Start;
-
-{$mode delphi}
-
-{ Copyright (c) 2018 by Herman Schoenfeld
-
-  Distributed under the MIT software license, see the accompanying file LICENSE
-  or visit http://www.opensource.org/licenses/mit-license.php.
-}
-
-interface
-
-uses
-  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
-  UWizard, UWIZAddKey, UWIZModels;
-
-type
-
-  { TWIZAddKey_Start }
-
-  TWIZAddKey_Start = class(TWizardForm<TWIZAddKeyModel>)
-    Label1: TLabel;
-    Label2: TLabel;
-    Label3: TLabel;
-    rbPrivateKey: TRadioButton;
-    rbPublicKey: TRadioButton;
-  private
-    { private declarations }
-  public
-    { public declarations }
-    procedure OnNext; override;
-  end;
-
-implementation
-
-{$R *.lfm}
-
-uses
-   UWIZAddKey_GenerateOrImport, UWIZAddKey_ImportPrivKey, UWIZAddKey_ImportPubKey, UWIZAddKey_EnterName;
-
-{ TWIZAddKey_Start }
-
-
-procedure TWIZAddKey_Start.OnNext;
-begin
-  if rbPublicKey.Checked = true then begin
-    Model.Action := akaImportPublicKey;
-    UpdatePath(ptReplaceAllNext, [TWIZAddKey_ImportPubKey, TWIZAddKey_EnterName]);
-  end else begin
-    UpdatePath(ptReplaceAllNext, [TWIZAddKey_GenerateOrImport, TWIZAddKey_ImportPrivKey]);//, TWIZAddKey_ImportPrivKey, TWIZAddKey_Finish]);
-  end;
-end;
-
-end.
-

+ 0 - 455
src/gui/wizards/UWIZChangeAccountPrivateKey.pas

@@ -1,455 +0,0 @@
-unit UWIZChangeAccountPrivateKey;
-
-{$mode delphi}
-
-{ Copyright (c) 2018 by Ugochukwu Mmaduekwe
-
-  Distributed under the MIT software license, see the accompanying file LICENSE
-  or visit http://www.opensource.org/licenses/mit-license.php.
-
-}
-
-interface
-
-uses
-  Classes, SysUtils, Forms, Dialogs, UCrypto, UWallet, UCommon, UWizard,
-  UAccounts, LCLType, UWIZModels;
-
-type
-
-  { TWIZChangeAccountPrivateKeyWizard }
-
-  TWIZChangeAccountPrivateKeyWizard = class(TWizard<TWIZOperationsModel>)
-  private
-    function UpdatePayload(const SenderAccount: TAccount; var errors: string): boolean;
-    function UpdateOperationOptions(var errors: string): boolean;
-    function UpdateOpChangeKey(const TargetAccount: TAccount; var SignerAccount: TAccount; var NewPublicKey: TAccountKey; var errors: ansistring): boolean;
-    procedure ChangeAccountPrivateKey();
-  public
-    constructor Create(AOwner: TComponent); override;
-    function DetermineHasNext: boolean; override;
-    function DetermineHasPrevious: boolean; override;
-    function FinishRequested(out message: ansistring): boolean; override;
-    function CancelRequested(out message: ansistring): boolean; override;
-  end;
-
-implementation
-
-uses
-  UBlockChain,
-  UOpTransaction,
-  UNode,
-  UConst,
-  UECIES,
-  UAES,
-  UWIZChangeAccountPrivateKey_Start,
-  UWIZChangeAccountPrivateKey_Confirmation;
-
-{ TWIZChangeAccountPrivateKeyWizard }
-
-function TWIZChangeAccountPrivateKeyWizard.UpdatePayload(const SenderAccount: TAccount;
-  var errors: string): boolean;
-var
-  valid: boolean;
-  payload_encrypted, payload_u: string;
-  account: TAccount;
-  public_key: TAccountKey;
-begin
-  valid := False;
-  payload_encrypted := '';
-  Model.ChangeAccountPrivateKey.EncodedPayload := '';
-  errors := 'Unknown error';
-  payload_u := Model.Payload.Content;
-
-  try
-    if (payload_u = '') then
-    begin
-      valid := True;
-      Exit;
-    end;
-    case Model.Payload.Mode of
-
-      akaEncryptWithSender:
-      begin
-        // Use sender
-        errors := 'Error encrypting';
-        account := SenderAccount;
-        payload_encrypted := ECIESEncrypt(account.accountInfo.accountKey, payload_u);
-        valid := payload_encrypted <> '';
-      end;
-
-      akaEncryptWithReceiver:
-      begin
-        errors := 'Error encrypting';
-
-        public_key := Model.ChangeAccountPrivateKey.NewWalletKey.AccountKey;
-        if public_key.EC_OpenSSL_NID <>
-          CT_Account_NUL.accountInfo.accountKey.EC_OpenSSL_NID then
-        begin
-          payload_encrypted := ECIESEncrypt(public_key, payload_u);
-          valid := payload_encrypted <> '';
-        end
-        else
-        begin
-          valid := False;
-          errors := 'Selected private key is not valid to encode';
-          exit;
-        end;
-      end;
-
-      akaEncryptWithPassword:
-      begin
-        payload_encrypted := TAESComp.EVP_Encrypt_AES256(
-          payload_u, Model.Payload.Password);
-        valid := payload_encrypted <> '';
-      end;
-
-      akaNotEncrypt:
-      begin
-        payload_encrypted := payload_u;
-        valid := True;
-      end
-
-      else
-      begin
-        raise Exception.Create('Invalid Encryption Selection');
-      end;
-    end;
-
-  finally
-    if valid then
-    begin
-      if length(payload_encrypted) > CT_MaxPayloadSize then
-      begin
-        valid := False;
-        errors := 'Payload size is bigger than ' + IntToStr(CT_MaxPayloadSize) +
-          ' (' + IntToStr(length(payload_encrypted)) + ')';
-      end;
-
-    end;
-    Model.ChangeAccountPrivateKey.EncodedPayload := payload_encrypted;
-    Result := valid;
-  end;
-
-end;
-
-function TWIZChangeAccountPrivateKeyWizard.UpdateOperationOptions(
-  var errors: string): boolean;
-var
-  iAcc, iWallet: integer;
-  sender_account, signer_account: TAccount;
-  publicKey: TAccountKey;
-  wk: TWalletKey;
-  e: string;
-  amount: int64;
-begin
-  Result := False;
-  errors := '';
-  if not Assigned(TWallet.Keys) then
-  begin
-    errors := 'No wallet keys';
-    Exit;
-  end;
-
-  if Length(Model.ChangeAccountPrivateKey.SelectedAccounts) = 0 then
-  begin
-    errors := 'No sender account';
-    Exit;
-  end
-  else
-  begin
-
-    for iAcc := Low(Model.ChangeAccountPrivateKey.SelectedAccounts) to High(Model.ChangeAccountPrivateKey.SelectedAccounts) do
-    begin
-      sender_account := Model.ChangeAccountPrivateKey.SelectedAccounts[iAcc];
-      iWallet := TWallet.Keys.IndexOfAccountKey(sender_account.accountInfo.accountKey);
-      if (iWallet < 0) then
-      begin
-        errors := 'Private key of account ' +
-          TAccountComp.AccountNumberToAccountTxtNumber(sender_account.account) +
-          ' not found in wallet';
-        Exit;
-      end;
-      wk := TWallet.Keys.Key[iWallet];
-      if not assigned(wk.PrivateKey) then
-      begin
-        if wk.CryptedKey <> '' then
-        begin
-          // TODO: handle unlocking of encrypted wallet here
-          errors := 'Wallet is password protected. Need password';
-        end
-        else
-        begin
-          errors := 'Only public key of account ' +
-            TAccountComp.AccountNumberToAccountTxtNumber(sender_account.account) +
-            ' found in wallet. You cannot operate with this account';
-        end;
-        Exit;
-      end;
-    end;
-  end;
-
-  Result := UpdateOpChangeKey(Model.ChangeAccountPrivateKey.SelectedAccounts[0], signer_account,
-    publicKey, errors);
-  UpdatePayload(sender_account, e);
-end;
-
-function TWIZChangeAccountPrivateKeyWizard.UpdateOpChangeKey(
-  const TargetAccount: TAccount; var SignerAccount: TAccount;
-  var NewPublicKey: TAccountKey; var errors: ansistring): boolean;
-begin
-  Result := False;
-  errors := '';
-  try
-    NewPublicKey := Model.ChangeAccountPrivateKey.NewWalletKey.AccountKey;
-
-    if TNode.Node.Bank.SafeBox.CurrentProtocol >= 1 then
-    begin
-      // Signer:
-      SignerAccount := Model.Signer.SignerAccount;
-      if (TAccountComp.IsAccountLocked(SignerAccount.accountInfo,
-        TNode.Node.Bank.BlocksCount)) then
-      begin
-        errors := 'Signer account ' + TAccountComp.AccountNumberToAccountTxtNumber(
-          SignerAccount.account) + ' is locked until block ' + IntToStr(
-          SignerAccount.accountInfo.locked_until_block);
-        exit;
-      end;
-      if (not TAccountComp.EqualAccountKeys(
-        SignerAccount.accountInfo.accountKey, TargetAccount.accountInfo.accountKey)) then
-      begin
-        errors := 'Signer account ' + TAccountComp.AccountNumberToAccountTxtNumber(
-          SignerAccount.account) + ' is not owner of account ' +
-          TAccountComp.AccountNumberToAccountTxtNumber(TargetAccount.account);
-        exit;
-      end;
-    end
-    else
-    begin
-      SignerAccount := TargetAccount;
-    end;
-
-    if (TAccountComp.EqualAccountKeys(TargetAccount.accountInfo.accountKey,
-      NewPublicKey)) then
-    begin
-      errors := 'New public key is the same public key';
-      exit;
-    end;
-
-  finally
-    Result := errors = '';
-  end;
-end;
-
-procedure TWIZChangeAccountPrivateKeyWizard.ChangeAccountPrivateKey();
-var
-  _V2, dooperation: boolean;
-  iAcc, i: integer;
-  _totalamount, _totalfee, _totalSignerFee, _amount, _fee: int64;
-  _signer_n_ops: cardinal;
-  operationstxt, operation_to_string, errors, auxs: string;
-  wk: TWalletKey;
-  ops: TOperationsHashTree;
-  op: TPCOperation;
-  account, signerAccount: TAccount;
-  _newOwnerPublicKey: TECDSA_Public;
-label
-  loop_start;
-begin
-  if not Assigned(TWallet.Keys) then
-    raise Exception.Create('No wallet keys');
-  if not UpdateOperationOptions(errors) then
-    raise Exception.Create(errors);
-  ops := TOperationsHashTree.Create;
-
-  try
-    _V2 := TNode.Node.Bank.SafeBox.CurrentProtocol >= CT_PROTOCOL_2;
-    _totalamount := 0;
-    _totalfee := 0;
-    _totalSignerFee := 0;
-    _signer_n_ops := 0;
-    operationstxt := '';
-    operation_to_string := '';
-    for iAcc := Low(Model.ChangeAccountPrivateKey.SelectedAccounts) to High(Model.ChangeAccountPrivateKey.SelectedAccounts) do
-    begin
-      loop_start:
-        op := nil;
-      account := Model.ChangeAccountPrivateKey.SelectedAccounts[iAcc];
-      if not UpdatePayload(account, errors) then
-      begin
-        raise Exception.Create('Error encoding payload of sender account ' +
-          TAccountComp.AccountNumberToAccountTxtNumber(account.account) + ': ' + errors);
-      end;
-      i := TWallet.Keys.IndexOfAccountKey(account.accountInfo.accountKey);
-      if i < 0 then
-      begin
-        raise Exception.Create('Sender account private key not found in Wallet');
-      end;
-
-      wk := TWallet.Keys.Key[i];
-      dooperation := True;
-      // Default fee
-      if account.balance > uint64(Model.Fee.DefaultFee) then
-        _fee := Model.Fee.DefaultFee
-      else
-        _fee := account.balance;
-
-      if not UpdateOpChangeKey(account, signerAccount, _newOwnerPublicKey, errors) then
-      begin
-        raise Exception.Create(errors);
-      end;
-      if _V2 then
-      begin
-        // must ensure is Signer account last if included in sender accounts (not necessarily ordered enumeration)
-        if (iAcc < Length(Model.ChangeAccountPrivateKey.SelectedAccounts) - 1) and
-          (account.account = signerAccount.account) then
-        begin
-          TArrayTool<TAccount>.Swap(Model.ChangeAccountPrivateKey.SelectedAccounts, iAcc,
-            Length(Model.ChangeAccountPrivateKey.SelectedAccounts) - 1); // ensure signer account processed last
-          // TArrayTool_internal<Cardinal>.Swap(_senderAccounts, iAcc, Length(_senderAccounts) - 1);
-          goto loop_start; // TODO: remove ugly hack with refactoring!
-        end;
-
-        // Maintain correct signer fee distribution
-        if uint64(_totalSignerFee) >= signerAccount.balance then
-          _fee := 0
-        else if signerAccount.balance - uint64(_totalSignerFee) >
-          uint64(Model.Fee.DefaultFee) then
-          _fee := Model.Fee.DefaultFee
-        else
-          _fee := signerAccount.balance - uint64(_totalSignerFee);
-        op := TOpChangeKeySigned.Create(signerAccount.account,
-          signerAccount.n_operation + _signer_n_ops + 1, account.account,
-          wk.PrivateKey, _newOwnerPublicKey, _fee, Model.ChangeAccountPrivateKey.EncodedPayload);
-        Inc(_signer_n_ops);
-        Inc(_totalSignerFee, _fee);
-      end
-      else
-      begin
-        op := TOpChangeKey.Create(account.account, account.n_operation +
-          1, account.account, wk.PrivateKey, _newOwnerPublicKey, _fee,
-          Model.ChangeAccountPrivateKey.EncodedPayload);
-      end;
-      Inc(_totalfee, _fee);
-      operationstxt :=
-        'Change private key to ' + TAccountComp.GetECInfoTxt(
-        _newOwnerPublicKey.EC_OpenSSL_NID);
-
-      if Assigned(op) and (dooperation) then
-      begin
-        ops.AddOperationToHashTree(op);
-        if operation_to_string <> '' then
-          operation_to_string := operation_to_string + #10;
-        operation_to_string := operation_to_string + op.ToString;
-      end;
-      FreeAndNil(op);
-    end;
-
-    if (ops.OperationsCount = 0) then
-      raise Exception.Create('No valid operation to execute');
-
-    if (Length(Model.ChangeAccountPrivateKey.SelectedAccounts) > 1) then
-    begin
-      auxs := '';
-      if Application.MessageBox(
-        PChar('Execute ' + IntToStr(Length(Model.ChangeAccountPrivateKey.SelectedAccounts)) +
-        ' operations?' + #10 + 'Operation: ' + operationstxt + #10 +
-        auxs + 'Total fee: ' + TAccountComp.FormatMoney(_totalfee) +
-        #10 + #10 + 'Note: This operation will be transmitted to the network!'),
-        PChar(Application.Title), MB_YESNO + MB_ICONINFORMATION + MB_DEFBUTTON2) <>
-        idYes then
-      begin
-        Exit;
-      end;
-    end
-    else
-    begin
-      if Application.MessageBox(PChar('Execute this operation:' +
-        #10 + #10 + operation_to_string + #10 + #10 +
-        'Note: This operation will be transmitted to the network!'),
-        PChar(Application.Title), MB_YESNO + MB_ICONINFORMATION + MB_DEFBUTTON2) <>
-        idYes then
-      begin
-        Exit;
-      end;
-    end;
-    i := TNode.Node.AddOperations(nil, ops, nil, errors);
-    if (i = ops.OperationsCount) then
-    begin
-      operationstxt := 'Successfully executed ' + IntToStr(i) +
-        ' operations!' + #10 + #10 + operation_to_string;
-      if i > 1 then
-      begin
-
-        ShowMessage(operationstxt);
-      end
-      else
-      begin
-        Application.MessageBox(
-          PChar('Successfully executed ' + IntToStr(i) + ' operations!' +
-          #10 + #10 + operation_to_string),
-          PChar(Application.Title), MB_OK + MB_ICONINFORMATION);
-      end;
-
-    end
-    else if (i > 0) then
-    begin
-      operationstxt := 'One or more of your operations has not been executed:' +
-        #10 + 'Errors:' + #10 + errors + #10 + #10 +
-        'Total successfully executed operations: ' + IntToStr(i);
-
-      ShowMessage(operationstxt);
-    end
-    else
-    begin
-      raise Exception.Create(errors);
-    end;
-
-
-  finally
-    ops.Free;
-  end;
-
-end;
-
-constructor TWIZChangeAccountPrivateKeyWizard.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner, [TWIZChangeAccountPrivateKey_Start,
-    TWIZChangeAccountPrivateKey_Confirmation]);
-  TitleText := 'Change Key';
-  FinishText := 'Change Key';
-end;
-
-function TWIZChangeAccountPrivateKeyWizard.DetermineHasNext: boolean;
-begin
-  Result := not (CurrentScreen is TWIZChangeAccountPrivateKey_Confirmation);
-end;
-
-function TWIZChangeAccountPrivateKeyWizard.DetermineHasPrevious: boolean;
-begin
-  Result := inherited DetermineHasPrevious;
-end;
-
-function TWIZChangeAccountPrivateKeyWizard.FinishRequested(
-  out message: ansistring): boolean;
-begin
-  // Execute the Change Account Private Key Action here
-  try
-    Result := True;
-    ChangeAccountPrivateKey();
-  except
-    On E: Exception do
-    begin
-      Result := False;
-      message := E.ToString;
-    end;
-  end;
-end;
-
-function TWIZChangeAccountPrivateKeyWizard.CancelRequested(
-  out message: ansistring): boolean;
-begin
-  Result := True;
-end;
-
-end.

+ 0 - 48
src/gui/wizards/UWIZChangeAccountPrivateKey_Confirmation.lfm

@@ -1,48 +0,0 @@
-object WIZChangeAccountPrivateKey_Confirmation: TWIZChangeAccountPrivateKey_Confirmation
-  Left = 0
-  Height = 253
-  Top = 0
-  Width = 429
-  Caption = 'WIZChangeAccountPrivateKey_Confirmation'
-  ClientHeight = 253
-  ClientWidth = 429
-  LCLVersion = '1.8.2.0'
-  Visible = False
-  object GroupBox1: TGroupBox
-    Left = 10
-    Height = 232
-    Top = 8
-    Width = 408
-    Anchors = [akTop, akLeft, akRight, akBottom]
-    Caption = 'Confirm Transfer Transaction'
-    ClientHeight = 212
-    ClientWidth = 404
-    TabOrder = 0
-    object paGrid: TPanel
-      Left = 8
-      Height = 152
-      Top = 48
-      Width = 382
-      Anchors = [akTop, akLeft, akRight, akBottom]
-      BevelOuter = bvNone
-      Caption = 'GRID PANEL'
-      TabOrder = 0
-    end
-    object Label1: TLabel
-      Left = 8
-      Height = 15
-      Top = 16
-      Width = 84
-      Caption = 'Signer Account:'
-      ParentColor = False
-    end
-    object lblSgnAcc: TLabel
-      Left = 112
-      Height = 15
-      Top = 16
-      Width = 53
-      Caption = 'lblSgnAcc'
-      ParentColor = False
-    end
-  end
-end

+ 0 - 144
src/gui/wizards/UWIZChangeAccountPrivateKey_Confirmation.pas

@@ -1,144 +0,0 @@
-unit UWIZChangeAccountPrivateKey_Confirmation;
-
-{$mode delphi}
-{$modeswitch nestedprocvars}
-
-{ Copyright (c) 2018 by Ugochukwu Mmaduekwe
-
-  Distributed under the MIT software license, see the accompanying file LICENSE
-  or visit http://www.opensource.org/licenses/mit-license.php.
-}
-
-interface
-
-uses
-  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
-  ExtCtrls, UVisualGrid, UCellRenderers, UCommon.Data, UWizard,
-  UWIZChangeAccountPrivateKey, UWIZModels;
-
-type
-
-  { TWIZChangeAccountPrivateKey_Confirmation }
-
-  TWIZChangeAccountPrivateKey_Confirmation = class(TWizardForm<TWIZOperationsModel>)
-    GroupBox1: TGroupBox;
-    Label1: TLabel;
-    lblSgnAcc: TLabel;
-    paGrid: TPanel;
-  private
-    FSendersGrid: TVisualGrid;
-  public
-    procedure OnPresent; override;
-  end;
-
-
-implementation
-
-{$R *.lfm}
-
-uses UAccounts, UCrypto, UDataSources, UCommon, UCommon.UI, Generics.Collections;
-
-type
-
-  { TAccountSenderDataSource }
-
-  TAccountSenderDataSource = class(TAccountsDataSourceBase)
-  private
-    FModel: TWIZOperationsModel;
-  protected
-    function GetColumns: TDataColumns; override;
-  public
-    property Model: TWIZOperationsModel read FModel write FModel;
-    procedure FetchAll(const AContainer: TList<TAccount>); override;
-    function GetItemField(constref AItem: TAccount;
-      const ABindingName: ansistring): variant; override;
-  end;
-
-{ TWIZChangeAccountPrivateKey_Confirmation }
-
-procedure TWIZChangeAccountPrivateKey_Confirmation.OnPresent;
-var
-  Data: TAccountSenderDataSource;
-begin
-  FSendersGrid := TVisualGrid.Create(Self);
-  FSendersGrid.CanSearch := False;
-  FSendersGrid.SortMode := smMultiColumn;
-  FSendersGrid.FetchDataInThread := False;
-  FSendersGrid.AutoPageSize := True;
-  FSendersGrid.SelectionType := stNone;
-  FSendersGrid.Options := [vgoColAutoFill, vgoColSizing, vgoSortDirectionAllowNone,
-    vgoAutoHidePaging];
-  with FSendersGrid.AddColumn('Account') do
-  begin
-    Binding := 'Account';
-    Filters := SORTABLE_NUMERIC_FILTER;
-    Width := 100;
-    HeaderFontStyles := [fsBold];
-    DataFontStyles := [fsBold];
-  end;
-  with FSendersGrid.AddColumn('New Private Key Name') do
-  begin
-    Binding := 'NewPrivateKey';
-    Filters := SORTABLE_TEXT_FILTER;
-    Width := 100;
-  end;
-  with FSendersGrid.AddColumn('Fee') do
-  begin
-    Filters := SORTABLE_TEXT_FILTER;
-    Width := 100;
-  end;
-
-  Data := TAccountSenderDataSource.Create(FSendersGrid);
-  Data.Model := Model;
-  FSendersGrid.DataSource := Data;
-  paGrid.AddControlDockCenter(FSendersGrid);
-  lblSgnAcc.Caption := TAccountComp.AccountNumberToAccountTxtNumber(Model.Signer.SignerAccount.account);
-end;
-
-{ TAccountSenderDataSource }
-
-function TAccountSenderDataSource.GetColumns: TDataColumns;
-begin
-  Result := TDataColumns.Create(
-    TDataColumn.From('Account'),
-    TDataColumn.From('NewPrivateKey'),
-    TDataColumn.From('Fee')
-    );
-end;
-
-function TAccountSenderDataSource.GetItemField(constref AItem: TAccount;
-  const ABindingName: ansistring): variant;
-var
-  index: integer;
-begin
-  if ABindingName = 'Account' then
-    Result := TAccountComp.AccountNumberToAccountTxtNumber(AItem.account)
-  else if ABindingName = 'NewPrivateKey' then
-  begin
-    Result := IIF(Model.ChangeAccountPrivateKey.NewWalletKey.Name = '',
-      TCrypto.ToHexaString(TAccountComp.AccountKey2RawString(
-      Model.ChangeAccountPrivateKey.NewWalletKey.AccountKey)), Model.ChangeAccountPrivateKey.NewWalletKey.Name);
-    if not Assigned(Model.ChangeAccountPrivateKey.NewWalletKey.PrivateKey) then
-    begin
-      Result := Result + '(*)';
-    end;
-  end
-  else if ABindingName = 'Fee' then
-    Result := TAccountComp.FormatMoney(Model.Fee.DefaultFee)
-  else
-    raise Exception.Create(Format('Field not found [%s]', [ABindingName]));
-end;
-
-
-procedure TAccountSenderDataSource.FetchAll(const AContainer: TList<TAccount>);
-var
-  i: integer;
-begin
-  for i := Low(Model.ChangeAccountPrivateKey.SelectedAccounts) to High(Model.ChangeAccountPrivateKey.SelectedAccounts) do
-  begin
-    AContainer.Add(Model.ChangeAccountPrivateKey.SelectedAccounts[i]);
-  end;
-end;
-
-
-end.

+ 0 - 106
src/gui/wizards/UWIZChangeAccountPrivateKey_Transaction.lfm

@@ -1,106 +0,0 @@
-object WIZChangeAccountPrivateKey_Transaction: TWIZChangeAccountPrivateKey_Transaction
-  Left = 0
-  Height = 253
-  Top = 0
-  Width = 429
-  ActiveControl = cbSignerAccount
-  Caption = 'WIZChangeAccountPrivateKey_Transaction'
-  ClientHeight = 253
-  ClientWidth = 429
-  LCLVersion = '1.8.2.0'
-  Visible = False
-  object gbTransaction: TGroupBox
-    Left = 24
-    Height = 192
-    Top = 40
-    Width = 384
-    Caption = 'Transaction Details'
-    ClientHeight = 172
-    ClientWidth = 380
-    TabOrder = 0
-    object cbSignerAccount: TComboBox
-      Left = 8
-      Height = 23
-      Top = 8
-      Width = 168
-      ItemHeight = 15
-      Items.Strings = (
-        ''
-      )
-      OnChange = cbSignerAccountChange
-      TabOrder = 0
-      Text = 'Select Signer Account'
-    end
-    object lblBalance: TLabel
-      Left = 200
-      Height = 15
-      Top = 12
-      Width = 151
-      Caption = 'Please Select Signer Account'
-      Font.Color = clRed
-      ParentColor = False
-      ParentFont = False
-    end
-    object lblprivatekey: TLabel
-      Left = 8
-      Height = 15
-      Top = 48
-      Width = 85
-      Caption = 'New Private Key'
-      ParentColor = False
-    end
-    object edtOpFee: TEdit
-      Left = 8
-      Height = 23
-      Top = 144
-      Width = 360
-      TabOrder = 1
-    end
-    object lblOpFee: TLabel
-      Left = 8
-      Height = 15
-      Top = 112
-      Width = 74
-      Caption = 'Operation Fee'
-      ParentColor = False
-    end
-    object cbNewPrivateKey: TComboBox
-      Left = 8
-      Height = 23
-      Top = 74
-      Width = 168
-      ItemHeight = 15
-      OnChange = cbNewPrivateKeyChange
-      TabOrder = 2
-      Text = 'Select Private Key'
-    end
-    object lblKeyName: TLabel
-      Left = 200
-      Height = 15
-      Top = 78
-      Width = 128
-      Caption = 'Please Select Private Key'
-      Font.Color = clRed
-      ParentColor = False
-      ParentFont = False
-    end
-  end
-  object lblTotalBalances: TLabel
-    Left = 24
-    Height = 15
-    Top = 16
-    Width = 176
-    Caption = 'Selected Accounts Total Balance: '
-    ParentColor = False
-  end
-  object lblTotalBalanceValue: TLabel
-    Left = 208
-    Height = 15
-    Top = 16
-    Width = 70
-    Caption = 'Total Balance'
-    Font.Color = clGreen
-    ParentColor = False
-    ParentFont = False
-  end
-end

+ 0 - 210
src/gui/wizards/UWIZChangeAccountPrivateKey_Transaction.pas

@@ -1,210 +0,0 @@
-unit UWIZChangeAccountPrivateKey_Transaction;
-
-{$mode delphi}
-{$modeswitch nestedprocvars}
-
-{ Copyright (c) 2018 by Ugochukwu Mmaduekwe
-
-  Distributed under the MIT software license, see the accompanying file LICENSE
-  or visit http://www.opensource.org/licenses/mit-license.php.
-}
-
-interface
-
-uses
-  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
-  ExtCtrls, Buttons, UCommon, UCommon.Collections, UWallet,
-  UFRMAccountSelect, UNode, UWizard, UWIZChangeAccountPrivateKey,
-  UWIZChangeAccountPrivateKey_TransactionPayload,
-  UWIZChangeAccountPrivateKey_Confirmation, UWIZModels;
-
-type
-
-  { TWIZChangeAccountPrivateKey_Transaction }
-
-  TWIZChangeAccountPrivateKey_Transaction = class(TWizardForm<TWIZOperationsModel>)
-    cbSignerAccount: TComboBox;
-    cbNewPrivateKey: TComboBox;
-    edtOpFee: TEdit;
-    gbTransaction: TGroupBox;
-    lblKeyName: TLabel;
-    lblOpFee: TLabel;
-    lblprivatekey: TLabel;
-    lblTotalBalanceValue: TLabel;
-    lblTotalBalances: TLabel;
-    lblBalance: TLabel;
-    procedure cbNewPrivateKeyChange(Sender: TObject);
-    procedure cbSignerAccountChange(Sender: TObject);
-  private
-    procedure UpdateWalletKeys();
-  public
-    procedure OnPresent; override;
-    procedure OnNext; override;
-    function Validate(out message: ansistring): boolean; override;
-  end;
-
-
-implementation
-
-{$R *.lfm}
-
-uses
-  UAccounts, UCrypto, UUserInterface, USettings;
-
-{ TWIZChangeAccountPrivateKey_Transaction }
-
-procedure TWIZChangeAccountPrivateKey_Transaction.cbSignerAccountChange(Sender: TObject);
-begin
-  if cbSignerAccount.ItemIndex < 1 then
-  begin
-    lblBalance.Font.Color := clRed;
-    lblBalance.Caption := 'Please Select Signer Account';
-  end
-  else
-  begin
-    lblBalance.Font.Color := clGreen;
-    lblBalance.Caption := Format('%s PASC',
-      [TAccountComp.FormatMoney(Model.ChangeAccountPrivateKey.SelectedAccounts[PtrInt(cbSignerAccount.Items.Objects[cbSignerAccount.ItemIndex])].Balance)]);
-  end;
-end;
-
-procedure TWIZChangeAccountPrivateKey_Transaction.cbNewPrivateKeyChange(
-  Sender: TObject);
-var
-  i: integer;
-  wk: TWalletKey;
-begin
-  if cbNewPrivateKey.ItemIndex < 1 then
-  begin
-    lblKeyName.Font.Color := clRed;
-    lblKeyName.Caption := 'Please Select Private Key';
-  end
-  else
-  begin
-    lblKeyName.Font.Color := clGreen;
-    i := PtrInt(cbNewPrivateKey.Items.Objects[cbNewPrivateKey.ItemIndex]);
-    wk := TWallet.Keys.Key[i];
-    lblKeyName.Caption := Format('%s ',
-      [IIF(wk.Name = '', TCrypto.ToHexaString(
-      TAccountComp.AccountKey2RawString(wk.AccountKey)), wk.Name)]);
-  end;
-end;
-
-procedure TWIZChangeAccountPrivateKey_Transaction.UpdateWalletKeys();
-var
-  i: integer;
-  wk: TWalletKey;
-  s: string;
-begin
-  cbNewPrivateKey.items.BeginUpdate;
-  try
-    cbNewPrivateKey.Items.Clear;
-    cbNewPrivateKey.Items.Add('Select Private Key');
-    if not Assigned(TWallet.Keys) then
-    begin
-      Exit;
-    end;
-    for i := 0 to TWallet.Keys.Count - 1 do
-    begin
-      wk := TWallet.Keys.Key[i];
-      s := IIF(wk.Name = '', TCrypto.ToHexaString(TAccountComp.AccountKey2RawString(wk.AccountKey)), wk.Name);
-      if not Assigned(wk.PrivateKey) then
-      begin
-        s := s + '(*)';
-      end;
-      cbNewPrivateKey.Items.AddObject(s, TObject(i));
-    end;
-    cbNewPrivateKey.Sorted := True;
-  finally
-    cbNewPrivateKey.Items.EndUpdate;
-  end;
-end;
-
-procedure TWIZChangeAccountPrivateKey_Transaction.OnPresent;
-
-  function GetAccNoWithChecksum(AAccountNumber: cardinal): string;
-  begin
-    Result := TAccountComp.AccountNumberToAccountTxtNumber(AAccountNumber);
-  end;
-
-var
-  acc: TAccount;
-  accNumberwithChecksum: string;
-  totalBalance: int64;
-  i: integer;
-begin
-  cbSignerAccount.Items.BeginUpdate;
-  totalBalance := 0;
-  try
-    cbSignerAccount.Items.Clear;
-    cbSignerAccount.Items.Add('Select Signer Account');
-    for i := Low(Model.ChangeAccountPrivateKey.SelectedAccounts) to High(Model.ChangeAccountPrivateKey.SelectedAccounts) do
-    begin
-      acc := Model.ChangeAccountPrivateKey.SelectedAccounts[i];
-      accNumberwithChecksum := GetAccNoWithChecksum(acc.account);
-      totalBalance := totalBalance + acc.balance;
-      cbSignerAccount.Items.AddObject(accNumberwithChecksum, TObject(i));
-    end;
-  finally
-    cbSignerAccount.Items.EndUpdate;
-  end;
-  UpdateWalletKeys();
-  cbSignerAccount.ItemIndex := Model.ChangeAccountPrivateKey.SelectedIndex;
-  cbSignerAccountChange(Self);
-  cbNewPrivateKey.ItemIndex := Model.ChangeAccountPrivateKey.PrivateKeySelectedIndex;
-  cbNewPrivateKeyChange(Self);
-  lblTotalBalanceValue.Caption :=
-    Format('%s PASC', [TAccountComp.FormatMoney(totalBalance)]);
-
-  edtOpFee.Text := TAccountComp.FormatMoney(TSettings.DefaultFee);
-end;
-
-procedure TWIZChangeAccountPrivateKey_Transaction.OnNext;
-begin
-  Model.ChangeAccountPrivateKey.SelectedIndex := cbSignerAccount.ItemIndex;
-  Model.ChangeAccountPrivateKey.PrivateKeySelectedIndex := cbNewPrivateKey.ItemIndex;
-  Model.Signer.SignerAccount := Model.ChangeAccountPrivateKey.SelectedAccounts[PtrInt(cbSignerAccount.Items.Objects[cbSignerAccount.ItemIndex])];
-  Model.ChangeAccountPrivateKey.NewWalletKey := TWallet.Keys.Key[PtrInt(cbNewPrivateKey.Items.Objects[cbNewPrivateKey.ItemIndex])];
-
-  UpdatePath(ptReplaceAllNext, [TWIZChangeAccountPrivateKey_TransactionPayload, TWIZChangeAccountPrivateKey_Confirmation]);
-end;
-
-function TWIZChangeAccountPrivateKey_Transaction.Validate(out message: ansistring): boolean;
-var
-  i: integer;
-begin
-  if cbSignerAccount.ItemIndex < 1 then
-  begin
-    message := 'A signer account must be selected';
-    Result := False;
-    Exit;
-  end;
-
-  if cbNewPrivateKey.ItemIndex < 1 then
-  begin
-    message := 'A private key must be selected';
-    Result := False;
-    Exit;
-  end;
-
-  if not TAccountComp.TxtToMoney(Trim(edtOpFee.Text), Model.Fee.DefaultFee) then
-  begin
-    message := 'Invalid fee value "' + edtOpFee.Text + '"';
-    Result := False;
-    Exit;
-  end;
-
-  //Result := TAccountComp.AccountKeyFromImport(edtPublicKey.Text,
-  //  Model.AccountKey, message);
-  //for i := Low(Model.SelectedAccounts) to High(Model.SelectedAccounts) do
-  //begin
-  //  if TAccountComp.EqualAccountKeys(Model.SelectedAccounts[i].accountInfo.accountKey,
-  //    Model.AccountKey) then
-  //  begin
-  //    Result := False;
-  //    message := 'new public key is same as selected account public key';
-  //  end;
-  //end;
-end;
-
-end.

+ 0 - 98
src/gui/wizards/UWIZChangeAccountPrivateKey_TransactionPayload.lfm

@@ -1,98 +0,0 @@
-object WIZChangeAccountPrivateKey_TransactionPayload: TWIZChangeAccountPrivateKey_TransactionPayload
-  Left = 0
-  Height = 253
-  Top = 0
-  Width = 429
-  ActiveControl = mmoPayload
-  Caption = 'Form1'
-  ClientHeight = 253
-  ClientWidth = 429
-  LCLVersion = '1.8.2.0'
-  Visible = False
-  object grpPayload: TGroupBox
-    Left = 8
-    Height = 244
-    Top = 2
-    Width = 416
-    Anchors = [akTop, akLeft, akRight, akBottom]
-    Caption = 'Transaction Payload'
-    ClientHeight = 224
-    ClientWidth = 412
-    TabOrder = 0
-    object paPayload: TPanel
-      Left = 8
-      Height = 214
-      Top = 2
-      Width = 396
-      Anchors = [akTop, akLeft, akRight, akBottom]
-      BevelOuter = bvNone
-      ClientHeight = 214
-      ClientWidth = 396
-      TabOrder = 0
-      object mmoPayload: TMemo
-        Left = 0
-        Height = 70
-        Top = 136
-        Width = 386
-        TabOrder = 0
-      end
-      object Label1: TLabel
-        Left = 0
-        Height = 15
-        Top = 118
-        Width = 69
-        Caption = 'Payload Data'
-        ParentColor = False
-      end
-      object rbEncryptedWithOldEC: TRadioButton
-        Left = 3
-        Height = 19
-        Top = 0
-        Width = 176
-        Caption = 'Encrypted with old public key'
-        TabOrder = 1
-      end
-      object rbEncryptedWithEC: TRadioButton
-        Left = 3
-        Height = 19
-        Top = 24
-        Width = 181
-        Caption = 'Encrypted with new public key'
-        Checked = True
-        TabOrder = 2
-        TabStop = True
-      end
-      object rbEncryptedWithPassword: TRadioButton
-        Left = 3
-        Height = 19
-        Top = 48
-        Width = 152
-        Caption = 'Encrypted with password'
-        TabOrder = 3
-      end
-      object lblPassword: TLabel
-        Left = 3
-        Height = 15
-        Top = 73
-        Width = 53
-        Caption = 'Password:'
-        ParentColor = False
-      end
-      object rbNotEncrypted: TRadioButton
-        Left = 3
-        Height = 19
-        Top = 94
-        Width = 181
-        Caption = 'Don''t encrypt (public payload)'
-        TabOrder = 4
-      end
-      object edtPassword: TEdit
-        Left = 64
-        Height = 23
-        Top = 70
-        Width = 160
-        TabOrder = 5
-      end
-    end
-  end
-end

+ 0 - 84
src/gui/wizards/UWIZChangeAccountPrivateKey_TransactionPayload.pas

@@ -1,84 +0,0 @@
-unit UWIZChangeAccountPrivateKey_TransactionPayload;
-
-{$mode delphi}
-{$modeswitch nestedprocvars}
-
-{ Copyright (c) 2018 by Ugochukwu Mmaduekwe
-
-  Distributed under the MIT software license, see the accompanying file LICENSE
-  or visit http://www.opensource.org/licenses/mit-license.php.
-}
-
-interface
-
-uses
-  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
-  ExtCtrls, Buttons, UCommon, UCommon.Collections,
-  UWizard, UWIZChangeAccountPrivateKey, UWIZModels;
-
-type
-
-  { TWIZChangeAccountPrivateKey_TransactionPayload }
-
-  TWIZChangeAccountPrivateKey_TransactionPayload = class(TWizardForm<TWIZOperationsModel>)
-    edtPassword: TEdit;
-    grpPayload: TGroupBox;
-    Label1: TLabel;
-    lblPassword: TLabel;
-    mmoPayload: TMemo;
-    paPayload: TPanel;
-    rbEncryptedWithOldEC: TRadioButton;
-    rbEncryptedWithEC: TRadioButton;
-    rbEncryptedWithPassword: TRadioButton;
-    rbNotEncrypted: TRadioButton;
-  public
-    procedure OnNext; override;
-    function Validate(out message: ansistring): boolean; override;
-  end;
-
-
-implementation
-
-{$R *.lfm}
-
-uses
-  UAccounts, UUserInterface;
-
-{ TWIZChangeAccountPrivateKey_TransactionPayload }
-
-procedure TWIZChangeAccountPrivateKey_TransactionPayload.OnNext;
-begin
-  Model.Payload.Content := mmoPayload.Lines.Text;
-  if rbEncryptedWithOldEC.Checked then
-  begin
-    Model.Payload.Mode := akaEncryptWithSender;
-  end
-  else
-  if rbEncryptedWithEC.Checked then
-  begin
-    Model.Payload.Mode := akaEncryptWithReceiver;
-  end
-  else
-  if rbEncryptedWithPassword.Checked then
-  begin
-    Model.Payload.Mode := akaEncryptWithPassword;
-  end
-  else
-  if rbNotEncrypted.Checked then
-  begin
-    Model.Payload.Mode := akaNotEncrypt;
-  end;
-end;
-
-function TWIZChangeAccountPrivateKey_TransactionPayload.Validate(out message: ansistring): boolean;
-begin
-  if (not rbNotEncrypted.Checked) and (not rbEncryptedWithEC.Checked) and
-    (not rbEncryptedWithOldEC.Checked) and (not rbEncryptedWithPassword.Checked) then
-  begin
-    message := 'you must select an encryption option for payload';
-    Result := False;
-    Exit;
-  end;
-end;
-
-end.

+ 0 - 431
src/gui/wizards/UWIZSendPASC.pas

@@ -1,431 +0,0 @@
-unit UWIZSendPASC;
-
-{$mode delphi}
-
-{ Copyright (c) 2018 by Ugochukwu Mmaduekwe
-
-  Distributed under the MIT software license, see the accompanying file LICENSE
-  or visit http://www.opensource.org/licenses/mit-license.php.
-
-  Acknowledgements:
-    Herman Schoenfeld <[email protected]>: added grid-based layout
-}
-
-interface
-
-uses
-  Classes, SysUtils, Forms, Dialogs, UCrypto, UWizard, UAccounts, LCLType, UWIZModels;
-
-type
-
-  { TWIZSendPASCWizard }
-
-  TWIZSendPASCWizard = class(TWizard<TWIZOperationsModel>)
-  private
-    function UpdatePayload(const SenderAccount: TAccount;
-      var errors: string): boolean;
-    function UpdateOperationOptions(var errors: string): boolean;
-    function UpdateOpTransaction(const SenderAccount: TAccount;
-      var DestAccount: TAccount; var amount: int64; var errors: string): boolean;
-    procedure SendPASC();
-  public
-    constructor Create(AOwner: TComponent); override;
-    function DetermineHasNext: boolean; override;
-    function DetermineHasPrevious: boolean; override;
-    function FinishRequested(out message: ansistring): boolean; override;
-    function CancelRequested(out message: ansistring): boolean; override;
-  end;
-
-implementation
-
-uses
-  UBlockChain,
-  UOpTransaction,
-  UNode,
-  UConst,
-  UWallet,
-  UECIES,
-  UAES,
-  UWIZSendPASC_ConfirmSender,
-  UWIZSendPASC_Confirmation;
-
-{ TWIZSendPASCWizard }
-
-function TWIZSendPASCWizard.UpdateOperationOptions(var errors: string): boolean;
-var
-  iAcc, iWallet: integer;
-  sender_account, dest_account: TAccount;
-  wk: TWalletKey;
-  e: string;
-  amount: int64;
-begin
-  Result := False;
-  errors := '';
-  if not Assigned(TWallet.Keys) then
-  begin
-    errors := 'No wallet keys';
-    Exit;
-  end;
-
-  if Length(Model.SendPASC.SelectedAccounts) = 0 then
-  begin
-    errors := 'No sender account';
-    Exit;
-  end
-  else
-  begin
-
-    for iAcc := Low(Model.SendPASC.SelectedAccounts) to High(Model.SendPASC.SelectedAccounts) do
-    begin
-      sender_account := Model.SendPASC.SelectedAccounts[iAcc];
-      iWallet := TWallet.Keys.IndexOfAccountKey(sender_account.accountInfo.accountKey);
-      if (iWallet < 0) then
-      begin
-        errors := 'Private key of account ' +
-          TAccountComp.AccountNumberToAccountTxtNumber(sender_account.account) +
-          ' not found in wallet';
-        Exit;
-      end;
-      wk := TWallet.Keys.Key[iWallet];
-      if not assigned(wk.PrivateKey) then
-      begin
-        if wk.CryptedKey <> '' then
-        begin
-          // TODO: handle unlocking of encrypted wallet here
-          errors := 'Wallet is password protected. Need password';
-        end
-        else
-        begin
-          errors := 'Only public key of account ' +
-            TAccountComp.AccountNumberToAccountTxtNumber(sender_account.account) +
-            ' found in wallet. You cannot operate with this account';
-        end;
-        Exit;
-      end;
-    end;
-  end;
-
-  Result := UpdateOpTransaction(Model.SendPASC.SelectedAccounts[0], dest_account, amount, errors);
-  UpdatePayload(sender_account, e);
-end;
-
-function TWIZSendPASCWizard.UpdateOpTransaction(const SenderAccount: TAccount;
-  var DestAccount: TAccount; var amount: int64; var errors: string): boolean;
-var
-  c: cardinal;
-begin
-  Result := False;
-  errors := '';
-
-  DestAccount := Model.SendPASC.DestinationAccount;
-
-  if Length(Model.SendPASC.SelectedAccounts) = 1 then
-  begin
-    amount := Model.SendPASC.SingleAmountToSend;
-  end
-  else
-  begin
-    amount := 0; // ALL BALANCE
-  end;
-
-  if DestAccount.account = SenderAccount.account then
-  begin
-    errors := 'Sender and dest account are the same';
-    Exit;
-  end;
-
-  if (Length(Model.SendPASC.SelectedAccounts) = 1) then
-  begin
-    if (SenderAccount.balance < (amount + Model.Fee.SingleOperationFee)) then
-    begin
-      errors := 'Insufficient funds';
-      Exit;
-    end;
-  end;
-  Result := True;
-end;
-
-procedure TWIZSendPASCWizard.SendPASC();
-var
-  _V2, dooperation: boolean;
-  iAcc, i: integer;
-  _totalamount, _totalfee, _totalSignerFee, _amount, _fee: int64;
-  _signer_n_ops: cardinal;
-  operationstxt, operation_to_string, errors, auxs: string;
-  wk: TWalletKey;
-  ops: TOperationsHashTree;
-  op: TPCOperation;
-  account, destAccount: TAccount;
-begin
-  if not Assigned(TWallet.Keys) then
-    raise Exception.Create('No wallet keys');
-  if not UpdateOperationOptions(errors) then
-    raise Exception.Create(errors);
-  ops := TOperationsHashTree.Create;
-  try
-    _V2 := TNode.Node.Bank.SafeBox.CurrentProtocol >= CT_PROTOCOL_2;
-    _totalamount := 0;
-    _totalfee := 0;
-    _totalSignerFee := 0;
-    _signer_n_ops := 0;
-    operationstxt := '';
-    operation_to_string := '';
-    for iAcc := Low(Model.SendPASC.SelectedAccounts) to High(Model.SendPASC.SelectedAccounts) do
-    begin
-      op := nil;
-      account := Model.SendPASC.SelectedAccounts[iAcc];
-      if not UpdatePayload(account, errors) then
-      begin
-        raise Exception.Create('Error encoding payload of sender account ' +
-          TAccountComp.AccountNumberToAccountTxtNumber(account.account) + ': ' + errors);
-      end;
-      i := TWallet.Keys.IndexOfAccountKey(account.accountInfo.accountKey);
-      if i < 0 then
-      begin
-        raise Exception.Create('Sender account private key not found in Wallet');
-      end;
-
-      wk := TWallet.Keys.Key[i];
-      dooperation := True;
-      // Default fee
-      if account.balance > uint64(Model.Fee.SingleOperationFee) then
-        _fee := Model.Fee.SingleOperationFee
-      else
-        _fee := account.balance;
-
-      if not UpdateOpTransaction(account, destAccount, _amount, errors) then
-        raise Exception.Create(errors);
-      if Length(Model.SendPASC.SelectedAccounts) > 1 then
-      begin
-        if account.balance > 0 then
-        begin
-          if account.balance > Model.Fee.SingleOperationFee then
-          begin
-            _amount := account.balance - Model.Fee.SingleOperationFee;
-            _fee := Model.Fee.SingleOperationFee;
-          end
-          else
-          begin
-            _amount := account.balance;
-            _fee := 0;
-          end;
-        end
-        else
-          dooperation := False;
-      end
-      else
-      begin
-      end;
-      if dooperation then
-      begin
-        op := TOpTransaction.CreateTransaction(
-          account.account, account.n_operation + 1, destAccount.account,
-          wk.PrivateKey, _amount, _fee, Model.Payload.EncodedBytes);
-        Inc(_totalamount, _amount);
-        Inc(_totalfee, _fee);
-      end;
-      operationstxt := 'Transaction to ' + TAccountComp.AccountNumberToAccountTxtNumber(
-        destAccount.account);
-
-      if Assigned(op) and (dooperation) then
-      begin
-        ops.AddOperationToHashTree(op);
-        if operation_to_string <> '' then
-          operation_to_string := operation_to_string + #10;
-        operation_to_string := operation_to_string + op.ToString;
-      end;
-      FreeAndNil(op);
-    end;
-
-    if (ops.OperationsCount = 0) then
-      raise Exception.Create('No valid operation to execute');
-
-    if (Length(Model.SendPASC.SelectedAccounts) > 1) then
-    begin
-      auxs := 'Total amount that dest will receive: ' + TAccountComp.FormatMoney(
-        _totalamount) + #10;
-      if Application.MessageBox(
-        PChar('Execute ' + IntToStr(Length(Model.SendPASC.SelectedAccounts)) +
-        ' operations?' + #10 + 'Operation: ' + operationstxt + #10 +
-        auxs + 'Total fee: ' + TAccountComp.FormatMoney(_totalfee) +
-        #10 + #10 + 'Note: This operation will be transmitted to the network!'),
-        PChar(Application.Title), MB_YESNO + MB_ICONINFORMATION + MB_DEFBUTTON2) <>
-        idYes then
-      begin
-        Exit;
-      end;
-    end
-    else
-    begin
-      if Application.MessageBox(PChar('Execute this operation:' +
-        #10 + #10 + operation_to_string + #10 + #10 +
-        'Note: This operation will be transmitted to the network!'),
-        PChar(Application.Title), MB_YESNO + MB_ICONINFORMATION + MB_DEFBUTTON2) <>
-        idYes then
-      begin
-        Exit;
-      end;
-    end;
-    i := TNode.Node.AddOperations(nil, ops, nil, errors);
-    if (i = ops.OperationsCount) then
-    begin
-      operationstxt := 'Successfully executed ' + IntToStr(i) +
-        ' operations!' + #10 + #10 + operation_to_string;
-      if i > 1 then
-      begin
-        //  with TFRMMemoText.Create(Self) do
-        //    try
-        //      InitData(Application.Title, operationstxt);
-        //      ShowModal;
-        //    finally
-        //      Free;
-        //    end;
-        ShowMessage(operationstxt);
-      end
-      else
-      begin
-        Application.MessageBox(
-          PChar('Successfully executed ' + IntToStr(i) + ' operations!' +
-          #10 + #10 + operation_to_string),
-          PChar(Application.Title), MB_OK + MB_ICONINFORMATION);
-      end;
-      // ModalResult := mrOk;
-    end
-    else if (i > 0) then
-    begin
-      operationstxt := 'One or more of your operations has not been executed:' +
-        #10 + 'Errors:' + #10 + errors + #10 + #10 +
-        'Total successfully executed operations: ' + IntToStr(i);
-      //with TFRMMemoText.Create(Self) do
-      //  try
-      //    InitData(Application.Title, operationstxt);
-      //    ShowModal;
-      //  finally
-      //    Free;
-      //  end;
-      //ModalResult := mrOk;
-      ShowMessage(operationstxt);
-    end
-    else
-    begin
-      raise Exception.Create(errors);
-    end;
-
-  finally
-    ops.Free;
-  end;
-end;
-
-function TWIZSendPASCWizard.UpdatePayload(const SenderAccount: TAccount;
-  var errors: string): boolean;
-var
-  valid: boolean;
-  payload_encrypted, payload_u: string;
-  account: TAccount;
-begin
-  valid := False;
-  payload_encrypted := '';
-  Model.Payload.EncodedBytes := '';
-  errors := 'Unknown error';
-  payload_u := Model.Payload.Content;
-
-  try
-    if (payload_u = '') then
-    begin
-      valid := True;
-      Exit;
-    end;
-    case Model.Payload.Mode of
-
-      akaEncryptWithSender:
-      begin
-        // Use sender
-        errors := 'Error encrypting';
-        account := SenderAccount;
-        payload_encrypted := ECIESEncrypt(account.accountInfo.accountKey, payload_u);
-        valid := payload_encrypted <> '';
-      end;
-
-      akaEncryptWithReceiver:
-      begin
-        // With dest public key
-        errors := 'Error encrypting';
-        account := Model.SendPASC.DestinationAccount;
-        payload_encrypted := ECIESEncrypt(account.accountInfo.accountKey, payload_u);
-        valid := payload_encrypted <> '';
-      end;
-
-      akaEncryptWithPassword:
-      begin
-        payload_encrypted := TAESComp.EVP_Encrypt_AES256(
-          payload_u, Model.Payload.Password);
-        valid := payload_encrypted <> '';
-      end;
-
-      akaNotEncrypt:
-      begin
-        payload_encrypted := payload_u;
-        valid := True;
-      end
-
-      else
-      begin
-        raise Exception.Create('Invalid Encryption Selection');
-      end;
-    end;
-
-  finally
-    if valid then
-    begin
-      if length(payload_encrypted) > CT_MaxPayloadSize then
-      begin
-        valid := False;
-        errors := 'Payload size is bigger than ' + IntToStr(CT_MaxPayloadSize) +
-          ' (' + IntToStr(length(payload_encrypted)) + ')';
-      end;
-
-    end;
-    Model.Payload.EncodedBytes := payload_encrypted;
-    Result := valid;
-  end;
-
-end;
-
-constructor TWIZSendPASCWizard.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner, [TWIZSendPASC_ConfirmSender, TWIZSendPASC_Confirmation]);
-  TitleText := 'Send PASC';
-  FinishText := 'Send PASC';
-end;
-
-function TWIZSendPASCWizard.DetermineHasNext: boolean;
-begin
-  Result := not (CurrentScreen is TWIZSendPASC_Confirmation);
-end;
-
-function TWIZSendPASCWizard.DetermineHasPrevious: boolean;
-begin
-  Result := inherited DetermineHasPrevious;
-end;
-
-function TWIZSendPASCWizard.FinishRequested(out message: ansistring): boolean;
-begin
-  // Execute the PASC Sending here
-  try
-    Result := True;
-    SendPASC();
-  except
-    On E: Exception do
-    begin
-      Result := False;
-      message := E.ToString;
-    end;
-  end;
-end;
-
-function TWIZSendPASCWizard.CancelRequested(out message: ansistring): boolean;
-begin
-  Result := True;
-end;
-
-end.

+ 0 - 32
src/gui/wizards/UWIZSendPASC_ConfirmSender.lfm

@@ -1,32 +0,0 @@
-object WIZSendPASC_ConfirmSender: TWIZSendPASC_ConfirmSender
-  Left = 0
-  Height = 261
-  Top = 0
-  Width = 429
-  Caption = 'WIZSendPASC_ConfirmSender'
-  ClientHeight = 261
-  ClientWidth = 429
-  LCLVersion = '1.8.2.0'
-  Visible = False
-  object gpSender: TGroupBox
-    Left = 4
-    Height = 256
-    Top = 0
-    Width = 420
-    Anchors = [akTop, akLeft, akRight, akBottom]
-    Caption = 'Sender Accounts'
-    ClientHeight = 236
-    ClientWidth = 416
-    TabOrder = 0
-    object paGrid: TPanel
-      Left = 8
-      Height = 192
-      Top = 24
-      Width = 400
-      Anchors = [akTop, akLeft, akRight, akBottom]
-      BevelOuter = bvNone
-      Caption = 'GRID PANEL'
-      TabOrder = 0
-    end
-  end
-end

+ 0 - 113
src/gui/wizards/UWIZSendPASC_ConfirmSender.pas

@@ -1,113 +0,0 @@
-unit UWIZSendPASC_ConfirmSender;
-
-{$mode delphi}
-
-{ Copyright (c) 2018 Sphere 10 Software (http://www.sphere10.com/)
-
-  Distributed under the MIT software license, see the accompanying file LICENSE
-  or visit http://www.opensource.org/licenses/mit-license.php.
-
-  Acknowledgements:
-  Ugochukwu Mmaduekwe - main developer
-  Herman Schoenfeld - designer
-}
-
-interface
-
-uses
-  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
-  ExtCtrls, UVisualGrid, UCommon.Data, UCellRenderers,
-  UWizard, UWIZSendPASC, UWIZSendPASC_EnterRecipient, UWIZSendPASC_Confirmation, UWIZModels;
-
-type
-
-  { TWIZSendPASC_ConfirmSender }
-
-  TWIZSendPASC_ConfirmSender = class(TWizardForm<TWIZOperationsModel>)
-    gpSender: TGroupBox;
-    paGrid: TPanel;
-  private
-    FSendersGrid : TVisualGrid;
-  public
-    procedure OnPresent; override;
-    procedure OnNext; override;
-  end;
-
-
-
-implementation
-
-{$R *.lfm}
-
-uses UAccounts, UDataSources, UCommon, UCommon.UI, Generics.Collections;
-
-type
-
-  { TAccountSenderDataSource }
-
-  TAccountSenderDataSource = class(TAccountsDataSourceBase)
-    private
-      FModel : TWIZOperationsModel.TSendPASCModel;
-    public
-      property Model : TWIZOperationsModel.TSendPASCModel read FModel write FModel;
-      procedure FetchAll(const AContainer : TList<TAccount>); override;
-  end;
-
-{ TWIZSendPASC_ConfirmSender }
-
-procedure TWIZSendPASC_ConfirmSender.OnPresent;
-var
-  data : TAccountSenderDataSource;
-begin
-  FSendersGrid := TVisualGrid.Create(Self);
-  FSendersGrid.CanSearch:= False;
-  FSendersGrid.SortMode := smMultiColumn;
-  FSendersGrid.FetchDataInThread := False;
-  FSendersGrid.AutoPageSize := True;
-  FSendersGrid.SelectionType := stNone;
-  FSendersGrid.Options := [vgoColAutoFill, vgoColSizing, vgoSortDirectionAllowNone, vgoAutoHidePaging];
-  with FSendersGrid.AddColumn('Account') do begin
-    StretchedToFill := true;
-    Binding := 'AccountNumber';
-    SortBinding := 'AccountNumber';
-    DisplayBinding := 'Account';
-    Width := 100;
-    HeaderFontStyles := [fsBold];
-    DataFontStyles := [fsBold];
-    Filters:=SORTABLE_NUMERIC_FILTER;
-  end;
-  with FSendersGrid.AddColumn('Balance') do begin
-    Binding := 'BalanceDecimal';
-    SortBinding := 'Balance';
-    DisplayBinding := 'Balance';
-    Width := 100;
-    HeaderAlignment:=taRightJustify;
-    DataAlignment:=taRightJustify;
-    Renderer := TCellRenderers.PASC;
-    Filters:=SORTABLE_NUMERIC_FILTER;
-  end;
-  data := TAccountSenderDataSource.Create(FSendersGrid);
-  data.Model := Model.SendPASC;
-  FSendersGrid.DataSource := data;
-  paGrid.AddControlDockCenter(FSendersGrid);
-end;
-
-procedure TWIZSendPASC_ConfirmSender.OnNext;
-begin
-  UpdatePath(ptReplaceAllNext, [TWIZSendPASC_EnterRecipient, TWIZSendPASC_Confirmation]);
-end;
-
-{ TAccountSenderDataSource }
-
-procedure TAccountSenderDataSource.FetchAll(const AContainer : TList<TAccount>);
-var
-  i: Integer;
-begin
-  for i := Low(Model.SelectedAccounts) to High(Model.SelectedAccounts) do
-  begin
-    AContainer.Add( Model.SelectedAccounts[i] );
-  end;
-end;
-
-end.
-

+ 0 - 64
src/gui/wizards/UWIZSendPASC_Confirmation.lfm

@@ -1,64 +0,0 @@
-object WIZSendPASC_Confirmation: TWIZSendPASC_Confirmation
-  Left = 0
-  Height = 253
-  Top = 0
-  Width = 429
-  Caption = 'WIZSendPASC_Confirmation'
-  ClientHeight = 253
-  ClientWidth = 429
-  LCLVersion = '1.8.2.0'
-  Visible = False
-  object GroupBox1: TGroupBox
-    Left = 10
-    Height = 232
-    Top = 8
-    Width = 408
-    Anchors = [akTop, akLeft, akRight, akBottom]
-    Caption = 'Confirm Transaction'
-    ClientHeight = 212
-    ClientWidth = 404
-    TabOrder = 0
-    object paGrid: TPanel
-      Left = 8
-      Height = 152
-      Top = 48
-      Width = 382
-      Anchors = [akTop, akLeft, akRight, akBottom]
-      BevelOuter = bvNone
-      Caption = 'GRID PANEL'
-      TabOrder = 0
-    end
-    object Label1: TLabel
-      Left = 8
-      Height = 15
-      Top = 2
-      Width = 84
-      Caption = 'Signer Account:'
-      ParentColor = False
-    end
-    object lblSgnAcc: TLabel
-      Left = 112
-      Height = 15
-      Top = 2
-      Width = 53
-      Caption = 'lblSgnAcc'
-      ParentColor = False
-    end
-    object Label2: TLabel
-      Left = 8
-      Height = 15
-      Top = 24
-      Width = 111
-      Caption = 'Destination Account:'
-      ParentColor = False
-    end
-    object lblDestAcc: TLabel
-      Left = 128
-      Height = 15
-      Top = 24
-      Width = 56
-      Caption = 'lblDestAcc'
-      ParentColor = False
-    end
-  end
-end

+ 0 - 144
src/gui/wizards/UWIZSendPASC_Confirmation.pas

@@ -1,144 +0,0 @@
-unit UWIZSendPASC_Confirmation;
-
-{$mode delphi}
-{$modeswitch nestedprocvars}
-
-{ Copyright (c) 2018 Sphere 10 Software (http://www.sphere10.com/)
-
-  Distributed under the MIT software license, see the accompanying file LICENSE
-  or visit http://www.opensource.org/licenses/mit-license.php.
-
-  Acknowledgements:
-  Ugochukwu Mmaduekwe - main developer
-  Herman Schoenfeld - designer
-}
-
-interface
-
-uses
-  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
-  ExtCtrls, UVisualGrid, UCellRenderers, UCommon.Data, UWizard, UWIZSendPASC, UWIZModels;
-
-type
-
-  { TWIZSendPASC_Confirmation }
-
-  TWIZSendPASC_Confirmation = class(TWizardForm<TWIZOperationsModel>)
-    GroupBox1: TGroupBox;
-    Label1: TLabel;
-    Label2: TLabel;
-    lblDestAcc: TLabel;
-    lblSgnAcc: TLabel;
-    paGrid: TPanel;
-  private
-    FSendersGrid : TVisualGrid;
-  public
-    procedure OnPresent; override;
-  end;
-
-
-implementation
-
-{$R *.lfm}
-
-uses UAccounts, UDataSources, UCommon, UCommon.UI, Generics.Collections;
-
-type
-
-  { TAccountSenderDataSource }
-
-  TAccountSenderDataSource = class(TAccountsDataSourceBase)
-    private
-      FModel : TWIZOperationsModel;
-    protected
-      function GetColumns : TDataColumns; override;
-    public
-      property Model : TWIZOperationsModel read FModel write FModel;
-      procedure FetchAll(const AContainer : TList<TAccount>); override;
-      function GetItemField(constref AItem: TAccount; const ABindingName : AnsiString) : Variant; override;
-  end;
-
-{ TWIZSendPASC_Confirmation }
-
-procedure TWIZSendPASC_Confirmation.OnPresent;
-var
-  data : TAccountSenderDataSource;
-begin
-  FSendersGrid := TVisualGrid.Create(Self);
-  FSendersGrid.CanSearch:= False;
-  FSendersGrid.SortMode := smMultiColumn;
-  FSendersGrid.FetchDataInThread := False;
-  FSendersGrid.AutoPageSize := True;
-  FSendersGrid.SelectionType := stNone;
-  FSendersGrid.Options := [vgoColAutoFill, vgoColSizing, vgoSortDirectionAllowNone, vgoAutoHidePaging];
-  with FSendersGrid.AddColumn('Sender') do begin
-    Binding := 'SenderAccount';
-    Filters := SORTABLE_NUMERIC_FILTER;
-    Width := 100;
-    HeaderFontStyles := [fsBold];
-    DataFontStyles := [fsBold];
-  end;
-  with FSendersGrid.AddColumn('Balance') do begin
-    Filters := SORTABLE_NUMERIC_FILTER;
-    Width := 100;
-    Renderer := TCellRenderers.PASC;
-  end;
-  with FSendersGrid.AddColumn('Amount To Send') do begin
-    Binding := 'AmountToSend';
-    Filters := SORTABLE_TEXT_FILTER;
-    Width := 100;
-  end;
-  with FSendersGrid.AddColumn('Fee') do begin
-    Filters := SORTABLE_TEXT_FILTER;
-    Width := 100;
-  end;
-
-   data := TAccountSenderDataSource.Create(FSendersGrid);
-   data.Model := Model;
-   FSendersGrid.DataSource := data;
-   paGrid.AddControlDockCenter(FSendersGrid);
-   lblSgnAcc.Caption := TAccountComp.AccountNumberToAccountTxtNumber(Model.Signer.SignerAccount.account);
-   lblDestAcc.Caption := TAccountComp.AccountNumberToAccountTxtNumber(Model.SendPASC.DestinationAccount.account);
-end;
-
-{ TAccountSenderDataSource }
-
-function TAccountSenderDataSource.GetColumns : TDataColumns;
-begin
-  Result := TDataColumns.Create(
-    TDataColumn.From('SenderAccount'),
-    TDataColumn.From('Balance'),
-    TDataColumn.From('AmountToSend'),
-    TDataColumn.From('Fee')
-  );
-end;
-
-function TAccountSenderDataSource.GetItemField(constref AItem: TAccount; const ABindingName : AnsiString) : Variant;
-var
-  index : Integer;
-begin
-   if ABindingName = 'SenderAccount' then
-     Result := TAccountComp.AccountNumberToAccountTxtNumber(AItem.account)
-   else if ABindingName = 'Balance' then
-     Result := TAccountComp.FormatMoney(AItem.Balance)
-   else if ABindingName = 'AmountToSend' then
-     Result := TAccountComp.FormatMoney(Model.SendPASC.SingleAmountToSend)
-     else if ABindingName = 'Fee' then
-     Result := TAccountComp.FormatMoney(Model.Fee.SingleOperationFee)
-   else raise Exception.Create(Format('Field not found [%s]', [ABindingName]));
-end;
-
-
-procedure TAccountSenderDataSource.FetchAll(const AContainer : TList<TAccount>);
-var
-  i: Integer;
-begin
-  for i := Low(Model.SendPASC.SelectedAccounts) to High(Model.SendPASC.SelectedAccounts) do
-  begin
-    AContainer.Add( Model.SendPASC.SelectedAccounts[i] );
-  end;
-end;
-
-
-end.
-

+ 0 - 63
src/gui/wizards/UWIZSendPASC_EnterQuantity.lfm

@@ -1,63 +0,0 @@
-object WIZSendPASC_EnterQuantity: TWIZSendPASC_EnterQuantity
-  Left = 0
-  Height = 253
-  Top = 0
-  Width = 429
-  ActiveControl = edtAmt
-  Caption = 'WIZSendPASC_EnterQuantity'
-  ClientHeight = 253
-  ClientWidth = 429
-  LCLVersion = '1.8.2.0'
-  Visible = False
-  object gbQuantity: TGroupBox
-    Left = 16
-    Height = 232
-    Top = 8
-    Width = 400
-    Caption = 'Transaction Quantity'
-    ClientHeight = 212
-    ClientWidth = 396
-    TabOrder = 0
-    object edtAmt: TEdit
-      Left = 8
-      Height = 23
-      Top = 40
-      Width = 160
-      TabOrder = 0
-    end
-    object lblQuantityNotice: TLabel
-      Left = 8
-      Height = 15
-      Top = 7
-      Width = 217
-      Caption = 'Please enter the quantity of PASC to send'
-      ParentColor = False
-    end
-    object chkallfunds: TCheckBox
-      Left = 184
-      Height = 19
-      Top = 42
-      Width = 166
-      Caption = 'Send all funds in account(s)'
-      OnChange = chkallfundsChange
-      TabOrder = 1
-    end
-    object chkChooseFee: TCheckBox
-      Left = 8
-      Height = 19
-      Top = 80
-      Width = 226
-      Caption = 'Let me choose fee''s for this transaction'
-      TabOrder = 2
-    end
-    object chkAttachPayload: TCheckBox
-      Left = 8
-      Height = 19
-      Top = 110
-      Width = 303
-      Caption = 'I want to attach a message payload to this transaction'
-      OnChange = chkAttachPayloadChange
-      TabOrder = 3
-    end
-  end
-end

+ 0 - 138
src/gui/wizards/UWIZSendPASC_EnterQuantity.pas

@@ -1,138 +0,0 @@
-unit UWIZSendPASC_EnterQuantity;
-
-{$mode delphi}
-{$modeswitch nestedprocvars}
-
-{ Copyright (c) 2018 Sphere 10 Software (http://www.sphere10.com/)
-
-  Distributed under the MIT software license, see the accompanying file LICENSE
-  or visit http://www.opensource.org/licenses/mit-license.php.
-
-  Acknowledgements:
-  Ugochukwu Mmaduekwe - main developer
-  Herman Schoenfeld - designer
-}
-
-interface
-
-uses
-  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
-  ExtCtrls, Buttons, UCommon, UCommon.Collections, UWallet,
-  UFRMAccountSelect, UNode, UWizard, UWIZSendPASC, UWIZFeeOverride, UWIZPayloadOverride, UWIZSelectSignerOverride,
-  UWIZSendPASC_Confirmation, UWIZModels;
-
-type
-
-  { TWIZSendPASC_EnterQuantity }
-
-  TWIZSendPASC_EnterQuantity = class(TWizardForm<TWIZOperationsModel>)
-    chkChooseFee: TCheckBox;
-    chkAttachPayload: TCheckBox;
-    chkallfunds: TCheckBox;
-    edtAmt: TEdit;
-    gbQuantity: TGroupBox;
-    lblQuantityNotice: TLabel;
-    procedure chkAttachPayloadChange(Sender: TObject);
-    procedure UpdateUI();
-    procedure chkallfundsChange(Sender: TObject);
-
-
-  public
-    procedure OnPresent; override;
-    procedure OnNext; override;
-    function Validate(out message: ansistring): boolean; override;
-  end;
-
-
-implementation
-
-{$R *.lfm}
-
-uses
-  UAccounts, UUserInterface, USettings;
-
-{ TWIZSendPASC_EnterQuantity }
-
-procedure TWIZSendPASC_EnterQuantity.UpdateUI();
-begin
-  if chkallfunds.Checked then
-  begin
-    edtAmt.Text := 'ALL BALANCE';
-    edtAmt.Enabled := False;
-  end
-  else
-  begin
-    edtAmt.Text := TAccountComp.FormatMoney(0);
-    edtAmt.Enabled := True;
-  end;
-
-  Model.Payload.HasPayload := IIF(chkAttachPayload.Checked, True, False);
-
-end;
-
-procedure TWIZSendPASC_EnterQuantity.chkallfundsChange(Sender: TObject);
-begin
-  UpdateUI();
-end;
-
-procedure TWIZSendPASC_EnterQuantity.OnPresent;
-begin
-  edtAmt.Text := TAccountComp.FormatMoney(0);
-end;
-
-procedure TWIZSendPASC_EnterQuantity.chkAttachPayloadChange(Sender: TObject);
-begin
-  UpdateUI();
-end;
-
-procedure TWIZSendPASC_EnterQuantity.OnNext;
-var
-  amount: Int64;
-begin
-  Model.Payload.HasPayload := chkAttachPayload.Checked;
-  if chkallfunds.Checked then
-  begin
-    Model.SendPASC.SingleAmountToSend := 0; // all balance
-  end
-  else
-  begin
-    TAccountComp.TxtToMoney(edtAmt.Text, Model.SendPASC.SingleAmountToSend);
-  end;
-
-  if chkChooseFee.Checked then
-  begin
-    UpdatePath(ptReplaceAllNext, [TWIZFeeOverride, TWIZSendPASC_Confirmation]);
-  end
-  else
-  begin
-    Model.Fee.SingleOperationFee := TSettings.DefaultFee;
-    if Model.Payload.HasPayload then
-    begin
-      UpdatePath(ptReplaceAllNext, [TWIZPayloadOverride, TWIZSendPASC_Confirmation]);
-    end
-    else
-    begin
-      UpdatePath(ptReplaceAllNext, [TWIZSelectSignerOverride, TWIZSendPASC_Confirmation]);
-    end;
-  end;
-
-end;
-
-function TWIZSendPASC_EnterQuantity.Validate(out message: ansistring): boolean;
-var
-  amount: int64;
-begin
-  Result := True;
-  if not chkallfunds.Checked then
-  begin
-    if not TAccountComp.TxtToMoney(edtAmt.Text, amount) then
-    begin
-      message := 'Invalid amount (' + edtAmt.Text + ')';
-      Result := False;
-      Exit;
-    end;
-  end;
-
-end;
-
-end.

+ 0 - 151
src/gui/wizards/UWIZSendPASC_Transaction.lfm

@@ -1,151 +0,0 @@
-object WIZSendPASC_Transaction: TWIZSendPASC_Transaction
-  Left = 0
-  Height = 253
-  Top = 0
-  Width = 429
-  ActiveControl = cbSignerAccount
-  Caption = 'WIZSendPASC_Transaction'
-  ClientHeight = 253
-  ClientWidth = 429
-  LCLVersion = '1.8.2.0'
-  Visible = False
-  object gbTransaction: TGroupBox
-    Left = 22
-    Height = 192
-    Top = 40
-    Width = 384
-    Caption = 'Transaction Details'
-    ClientHeight = 172
-    ClientWidth = 380
-    TabOrder = 0
-    object cbSignerAccount: TComboBox
-      Left = 8
-      Height = 23
-      Top = 8
-      Width = 168
-      ItemHeight = 15
-      Items.Strings = (
-        ''
-      )
-      OnChange = cbSignerAccountChange
-      TabOrder = 0
-      Text = 'Select Signer Account'
-    end
-    object lblBalance: TLabel
-      Left = 200
-      Height = 15
-      Top = 12
-      Width = 151
-      Caption = 'Please Select Signer Account'
-      Font.Color = clRed
-      ParentColor = False
-      ParentFont = False
-    end
-    object lblDestAcc: TLabel
-      Left = 8
-      Height = 15
-      Top = 48
-      Width = 108
-      Caption = 'Destination Account'
-      ParentColor = False
-    end
-    object edtDestAcc: TEdit
-      Left = 8
-      Height = 23
-      Top = 74
-      Width = 136
-      TabOrder = 1
-    end
-    object lblAmount: TLabel
-      Left = 8
-      Height = 15
-      Top = 116
-      Width = 44
-      Caption = 'Amount'
-      ParentColor = False
-    end
-    object edtAmt: TEdit
-      Left = 8
-      Height = 23
-      Top = 143
-      Width = 136
-      TabOrder = 2
-    end
-    object btnSearch: TSpeedButton
-      Left = 152
-      Height = 22
-      Top = 75
-      Width = 23
-      Glyph.Data = {
-        36040000424D3604000000000000360000002800000010000000100000000100
-        2000000000000004000064000000640000000000000000000000000000000000
-        0000000000000000000F00000010000000100000001000000010000000100000
-        001000000010000000100000000F000000000000000000000000000000003509
-        033190370DEBA6410FFFA6410FFFA6410FFFA6410FFFA6410FFFA6410FFFA641
-        0FFFA6410FFFA6410FFFA6410FFF90370DEB350903310000000000000000953A
-        0EE6B14B10FFB04B10FFB04B10FFB04B10FFB04B10FFB04B10FFB04B10FFB04B
-        10FFB14B11FFAE460CFFB14B11FFB14B10FF953A0EE60000000000000001AA47
-        12FFB24D11FFB24D11FFB24D11FFB24D11FFB34E12FFB34E12FFB24D11FFB34E
-        12FFAB440DFFE1C19FFFAC4914FFB34E12FFAA4712FF0000000100000001AD4A
-        13FFB65113FFB65113FFB55113FFB14A0EFFAA3F05FFAA3F05FFB14A0EFFAE48
-        0EFFEEDCBCFFFFFFE2FFE6C6A1FFB44E0FFFAD4A13FF0000000100000001AF4D
-        14FFB85414FFB85414FFB75A25FFE5C8A7FFFFFFEBFFFFFFEAFFE3C3A1FFECD7
-        B8FFFFFFE4FFF1DFBEFFB55011FFB85414FFAF4D14FF0000000100000001B251
-        15FFBB5816FFBB6027FFFFFFEAFFEBCFABFFCC814BFFCC824CFFECD1AEFFFFFF
-        E8FFEFDAB9FFB95412FFBB5816FFBB5816FFB25115FF0000000100000001B555
-        16FFBC5712FFEACDAAFFEBCEAAFFBB540EFFBF5E19FFBF5E19FFBB550FFFEDD2
-        B0FFE7C7A5FFBC5712FFBE5C16FFBE5C16FFB55516FF0000000100000001B859
-        19FFBD5915FFFFFFFCFFD08857FFC56B29FFC46B29FFC46A29FFC56B29FFD18B
-        5BFFFFFFF9FFBF5D1BFFC46A27FFC36623FFB85919FF0000000100000001C170
-        35FFC66B2BFFFFFFFFFFD38F64FFCB7839FFCA7739FFCA7739FFCB7839FFD492
-        67FFFFFFFFFFC66C2CFFCA7739FFCB7739FFC17035FF0000000100000001C77F
-        46FFCF8248FFF1DBCCFFEED3C5FFCC7A40FFD1864CFFD1864CFFCC7A40FFEFD5
-        C8FFF1D9C9FFCF8348FFD0864CFFD0864CFFC77F46FF0000000100000001CD8D
-        59FFD79561FFDA9D6EFFFFFFFFFFF0D7C8FFDA9F79FFDAA079FFF0D8CAFFFFFF
-        FFFFD99C6DFFD79561FFD69460FFD69460FFCD8D59FF0000000100000000D29A
-        6CFFDCA373FFDCA373FFDEA97FFFF5E5D8FFFFFFFFFFFFFFFFFFF5E5D7FFDEA9
-        7EFFDCA373FFDCA373FFDCA373FFDCA373FFD29A6CFF0000000000000000C99C
-        75E0E1AE83FFE1AE84FFE1AE84FFE0AC80FFDFA87AFFDEA87AFFE0AC80FFE1AE
-        84FFE1AE84FFE1AE84FFE1AE84FFE1AE83FFC99C75E000000000FFFFFE007960
-        4721D0AA87DCDCB58FFFDDB590FFDDB590FFDDB590FFDDB590FFDDB590FFDDB5
-        90FFDDB590FFDDB590FFDCB58FFFD0AA87DC79604821FFFFFA0000000000FFFF
-        FF00000000000000000000000000000000000000000000000000000000000000
-        000000000000000000000000000000000000FFFFFF0000000000
-      }
-      OnClick = btnSearchClick
-    end
-    object edtOpFee: TEdit
-      Left = 232
-      Height = 23
-      Top = 144
-      Width = 136
-      TabOrder = 3
-    end
-    object lblOpFee: TLabel
-      Left = 232
-      Height = 15
-      Top = 116
-      Width = 74
-      Caption = 'Operation Fee'
-      ParentColor = False
-    end
-  end
-  object lblTotalBalances: TLabel
-    Left = 24
-    Height = 15
-    Top = 16
-    Width = 176
-    Caption = 'Selected Accounts Total Balance: '
-    ParentColor = False
-  end
-  object lblTotalBalanceValue: TLabel
-    Left = 208
-    Height = 15
-    Top = 16
-    Width = 70
-    Caption = 'Total Balance'
-    Font.Color = clGreen
-    ParentColor = False
-    ParentFont = False
-  end
-end

+ 0 - 258
src/gui/wizards/UWIZSendPASC_Transaction.pas

@@ -1,258 +0,0 @@
-unit UWIZSendPASC_Transaction;
-
-{$mode delphi}
-{$modeswitch nestedprocvars}
-
-{ Copyright (c) 2018 by Ugochukwu Mmaduekwe
-
-  Distributed under the MIT software license, see the accompanying file LICENSE
-  or visit http://www.opensource.org/licenses/mit-license.php.
-}
-
-interface
-
-uses
-  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
-  ExtCtrls, Buttons, UCommon, UCommon.Collections, UWallet,
-  UFRMAccountSelect, UNode, UWizard, UWIZSendPASC, UWIZSendPASC_Confirmation, UWIZSendPASC_TransactionPayload, UWIZModels;
-
-type
-
-  { TWIZSendPASC_Transaction }
-
-  TWIZSendPASC_Transaction = class(TWizardForm<TWIZOperationsModel>)
-    cbSignerAccount: TComboBox;
-    edtOpFee: TEdit;
-    edtAmt: TEdit;
-    edtDestAcc: TEdit;
-    gbTransaction: TGroupBox;
-    lblOpFee: TLabel;
-    lblAmount: TLabel;
-    lblDestAcc: TLabel;
-    lblTotalBalanceValue: TLabel;
-    lblTotalBalances: TLabel;
-    lblBalance: TLabel;
-    btnSearch: TSpeedButton;
-    procedure btnSearchClick(Sender: TObject);
-    procedure cbSignerAccountChange(Sender: TObject);
-
-  public
-    procedure OnPresent; override;
-    procedure OnNext; override;
-    function Validate(out message: ansistring): boolean; override;
-  end;
-
-
-implementation
-
-{$R *.lfm}
-
-uses
-  UAccounts, UUserInterface, USettings;
-
-{ TWIZSendPASC_Transaction }
-
-procedure TWIZSendPASC_Transaction.cbSignerAccountChange(Sender: TObject);
-begin
-  if cbSignerAccount.ItemIndex < 1 then
-  begin
-    lblBalance.Font.Color := clRed;
-    lblBalance.Caption := 'Please Select Signer Account';
-  end
-  else
-  begin
-    lblBalance.Font.Color := clGreen;
-    lblBalance.Caption := Format('%s PASC',
-      [TAccountComp.FormatMoney(Model.SendPASC.SelectedAccounts[PtrInt(
-      cbSignerAccount.Items.Objects[cbSignerAccount.ItemIndex])].Balance)]);
-  end;
-end;
-
-procedure TWIZSendPASC_Transaction.btnSearchClick(Sender: TObject);
-var
-  F: TFRMAccountSelect;
-  c: cardinal;
-begin
-  F := TFRMAccountSelect.Create(Self);
-  F.Position := poMainFormCenter;
-  try
-    F.Node := TNode.Node;
-    F.WalletKeys := TWallet.Keys;
-    F.Filters := edtDestAcc.Tag;
-    if TAccountComp.AccountTxtNumberToAccountNumber(edtDestAcc.Text, c) then
-      F.DefaultAccount := c;
-    F.AllowSelect := True;
-    if F.ShowModal = mrOk then
-    begin
-      edtDestAcc.Text := TAccountComp.AccountNumberToAccountTxtNumber(F.GetSelected);
-    end;
-  finally
-    F.Free;
-  end;
-end;
-
-procedure TWIZSendPASC_Transaction.OnPresent;
-
-  function GetAccNoWithChecksum(AAccountNumber: cardinal): string;
-  begin
-    Result := TAccountComp.AccountNumberToAccountTxtNumber(AAccountNumber);
-  end;
-
-var
-  acc: TAccount;
-  accNumberwithChecksum: string;
-  totalBalance: int64;
-  i: integer;
-begin
-  cbSignerAccount.Items.BeginUpdate;
-  totalBalance := 0;
-  try
-    cbSignerAccount.Items.Clear;
-    cbSignerAccount.Items.Add('Select Signer Account');
-    for i := 0 to High(Model.SendPASC.SelectedAccounts) do
-    begin
-      acc := Model.SendPASC.SelectedAccounts[i];
-      accNumberwithChecksum := GetAccNoWithChecksum(acc.account);
-      totalBalance := totalBalance + acc.balance;
-      cbSignerAccount.Items.AddObject(accNumberwithChecksum, TObject(i));
-    end;
-  finally
-    cbSignerAccount.Items.EndUpdate;
-  end;
-  cbSignerAccount.ItemIndex := Model.SendPASC.SelectedIndex;
-  cbSignerAccountChange(Self);
-  lblTotalBalanceValue.Caption :=
-    Format('%s PASC', [TAccountComp.FormatMoney(totalBalance)]);
-
-  if Length(Model.SendPASC.SelectedAccounts) > 1 then
-  begin
-    edtAmt.Text := 'ALL BALANCE';
-    edtAmt.Enabled := False;
-  end
-  else
-  begin
-    edtAmt.Text := TAccountComp.FormatMoney(0);
-  end;
-  edtOpFee.Text := TAccountComp.FormatMoney(TSettings.DefaultFee);
-end;
-
-procedure TWIZSendPASC_Transaction.OnNext;
-
-  function GetAccNoWithoutChecksum(const AAccount: string): cardinal;
-  begin
-    if not TAccountComp.AccountTxtNumberToAccountNumber(AAccount, Result) then
-    begin
-      raise Exception.Create(
-        'Internal Error: Unable to parse account number from input');
-    end;
-  end;
-
-  function GetAccounts(AccountNumber: cardinal): TAccount;
-  var
-    acc: TAccount;
-    safeBox: TPCSafeBox;
-    keys: TOrderedAccountKeysList;
-    i: integer;
-  begin
-    keys := TWallet.keys.AccountsKeyList;
-    safeBox := TUserInterface.Node.Bank.safeBox;
-    safeBox.StartThreadSafe;
-    try
-      acc := safeBox.Account(AccountNumber);
-      if keys.IndexOfAccountKey(acc.accountInfo.accountKey) >= 0 then
-      begin
-        Result := acc;
-      end;
-    finally
-      safeBox.EndThreadSave;
-    end;
-
-  end;
-
-begin
-  Model.SendPASC.SelectedIndex := cbSignerAccount.ItemIndex;
-  Model.SignerModel.SignerAccount := Model.SendPASC.SelectedAccounts[PtrInt(cbSignerAccount.Items.Objects[cbSignerAccount.ItemIndex])];
-  Model.SendPASC.DestinationAccount := GetAccounts(GetAccNoWithoutChecksum(edtDestAcc.Text));
-  Model.SendPASC.AmountToSend := edtAmt.Text;
-  UpdatePath(ptReplaceAllNext, [TWIZSendPASC_TransactionPayload, TWIZSendPASC_Confirmation]);
-end;
-
-function TWIZSendPASC_Transaction.Validate(out message: ansistring): boolean;
-
-  function GetAccNoWithChecksum(constref AAccount: TAccount): string;
-  begin
-    Result := TAccountComp.AccountNumberToAccountTxtNumber(AAccount.account);
-  end;
-
-var
-  AccountNumbersWithChecksum: TArray<string>;
-  Accounts: TArray<TAccount>;
-  c: cardinal;
-  DestAccount: TAccount;
-  amount, opfee: int64;
-  i: integer;
-begin
-  Accounts := Model.SendPASC.SelectedAccounts;
-  Result := True;
-  if cbSignerAccount.ItemIndex < 1 then
-  begin
-    message := 'A signer account must be selected';
-    Result := False;
-    Exit;
-  end;
-
-  if not (TAccountComp.AccountTxtNumberToAccountNumber(edtDestAcc.Text, c)) then
-  begin
-    message := 'Invalid destination account (' + edtDestAcc.Text + ')';
-    Result := False;
-    Exit;
-  end;
-
-  if (c < 0) or (c >= TNode.Node.Bank.AccountsCount) then
-  begin
-    message := 'Invalid destination account (' +
-      TAccountComp.AccountNumberToAccountTxtNumber(c) + ')';
-    Result := False;
-    Exit;
-  end;
-
-  DestAccount := TNode.Node.Operations.SafeBoxTransaction.account(c);
-  if Length(Accounts) = 1 then
-  begin
-    if not TAccountComp.TxtToMoney(edtAmt.Text, amount) then
-    begin
-      message := 'Invalid amount (' + edtAmt.Text + ')';
-      Result := False;
-      Exit;
-    end;
-  end;
-
-  AccountNumbersWithChecksum := TListTool<TAccount, string>.Transform(Accounts, GetAccNoWithCheckSum);
-
-  if TArrayTool<string>.Contains(AccountNumbersWithChecksum, edtDestAcc.Text) then
-  begin
-    message := 'Sender and destination account are the same';
-    Result := False;
-    Exit;
-  end;
-
-  if not TAccountComp.TxtToMoney(Trim(edtOpFee.Text), Model.FeeModel.DefaultFee) then
-  begin
-    message := 'Invalid fee value "' + edtOpFee.Text + '"';
-    Result := False;
-    Exit;
-  end;
-
-  //for i := Low(Accounts) to High(Accounts) do
-  //begin
-  //  if (Accounts[i].balance < (amount + opfee)) then
-  //  begin
-  //    message := 'Insufficient funds';
-  //    Result := False;
-  //    Exit;
-  //  end;
-  //end;
-
-end;
-
-end.

+ 0 - 98
src/gui/wizards/UWIZSendPASC_TransactionPayload.lfm

@@ -1,98 +0,0 @@
-object WIZSendPASC_TransactionPayload: TWIZSendPASC_TransactionPayload
-  Left = 0
-  Height = 253
-  Top = 0
-  Width = 429
-  ActiveControl = mmoPayload
-  Caption = 'Form1'
-  ClientHeight = 253
-  ClientWidth = 429
-  LCLVersion = '1.8.2.0'
-  Visible = False
-  object grpPayload: TGroupBox
-    Left = 8
-    Height = 244
-    Top = 2
-    Width = 416
-    Anchors = [akTop, akLeft, akRight, akBottom]
-    Caption = 'Transaction Payload'
-    ClientHeight = 224
-    ClientWidth = 412
-    TabOrder = 0
-    object paPayload: TPanel
-      Left = 8
-      Height = 214
-      Top = 2
-      Width = 396
-      Anchors = [akTop, akLeft, akRight, akBottom]
-      BevelOuter = bvNone
-      ClientHeight = 214
-      ClientWidth = 396
-      TabOrder = 0
-      object mmoPayload: TMemo
-        Left = 0
-        Height = 70
-        Top = 136
-        Width = 386
-        TabOrder = 0
-      end
-      object Label1: TLabel
-        Left = 0
-        Height = 15
-        Top = 118
-        Width = 69
-        Caption = 'Payload Data'
-        ParentColor = False
-      end
-      object rbEncryptedWithOldEC: TRadioButton
-        Left = 3
-        Height = 19
-        Top = 0
-        Width = 194
-        Caption = 'Encrypted with sender public key'
-        TabOrder = 1
-      end
-      object rbEncryptedWithEC: TRadioButton
-        Left = 3
-        Height = 19
-        Top = 24
-        Width = 227
-        Caption = 'Encrypted with dest account public key'
-        Checked = True
-        TabOrder = 2
-        TabStop = True
-      end
-      object rbEncryptedWithPassword: TRadioButton
-        Left = 3
-        Height = 19
-        Top = 48
-        Width = 152
-        Caption = 'Encrypted with password'
-        TabOrder = 3
-      end
-      object lblPassword: TLabel
-        Left = 3
-        Height = 15
-        Top = 73
-        Width = 53
-        Caption = 'Password:'
-        ParentColor = False
-      end
-      object rbNotEncrypted: TRadioButton
-        Left = 3
-        Height = 19
-        Top = 94
-        Width = 181
-        Caption = 'Don''t encrypt (public payload)'
-        TabOrder = 4
-      end
-      object edtPassword: TEdit
-        Left = 64
-        Height = 23
-        Top = 70
-        Width = 160
-        TabOrder = 5
-      end
-    end
-  end
-end

+ 0 - 84
src/gui/wizards/UWIZSendPASC_TransactionPayload.pas

@@ -1,84 +0,0 @@
-unit UWIZSendPASC_TransactionPayload;
-
-{$mode delphi}
-{$modeswitch nestedprocvars}
-
-{ Copyright (c) 2018 by Ugochukwu Mmaduekwe
-
-  Distributed under the MIT software license, see the accompanying file LICENSE
-  or visit http://www.opensource.org/licenses/mit-license.php.
-}
-
-interface
-
-uses
-  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
-  ExtCtrls, Buttons, UCommon, UCommon.Collections,
-  UWizard, UWIZSendPASC, UWIZModels;
-
-type
-
-  { TWIZSendPASC_TransactionPayload }
-
-  TWIZSendPASC_TransactionPayload = class(TWizardForm<TWIZOperationsModel>)
-    edtPassword: TEdit;
-    grpPayload: TGroupBox;
-    Label1: TLabel;
-    lblPassword: TLabel;
-    mmoPayload: TMemo;
-    paPayload: TPanel;
-    rbEncryptedWithOldEC: TRadioButton;
-    rbEncryptedWithEC: TRadioButton;
-    rbEncryptedWithPassword: TRadioButton;
-    rbNotEncrypted: TRadioButton;
-  public
-    procedure OnNext; override;
-    function Validate(out message: ansistring): boolean; override;
-  end;
-
-
-implementation
-
-{$R *.lfm}
-
-uses
-  UAccounts, UUserInterface;
-
-{ TWIZSendPASC_TransactionPayload }
-
-procedure TWIZSendPASC_TransactionPayload.OnNext;
-begin
-  Model.Payload.Payload := mmoPayload.Lines.Text;
-  if rbEncryptedWithOldEC.Checked then
-  begin
-    Model.Payload.PayloadEncryptionMode := akaEncryptWithOldEC;
-  end
-  else
-  if rbEncryptedWithEC.Checked then
-  begin
-    Model.Payload.PayloadEncryptionMode := akaEncryptWithEC;
-  end
-  else
-  if rbEncryptedWithPassword.Checked then
-  begin
-    Model.Payload.PayloadEncryptionMode := akaEncryptWithPassword;
-  end
-  else
-  if rbNotEncrypted.Checked then
-  begin
-    Model.Payload.PayloadEncryptionMode := akaNotEncrypt;
-  end;
-end;
-
-function TWIZSendPASC_TransactionPayload.Validate(out message: ansistring): boolean;
-begin
-  if (not rbNotEncrypted.Checked) and (not rbEncryptedWithEC.Checked) and
-    (not rbEncryptedWithOldEC.Checked) and (not rbEncryptedWithPassword.Checked) then
-  begin
-    message := 'you must select an encryption option for payload';
-    Result := False;
-    Exit;
-  end;
-end;
-
-end.

+ 0 - 451
src/gui/wizards/UWIZTransferAccount.pas

@@ -1,451 +0,0 @@
-unit UWIZTransferAccount;
-
-{$mode delphi}
-
-{ Copyright (c) 2018 by Ugochukwu Mmaduekwe
-
-  Distributed under the MIT software license, see the accompanying file LICENSE
-  or visit http://www.opensource.org/licenses/mit-license.php.
-
-}
-
-interface
-
-uses
-  Classes, SysUtils, Forms, Dialogs, UCrypto, UCommon, UWizard, UAccounts, LCLType, UWIZModels;
-
-type
-
-  { TWIZTransferAccountWizard }
-
-  TWIZTransferAccountWizard = class(TWizard<TWIZOperationsModel>)
-  private
-    function UpdatePayload(const SenderAccount: TAccount; var errors: string): boolean;
-    function UpdateOperationOptions(var errors: string): boolean;
-    function UpdateOpChangeKey(const TargetAccount: TAccount; var SignerAccount: TAccount; var NewPublicKey: TAccountKey; var errors: ansistring): boolean;
-    procedure TransferAccountOwnership();
-  public
-    constructor Create(AOwner: TComponent); override;
-    function DetermineHasNext: boolean; override;
-    function DetermineHasPrevious: boolean; override;
-    function FinishRequested(out message: ansistring): boolean; override;
-    function CancelRequested(out message: ansistring): boolean; override;
-  end;
-
-implementation
-
-uses
-  UBlockChain,
-  UOpTransaction,
-  UNode,
-  UConst,
-  UWallet,
-  UECIES,
-  UAES,
-  UWIZTransferAccount_Start,
-  UWIZTransferAccount_Confirmation;
-
-{ TWIZTransferAccountWizard }
-
-function TWIZTransferAccountWizard.UpdatePayload(const SenderAccount: TAccount; var errors: string): boolean;
-var
-  valid: boolean;
-  payload_encrypted, payload_u: string;
-  account: TAccount;
-begin
-  valid := False;
-  payload_encrypted := '';
-  Model.Payload.EncodedBytes := '';
-  errors := 'Unknown error';
-  payload_u := Model.Payload.Content;
-
-  try
-    if (payload_u = '') then
-    begin
-      valid := True;
-      Exit;
-    end;
-    case Model.Payload.Mode of
-
-      akaEncryptWithSender:
-      begin
-        // Use sender
-        errors := 'Error encrypting';
-        account := SenderAccount;
-        payload_encrypted := ECIESEncrypt(account.accountInfo.accountKey, payload_u);
-        valid := payload_encrypted <> '';
-      end;
-
-      akaEncryptWithReceiver:
-      begin
-        errors := 'Public key: ' + 'Error encrypting';
-
-        if Model.TransferAccount.AccountKey.EC_OpenSSL_NID <>
-          CT_Account_NUL.accountInfo.accountKey.EC_OpenSSL_NID then
-        begin
-          payload_encrypted := ECIESEncrypt(Model.TransferAccount.AccountKey, payload_u);
-          valid := payload_encrypted <> '';
-        end
-        else
-        begin
-          valid := False;
-          errors := 'Selected private key is not valid to encode';
-          exit;
-        end;
-      end;
-
-      akaEncryptWithPassword:
-      begin
-        payload_encrypted := TAESComp.EVP_Encrypt_AES256(
-          payload_u, Model.Payload.Password);
-        valid := payload_encrypted <> '';
-      end;
-
-      akaNotEncrypt:
-      begin
-        payload_encrypted := payload_u;
-        valid := True;
-      end
-
-      else
-      begin
-        raise Exception.Create('Invalid Encryption Selection');
-      end;
-    end;
-
-  finally
-    if valid then
-    begin
-      if length(payload_encrypted) > CT_MaxPayloadSize then
-      begin
-        valid := False;
-        errors := 'Payload size is bigger than ' + IntToStr(CT_MaxPayloadSize) +
-          ' (' + IntToStr(length(payload_encrypted)) + ')';
-      end;
-
-    end;
-    Model.Payload.EncodedBytes := payload_encrypted;
-    Result := valid;
-  end;
-
-end;
-
-function TWIZTransferAccountWizard.UpdateOperationOptions(var errors: string): boolean;
-var
-  iAcc, iWallet: integer;
-  sender_account, signer_account: TAccount;
-  publicKey: TAccountKey;
-  wk: TWalletKey;
-  e: string;
-  amount: int64;
-begin
-  Result := False;
-  errors := '';
-  if not Assigned(TWallet.Keys) then
-  begin
-    errors := 'No wallet keys';
-    Exit;
-  end;
-
-  if Length(Model.TransferAccount.SelectedAccounts) = 0 then
-  begin
-    errors := 'No sender account';
-    Exit;
-  end
-  else
-  begin
-
-    for iAcc := Low(Model.TransferAccount.SelectedAccounts) to High(Model.TransferAccount.SelectedAccounts) do
-    begin
-      sender_account := Model.TransferAccount.SelectedAccounts[iAcc];
-      iWallet := TWallet.Keys.IndexOfAccountKey(sender_account.accountInfo.accountKey);
-      if (iWallet < 0) then
-      begin
-        errors := 'Private key of account ' +
-          TAccountComp.AccountNumberToAccountTxtNumber(sender_account.account) +
-          ' not found in wallet';
-        Exit;
-      end;
-      wk := TWallet.Keys.Key[iWallet];
-      if not assigned(wk.PrivateKey) then
-      begin
-        if wk.CryptedKey <> '' then
-        begin
-          // TODO: handle unlocking of encrypted wallet here
-          errors := 'Wallet is password protected. Need password';
-        end
-        else
-        begin
-          errors := 'Only public key of account ' +
-            TAccountComp.AccountNumberToAccountTxtNumber(sender_account.account) +
-            ' found in wallet. You cannot operate with this account';
-        end;
-        Exit;
-      end;
-    end;
-  end;
-
-  Result := UpdateOpChangeKey(Model.TransferAccount.SelectedAccounts[0], signer_account,
-    publicKey, errors);
-  UpdatePayload(sender_account, e);
-end;
-
-function TWIZTransferAccountWizard.UpdateOpChangeKey(const TargetAccount: TAccount;
-  var SignerAccount: TAccount; var NewPublicKey: TAccountKey;
-  var errors: ansistring): boolean;
-begin
-  Result := False;
-  errors := '';
-  try
-    if not TAccountComp.AccountKeyFromImport(Model.TransferAccount.NewPublicKey,
-      NewPublicKey, errors) then
-    begin
-      Exit;
-    end;
-
-    if TNode.Node.Bank.SafeBox.CurrentProtocol >= 1 then
-    begin
-      // Signer:
-      SignerAccount := Model.Signer.SignerAccount;
-      if (TAccountComp.IsAccountLocked(SignerAccount.accountInfo,
-        TNode.Node.Bank.BlocksCount)) then
-      begin
-        errors := 'Signer account ' + TAccountComp.AccountNumberToAccountTxtNumber(
-          SignerAccount.account) + ' is locked until block ' + IntToStr(
-          SignerAccount.accountInfo.locked_until_block);
-        exit;
-      end;
-      if (not TAccountComp.EqualAccountKeys(
-        SignerAccount.accountInfo.accountKey, TargetAccount.accountInfo.accountKey)) then
-      begin
-        errors := 'Signer account ' + TAccountComp.AccountNumberToAccountTxtNumber(
-          SignerAccount.account) + ' is not owner of account ' +
-          TAccountComp.AccountNumberToAccountTxtNumber(TargetAccount.account);
-        exit;
-      end;
-    end
-    else
-    begin
-      SignerAccount := TargetAccount;
-    end;
-
-    if (TAccountComp.EqualAccountKeys(TargetAccount.accountInfo.accountKey,
-      NewPublicKey)) then
-    begin
-      errors := 'New public key is the same public key';
-      exit;
-    end;
-
-  finally
-    Result := errors = '';
-  end;
-end;
-
-procedure TWIZTransferAccountWizard.TransferAccountOwnership();
-var
-  _V2, dooperation: boolean;
-  iAcc, i: integer;
-  _totalamount, _totalfee, _totalSignerFee, _amount, _fee: int64;
-  _signer_n_ops: cardinal;
-  operationstxt, operation_to_string, errors, auxs: string;
-  wk: TWalletKey;
-  ops: TOperationsHashTree;
-  op: TPCOperation;
-  account, signerAccount: TAccount;
-  _newOwnerPublicKey: TECDSA_Public;
-label
-  loop_start;
-begin
-  if not Assigned(TWallet.Keys) then
-    raise Exception.Create('No wallet keys');
-  if not UpdateOperationOptions(errors) then
-    raise Exception.Create(errors);
-  ops := TOperationsHashTree.Create;
-
-  try
-    _V2 := TNode.Node.Bank.SafeBox.CurrentProtocol >= CT_PROTOCOL_2;
-    _totalamount := 0;
-    _totalfee := 0;
-    _totalSignerFee := 0;
-    _signer_n_ops := 0;
-    operationstxt := '';
-    operation_to_string := '';
-    for iAcc := Low(Model.TransferAccount.SelectedAccounts) to High(Model.TransferAccount.SelectedAccounts) do
-    begin
-      loop_start:
-        op := nil;
-      account := Model.TransferAccount.SelectedAccounts[iAcc];
-      if not UpdatePayload(account, errors) then
-      begin
-        raise Exception.Create('Error encoding payload of sender account ' +
-          TAccountComp.AccountNumberToAccountTxtNumber(account.account) + ': ' + errors);
-      end;
-      i := TWallet.Keys.IndexOfAccountKey(account.accountInfo.accountKey);
-      if i < 0 then
-      begin
-        raise Exception.Create('Sender account private key not found in Wallet');
-      end;
-
-      wk := TWallet.Keys.Key[i];
-      dooperation := True;
-      // Default fee
-      if account.balance > uint64(Model.Fee.DefaultFee) then
-        _fee := Model.Fee.DefaultFee
-      else
-        _fee := account.balance;
-
-      if not UpdateOpChangeKey(account, signerAccount, _newOwnerPublicKey, errors) then
-      begin
-        raise Exception.Create(errors);
-      end;
-      if _V2 then
-      begin
-        // must ensure is Signer account last if included in sender accounts (not necessarily ordered enumeration)
-        if (iAcc < Length(Model.TransferAccount.SelectedAccounts) - 1) and
-          (account.account = signerAccount.account) then
-        begin
-          TArrayTool<TAccount>.Swap(Model.TransferAccount.SelectedAccounts, iAcc,
-            Length(Model.TransferAccount.SelectedAccounts) - 1); // ensure signer account processed last
-          // TArrayTool_internal<Cardinal>.Swap(_senderAccounts, iAcc, Length(_senderAccounts) - 1);
-          goto loop_start; // TODO: remove ugly hack with refactoring!
-        end;
-
-        // Maintain correct signer fee distribution
-        if uint64(_totalSignerFee) >= signerAccount.balance then
-          _fee := 0
-        else if signerAccount.balance - uint64(_totalSignerFee) >
-          uint64(Model.Fee.DefaultFee) then
-          _fee := Model.Fee.DefaultFee
-        else
-          _fee := signerAccount.balance - uint64(_totalSignerFee);
-        op := TOpChangeKeySigned.Create(signerAccount.account,
-          signerAccount.n_operation + _signer_n_ops + 1, account.account,
-          wk.PrivateKey, _newOwnerPublicKey, _fee, Model.Payload.EncodedBytes);
-        Inc(_signer_n_ops);
-        Inc(_totalSignerFee, _fee);
-      end
-      else
-      begin
-        op := TOpChangeKey.Create(account.account, account.n_operation +
-          1, account.account, wk.PrivateKey, _newOwnerPublicKey, _fee, Model.Payload.EncodedBytes);
-      end;
-      Inc(_totalfee, _fee);
-      operationstxt :=
-        'Change private key to ' + TAccountComp.GetECInfoTxt(
-        _newOwnerPublicKey.EC_OpenSSL_NID);
-
-      if Assigned(op) and (dooperation) then
-      begin
-        ops.AddOperationToHashTree(op);
-        if operation_to_string <> '' then
-          operation_to_string := operation_to_string + #10;
-        operation_to_string := operation_to_string + op.ToString;
-      end;
-      FreeAndNil(op);
-    end;
-
-    if (ops.OperationsCount = 0) then
-      raise Exception.Create('No valid operation to execute');
-
-    if (Length(Model.TransferAccount.SelectedAccounts) > 1) then
-    begin
-      auxs := '';
-      if Application.MessageBox(
-        PChar('Execute ' + IntToStr(Length(Model.TransferAccount.SelectedAccounts)) +
-        ' operations?' + #10 + 'Operation: ' + operationstxt + #10 +
-        auxs + 'Total fee: ' + TAccountComp.FormatMoney(_totalfee) +
-        #10 + #10 + 'Note: This operation will be transmitted to the network!'),
-        PChar(Application.Title), MB_YESNO + MB_ICONINFORMATION + MB_DEFBUTTON2) <>
-        idYes then
-      begin
-        Exit;
-      end;
-    end
-    else
-    begin
-      if Application.MessageBox(PChar('Execute this operation:' + #10 +
-        #10 + operation_to_string + #10 + #10 +
-        'Note: This operation will be transmitted to the network!'),
-        PChar(Application.Title), MB_YESNO + MB_ICONINFORMATION + MB_DEFBUTTON2) <> idYes then
-      begin
-        Exit;
-      end;
-    end;
-    i := TNode.Node.AddOperations(nil, ops, nil, errors);
-    if (i = ops.OperationsCount) then
-    begin
-      operationstxt := 'Successfully executed ' + IntToStr(i) +
-        ' operations!' + #10 + #10 + operation_to_string;
-      if i > 1 then
-      begin
-
-        ShowMessage(operationstxt);
-      end
-      else
-      begin
-        Application.MessageBox(
-          PChar('Successfully executed ' + IntToStr(i) + ' operations!' +
-          #10 + #10 + operation_to_string),
-          PChar(Application.Title), MB_OK + MB_ICONINFORMATION);
-      end;
-
-    end
-    else if (i > 0) then
-    begin
-      operationstxt := 'One or more of your operations has not been executed:' +
-        #10 + 'Errors:' + #10 + errors + #10 + #10 +
-        'Total successfully executed operations: ' + IntToStr(i);
-
-      ShowMessage(operationstxt);
-    end
-    else
-    begin
-      raise Exception.Create(errors);
-    end;
-
-
-  finally
-    ops.Free;
-  end;
-
-end;
-
-constructor TWIZTransferAccountWizard.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner, [TWIZTransferAccount_Start,
-    TWIZTransferAccount_Confirmation]);
-  TitleText := 'Transfer Account';
-  FinishText := 'Transfer Account';
-end;
-
-function TWIZTransferAccountWizard.DetermineHasNext: boolean;
-begin
-  Result := not (CurrentScreen is TWIZTransferAccount_Confirmation);
-end;
-
-function TWIZTransferAccountWizard.DetermineHasPrevious: boolean;
-begin
-  Result := inherited DetermineHasPrevious;
-end;
-
-function TWIZTransferAccountWizard.FinishRequested(out message: ansistring): boolean;
-begin
-  // Execute the Transfer Account Action here
-  try
-    Result := True;
-    TransferAccountOwnership();
-  except
-    On E: Exception do
-    begin
-      Result := False;
-      message := E.ToString;
-    end;
-  end;
-end;
-
-function TWIZTransferAccountWizard.CancelRequested(out message: ansistring): boolean;
-begin
-  Result := True;
-end;
-
-end.

+ 0 - 48
src/gui/wizards/UWIZTransferAccount_Confirmation.lfm

@@ -1,48 +0,0 @@
-object WIZTransferAccount_Confirmation: TWIZTransferAccount_Confirmation
-  Left = 0
-  Height = 253
-  Top = 0
-  Width = 429
-  Caption = 'WIZTransferAccount_Confirmation'
-  ClientHeight = 253
-  ClientWidth = 429
-  LCLVersion = '1.8.2.0'
-  Visible = False
-  object GroupBox1: TGroupBox
-    Left = 10
-    Height = 232
-    Top = 8
-    Width = 408
-    Anchors = [akTop, akLeft, akRight, akBottom]
-    Caption = 'Confirm Transfer Transaction'
-    ClientHeight = 212
-    ClientWidth = 404
-    TabOrder = 0
-    object paGrid: TPanel
-      Left = 8
-      Height = 152
-      Top = 48
-      Width = 382
-      Anchors = [akTop, akLeft, akRight, akBottom]
-      BevelOuter = bvNone
-      Caption = 'GRID PANEL'
-      TabOrder = 0
-    end
-    object Label1: TLabel
-      Left = 8
-      Height = 15
-      Top = 16
-      Width = 84
-      Caption = 'Signer Account:'
-      ParentColor = False
-    end
-    object lblSgnAcc: TLabel
-      Left = 112
-      Height = 15
-      Top = 16
-      Width = 53
-      Caption = 'lblSgnAcc'
-      ParentColor = False
-    end
-  end
-end

+ 0 - 137
src/gui/wizards/UWIZTransferAccount_Confirmation.pas

@@ -1,137 +0,0 @@
-unit UWIZTransferAccount_Confirmation;
-
-{$mode delphi}
-{$modeswitch nestedprocvars}
-
-{ Copyright (c) 2018 by Ugochukwu Mmaduekwe
-
-  Distributed under the MIT software license, see the accompanying file LICENSE
-  or visit http://www.opensource.org/licenses/mit-license.php.
-}
-
-interface
-
-uses
-  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
-  ExtCtrls, UVisualGrid, UCellRenderers, UCommon.Data, UWizard, UWIZTransferAccount, UWIZModels;
-
-type
-
-  { TWIZTransferAccount_Confirmation }
-
-  TWIZTransferAccount_Confirmation = class(TWizardForm<TWIZOperationsModel>)
-    GroupBox1: TGroupBox;
-    Label1: TLabel;
-    lblSgnAcc: TLabel;
-    paGrid: TPanel;
-  private
-    FSendersGrid : TVisualGrid;
-  public
-    procedure OnPresent; override;
-  end;
-
-
-implementation
-
-{$R *.lfm}
-
-uses UAccounts, UDataSources, UCommon, UCommon.UI, Generics.Collections;
-
-type
-
-  { TAccountSenderDataSource }
-
-  TAccountSenderDataSource = class(TAccountsDataSourceBase)
-    private
-      FModel : TWIZOperationsModel;
-    protected
-      function GetColumns : TDataColumns; override;
-    public
-      property Model : TWIZOperationsModel read FModel write FModel;
-      procedure FetchAll(const AContainer : TList<TAccount>); override;
-      function GetItemField(constref AItem: TAccount; const ABindingName : AnsiString) : Variant; override;
-  end;
-
-{ TWIZTransferAccount_Confirmation }
-
-procedure TWIZTransferAccount_Confirmation.OnPresent;
-var
-  data : TAccountSenderDataSource;
-begin
-  FSendersGrid := TVisualGrid.Create(Self);
-  FSendersGrid.CanSearch:= False;
-  FSendersGrid.SortMode := smMultiColumn;
-  FSendersGrid.FetchDataInThread := False;
-  FSendersGrid.AutoPageSize := True;
-  FSendersGrid.SelectionType := stNone;
-  FSendersGrid.Options := [vgoColAutoFill, vgoColSizing, vgoSortDirectionAllowNone, vgoAutoHidePaging];
-  with FSendersGrid.AddColumn('Account') do begin
-    Binding := 'Account';
-    Filters := SORTABLE_NUMERIC_FILTER;
-    Width := 100;
-    HeaderFontStyles := [fsBold];
-    DataFontStyles := [fsBold];
-  end;
-  with FSendersGrid.AddColumn('Current Public Key') do begin
-    Binding := 'CurrentPublicKey';
-    Filters := SORTABLE_TEXT_FILTER;
-    Width := 100;
-  end;
-   with FSendersGrid.AddColumn('New Public Key') do begin
-    Binding := 'NewPublicKey';
-    Filters := SORTABLE_TEXT_FILTER;
-    Width := 100;
-  end;
-  with FSendersGrid.AddColumn('Fee') do begin
-    Filters := SORTABLE_TEXT_FILTER;
-    Width := 100;
-  end;
-
-   data := TAccountSenderDataSource.Create(FSendersGrid);
-   data.Model := Model;
-   FSendersGrid.DataSource := data;
-   paGrid.AddControlDockCenter(FSendersGrid);
-   lblSgnAcc.Caption := TAccountComp.AccountNumberToAccountTxtNumber(Model.Signer.SignerAccount.account);
-end;
-
-{ TAccountSenderDataSource }
-
-function TAccountSenderDataSource.GetColumns : TDataColumns;
-begin
-  Result := TDataColumns.Create(
-    TDataColumn.From('Account'),
-    TDataColumn.From('CurrentPublicKey'),
-    TDataColumn.From('NewPublicKey'),
-    TDataColumn.From('Fee')
-  );
-end;
-
-function TAccountSenderDataSource.GetItemField(constref AItem: TAccount; const ABindingName : AnsiString) : Variant;
-var
-  index : Integer;
-begin
-   if ABindingName = 'Account' then
-     Result := TAccountComp.AccountNumberToAccountTxtNumber(AItem.account)
-   else if ABindingName = 'CurrentPublicKey' then
-     Result := TAccountComp.AccountPublicKeyExport(AItem.accountInfo.accountKey)
-   else if ABindingName = 'NewPublicKey' then
-     Result := Model.TransferAccount.NewPublicKey
-     else if ABindingName = 'Fee' then
-     Result := TAccountComp.FormatMoney(Model.Fee.DefaultFee)
-   else raise Exception.Create(Format('Field not found [%s]', [ABindingName]));
-end;
-
-
-procedure TAccountSenderDataSource.FetchAll(const AContainer : TList<TAccount>);
-var
-  i: Integer;
-begin
-  for i := Low(Model.TransferAccount.SelectedAccounts) to High(Model.TransferAccount.SelectedAccounts) do
-  begin
-    AContainer.Add( Model.TransferAccount.SelectedAccounts[i] );
-  end;
-end;
-
-
-end.
-

+ 0 - 93
src/gui/wizards/UWIZTransferAccount_Transaction.lfm

@@ -1,93 +0,0 @@
-object WIZTransferAccount_Transaction: TWIZTransferAccount_Transaction
-  Left = 0
-  Height = 253
-  Top = 0
-  Width = 429
-  ActiveControl = cbSignerAccount
-  Caption = 'WIZTransferAccount_Transaction'
-  ClientHeight = 253
-  ClientWidth = 429
-  LCLVersion = '1.8.2.0'
-  Visible = False
-  object gbTransaction: TGroupBox
-    Left = 24
-    Height = 192
-    Top = 40
-    Width = 384
-    Caption = 'Transfer Transaction Details'
-    ClientHeight = 172
-    ClientWidth = 380
-    TabOrder = 0
-    object cbSignerAccount: TComboBox
-      Left = 8
-      Height = 23
-      Top = 8
-      Width = 168
-      ItemHeight = 15
-      Items.Strings = (
-        ''
-      )
-      OnChange = cbSignerAccountChange
-      TabOrder = 0
-      Text = 'Select Signer Account'
-    end
-    object lblBalance: TLabel
-      Left = 200
-      Height = 15
-      Top = 12
-      Width = 151
-      Caption = 'Please Select Signer Account'
-      Font.Color = clRed
-      ParentColor = False
-      ParentFont = False
-    end
-    object lblpublickey: TLabel
-      Left = 8
-      Height = 15
-      Top = 48
-      Width = 120
-      Caption = 'New Owner Public Key'
-      ParentColor = False
-    end
-    object edtPublicKey: TEdit
-      Left = 8
-      Height = 23
-      Top = 74
-      Width = 360
-      TabOrder = 1
-    end
-    object edtOpFee: TEdit
-      Left = 8
-      Height = 23
-      Top = 144
-      Width = 360
-      TabOrder = 2
-    end
-    object lblOpFee: TLabel
-      Left = 8
-      Height = 15
-      Top = 112
-      Width = 74
-      Caption = 'Operation Fee'
-      ParentColor = False
-    end
-  end
-  object lblTotalBalances: TLabel
-    Left = 24
-    Height = 15
-    Top = 16
-    Width = 176
-    Caption = 'Selected Accounts Total Balance: '
-    ParentColor = False
-  end
-  object lblTotalBalanceValue: TLabel
-    Left = 208
-    Height = 15
-    Top = 16
-    Width = 70
-    Caption = 'Total Balance'
-    Font.Color = clGreen
-    ParentColor = False
-    ParentFont = False
-  end
-end

+ 0 - 148
src/gui/wizards/UWIZTransferAccount_Transaction.pas

@@ -1,148 +0,0 @@
-unit UWIZTransferAccount_Transaction;
-
-{$mode delphi}
-{$modeswitch nestedprocvars}
-
-{ Copyright (c) 2018 by Ugochukwu Mmaduekwe
-
-  Distributed under the MIT software license, see the accompanying file LICENSE
-  or visit http://www.opensource.org/licenses/mit-license.php.
-}
-
-interface
-
-uses
-  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
-  ExtCtrls, Buttons, UCommon, UCommon.Collections, UWallet,
-  UFRMAccountSelect, UNode, UWizard, UWIZTransferAccount,
-  UWIZTransferAccount_TransactionPayload,
-  UWIZTransferAccount_Confirmation, UWIZModels;
-
-type
-
-  { TWIZTransferAccount_Transaction }
-
-  TWIZTransferAccount_Transaction = class(TWizardForm<TWIZOperationsModel>)
-    cbSignerAccount: TComboBox;
-    edtOpFee: TEdit;
-    edtPublicKey: TEdit;
-    gbTransaction: TGroupBox;
-    lblOpFee: TLabel;
-    lblpublickey: TLabel;
-    lblTotalBalanceValue: TLabel;
-    lblTotalBalances: TLabel;
-    lblBalance: TLabel;
-    procedure cbSignerAccountChange(Sender: TObject);
-
-
-  public
-    procedure OnPresent; override;
-    procedure OnNext; override;
-    function Validate(out message: ansistring): boolean; override;
-  end;
-
-
-implementation
-
-{$R *.lfm}
-
-uses
-  UAccounts, UUserInterface, USettings;
-
-{ TWIZTransferAccount_Transaction }
-
-procedure TWIZTransferAccount_Transaction.cbSignerAccountChange(Sender: TObject);
-begin
-  if cbSignerAccount.ItemIndex < 1 then
-  begin
-    lblBalance.Font.Color := clRed;
-    lblBalance.Caption := 'Please Select Signer Account';
-  end
-  else
-  begin
-    lblBalance.Font.Color := clGreen;
-    lblBalance.Caption := Format('%s PASC', [TAccountComp.FormatMoney(Model.TransferAccount.SelectedAccounts[PtrInt(cbSignerAccount.Items.Objects[cbSignerAccount.ItemIndex])].Balance)]);
-  end;
-end;
-
-procedure TWIZTransferAccount_Transaction.OnPresent;
-
-  function GetAccNoWithChecksum(AAccountNumber: cardinal): string;
-  begin
-    Result := TAccountComp.AccountNumberToAccountTxtNumber(AAccountNumber);
-  end;
-
-var
-  acc: TAccount;
-  accNumberwithChecksum: string;
-  totalBalance: int64;
-  i: integer;
-begin
-  cbSignerAccount.Items.BeginUpdate;
-  totalBalance := 0;
-  try
-    cbSignerAccount.Items.Clear;
-    cbSignerAccount.Items.Add('Select Signer Account');
-    for i := Low(Model.TransferAccount.SelectedAccounts) to High(Model.TransferAccount.SelectedAccounts) do
-    begin
-      acc := Model.TransferAccount.SelectedAccounts[i];
-      accNumberwithChecksum := GetAccNoWithChecksum(acc.account);
-      totalBalance := totalBalance + acc.balance;
-      cbSignerAccount.Items.AddObject(accNumberwithChecksum, TObject(i));
-    end;
-  finally
-    cbSignerAccount.Items.EndUpdate;
-  end;
-  cbSignerAccount.ItemIndex := Model.TransferAccount.SelectedIndex;
-  cbSignerAccountChange(Self);
-  lblTotalBalanceValue.Caption :=
-    Format('%s PASC', [TAccountComp.FormatMoney(totalBalance)]);
-
-  edtOpFee.Text := TAccountComp.FormatMoney(TSettings.DefaultFee);
-end;
-
-procedure TWIZTransferAccount_Transaction.OnNext;
-begin
-  Model.TransferAccount.SelectedIndex := cbSignerAccount.ItemIndex;
-  Model.Signer.SignerAccount := Model.TransferAccount.SelectedAccounts[PtrInt(
-    cbSignerAccount.Items.Objects[cbSignerAccount.ItemIndex])];
-  Model.TransferAccount.NewPublicKey := Trim(edtPublicKey.Text);
-
-  UpdatePath(ptReplaceAllNext, [TWIZTransferAccount_TransactionPayload,
-    TWIZTransferAccount_Confirmation]);
-end;
-
-function TWIZTransferAccount_Transaction.Validate(out message: ansistring): boolean;
-var
-  i: integer;
-begin
-  Result := True;
-  if cbSignerAccount.ItemIndex < 1 then
-  begin
-    message := 'A signer account must be selected';
-    Result := False;
-    Exit;
-  end;
-
-  if not TAccountComp.TxtToMoney(Trim(edtOpFee.Text), Model.Fee.DefaultFee) then
-  begin
-    message := 'Invalid fee value "' + edtOpFee.Text + '"';
-    Result := False;
-    Exit;
-  end;
-
-  Result := TAccountComp.AccountKeyFromImport(edtPublicKey.Text,
-    Model.TransferAccount.AccountKey, message);
-  for i := Low(Model.TransferAccount.SelectedAccounts) to High(Model.TransferAccount.SelectedAccounts) do
-  begin
-    if TAccountComp.EqualAccountKeys(Model.TransferAccount.SelectedAccounts[i].accountInfo.accountKey,
-      Model.TransferAccount.AccountKey) then
-    begin
-      Result := False;
-      message := 'new public key is same as selected account public key';
-      Exit;
-    end;
-  end;
-end;
-
-end.

+ 0 - 98
src/gui/wizards/UWIZTransferAccount_TransactionPayload.lfm

@@ -1,98 +0,0 @@
-object WIZTransferAccount_TransactionPayload: TWIZTransferAccount_TransactionPayload
-  Left = 0
-  Height = 253
-  Top = 0
-  Width = 429
-  ActiveControl = mmoPayload
-  Caption = 'Form1'
-  ClientHeight = 253
-  ClientWidth = 429
-  LCLVersion = '1.8.2.0'
-  Visible = False
-  object grpPayload: TGroupBox
-    Left = 8
-    Height = 244
-    Top = 2
-    Width = 416
-    Anchors = [akTop, akLeft, akRight, akBottom]
-    Caption = 'Transfer Transaction Payload'
-    ClientHeight = 224
-    ClientWidth = 412
-    TabOrder = 0
-    object paPayload: TPanel
-      Left = 8
-      Height = 214
-      Top = 2
-      Width = 396
-      Anchors = [akTop, akLeft, akRight, akBottom]
-      BevelOuter = bvNone
-      ClientHeight = 214
-      ClientWidth = 396
-      TabOrder = 0
-      object mmoPayload: TMemo
-        Left = 0
-        Height = 70
-        Top = 136
-        Width = 386
-        TabOrder = 0
-      end
-      object Label1: TLabel
-        Left = 0
-        Height = 15
-        Top = 118
-        Width = 69
-        Caption = 'Payload Data'
-        ParentColor = False
-      end
-      object rbEncryptedWithOldEC: TRadioButton
-        Left = 3
-        Height = 19
-        Top = 0
-        Width = 176
-        Caption = 'Encrypted with old public key'
-        TabOrder = 1
-      end
-      object rbEncryptedWithEC: TRadioButton
-        Left = 3
-        Height = 19
-        Top = 24
-        Width = 181
-        Caption = 'Encrypted with new public key'
-        Checked = True
-        TabOrder = 2
-        TabStop = True
-      end
-      object rbEncryptedWithPassword: TRadioButton
-        Left = 3
-        Height = 19
-        Top = 48
-        Width = 152
-        Caption = 'Encrypted with password'
-        TabOrder = 3
-      end
-      object lblPassword: TLabel
-        Left = 3
-        Height = 15
-        Top = 73
-        Width = 53
-        Caption = 'Password:'
-        ParentColor = False
-      end
-      object rbNotEncrypted: TRadioButton
-        Left = 3
-        Height = 19
-        Top = 94
-        Width = 181
-        Caption = 'Don''t encrypt (public payload)'
-        TabOrder = 4
-      end
-      object edtPassword: TEdit
-        Left = 64
-        Height = 23
-        Top = 70
-        Width = 160
-        TabOrder = 5
-      end
-    end
-  end
-end

+ 0 - 84
src/gui/wizards/UWIZTransferAccount_TransactionPayload.pas

@@ -1,84 +0,0 @@
-unit UWIZTransferAccount_TransactionPayload;
-
-{$mode delphi}
-{$modeswitch nestedprocvars}
-
-{ Copyright (c) 2018 by Ugochukwu Mmaduekwe
-
-  Distributed under the MIT software license, see the accompanying file LICENSE
-  or visit http://www.opensource.org/licenses/mit-license.php.
-}
-
-interface
-
-uses
-  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
-  ExtCtrls, Buttons, UCommon, UCommon.Collections,
-  UWizard, UWIZTransferAccount, UWIZModels;
-
-type
-
-  { TWIZTransferAccount_TransactionPayload }
-
-  TWIZTransferAccount_TransactionPayload = class(TWizardForm<TWIZOperationsModel>)
-    edtPassword: TEdit;
-    grpPayload: TGroupBox;
-    Label1: TLabel;
-    lblPassword: TLabel;
-    mmoPayload: TMemo;
-    paPayload: TPanel;
-    rbEncryptedWithOldEC: TRadioButton;
-    rbEncryptedWithEC: TRadioButton;
-    rbEncryptedWithPassword: TRadioButton;
-    rbNotEncrypted: TRadioButton;
-  public
-    procedure OnNext; override;
-    function Validate(out message: ansistring): boolean; override;
-  end;
-
-
-implementation
-
-{$R *.lfm}
-
-uses
-  UAccounts, UUserInterface;
-
-{ TWIZTransferAccount_TransactionPayload }
-
-procedure TWIZTransferAccount_TransactionPayload.OnNext;
-begin
-  Model.Payload.Content := mmoPayload.Lines.Text;
-  if rbEncryptedWithOldEC.Checked then
-  begin
-    Model.Payload.Mode := akaEncryptWithSender;
-  end
-  else
-  if rbEncryptedWithEC.Checked then
-  begin
-    Model.Payload.Mode := akaEncryptWithReceiver;
-  end
-  else
-  if rbEncryptedWithPassword.Checked then
-  begin
-    Model.Payload.Mode := akaEncryptWithPassword;
-  end
-  else
-  if rbNotEncrypted.Checked then
-  begin
-    Model.Payload.Mode := akaNotEncrypt;
-  end;
-end;
-
-function TWIZTransferAccount_TransactionPayload.Validate(out message: ansistring): boolean;
-begin
-  if (not rbNotEncrypted.Checked) and (not rbEncryptedWithEC.Checked) and
-    (not rbEncryptedWithOldEC.Checked) and (not rbEncryptedWithPassword.Checked) then
-  begin
-    message := 'you must select an encryption option for payload';
-    Result := False;
-    Exit;
-  end;
-end;
-
-end.

+ 4 - 4
src/gui/wizards/operations/UWIZChangeAccountPrivateKey.pas

@@ -289,8 +289,8 @@ begin
       wk := TWallet.Keys.Key[i];
       dooperation := True;
       // Default fee
-      if account.balance > uint64(Model.ChangeAccountPrivateKey.Fee.DefaultFee) then
-        _fee := Model.ChangeAccountPrivateKey.Fee.DefaultFee
+      if account.balance > uint64(Model.Fee.DefaultFee) then
+        _fee := Model.Fee.DefaultFee
       else
         _fee := account.balance;
 
@@ -314,8 +314,8 @@ begin
         if uint64(_totalSignerFee) >= signerAccount.balance then
           _fee := 0
         else if signerAccount.balance - uint64(_totalSignerFee) >
-          uint64(Model.ChangeAccountPrivateKey.Fee.DefaultFee) then
-          _fee := Model.ChangeAccountPrivateKey.Fee.DefaultFee
+          uint64(Model.Fee.DefaultFee) then
+          _fee := Model.Fee.DefaultFee
         else
           _fee := signerAccount.balance - uint64(_totalSignerFee);
         op := TOpChangeKeySigned.Create(signerAccount.account,

+ 9 - 10
src/gui/wizards/operations/UWIZChangeAccountPrivateKey_Confirmation.pas

@@ -44,11 +44,11 @@ type
 
   TAccountSenderDataSource = class(TAccountsDataSourceBase)
   private
-    FModel: TWIZOperationsModel.TChangeAccountPrivateKeyModel;
+    FModel: TWIZOperationsModel;
   protected
     function GetColumns: TDataColumns; override;
   public
-    property Model: TWIZOperationsModel.TChangeAccountPrivateKeyModel read FModel write FModel;
+    property Model: TWIZOperationsModel read FModel write FModel;
     procedure FetchAll(const AContainer: TList<TAccount>); override;
     function GetItemField(constref AItem: TAccount;
       const ABindingName: ansistring): variant; override;
@@ -66,8 +66,7 @@ begin
   FSendersGrid.FetchDataInThread := False;
   FSendersGrid.AutoPageSize := True;
   FSendersGrid.SelectionType := stNone;
-  FSendersGrid.Options := [vgoColAutoFill, vgoColSizing, vgoSortDirectionAllowNone,
-    vgoAutoHidePaging];
+  FSendersGrid.Options := [vgoColAutoFill, vgoColSizing, vgoSortDirectionAllowNone, vgoAutoHidePaging];
   with FSendersGrid.AddColumn('Account') do
   begin
     Binding := 'Account';
@@ -89,7 +88,7 @@ begin
   end;
 
   Data := TAccountSenderDataSource.Create(FSendersGrid);
-  Data.Model := Model.ChangeAccountPrivateKey;
+  Data.Model := Model;
   FSendersGrid.DataSource := Data;
   paGrid.AddControlDockCenter(FSendersGrid);
   lblSgnAcc.Caption := TAccountComp.AccountNumberToAccountTxtNumber(Model.Signer.SignerAccount.account);
@@ -115,10 +114,10 @@ begin
     Result := TAccountComp.AccountNumberToAccountTxtNumber(AItem.account)
   else if ABindingName = 'NewPrivateKey' then
   begin
-    Result := IIF(Model.NewWalletKey.Name = '',
+    Result := IIF(Model.ChangeAccountPrivateKey.NewWalletKey.Name = '',
       TCrypto.ToHexaString(TAccountComp.AccountKey2RawString(
-      Model.NewWalletKey.AccountKey)), Model.NewWalletKey.Name);
-    if not Assigned(Model.NewWalletKey.PrivateKey) then
+      Model.ChangeAccountPrivateKey.NewWalletKey.AccountKey)), Model.ChangeAccountPrivateKey.NewWalletKey.Name);
+    if not Assigned(Model.ChangeAccountPrivateKey.NewWalletKey.PrivateKey) then
     begin
       Result := Result + '(*)';
     end;
@@ -134,9 +133,9 @@ procedure TAccountSenderDataSource.FetchAll(const AContainer: TList<TAccount>);
 var
   i: integer;
 begin
-  for i := Low(Model.SelectedAccounts) to High(Model.SelectedAccounts) do
+  for i := Low(Model.ChangeAccountPrivateKey.SelectedAccounts) to High(Model.ChangeAccountPrivateKey.SelectedAccounts) do
   begin
-    AContainer.Add(Model.SelectedAccounts[i]);
+    AContainer.Add(Model.ChangeAccountPrivateKey.SelectedAccounts[i]);
   end;
 end;
 

+ 2 - 2
src/gui/wizards/operations/UWIZChangeAccountPrivateKey_Transaction.pas

@@ -156,7 +156,7 @@ begin
   lblTotalBalanceValue.Caption :=
     Format('%s PASC', [TAccountComp.FormatMoney(totalBalance)]);
 
-  edtOpFee.Text := TAccountComp.FormatMoney(TSettings.Fee.DefaultFee);
+  edtOpFee.Text := TAccountComp.FormatMoney(TSettings.DefaultFee);
 end;
 
 procedure TWIZChangeAccountPrivateKey_Transaction.OnNext;
@@ -187,7 +187,7 @@ begin
     Exit;
   end;
 
-  if not TAccountComp.TxtToMoney(Trim(edtOpFee.Text), Model.ChangeAccountPrivateKey.Fee.DefaultFee) then
+  if not TAccountComp.TxtToMoney(Trim(edtOpFee.Text), Model.Fee.DefaultFee) then
   begin
     message := 'Invalid fee value "' + edtOpFee.Text + '"';
     Result := False;

+ 1 - 1
src/gui/wizards/operations/UWIZEnlistAccountForSale_Transaction.lfm

@@ -7,7 +7,7 @@ object WIZEnlistAccountForSale_Transaction: TWIZEnlistAccountForSale_Transaction
   Caption = 'WIZEnlistAccountForSale_Transaction'
   ClientHeight = 253
   ClientWidth = 429
-  LCLVersion = '1.8.1.0'
+  LCLVersion = '1.8.2.0'
   Visible = False
   object gbTransaction: TGroupBox
     Left = 24

+ 1 - 1
src/gui/wizards/operations/UWIZEnlistAccountForSale_Transaction.pas

@@ -126,7 +126,7 @@ begin
   cbSignerAccountChange(Self);
   lblTotalBalanceValue.Caption :=
     Format('%s PASC', [TAccountComp.FormatMoney(totalBalance)]);
-  edtOpFee.Text := TAccountComp.FormatMoney(TSettings.Fee.DefaultFee);
+  edtOpFee.Text := TAccountComp.FormatMoney(TSettings.DefaultFee);
   edtSalePrice.Text := TAccountComp.FormatMoney(0);
 end;
 

+ 1 - 0
src/gui/wizards/operations/UWIZSendPASC_Confirmation.lfm

@@ -6,6 +6,7 @@ object WIZSendPASC_Confirmation: TWIZSendPASC_Confirmation
   Caption = 'WIZSendPASC_Confirmation'
   ClientHeight = 253
   ClientWidth = 429
+  LCLVersion = '1.8.2.0'
   Visible = False
   object GroupBox1: TGroupBox
     Left = 10

+ 7 - 7
src/gui/wizards/operations/UWIZSendPASC_Confirmation.pas

@@ -49,11 +49,11 @@ type
 
   TAccountSenderDataSource = class(TAccountsDataSourceBase)
     private
-      FModel : TWIZOperationsModel.TSendPASCModel;
+      FModel : TWIZOperationsModel;
     protected
       function GetColumns : TDataColumns; override;
     public
-      property Model : TWIZOperationsModel.TSendPASCModel read FModel write FModel;
+      property Model : TWIZOperationsModel read FModel write FModel;
       procedure FetchAll(const AContainer : TList<TAccount>); override;
       function GetItemField(constref AItem: TAccount; const ABindingName : AnsiString) : Variant; override;
   end;
@@ -94,7 +94,7 @@ begin
   end;
 
    data := TAccountSenderDataSource.Create(FSendersGrid);
-   data.Model := Model.SendPASC;
+   data.Model := Model;
    FSendersGrid.DataSource := data;
    paGrid.AddControlDockCenter(FSendersGrid);
    lblSgnAcc.Caption := TAccountComp.AccountNumberToAccountTxtNumber(Model.Signer.SignerAccount.account);
@@ -122,9 +122,9 @@ begin
    else if ABindingName = 'Balance' then
      Result := TAccountComp.FormatMoney(AItem.Balance)
    else if ABindingName = 'AmountToSend' then
-     Result := TAccountComp.FormatMoney(Model.SingleAmountToSend)
+     Result := TAccountComp.FormatMoney(Model.SendPASC.SingleAmountToSend)
      else if ABindingName = 'Fee' then
-     Result := TAccountComp.FormatMoney(Model.SingleOperationFee)
+     Result := TAccountComp.FormatMoney(Model.Fee.SingleOperationFee)
    else raise Exception.Create(Format('Field not found [%s]', [ABindingName]));
 end;
 
@@ -133,9 +133,9 @@ procedure TAccountSenderDataSource.FetchAll(const AContainer : TList<TAccount>);
 var
   i: Integer;
 begin
-  for i := Low(Model.SelectedAccounts) to High(Model.SelectedAccounts) do
+  for i := Low(Model.SendPASC.SelectedAccounts) to High(Model.SendPASC.SelectedAccounts) do
   begin
-    AContainer.Add( Model.SelectedAccounts[i] );
+    AContainer.Add( Model.SendPASC.SelectedAccounts[i] );
   end;
 end;
 

+ 1 - 0
src/gui/wizards/operations/UWIZSendPASC_EnterQuantity.lfm

@@ -7,6 +7,7 @@ object WIZSendPASC_EnterQuantity: TWIZSendPASC_EnterQuantity
   Caption = 'WIZSendPASC_EnterQuantity'
   ClientHeight = 253
   ClientWidth = 429
+  LCLVersion = '1.8.2.0'
   Visible = False
   object gbQuantity: TGroupBox
     Left = 16

+ 1 - 1
src/gui/wizards/operations/UWIZSendPASC_EnterQuantity.pas

@@ -105,7 +105,7 @@ begin
   end
   else
   begin
-    Model.Fee.SingleOperationFee := TSettings.Fee.DefaultFee;
+    Model.Fee.SingleOperationFee := TSettings.DefaultFee;
     if Model.Payload.HasPayload then
     begin
       UpdatePath(ptReplaceAllNext, [TWIZPayloadOverride, TWIZSendPASC_Confirmation]);

+ 4 - 4
src/gui/wizards/operations/UWIZTransferAccount.pas

@@ -289,8 +289,8 @@ begin
       wk := TWallet.Keys.Key[i];
       dooperation := True;
       // Default fee
-      if account.balance > uint64(Model.TransferAccount.Fee.DefaultFee) then
-        _fee := Model.TransferAccount.Fee.DefaultFee
+      if account.balance > uint64(Model.Fee.DefaultFee) then
+        _fee := Model.Fee.DefaultFee
       else
         _fee := account.balance;
 
@@ -314,8 +314,8 @@ begin
         if uint64(_totalSignerFee) >= signerAccount.balance then
           _fee := 0
         else if signerAccount.balance - uint64(_totalSignerFee) >
-          uint64(Model.TransferAccount.Fee.DefaultFee) then
-          _fee := Model.TransferAccount.Fee.DefaultFee
+          uint64(Model.Fee.DefaultFee) then
+          _fee := Model.Fee.DefaultFee
         else
           _fee := signerAccount.balance - uint64(_totalSignerFee);
         op := TOpChangeKeySigned.Create(signerAccount.account,

+ 6 - 6
src/gui/wizards/operations/UWIZTransferAccount_Confirmation.pas

@@ -43,11 +43,11 @@ type
 
   TAccountSenderDataSource = class(TAccountsDataSourceBase)
     private
-      FModel : TWIZOperationsModel.TTransferAccountModel;
+      FModel : TWIZOperationsModel;
     protected
       function GetColumns : TDataColumns; override;
     public
-      property Model : TWIZOperationsModel.TTransferAccountModel read FModel write FModel;
+      property Model : TWIZOperationsModel read FModel write FModel;
       procedure FetchAll(const AContainer : TList<TAccount>); override;
       function GetItemField(constref AItem: TAccount; const ABindingName : AnsiString) : Variant; override;
   end;
@@ -88,7 +88,7 @@ begin
   end;
 
    data := TAccountSenderDataSource.Create(FSendersGrid);
-   data.Model := Model.TransferAccount;
+   data.Model := Model;
    FSendersGrid.DataSource := data;
    paGrid.AddControlDockCenter(FSendersGrid);
    lblSgnAcc.Caption := TAccountComp.AccountNumberToAccountTxtNumber(Model.Signer.SignerAccount.account);
@@ -115,7 +115,7 @@ begin
    else if ABindingName = 'CurrentPublicKey' then
      Result := TAccountComp.AccountPublicKeyExport(AItem.accountInfo.accountKey)
    else if ABindingName = 'NewPublicKey' then
-     Result := Model.NewPublicKey
+     Result := Model.TransferAccount.NewPublicKey
      else if ABindingName = 'Fee' then
      Result := TAccountComp.FormatMoney(Model.Fee.DefaultFee)
    else raise Exception.Create(Format('Field not found [%s]', [ABindingName]));
@@ -126,9 +126,9 @@ procedure TAccountSenderDataSource.FetchAll(const AContainer : TList<TAccount>);
 var
   i: Integer;
 begin
-  for i := Low(Model.SelectedAccounts) to High(Model.SelectedAccounts) do
+  for i := Low(Model.TransferAccount.SelectedAccounts) to High(Model.TransferAccount.SelectedAccounts) do
   begin
-    AContainer.Add( Model.SelectedAccounts[i] );
+    AContainer.Add( Model.TransferAccount.SelectedAccounts[i] );
   end;
 end;
 

+ 2 - 2
src/gui/wizards/operations/UWIZTransferAccount_Transaction.pas

@@ -98,7 +98,7 @@ begin
   lblTotalBalanceValue.Caption :=
     Format('%s PASC', [TAccountComp.FormatMoney(totalBalance)]);
 
-  edtOpFee.Text := TAccountComp.FormatMoney(TSettings.Fee.DefaultFee);
+  edtOpFee.Text := TAccountComp.FormatMoney(TSettings.DefaultFee);
 end;
 
 procedure TWIZTransferAccount_Transaction.OnNext;
@@ -124,7 +124,7 @@ begin
     Exit;
   end;
 
-  if not TAccountComp.TxtToMoney(Trim(edtOpFee.Text), Model.TransferAccount.Fee.DefaultFee) then
+  if not TAccountComp.TxtToMoney(Trim(edtOpFee.Text), Model.Fee.DefaultFee) then
   begin
     message := 'Invalid fee value "' + edtOpFee.Text + '"';
     Result := False;

+ 16 - 0
src/pascalcoin_wallet.lpi

@@ -402,7 +402,9 @@
       <Unit75>
         <Filename Value="gui\wizards\operations\UWIZChangeAccountPrivateKey_Confirmation.pas"/>
         <IsPartOfProject Value="True"/>
+        <ComponentName Value="WIZChangeAccountPrivateKey_Confirmation"/>
         <HasResources Value="True"/>
+        <ResourceBaseClass Value="Form"/>
       </Unit75>
       <Unit76>
         <Filename Value="gui\wizards\operations\UWIZChangeAccountPrivateKey_Start.pas"/>
@@ -412,7 +414,9 @@
       <Unit77>
         <Filename Value="gui\wizards\operations\UWIZChangeAccountPrivateKey_Transaction.pas"/>
         <IsPartOfProject Value="True"/>
+        <ComponentName Value="WIZChangeAccountPrivateKey_Transaction"/>
         <HasResources Value="True"/>
+        <ResourceBaseClass Value="Form"/>
       </Unit77>
       <Unit78>
         <Filename Value="gui\wizards\operations\UWIZChangeAccountPrivateKey_TransactionPayload.pas"/>
@@ -446,7 +450,9 @@
       <Unit84>
         <Filename Value="gui\wizards\operations\UWIZEnlistAccountForSale_Transaction.pas"/>
         <IsPartOfProject Value="True"/>
+        <ComponentName Value="WIZEnlistAccountForSale_Transaction"/>
         <HasResources Value="True"/>
+        <ResourceBaseClass Value="Form"/>
       </Unit84>
       <Unit85>
         <Filename Value="gui\wizards\operations\UWIZEnlistAccountForSale_TransactionPayload.pas"/>
@@ -461,7 +467,9 @@
       <Unit87>
         <Filename Value="gui\wizards\operations\UWIZPayloadContentOverride.pas"/>
         <IsPartOfProject Value="True"/>
+        <ComponentName Value="WIZPayloadContentOverride"/>
         <HasResources Value="True"/>
+        <ResourceBaseClass Value="Form"/>
       </Unit87>
       <Unit88>
         <Filename Value="gui\wizards\operations\UWIZPayloadOverride.pas"/>
@@ -487,7 +495,9 @@
       <Unit92>
         <Filename Value="gui\wizards\operations\UWIZSendPASC_Confirmation.pas"/>
         <IsPartOfProject Value="True"/>
+        <ComponentName Value="WIZSendPASC_Confirmation"/>
         <HasResources Value="True"/>
+        <ResourceBaseClass Value="Form"/>
       </Unit92>
       <Unit93>
         <Filename Value="gui\wizards\operations\UWIZSendPASC_ConfirmSender.pas"/>
@@ -497,7 +507,9 @@
       <Unit94>
         <Filename Value="gui\wizards\operations\UWIZSendPASC_EnterQuantity.pas"/>
         <IsPartOfProject Value="True"/>
+        <ComponentName Value="WIZSendPASC_EnterQuantity"/>
         <HasResources Value="True"/>
+        <ResourceBaseClass Value="Form"/>
       </Unit94>
       <Unit95>
         <Filename Value="gui\wizards\operations\UWIZSendPASC_EnterRecipient.pas"/>
@@ -511,7 +523,9 @@
       <Unit97>
         <Filename Value="gui\wizards\operations\UWIZTransferAccount_Confirmation.pas"/>
         <IsPartOfProject Value="True"/>
+        <ComponentName Value="WIZTransferAccount_Confirmation"/>
         <HasResources Value="True"/>
+        <ResourceBaseClass Value="Form"/>
       </Unit97>
       <Unit98>
         <Filename Value="gui\wizards\operations\UWIZTransferAccount_Start.pas"/>
@@ -521,7 +535,9 @@
       <Unit99>
         <Filename Value="gui\wizards\operations\UWIZTransferAccount_Transaction.pas"/>
         <IsPartOfProject Value="True"/>
+        <ComponentName Value="WIZTransferAccount_Transaction"/>
         <HasResources Value="True"/>
+        <ResourceBaseClass Value="Form"/>
       </Unit99>
       <Unit100>
         <Filename Value="gui\wizards\operations\UWIZTransferAccount_TransactionPayload.pas"/>