public static Signatory CreateSignatory(Guid idTransaction, Guid idUser, string role, UpsilabEntities context) { var signatory = new Signatory { idSignatory = Guid.NewGuid(), idSignatureTransaction = idTransaction, idUser = idUser, Role = role, DateCreated = DateTime.Now }; context.Signatory.AddObject(signatory); context.SaveChanges(); return signatory; }
static void Main(string[] args) { var arguments = new CommandLineArgs(); arguments.Parse(args); if(arguments.Help) { arguments.WriteHelp(); return; } try { var signatory = new Signatory(arguments.Assembly, arguments.Key, arguments.Out); signatory.Sign(); } catch(Exception e) { Environment.ExitCode = -1; Console.WriteLine("An error occurred when running CecilSign."); Console.WriteLine(e); } Console.WriteLine("Signing complete."); }
public NPSheet1(ExcelWorksheet sheet, ProjectCompany ownerCompany, int totalPagesCount, Signatory signature) : base(sheet, ownerCompany, 1) { this.totalPagesCount = totalPagesCount; this.signature = signature; }
/// <summary> /// Sends a message to the network for a given consensus topic. /// </summary> /// <param name="topic"> /// The address of the topic for the message. /// </param> /// <param name="message"> /// The value of the message, limited to the 4K total Network Transaction Size. /// </param> /// <param name="signatory"> /// The signatory containing any additional private keys or callbacks /// to meet the key signing requirements for participants. /// </param> /// <param name="configure"> /// Optional callback method providing an opportunity to modify /// the execution configuration for just this method call. /// It is executed prior to submitting the request to the network. /// </param> /// <returns> /// A Submit Message Receipt indicating success, includes information /// about the sequence number of the message and its running hash. /// </returns> /// <exception cref="ArgumentOutOfRangeException">If required arguments are missing.</exception> /// <exception cref="InvalidOperationException">If required context configuration is missing.</exception> /// <exception cref="PrecheckException">If the gateway node create rejected the request upon submission.</exception> /// <exception cref="ConsensusException">If the network was unable to come to consensus before the duration of the transaction expired.</exception> /// <exception cref="TransactionException">If the network rejected the create request as invalid or had missing data.</exception> public async Task <SubmitMessageReceipt> SubmitMessageAsync(Address topic, ReadOnlyMemory <byte> message, Signatory signatory, Action <IContext>?configure = null) { return(new SubmitMessageReceipt(await SubmitMessageImplementationAsync(topic, message, false, null, 0, 0, signatory, configure, false).ConfigureAwait(false))); }
/// <summary> /// Removes a contract from the network via Administrative Delete /// </summary> /// <param name="contractToDelete"> /// The address of the contract to delete. /// </param> /// <param name="signatory"> /// Typically private key, keys or signing callback method that /// are needed to delete the contract as per the requirements in the /// associated Endorsement. /// </param> /// <param name="configure"> /// Optional callback method providing an opportunity to modify /// the execution configuration for just this method call. /// It is executed prior to submitting the request to the network. /// </param> /// <returns> /// A transaction receipt indicating success of the contract deletion. /// </returns> /// <exception cref="ArgumentOutOfRangeException">If required arguments are missing.</exception> /// <exception cref="InvalidOperationException">If required context configuration is missing.</exception> /// <exception cref="PrecheckException">If the gateway node create rejected the request upon submission.</exception> /// <exception cref="ConsensusException">If the network was unable to come to consensus before the duration of the transaction expired.</exception> /// <exception cref="TransactionException">If the network rejected the create request as invalid or had missing data.</exception> public async Task <TransactionReceipt> SytemDeleteContractAsync(Address contractToDelete, Signatory signatory, Action <IContext>?configure = null) { return(new TransactionReceipt(await ExecuteTransactionAsync(SystemDeleteTransactionBody.FromContract(contractToDelete), configure, false, signatory).ConfigureAwait(false))); }
/// <summary> /// Removes Storage associated with the Account for maintaining token balances /// for this account. /// </summary> /// <remarks> /// Since this action modifies the account's records, /// it must be signed by the account's key. /// </remarks> /// <param name="tokens"> /// The Address of the tokens that will be dissociated. /// </param> /// <param name="account"> /// Address of the account that will be dissociated. /// </param> /// <param name="signatory"> /// Additional signing key matching the administrative endorsements /// dissociated with this token (if not already added in the context). /// </param> /// <param name="configure"> /// Optional callback method providing an opportunity to modify /// the execution configuration for just this method call. /// It is executed prior to submitting the request to the network. /// </param> /// <returns> /// A transaction record indicating a successful operation. /// </returns> /// <exception cref="ArgumentOutOfRangeException">If required arguments are missing.</exception> /// <exception cref="InvalidOperationException">If required context configuration is missing.</exception> /// <exception cref="PrecheckException">If the gateway node create rejected the request upon submission, for example of the token is already deleted.</exception> /// <exception cref="ConsensusException">If the network was unable to come to consensus before the duration of the transaction expired.</exception> /// <exception cref="TransactionException">If the network rejected the create request as invalid or had missing data.</exception> public async Task <TransactionRecord> DissociateTokensWithRecordAsync(IEnumerable <Address> tokens, AddressOrAlias account, Signatory signatory, Action <IContext>?configure = null) { return(new TransactionRecord(await ExecuteTransactionAsync(new TokenDissociateTransactionBody(tokens, account), configure, true, signatory).ConfigureAwait(false))); }
/// <summary> /// Removes Storage associated with the Account for maintaining token balances /// for this account. /// </summary> /// <remarks> /// Since this action modifies the account's records, /// it must be signed by the account's key. /// </remarks> /// <param name="token"> /// The Address of the token that will be dissociated. /// </param> /// <param name="account"> /// Address of the account that will be dissociated. /// </param> /// <param name="signatory"> /// Additional signing key matching the administrative endorsements /// dissociated with this token (if not already added in the context). /// </param> /// <param name="configure"> /// Optional callback method providing an opportunity to modify /// the execution configuration for just this method call. /// It is executed prior to submitting the request to the network. /// </param> /// <returns> /// A transaction receipt indicating a successful operation. /// </returns> /// <exception cref="ArgumentOutOfRangeException">If required arguments are missing.</exception> /// <exception cref="InvalidOperationException">If required context configuration is missing.</exception> /// <exception cref="PrecheckException">If the gateway node create rejected the request upon submission, for example of the token is already deleted.</exception> /// <exception cref="ConsensusException">If the network was unable to come to consensus before the duration of the transaction expired.</exception> /// <exception cref="TransactionException">If the network rejected the create request as invalid or had missing data.</exception> public async Task <TransactionReceipt> DissociateTokenAsync(Address token, AddressOrAlias account, Signatory signatory, Action <IContext>?configure = null) { return(new TransactionReceipt(await ExecuteTransactionAsync(new TokenDissociateTransactionBody(token, account), configure, false, signatory).ConfigureAwait(false))); }
/// <summary> /// Transfer assets (NFTs) from one account to another. /// </summary> /// <param name="asset"> /// The identifier of the asset to transfer (shard, realm, num, serial). /// </param> /// <param name="fromAddress"> /// The address to transfer the assets from. Ensure that /// a signatory either in the context or passed with this /// call can fulfill the signing requrements to transfer /// crypto out of the account identified by this address. /// </param> /// <param name="toAddress"> /// The address receiving the assets. /// </param> /// <param name="signatory"> /// The signatory containing any additional private keys or callbacks /// to meet the requirements for the sending and receiving accounts. /// </param> /// <param name="configure"> /// Optional callback method providing an opportunity to modify /// the execution configuration for just this method call. /// It is executed prior to submitting the request to the network. /// </param> /// <returns> /// A transfer record describing the details of the concensus transaction. /// </returns> /// <exception cref="ArgumentOutOfRangeException">If required arguments are missing.</exception> /// <exception cref="InvalidOperationException">If required context configuration is missing.</exception> /// <exception cref="PrecheckException">If the gateway node create rejected the request upon submission.</exception> /// <exception cref="ConsensusException">If the network was unable to come to consensus before the duration of the transaction expired.</exception> /// <exception cref="TransactionException">If the network rejected the create request as invalid or had missing data.</exception> public async Task <TransactionRecord> TransferAssetWithRecordAsync(Asset asset, AddressOrAlias fromAddress, AddressOrAlias toAddress, Signatory signatory, Action <IContext>?configure = null) { return(new TransactionRecord(await ExecuteTransactionAsync(new CryptoTransferTransactionBody(asset, fromAddress, toAddress), configure, true, signatory).ConfigureAwait(false))); }
/// <summary> /// Deletes a token from the network. Must be signed by the admin key. /// </summary> /// <param name="pending"> /// The identifier (Address) of the pending transaction to cancel. /// </param> /// <param name="signatory"> /// Additional signing key matching the administrative endorsements /// associated with this token (if not already added in the context). /// </param> /// <param name="configure"> /// Optional callback method providing an opportunity to modify /// the execution configuration for just this method call. /// It is executed prior to submitting the request to the network. /// </param> /// <returns> /// A transaction receipt indicating a successful operation. /// </returns> /// <exception cref="ArgumentOutOfRangeException">If required arguments are missing.</exception> /// <exception cref="InvalidOperationException">If required context configuration is missing.</exception> /// <exception cref="PrecheckException">If the gateway node create rejected the request upon submission, for example of the token is already deleted.</exception> /// <exception cref="ConsensusException">If the network was unable to come to consensus before the duration of the transaction expired.</exception> /// <exception cref="TransactionException">If the network rejected the create request as invalid or had missing data.</exception> public async Task <TransactionReceipt> DeletePendingTransactionAsync(Address pending, Signatory signatory, Action <IContext>?configure = null) { return(new TransactionReceipt(await ExecuteTransactionAsync(new ScheduleDeleteTransactionBody(pending), configure, false, signatory).ConfigureAwait(false))); }
public ActionResult InsertSignatureTransaction(SignatureTransaction _SignatureTransaction) { try { _SignatureTransaction.idSignatureTransaction = GuidHelper.GenerateGuid(); _SignatureTransaction.DateCreated = DateTime.Now; _SignatureTransaction.idUserCreated = SessionManager.GetUserSession().idUser; _SignatureTransaction.Status = SignatureTransactionBL.Status.Created.ToString(); SignatureTransactionBL.InsertSignatureTransaction(_SignatureTransaction); //Créer signataire par défaut var currentUSer = SessionManager.GetUserSession(); Signatory _defaultsSignatory = new Signatory() { idSignatory = GuidHelper.GenerateGuid(), DateCreated = DateTime.Now, Email = currentUSer.UserEmail, idUser = currentUSer.idUser, Mobile = currentUSer.UserMobilePhone, Name = currentUSer.UserName, Firstname = currentUSer.UserFirstName, idSignatureTransaction = _SignatureTransaction.idSignatureTransaction }; SignatureTransactionBL.InsertSignatory(_defaultsSignatory); return Content("Ok"); } catch (Exception ex) { Business.Log.Log.AppendException(ex); return Content(ex.Message); } }
public PartialViewResult EditSignature(string SignatoryId) { try { if (!string.IsNullOrEmpty(SignatoryId)) { Signatory signatory = new Signatory(); using (UpsilabEntities context = new UpsilabEntities()) { signatory = context.Signatory.Where(s => s.idSignatory == new Guid(SignatoryId)).FirstOrDefault(); } return PartialView(signatory); } else { return PartialView(); } } catch (Exception ex) { Business.Log.Log.AppendException(ex); return PartialView(); } }
public ActionResult InsertSignatory(Signatory _signatory) { try { _signatory.idSignatory = GuidHelper.GenerateGuid(); _signatory.DateCreated = DateTime.Now; SignatureTransactionBL.InsertSignatory(_signatory); return Content("Ok"); } catch (Exception ex) { Business.Log.Log.AppendException(ex); return Content(ex.Message); } }
/// <summary> /// Suspends the associated account's ability to send or /// receive the specified token. /// </summary> /// <param name="token"> /// The identifier (Address/Symbol) of the token to suspend/freeze. /// </param> /// <param name="address"> /// Address of the account to suspend. /// </param> /// <param name="signatory"> /// Additional signing key matching the administrative endorsements /// associated with this token (if not already added in the context). /// </param> /// <param name="configure"> /// Optional callback method providing an opportunity to modify /// the execution configuration for just this method call. /// It is executed prior to submitting the request to the network. /// </param> /// <returns> /// A transaction record indicating a successful operation. /// </returns> /// <exception cref="ArgumentOutOfRangeException">If required arguments are missing.</exception> /// <exception cref="InvalidOperationException">If required context configuration is missing.</exception> /// <exception cref="PrecheckException">If the gateway node create rejected the request upon submission, for example of the token is already deleted.</exception> /// <exception cref="ConsensusException">If the network was unable to come to consensus before the duration of the transaction expired.</exception> /// <exception cref="TransactionException">If the network rejected the create request as invalid or had missing data.</exception> public async Task <TransactionRecord> SuspendTokenWithRecordAsync(Address token, AddressOrAlias address, Signatory signatory, Action <IContext>?configure = null) { return(new TransactionRecord(await ExecuteTransactionAsync(new TokenFreezeAccountTransactionBody(token, address), configure, true, signatory).ConfigureAwait(false))); }
/// <summary> /// Removes the holdings of given token from the associated /// account and returns them to the treasury. Must be signed by /// the confiscate/wipe admin key. /// </summary> /// <param name="token"> /// The identifier (Address/Symbol) of the token to confiscate. /// </param> /// <param name="address"> /// Address of the account holding the tokens to remove. /// </param> /// <param name="signatory"> /// Additional signing key matching the administrative endorsements /// associated with this token (if not already added in the context). /// </param> /// <param name="amount"> /// The amount of coins to confiscate (of the divisible denomination) /// </param> /// <param name="configure"> /// Optional callback method providing an opportunity to modify /// the execution configuration for just this method call. /// It is executed prior to submitting the request to the network. /// </param> /// <returns> /// A transaction receipt indicating a successful operation. /// </returns> /// <exception cref="ArgumentOutOfRangeException">If required arguments are missing.</exception> /// <exception cref="InvalidOperationException">If required context configuration is missing.</exception> /// <exception cref="PrecheckException">If the gateway node create rejected the request upon submission, for example of the token is already deleted.</exception> /// <exception cref="ConsensusException">If the network was unable to come to consensus before the duration of the transaction expired.</exception> /// <exception cref="TransactionException">If the network rejected the create request as invalid or had missing data.</exception> public async Task <TokenReceipt> ConfiscateTokensAsync(Address token, AddressOrAlias address, ulong amount, Signatory signatory, Action <IContext>?configure = null) { return(new TokenReceipt(await ExecuteTransactionAsync(new TokenWipeAccountTransactionBody(token, address, amount), configure, false, signatory).ConfigureAwait(false))); }
/// <summary> /// Revokes KYC status from the associated account's relating to the specified token. /// receive the specified token. /// </summary> /// <param name="token"> /// The identifier (Address/Symbol) of the token to revoke KYC status. /// </param> /// <param name="address"> /// Address of the account to suspend. /// </param> /// <param name="signatory"> /// Additional signing key matching the administrative endorsements /// associated with this token (if not already added in the context). /// </param> /// <param name="configure"> /// Optional callback method providing an opportunity to modify /// the execution configuration for just this method call. /// It is executed prior to submitting the request to the network. /// </param> /// <returns> /// A transaction receipt indicating a successful operation. /// </returns> /// <exception cref="ArgumentOutOfRangeException">If required arguments are missing.</exception> /// <exception cref="InvalidOperationException">If required context configuration is missing.</exception> /// <exception cref="PrecheckException">If the gateway node create rejected the request upon submission, for example of the token is already deleted.</exception> /// <exception cref="ConsensusException">If the network was unable to come to consensus before the duration of the transaction expired.</exception> /// <exception cref="TransactionException">If the network rejected the create request as invalid or had missing data.</exception> public async Task <TransactionReceipt> RevokeTokenKycAsync(Address token, AddressOrAlias address, Signatory signatory, Action <IContext>?configure = null) { return(new TransactionReceipt(await ExecuteTransactionAsync(new TokenRevokeKycTransactionBody(token, address), configure, false, signatory).ConfigureAwait(false))); }
/// <summary> /// Pauses the all accounts' ability to send or /// receive the specified token. /// </summary> /// <param name="token"> /// The identifier (Address/Symbol) of the token to pause/freeze. /// </param> /// <param name="signatory"> /// Additional signing key matching the administrative endorsements /// associated with this token (if not already added in the context). /// </param> /// <param name="configure"> /// Optional callback method providing an opportunity to modify /// the execution configuration for just this method call. /// It is executed prior to submitting the request to the network. /// </param> /// <returns> /// A transaction receipt indicating a successful operation. /// </returns> /// <exception cref="ArgumentOutOfRangeException">If required arguments are missing.</exception> /// <exception cref="InvalidOperationException">If required context configuration is missing.</exception> /// <exception cref="PrecheckException">If the gateway node create rejected the request upon submission, for example of the token is already deleted.</exception> /// <exception cref="ConsensusException">If the network was unable to come to consensus before the duration of the transaction expired.</exception> /// <exception cref="TransactionException">If the network rejected the create request as invalid or had missing data.</exception> public async Task <TransactionReceipt> PauseTokenAsync(Address token, Signatory signatory, Action <IContext>?configure = null) { return(new TransactionReceipt(await ExecuteTransactionAsync(new TokenPauseTransactionBody(token), configure, false, signatory).ConfigureAwait(false))); }
/// <summary> /// Transfer tinybars from one account to another. /// </summary> /// <param name="fromAddress"> /// The address to transfer the tinybars from. Ensure that /// a signatory either in the context or passed with this /// call can fulfill the signing requrements to transfer /// crypto out of the account identified by this address. /// </param> /// <param name="toAddress"> /// The address receiving the tinybars. /// </param> /// <param name="amount"> /// The amount of tinybars to transfer. /// </param> /// <param name="signatory"> /// The signatory containing any additional private keys or callbacks /// to meet the requirements for the sending and receiving accounts. /// </param> /// <param name="configure"> /// Optional callback method providing an opportunity to modify /// the execution configuration for just this method call. /// It is executed prior to submitting the request to the network. /// </param> /// <returns> /// A transfer receipt indicating success of the operation. /// </returns> /// <exception cref="ArgumentOutOfRangeException">If required arguments are missing.</exception> /// <exception cref="InvalidOperationException">If required context configuration is missing.</exception> /// <exception cref="PrecheckException">If the gateway node create rejected the request upon submission.</exception> /// <exception cref="ConsensusException">If the network was unable to come to consensus before the duration of the transaction expired.</exception> /// <exception cref="TransactionException">If the network rejected the create request as invalid or had missing data.</exception> public async Task <TransactionReceipt> TransferAsync(AddressOrAlias fromAddress, AddressOrAlias toAddress, long amount, Signatory signatory, Action <IContext>?configure = null) { return(new TransactionReceipt(await ExecuteTransactionAsync(new CryptoTransferTransactionBody(fromAddress, toAddress, amount), configure, false, signatory).ConfigureAwait(false))); }
public static bool SendEmailForSignature(Signatory signatory, string url) { bool isSent = true; try { string sFrom = Upsilab.Business.Utility.ConfigurationManager.EmailFrom; string sTo = signatory.Email; string sSubject = @"Signature"; string sMsg = string.Empty; sMsg += @"<p>Bonjour,</p><p>Nous vous prions de signer les documents en cliquant sur le lien ci dessous:</p>"; sMsg += url; sMsg += @"<p>Cordialement,</p>Le service client d’UPSIDEO<br/>[email protected]"; bool bProdServer = (Upsilab.Business.Utility.ConfigurationManager.ServerType == Upsilab.Business.Utility.ConfigurationManager.EnumServerType.PROD.ToString()) ? true : false; EmailManager.SendEmail(sFrom, sTo, String.Empty, sSubject, sMsg, true); //Log mail EmailLogBL.Log(null, sFrom, SessionManager.GetUserSession().idUser, SessionManager.GetUserSession().UserEmail, EmailLogBL.TypeDestinataire.Admin, System.Reflection.MethodBase.GetCurrentMethod().Name); } catch (Exception ex) { isSent = false; Log.Log.AppendException(ex); } return isSent; }
public async Task CanScheduleATransferThatShouldImmediatelyExecute() { var initialBalance = (ulong)Generator.Integer(100, 1000); var transferAmount = initialBalance / 2; await using var fxSender = await TestAccount.CreateAsync(_network, fx => fx.CreateParams.InitialBalance = initialBalance); await using var fxReceiver = await TestAccount.CreateAsync(_network, fx => fx.CreateParams.InitialBalance = initialBalance); await using var fxPayer = await TestAccount.CreateAsync(_network, fx => fx.CreateParams.InitialBalance = 20_00_000_000); var pendingSignatory = new Signatory(fxPayer.PrivateKey, fxSender.PrivateKey, new PendingParams { PendingPayer = fxPayer }); var record = await fxSender.Client.TransferWithRecordAsync(fxSender, fxReceiver, (long)transferAmount, pendingSignatory); var info = await fxPayer.Client.GetPendingTransactionInfoAsync(record.Pending.Id); Assert.Equal(record.Pending.Id, info.Id); Assert.Equal(record.Pending.TxId, info.TxId); Assert.Equal(_network.Payer, info.Creator); Assert.Equal(fxPayer.Record.Address, info.Payer); Assert.Equal(2, info.Endorsements.Length); Assert.Equal(new Endorsement(fxPayer.PublicKey), info.Endorsements[0]); Assert.Null(info.Administrator); Assert.Empty(info.Memo); Assert.True(info.Expiration > DateTime.MinValue); Assert.True(record.Concensus <= info.Executed); Assert.Null(info.Deleted); Assert.False(info.PendingTransactionBody.IsEmpty); await AssertHg.CryptoBalanceAsync(fxSender, initialBalance - transferAmount); await AssertHg.CryptoBalanceAsync(fxReceiver, initialBalance + transferAmount); Assert.True(await fxPayer.Client.GetAccountBalanceAsync(fxPayer) < fxPayer.CreateParams.InitialBalance); var executedReceipt = await fxPayer.Client.GetReceiptAsync(record.Pending.TxId); Assert.Equal(ResponseCode.Success, executedReceipt.Status); Assert.Equal(record.Pending.TxId, executedReceipt.Id); Assert.NotNull(executedReceipt.CurrentExchangeRate); Assert.NotNull(executedReceipt.NextExchangeRate); Assert.Null(executedReceipt.Pending); var executedRecord = await fxPayer.Client.GetTransactionRecordAsync(record.Pending.TxId); Assert.Equal(ResponseCode.Success, executedRecord.Status); Assert.Equal(record.Pending.TxId, executedRecord.Id); Assert.InRange(executedRecord.Fee, 0UL, ulong.MaxValue); Assert.Equal(executedRecord.Transfers[fxSender], -(long)transferAmount); Assert.Equal(executedRecord.Transfers[fxReceiver], (long)transferAmount); Assert.True(executedRecord.Transfers[fxPayer] < 0); Assert.Empty(executedRecord.TokenTransfers); Assert.False(executedRecord.Hash.IsEmpty); Assert.NotNull(executedRecord.Concensus); Assert.NotNull(executedRecord.CurrentExchangeRate); Assert.NotNull(executedRecord.NextExchangeRate); Assert.Empty(executedRecord.Memo); Assert.Null(executedRecord.Pending); }