OriginalSDK 1.0.1

dotnet add package OriginalSDK --version 1.0.1
                    
NuGet\Install-Package OriginalSDK -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OriginalSDK" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OriginalSDK" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="OriginalSDK" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add OriginalSDK --version 1.0.1
                    
#r "nuget: OriginalSDK, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package OriginalSDK@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=OriginalSDK&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=OriginalSDK&version=1.0.1
                    
Install as a Cake Tool

Official Server-Side C# .NET SDK for Original API

Table of Contents

Getting Started

To start using the C# SDK for the Original API, register for an account and obtain your API key and secret. Once set up, install the SDK via NuGet:

dotnet add package OriginalSDK

Documentation

For the full documentation, please refer to https://docs.getoriginal.com.

Initialization

The Original SDK provides access to API methods in a strongly typed manner.

For development environments:

using OriginalSDK;

OriginalClient client = new OriginalClient(
  apiKey: "YOUR_API_KEY",
  apiSecret: "YOUR_API_SECRET",
  options: new OriginalOptions { Environment = OriginalEnvironment.Development }
);

For production environments:

using OriginalSDK;

OriginalClient client = new OriginalClient(
  apiKey: "YOUR_API_KEY",
  apiSecret: "YOUR_API_SECRET",
  options: new OriginalOptions { Environment = OriginalEnvironment.Production }
);

Using environment variables

You can also set environment variables which will be picked up by the SDK:

# .env file
ORIGINAL_API_KEY=your_api_key_here
ORIGINAL_API_SECRET=your_api_secret_here
ORIGINAL_ENVIRONMENT=development #(or production)

ORIGINAL_BASE_URL can also be set, however this is not recommended and is for advanced/internal use cases only.

// Utilises environment variables
OriginalClient client = new OriginalClient();

User

Create a New User

UserParams userParams = new UserParams
{
    UserExternalId = "YOUR_USER_EXTERNAL_ID",
    Email = "YOUR_EMAIL"
};
ApiResponse<UidResponse> response = await client.CreateUserAsync(userParams);
var userUid = response.Data.Uid;

// Sample response
new ApiResponse<UidResponse>
{
    Success = true,
    Data = new UidResponse
    {
        Uid = "175324281338"
    }
};

Get a User by UID

ApiResponse<User> response = await client.GetUserAsync("USER_UID");
var userDetails = response.Data;

// Sample response on success
new ApiResponse<User>
{
    Success = true,
    Data = new User
    {
        Uid = "754566475542",
        UserExternalId = "user_external_id",
        CreatedAt = DateTime.Parse("2024-02-26T13:12:31.798296Z"),
        Email = "user_email@email.com",
        WalletAddress = "0xa22f2dfe189ed3d16bb5bda5e5763b2919058e40",
        Wallets = new List<Wallet>
        {
            new Wallet
            {
                Address = "0x1d6169328e0a2e0a0709115d1860c682cf8d1398",
                ChainId = 80001,
                ExplorerUrl = "https://amoy.polygonscan.com/address/0x1d6169328e0a2e0a0709115d1860c682cf8d1398",
                Network = "Amoy"
            }
        }
    }
};

// Sample response if user not found
new ApiResponse<User>
{
    Success = false,
    Data = null
};

Get a User by Email

ApiResponse<User> response = await client.GetUserByEmailAsync("YOUR_EMAIL");
var userDetails = response.Data;

// Sample response - the same as "Get a User by UID" above

Get a User by External ID

ApiResponse<User> response = await client.GetUserByUserExternalIdAsync("YOUR_USER_EXTERNAL_ID");
var userDetails = response.Data;

// Sample response - the same as "Get a User by UID" above

Asset

Create a New Asset

AssetParams assetParams = new AssetParams
{
    UserUid = "USER_UID",
    CollectionUid = "COLLECTION_UID",
    AssetExternalId = "ASSET_EXTERNAL_ID",
    SalePriceInUsd = 9.99m,
    Data = new AssetData
    {
        Name = "Asset Name",
        UniqueName = true,
        ImageUrl = "https://example.com/image.png",
        Attributes = new List<AssetAttribute>
        {
            new AssetAttribute { TraitType = "Eyes", Value = "Green" },
            new AssetAttribute { TraitType = "Hair", Value = "Black" }
        }
    }
};
ApiResponse<UidResponse> response = await client.CreateAssetAsync(assetParams);
var assetUid = response.Data.Uid;

