If your service is developed in .NET, the features we provide are available through the SDK. The Gluwa SDK for .NET is a library with powerful features that enable .NET developers to easily make requests to the Gluwa APIs.
Please note that the sandbox environment is deprecated and will be replaced with an alternative solution in the future.
At the moment, our .NET SDK only supports Gluwacoin transfers. For Bitcoin transfers, please use the REST API.
Getting Started
The namespace of Gluwa SDK is Gluwa.SDK_dotnet. The SDK requires .NET Core 2.1 or above.
ECurrency currency ="{USDG or KRWG or NGNG or BTC}";string address ="{Your Gluwacoin public Address}";string privateKey ="{Your Gluwacoin Private Key}";string amount ="{Transaction amount, not including the fee}";string target ="{The address that the transaction will be sent to}";string merchantOrderID = "{Identifier for the transaction that was provided by the merchant user}"; // default to null. Optional
string note ="{Additional information about the transaction that a user can provide}"; // default to null. Optionalstring nonce ="{Nonce for the transaction. For Gluwacoin currencies only}"; // default to null. Optionalstring idem ="{Idempotent key for the transaction to prevent duplicate transactions}"; // default to null. Optionalstring paymentID ="{ID for the QR code payment}"; // default to null. Optionalstring paymentSig = "{Signature of the QR code payment. Required if PaymentID is not null}"; // default to null. Optional
Result<bool,ErrorResponse> result =awaitgluwaClient.CreateTransactionAsync( currency, address, privateKey, amount, target, merchantOrderID,// optional, default = null note,// optional, default = null nonce,// optional, default = null idem,// optional, default = null paymentID,// optional, default = null paymentSig // optional, default = null);if (result.IsFailure){switch (result.Error.Code) {case"ErrorCode1": // handle error 1break;case"ErrorCode2": // handle error 2break;default: // handle errorbreak; }}else{ // successful response. See result.Data for the response}
Returns true if successful and false if unsuccessful. Successful response means that the transaction has been accepted by Gluwa and will be included in the blockchain in a couple of minutes.
ECurrency currency ="{USDG or KRWG or NGNG or BTC}";string address ="{Your Gluwacoin public Address}";string privateKey ="{Your Gluwacoin Private Key}";uint limit ="{Number of transactions to include in the result}"; // defaults to 100. OptionalETransactionStatusFilter status ="{Incomplete or Confirmed}"; // defaults to Confirmed. Optionaluint offset ="{Number of transactions to skip}"; // default to 0. Optional”Result<List<SuccessResponse>,ErrorResponse> result =awaitgluwaClient.GetTransactionListAsync( currency, address, privateKey, limit,// optional, default = 100 status,// optional, default = Confirmed, offset // optional, default = 0);if (result.IsFailure){switch (result.Error.Code) {case"ErrorCode1": // handle error 1break;case"ErrorCode2": // handle error 2break;default: // handle errorbreak; }}else{ // successful response. See result.Data for the response}
ECurrency currency ="{USDG or KRWG or NGNG or BTC}";string privateKey ="{Your Gluwacoin Private Key}";string txnHash ="{Hash of the transaction on the blockchain}";Result<SuccessResponse,ErrorResponse> result =awaitgluwaClient.GetTransactionDetailsAsync(currency,privateKey,txnHash);if (result.IsFailure){switch (result.Error.Code) {case"ErrorCode1": // handle error 1break;case"ErrorCode2": // handle error 2break;default: // handle errorbreak; }}else{ // successful response. See result.Data for the response}
ECurrency currency ="{USDG or KRWG or NGNG or BTC}";string address ="{Your Gluwacoin public Address}";bool bUnspentOutputs = false; // (For BTC only) if true, the response includes unspent outputs for the address. Default to false. Optional
Result<SuccessResponse,ErrorResponse> result =awaitgluwaClient.GetBalanceAsync( currency, address, bUnspentOutputs);if (result.IsFailure){switch (result.Error.Code) {case"ErrorCode1": // handle error 1break;case"ErrorCode2": // handle error 2break;default: // handle errorbreak; }}else{ // successful response. See result.Data for the response}
string apiKey ="{Your API Key}";string secret ="{Your API Secret}";string address ="{Your public address}";string privateKey ="{Your private Key}"; EPaymentCurrency currency ="{USDG or KRWG or NGNG}";string amount ="{Payment amount}";string format ="{Desired image format}"; // defaults to null. Returns base64 string. Optional. // if you want to receive an image file put ‘image/jpeg’ or ‘image/png’ instead.
string note ="{Additional information, used by the merchant user}"; // default to null. Optionalstring merchantOrderID ="{Identifier for the payment, used by the merchant user}"; // default to null. Optionalint expiry ="{Time of expiry for the QR code in seconds}"; // default to 1800. Optional”Result<string,ErrorResponse> result =awaitqRCodeClient.GetPaymentQRCodeAsync( apiKey, secret, address, privateKey, currency, amount, format,//optional, default = null note,//optional, default = null merchantOrderID,//optional, default = null expiry //optional, default = 1800);if (result.IsFailure){switch (result.Error.Code) {case"ErrorCode1": // handle error 1break;case"ErrorCode2": // handle error 2break;default: // handle errorbreak; }}else{ // successful response. See result.Data for the response}
Webhook Validation
A method for validating if the webhook is from Gluwa or not. Gluwa sends a webhook request when a transaction is created or completed. Learn more about webhooks from Gluwa here.
PayLoad payLoad =newPayLoad(){ Data =newData { MerchantOrderID ="My merchant order ID", EventType =EEventType.TransactionConfirmed, Type =ENotificationType.Webhook, ResourceID ="0xfd820a7e9d9851537e259289269db88826a561a04e1c6982b4d860c797a625ce" }};string signature ="{The value of X-REQUEST-SIGNATURE header}";string webhookSecretKey ="{Your Webhook Secret}";bool bValidated =Webhook.ValidateWebhook( payLoad, signature, webhookSecretKey); // true if validation was successful