Skip to content

Opdex/opdex-v1-sdk-csharp

Repository files navigation

Opdex V1 API C# SDK

NuGet

The Opdex Platform Web API is an interface for querying information from the Opdex contract indexer and quoting Opdex smart contract transactions. This project maintains a C# SDK that integrates with the API.

Getting Started

To get started, install the NuGet package into your project.

dotnet add package Opdex.Client

Usage

Using the API client is as simple as creating an instance of OpdexApi. It is recommended to configure OpdexApi as a typed client, in the following way:

public void ConfigureServices(IServiceCollection services)
{
    services.AddHttpClient<IOpdexApi, OpdexApi>(config => config.BaseAddress = new Uri("https://v1-test-api.opdex.com/v1"));
}

It is then possible to access IOpdexApi wherever it can be resolved through dependency injection. For example, you might inject it into a class constructor.

public class MyService
{
    private readonly IOpdexApi _opdexApi;

    public MyService(IOpdexApi opdexApi)
    {
        _opdexApi = opdexApi;
    }

    public async Task DoSomething()
    {
        var market = await _opdexApi.Markets.GetMarketAsync("t7RorA7xQCMVYKPM1ibPE1NSswaLbpqLQb");
    }
}

Endpoints

Class Method HTTP request Description
AuthenticationApi Authenticate POST /auth Stratis Signature Auth
AuthenticationApi AuthenticateCallback POST /auth/callback Stratis Signature Auth Callback
AuthenticationApi GetStratisId GET /auth Get Stratis Id
BlocksApi GetBlock GET /blocks/{height} Get Block
BlocksApi GetBlocks GET /blocks Get Blocks
IndexerApi GetIndexerStatus GET /indexer Get Indexer Status
LiquidityPoolsApi BuildAddLiquidityQuote POST /liquidity-pools/{pool}/add Build Add Liquidity Transaction Quote
LiquidityPoolsApi BuildCollectStakingRewardsQuote POST /liquidity-pools/{pool}/staking/collect Build Collect Staking Rewards Transaction Quote
LiquidityPoolsApi BuildCreateLiquidityPoolQuote POST /liquidity-pools Build Create Liquidity Pool Transaction Quote
LiquidityPoolsApi BuildRemoveLiquidityQuote POST /liquidity-pools/{pool}/remove Build Remove Liquidity Transaction Quote
LiquidityPoolsApi BuildSkimQuote POST /liquidity-pools/{pool}/skim Build Skim Transaction Quote
LiquidityPoolsApi BuildStartStakingQuote POST /liquidity-pools/{pool}/staking/start Build Start Staking Transaction Quote
LiquidityPoolsApi BuildStopStakingQuote POST /liquidity-pools/{pool}/staking/stop Build Stop Staking Transaction Quote
LiquidityPoolsApi BuildSyncQuote POST /liquidity-pools/{pool}/sync Build Sync Transaction Quote
LiquidityPoolsApi GetLiquidityAmountInQuote POST /liquidity-pools/{pool}/add/amount-in Add Liquidity Amount In Quote
LiquidityPoolsApi GetLiquidityPool GET /liquidity-pools/{pool} Get Liquidity Pool
LiquidityPoolsApi GetLiquidityPoolHistory GET /liquidity-pools/{pool}/history Get Liquidity Pool History
LiquidityPoolsApi GetLiquidityPools GET /liquidity-pools Get Liquidity Pools
MarketTokensApi GetMarketToken GET /markets/{market}/tokens/{token} Get Market Token
MarketTokensApi GetMarketTokenHistory GET /markets/{market}/tokens/{token}/history Get Market Token History
MarketTokensApi GetMarketTokens GET /markets/{market}/tokens Get Market Tokens
MarketTokensApi GetSwapAmountInQuote POST /markets/{market}/tokens/{token}/swap/amount-in Swap Amount In Quote
MarketTokensApi GetSwapAmountOutQuote POST /markets/{market}/tokens/{token}/swap/amount-out Swap Amount Out Quote
MarketTokensApi Swap POST /markets/{market}/tokens/{token}/swap Build Swap Tokens Transaction Quote
MarketsApi BuildClaimMarketOwnershipQuote POST /markets/{market}/standard/claim-ownership Build Claim Market Ownership Transaction Quote
MarketsApi BuildCollectMarketFeesQuote POST /markets/{market}/standard/collect-fees Build Collect Market Fees Transaction Quote
MarketsApi BuildCreateStakingMarketQuote POST /markets/staking Build Create Staking Market Transaction Quote
MarketsApi BuildCreateStandardMarketQuote POST /markets/standard Build Create Standard Market Transaction Quote
MarketsApi BuildSetMarketOwnershipQuote POST /markets/{market}/standard/set-ownership Build Set Market Ownership Transaction Quote
MarketsApi BuildSetMarketPermissionsQuote POST /markets/{market}/standard/permissions/{address} Build Set Market Permissions Transaction Quote
MarketsApi GetMarket GET /markets/{market} Get Market
MarketsApi GetMarketHistory GET /markets/{market}/history Get Market History
MarketsApi GetMarketPermissions GET /markets/{market}/standard/permissions/{address} Get Market Permissions
MarketsApi GetMarkets GET /markets Get Markets
MiningGovernancesApi BuildRewardMiningPoolsQuote POST /mining-governances/{governance}/reward-mining-pools Build Reward Mining Pools Transaction Quote
MiningGovernancesApi GetMiningGovernance GET /mining-governances/{governance} Get Mining Governance
MiningGovernancesApi GetMiningGovernances GET /mining-governances Get Mining Governances
MiningPoolsApi BuildCollectMiningRewardsQuote POST /mining-pools/{pool}/collect Build Collect Mining Rewards Transaction Quote
MiningPoolsApi BuildStartMiningQuote POST /mining-pools/{pool}/start Build Start Mining Transaction Quote
MiningPoolsApi BuildStopMiningQuote POST /mining-pools/{pool}/stop Build Stop Mining Transaction Quote
MiningPoolsApi GetMiningPool GET /mining-pools/{pool} Get Mining Pool
MiningPoolsApi GetMiningPools GET /mining-pools Get Mining Pools
StatusApi GetStatus GET /status Get Status
TokensApi AddToken POST /tokens Add Token
TokensApi BuildApproveAllowanceQuote POST /tokens/{token}/approve Build Approve Allowance Transaction Quote
TokensApi BuildDistributeTokensQuote POST /tokens/{token}/distribute Build Distribute Tokens Transaction Quote
TokensApi GetToken GET /tokens/{token} Get Token
TokensApi GetTokenHistory GET /tokens/{token}/history Get Token History
TokensApi GetTokens GET /tokens Get Tokens
TransactionsApi GetTransaction GET /transaction/{hash} Get Transaction
TransactionsApi GetTransactions GET /transactions Get Transactions
TransactionsApi NotifyTransactionBroadcast POST /transactions Notify Broadcast
TransactionsApi ReplayQuote POST /transaction/replay-quote Replay Transaction Quote
VaultsApi BuildCompleteProposalQuote POST /vaults/{vault}/proposals/{proposalId}/complete Build Complete Proposal Transaction Quote
VaultsApi BuildPledgeQuote POST /vaults/{vault}/proposals/{proposalId}/pledges Build Make Pledge Transaction Quote
VaultsApi BuildProposeChangeMinimumPledgeQuote POST /vaults/{vault}/proposals/minimum-pledge Build Propose Change Minimum Pledge Transaction Quote
VaultsApi BuildProposeChangeMinimumVoteQuote POST /vaults/{vault}/proposals/minimum-vote Build Propose Change Minimum Vote Transaction Quote
VaultsApi BuildProposeCreateCertificateQuote POST /vaults/{vault}/proposals/create-certificate Build Propose Create Certificate Transaction Quote
VaultsApi BuildProposeRevokeCertificateQuote POST /vaults/{vault}/proposals/revoke-certificate Build Propose Revoke Certificate Transaction Quote
VaultsApi BuildRedeemCertificateQuote POST /vaults/{vault}/certificates/redeem Build Redeem Vault Certificate Transaction Quote
VaultsApi BuildVoteQuote POST /vaults/{vault}/proposals/{proposalId}/votes Build Cast Vote Transaction Quote
VaultsApi BuildWithdrawPledgeQuote POST /vaults/{vault}/proposals/{proposalId}/pledges/withdraw Build Withdraw Pledge Transaction Quote
VaultsApi BuildWithdrawVoteQuote POST /vaults/{vault}/proposals/{proposalId}/votes/withdraw Build Withdraw Vote Transaction Quote
VaultsApi GetCertificates GET /vaults/{vault}/certificates Get Vault Certificates
VaultsApi GetPledgePosition GET /vaults/{vault}/proposals/{proposalId}/pledges/{pledger} Get Vault Proposal Pledge Position
VaultsApi GetPledges GET /vaults/{vault}/pledges Get Vault Proposal Pledges
VaultsApi GetProposals GET /vaults/{vault}/proposals Get Vault Proposals
VaultsApi GetVault GET /vaults/{vault} Get Vault
VaultsApi GetVaultProposal GET /vaults/{vault}/proposals/{proposalId} Get Vault Proposal
VaultsApi GetVaults GET /vaults Get Vaults
VaultsApi GetVotePosition GET /vaults/{vault}/proposals/{proposalId}/votes/{voter} Get Vault Proposal Vote Position
VaultsApi GetVotes GET /vaults/{vault}/votes Get Vault Proposal Votes
WalletsApi GetApprovedAllowance GET /wallets/{address}/allowance/{token}/approved/{spender} Get Approved Allowance
WalletsApi GetBalance GET /wallets/{address}/balance/{token} Get Balance
WalletsApi GetBalances GET /wallets/{address}/balance Get Balances
WalletsApi GetMiningPosition GET /wallets/{address}/mining/{pool} Get Mining Position
WalletsApi GetMiningPositions GET /wallets/{address}/mining Get Mining Positions
WalletsApi GetStakingPosition GET /wallets/{address}/staking/{pool} Get Staking Position
WalletsApi GetStakingPositions GET /wallets/{address}/staking Get Staking Positions
WalletsApi RefreshBalance POST /wallets/{address}/balance/{token} Refresh Balance

About

Opdex V1 C# SDK (experimental)

Resources

Stars

Watchers

Forks