// Sample response
new ApiResponse<UidResponse>
{
    Success = true,
    Data = new UidResponse
    {
        Uid = "151854912345"
    }
};

Get an Asset by UID

ApiResponse<Asset> response = await client.GetAssetAsync("ASSET_UID");
var assetDetails = response.Data;

// Sample response
new ApiResponse<Asset>
{
    Success = true,
    Data = new Asset
    {
        Uid = "151854912345",
        Name = "Random Name #2",
        AssetExternalId = "asset_external_id_1",
        CollectionUid = "471616646163",
        CollectionName = "Test SDK Collection 1",
        TokenId = 2,
        CreatedAt = DateTime.Parse("2024-02-16T11:33:19.577827Z"),
        IsMinted = true,
        IsBurned = false,
        IsTransferring = false,
        IsTransferable = true,
        IsEditing = false,
        MintForUserUid = "885810911461",
        OwnerUserUid = "885810911461",
        OwnerAddress = "0x32e28bfe647939d073d39113c697a11e3065ea97",
        Metadata = new Metadata
        {
            Name = "Random Name",
            Image = "https://cryptopunks.app/cryptopunks/cryptopunk1081.png",
            Description = "nft_description",
            OriginalId = "151854912345",
            ExternalUrl = "external_url@example.com",
            OrgImageUrl = "https://cryptopunks.app/cryptopunks/cryptopunk1081.png",
            Attributes = new List<AssetAttribute>
            {
                new AssetAttribute
                {
                    TraitType = "Stamina Increase",
                    DisplayType = "boost_percentage",
                    Value = 10
                }
            }
        },
        ExplorerUrl = "https://mumbai.polygonscan.com/token/0x124a6755ee787153bb6228463d5dc3a02890a7db?a=2",
        TokenUri = "https://storage.googleapis.com/original-production-media/data/metadata/9ac0dad4-75ae-4406-94fd-1a0f6bf75db3.json"
    }
};

Edit an Asset

EditAssetParams editAssetParams = new EditAssetParams
{
    Data = new EditAssetData
    {
        Name = "Updated Asset Name",
        Description = "Updated Description",
        Attributes = new List<AssetAttribute>
        {
            new AssetAttribute { TraitType = "Eyes", Value = "Blue" },
            new AssetAttribute { TraitType = "Hair", Value = "Blonde" }
        }
    }
};
ApiResponse<object> response = await client.EditAssetAsync("ASSET_UID", editAssetParams);
bool editSuccess = response.Success;

// Sample response
new ApiResponse<object>
{
    Success = true,
    Data = null
}

Transfer

Create a Transfer

TransferParams transferParams = new TransferParams
{
    AssetUid = "ASSET_UID",
    FromUserUid = "FROM_USER_UID",
    ToAddress = "0xRecipientAddress"
};
ApiResponse<UidResponse> response = await client.CreateTransferAsync(transferParams);
var transferUid = response.Data.Uid;

// Sample response
new ApiResponse<UidResponse>
{
    Success = true,
    Data = new UidResponse
    {
        Uid = "883072660397"
    }
};

Get a Transfer by UID

ApiResponse<Transfer> response = await client.GetTransferAsync("TRANSFER_UID");
var transferDetails = response.Data;

// Sample response
new ApiResponse<Transfer>
{
    Success = true,
    Data = new Transfer
    {
        Uid = "883072660397",
        Status = "done",
        AssetUid = "708469717542",
        FromUserUid = "149997600351",
        ToAddress = "0xe02522d0ac9f53e35a56f42cd5e54fc7b5a12f05",
        CreatedAt = DateTime.Parse("2024-02-26T10:20:17.668254Z")
    }
};

Get Transfers by User UID

ApiResponse<List<Transfer>> response = await client.GetTransfersByUserUidAsync("USER_UID");
var transferDetails = response.Data;

// Sample response
new ApiResponse<List<Transfer>>
{
    Success = true,
    Data = new List<Transfer>
    {
        new Transfer
        {
            Uid = "883072660397",
            Status = "done",
            AssetUid = "708469717542",
            FromUserUid = "149997600351",
            ToAddress = "0xe02522d0ac9f53e35a56f42cd5e54fc7b5a12f05",
            CreatedAt = DateTime.Parse("2024-02-26T10:20:17.668254Z")
        },
        new Transfer {
          // ...
        }
    }
};

