Skip to content

X1ting/decommas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Decommas Ruby SDK

The decommas gem provides a Ruby SDK to easily integrate with the Decommas API. With this SDK, you can fetch information about coins, tokens, NFTs, transactions, and more.

Installation

Add this line to your application's Gemfile:

gem "decommas", ">= 0.0.3"

And then execute:

$ bundle install

Or install it yourself:

$ gem install decommas

Usage:

First, configure your client (you might need an API key or other configuration details):

Decommas.configure do |config|
  config.token = "YOUR_TOKEN"
  config.safe_mode = true
end

safe_mode when set to true retry all requests to API 5 times with exponential backoff in case if it was throttled and returned 429 in response code. when set to false it simply returns response as is.

Then, use the provided methods to fetch data:

# Fetch coins for an address
coins = Decommas::Api.coins(address: 'YOUR_ADDRESS')

Fetch tokens for an address

tokens = Decommas::Api.tokens(address: 'YOUR_ADDRESS')

API

Available Methods:

/coins

Fetch coins for a specific address.

Decommas::Api.coins(address: 'YOUR_ADDRESS', options: {})

/tokens

Fetch tokens for a specific address.

Decommas::Api.tokens(address: 'YOUR_ADDRESS', options: {})

/nfts

Fetch NFTs for a specific address.

Decommas::Api.nfts(address: 'YOUR_ADDRESS', options: {})

/transactions

Fetch transactions for a specific address with optional pagination.

Decommas::Api.transactions(address: 'YOUR_ADDRESS', limit: 10, offset: 0)

/transfers_erc20

Fetch ERC20 transfers for a specific address with optional pagination.

Decommas::Api.transfers_erc20(address: 'YOUR_ADDRESS', limit: 10, offset: 0)

/transfers_nft

Decommas::Api.transfers_nft(address: 'YOUR_ADDRESS')

/protocols

Decommas::Api.protocols(address: 'YOUR_ADDRESS')

/transaction_erc20_transfers

Decommas::Api.transaction_erc20_transfers(chain_name: 'mainnet', tx: 'TX_HASH')

/all_tokens_metadata

Decommas::Api.all_tokens_metadata(address: 'YOUR_ADDRESS')

/all_coins_metadata

Decommas::Api.all_coins_metadata(address: 'YOUR_ADDRESS')

/token_metadata

Decommas::Api.token_metadata(chain_name: 'mainnet', contract_address: 'CONTRACT_ADDRESS')

PriceService

Available Methods:

/dexes

Fetch available dexes for chainname.

Decommas::PriceService.dexes(chain: 'mainnet', options: {})

/get_price

Returns a prices in ETH & in USD for requested ERC20 tokens in corresponding chain and DEX at last write block heigh.

Decommas::Api.get_price(chain: "mainnet", dex: "UniswapV2", tokens: ["CONTRACT"])

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/x1ting/decommas. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License The gem is available as open-source under the terms of the MIT License.

About

Ruby SDK for Decommas API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages