/// <summary>
        /// Endpoint: [POST] /api/addresses
        /// </summary>
        /// <param name="encryptionPublicKey">
        /// Encryption public key which should be used to encrypt
        /// the private key of the address being created before
        /// return it in the encryptedPrivateKey field of the
        /// response.
        /// </param>
        public CreateAddressRequest(Base64String encryptionPublicKey)
        {
            if (string.IsNullOrWhiteSpace(encryptionPublicKey?.ToString()))
            {
                throw RequestValidationException.ShouldBeNotEmptyString(nameof(encryptionPublicKey));
            }

            EncryptionPublicKey = encryptionPublicKey;
        }
예제 #2
0
        /// <summary>
        /// Endpoint: [POST] /api/transactions/broadcasted
        /// </summary>
        /// <param name="signedTransaction">The signed transaction.</param>
        public BroadcastTransactionRequest(Base64String signedTransaction)
        {
            if (string.IsNullOrWhiteSpace(signedTransaction?.ToString()))
            {
                throw RequestValidationException.ShouldBeNotEmptyString(nameof(signedTransaction));
            }

            SignedTransaction = signedTransaction;
        }
예제 #3
0
        /// <summary>
        /// Endpoint: [POST] /api/transactions/signed
        /// </summary>
        /// <param name="privateKeys">
        /// Private keys of the addresses which should sign the transaction.
        /// Multiple keys can be used for the/ transactions with multiple inputs.
        /// </param>
        /// <param name="transactionContext">
        /// Implementation specific transaction context.
        /// </param>
        public SignTransactionRequest(IReadOnlyCollection <EncryptedString> privateKeys, Base64String transactionContext)
        {
            if (privateKeys == null || !privateKeys.Any() || privateKeys.Any(x => x == null))
            {
                throw RequestValidationException.ShouldBeNotEmptyCollection(nameof(privateKeys));
            }

            if (string.IsNullOrWhiteSpace(transactionContext?.ToString()))
            {
                throw RequestValidationException.ShouldBeNotEmptyString(nameof(transactionContext));
            }

            PrivateKeys        = privateKeys;
            TransactionContext = transactionContext;
        }