Burn

Create a Burn

BurnParams burnParams = new BurnParams
{
    AssetUid = "ASSET_UID",
    FromUserUid = "USER_UID"
};
ApiResponse<UidResponse> response = await client.CreateBurnAsync(burnParams);
var burnUid = response.Data.Uid;

// Sample response
new ApiResponse<UidResponse>
{
    Success = true,
    Data = new UidResponse
    {
        Uid = "365684656925"
    }
};

Get a Burn by UID

ApiResponse<Burn> response = await client.GetBurnAsync("BURN_UID");
var burnDetails = response.Data;

// Sample response
new ApiResponse<Burn>
{
    Success = true,
    Data = new Burn
    {
        Uid = "365684656925",
        Status = "done",
        AssetUid = "708469717542",
        FromUserUid = "483581848722",
        CreatedAt = DateTime.Parse("2024-02-26T10:20:17.668254Z")
    }
};

Get Burns by User UID

ApiResponse<List<Burn>> response = await client.GetBurnsByUserUidAsync("USER_UID");
var burnDetails = response.Data;

// Sample response
new ApiResponse<List<Burn>>
{
    Success = true,
    Data = new List<Burn>
    {
        new Burn
        {
            Uid = "365684656925",
            Status = "done",
            AssetUid = "708469717542",
            FromUserUid = "483581848722",
            CreatedAt = DateTime.Parse("2024-02-26T10:20:17.668254Z")
        },
        {
            //...
        }
    }
};

Deposit

Get Deposit Details by User and Collection

ApiResponse<Deposit> response = await client.GetDepositAsync("USER_UID", "COLLECTION_UID");
var depositDetails = response.Data;

// Sample response
new ApiResponse<Deposit>
{
    Success = true,
    Data = new Deposit
    {
        Network = "Mumbai",
        ChainId = 80001,
        WalletAddress = "0x1d6169328e0a2e0a0709115d1860c682cf8d1398",
        QrCodeData = "ethereum:0x1d6169328e0a2e0a0709115d1860c682cf8d1398@80001"
    }
};

Collection

Get a Collection by UID

ApiResponse<Collection> response = await client.GetCollectionAsync("COLLECTION_UID");
var collectionDetails = response.Data;

// Sample response
new ApiResponse<Collection>
{
    Success = true,
    Data = new Collection
    {
        Uid = "221137489875",
        Name = "Test SDK Collection 1",
        Status = "deployed",
        Type = "ERC721",
        CreatedAt = DateTime.Parse("2024-02-13T10:45:56.952745Z"),
        EditableAssets = true,
        ContractAddress = "0x124a6755ee787153bb6228463d5dc3a02890a7db",
        Symbol = "SYM",
        Description = "Description of the collection",
        ExplorerUrl = "https://mumbai.polygonscan.com/address/0x124a6755ee787153bb6228463d5dc3a02890a7db"
    }
};

Reward

Get a Reward by UID

ApiResponse<Reward> response = await client.GetRewardAsync("REWARD_UID");
var rewardDetails = response.Data;

// Sample response
new ApiResponse<Reward>
{
    Success = true,
    Data = new Reward
    {
        Uid = "151854912345",
        Name = "Test SDK Reward 1",
        Status = "deployed",
        TokenType = "ERC20",
        TokenName = "TestnetORI",
        CreatedAt = DateTime.Parse("2024-02-13T10:45:56.952745Z"),
        ContractAddress = "0x124a6755ee787153bb6228463d5dc3a02890a7db",
        WithdrawReceiver = "0x4881ab2f73c48a54b907a8b697b270f490768e6d",
        Description = "Description of the reward",
        ExplorerUrl = "https://mumbai.polygonscan.com/address/0x124a6755ee787153bb6228463d5dc3a02890a7db"
    }
};

Allocation

Create a New Allocation

AllocationParams allocationParams = new AllocationParams
{
    Amount = 100,
    Nonce = "random_nonce",
    RewardUid = "REWARD_UID",
    ToUserUid = "USER_UID"
};
ApiResponse<UidResponse> response = await client.CreateAllocationAsync(allocationParams);
var allocationUid = response.Data.Uid;

// Sample response
new ApiResponse<UidResponse>
{
    Success = true,
    Data = new UidResponse
    {
        Uid = "151854912345"
    }
};

Get an Allocation by UID

ApiResponse<Allocation> response = await client.GetAllocationAsync("ALLOCATION_UID");
var allocationDetails = response.Data;

// Sample response
new ApiResponse<Allocation>
{
    Success = true,
    Data = new Allocation
    {
        Uid = "151854912345",
        Status = "done",
        RewardUid = "reward_uid",
        ToUserUid = "754566475542",
        Amount = 123.123,
        Nonce = "nonce1",
        CreatedAt = DateTime.Parse("2024-02-16T11:33:19.577827Z")
    }
};

Get Allocations by User UID

ApiResponse<List<Allocation>> response = await client.GetAllocationsByUserUidAsync("USER_UID");
var allocationDetails = response.Data;

// Sample response
new ApiResponse<List<Allocation>>
{
    Success = true,
    Data = new List<Allocation>
    {
        new Allocation {
            Uid = "151854912345",
            Status = "done",
            RewardUid = "reward_uid",
            ToUserUid = "754566475542",
            Amount = 123.123,
            Nonce = "nonce1",
            CreatedAt = DateTime.Parse("2024-02-16T11:33:19.577827Z")
        }
    }
};

Claim

Create a New Claim

ClaimParams claimParams = new ClaimParams
{
    FromUserUid = "USER_UID",
    RewardUid = "REWARD_UID",
    ToAddress = "0xRecipientAddress"
};
ApiResponse<UidResponse> response = await client.CreateClaimAsync(claimParams);
var claimUid = response.Data.Uid;

// Sample response
new ApiResponse<UidResponse>
{
    Success = true,
    Data = new UidResponse
    {
        Uid = "151854912345"
    }
};

Get a Claim by UID

ApiResponse<Claim> response = await client.GetClaimAsync("CLAIM_UID");
var claimDetails = response.Data;

// Sample response
new ApiResponse<Claim>
{
    Success = true,
    Data = new Claim
    {
        Uid = "151854912345",
        Status = "done",
        RewardUid = "708469717542",
        FromUserUid = "754566475542",
        ToAddress = "0x4881ab2f73c48a54b907a8b697b270f490768e6d",
        Amount = 123.123,
        CreatedAt = DateTime.Parse("2024-02-16T11:33:19.577827Z")
    }
};

Get Claims by User UID

ApiResponse<List<Claim>> response = await client.GetClaimsByUserUidAsync("USER_UID");
var claimDetails = response.Data;

// Sample response
new ApiResponse<List<Claim>>
{
    Success = true,
    Data = new List<Claim>
    {
        new Claim {
            Uid = "151854912345",
            Status = "done",
            RewardUid = "708469717542",
            FromUserUid = "754566475542",
            ToAddress = "0x4881ab2f73c48a54b907a8b697b270f490768e6d",
            Amount = 123.123,
            CreatedAt = DateTime.Parse("2024-02-16T11:33:19.577827Z")
        }
    }
};

Balance

Get Reward Balance by User UID

ApiResponse<Balance> response = await client.GetBalanceAsync("REWARD_UID", "USER_UID");
var balanceData = response.Data;

// Sample response
new ApiResponse<Balance>
{
    Success = true,
    Data = new Balance
    {
        RewardUid = "151854912345",
        UserUid = "754566475542",
        Amount = 123.123
    }
};

Handling Errors

You can catch all errors with the OriginalException class:

try
{
    var response = await client.CreateUserAsync(new UserParams { UserExternalId = "user_external_id", Email = "invalid_email" });
}
catch (OriginalException ex)
{
    // Handle all errors
    Console.WriteLine($"Error: {ex.Message}");
}

Or, catch specific errors:

try
{
    var response = await client.CreateUserAsync(new UserParams {
      UserExternalId = "user_external_id",
      Email = "invalid_email"
    });
}
catch (ClientException ex)
{
    Console.WriteLine($"Client error: {ex.Message}");
}
catch (ServerException ex)
{
    Console.WriteLine($"Server error: {ex.Message}");
}
catch (ValidationException ex)
{
    Console.WriteLine($"Validation error: {ex.Message}");
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 123 11/7/2024
1.0.0 129 11/1/2024