Skip to content

Commit 45e0d21

Browse files
committed
feat: adds new method params
1 parent b49ae16 commit 45e0d21

File tree

2 files changed

+39
-21
lines changed

2 files changed

+39
-21
lines changed

lib/cryptomarket/client.rb

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ def get_spot_trades_history(
718718
#
719719
# https://api.exchange.cryptomkt.com/#wallet-balance
720720

721-
def get_wallet_balance
721+
def get_wallet_balances
722722
return get("wallet/balance")
723723
end
724724

@@ -731,7 +731,7 @@ def get_wallet_balance
731731
# ==== Params
732732
# +String+ +currency+:: The currency code to query the balance
733733

734-
def get_wallet_balance_of_currency(currency:)
734+
def get_wallet_balance(currency:)
735735
return get("wallet/balance/#{currency}")
736736
end
737737

@@ -756,9 +756,10 @@ def get_deposit_crypto_addresses()
756756
#
757757
# ==== Params
758758
# +String+ +currency+:: Currency to get the address
759+
# +String+ +network_code+:: Optional. network code
759760

760-
def get_deposit_crypto_address_of_currency(currency:nil)
761-
result = get("wallet/crypto/address", {currency:currency})
761+
def get_deposit_crypto_address(currency:nil, network_code:nil)
762+
result = get("wallet/crypto/address", {currency:currency, network_code:network_code})
762763
if result.length != 1
763764
raise CryptomarketSDKException "Too many currencies recieved, expected 1 currency"
764765
end
@@ -774,9 +775,10 @@ def get_deposit_crypto_address_of_currency(currency:nil)
774775
#
775776
# ==== Params
776777
# +String+ +currency+:: currency to create a new address
778+
# +String+ +network_code+:: Optional. network code
777779

778-
def create_deposit_crypto_address(currency:)
779-
return post("wallet/crypto/address", {currency:currency})
780+
def create_deposit_crypto_address(currency:, network_code:nil)
781+
return post("wallet/crypto/address", {currency:currency, network_code:network_code})
780782
end
781783

782784
# Get the last 10 unique addresses used for deposit, by currency
@@ -788,9 +790,10 @@ def create_deposit_crypto_address(currency:)
788790
#
789791
# ==== Params
790792
# +String+ +currency+:: currency to get the list of addresses
793+
# +String+ +network_code+:: Optional. network code
791794

792-
def get_last_10_deposit_crypto_addresses(currency:)
793-
return get("wallet/crypto/address/recent-deposit", {currency:currency})
795+
def get_last_10_deposit_crypto_addresses(currency:, network_code:nil)
796+
return get("wallet/crypto/address/recent-deposit", {currency:currency, network_code:network_code})
794797
end
795798

796799
# Get the last 10 unique addresses used for withdrawals, by currency
@@ -802,9 +805,10 @@ def get_last_10_deposit_crypto_addresses(currency:)
802805
#
803806
# ==== Params
804807
# +String+ +currency+:: currency to get the list of addresses
808+
# +String+ +network_code+:: Optional. network code
805809

806-
def get_last_10_withdrawal_crypto_addresses(currency:)
807-
return get("wallet/crypto/address/recent-withdraw", {currency:currency})
810+
def get_last_10_withdrawal_crypto_addresses(currency:, network_code:nil)
811+
return get("wallet/crypto/address/recent-withdraw", {currency:currency, network_code:network_code})
808812
end
809813

810814
# Please take note that changing security settings affects withdrawals:
@@ -822,6 +826,7 @@ def get_last_10_withdrawal_crypto_addresses(currency:)
822826
# +String+ +currency+:: currency code of the crypto to withdraw
823827
# +float+ +amount+:: amount to be sent to the specified address
824828
# +String+ +address+:: address identifier
829+
# +String+ +network_code+:: Optional. network code
825830
# +String+ +payment id+:: Optional.
826831
# +bool+ +include fee+:: Optional. If true then the amount includes fees. Default is false
827832
# +bool+ +auto commit+:: Optional. If false then you should commit or rollback the transaction in an hour. Used in two phase commit schema. Default is true
@@ -832,6 +837,7 @@ def withdraw_crypto(
832837
currency:,
833838
amount:,
834839
address:,
840+
network_code:nil,
835841
payment_id:nil,
836842
include_fee:nil,
837843
auto_commit:nil,
@@ -844,6 +850,7 @@ def withdraw_crypto(
844850
currency:currency,
845851
amount:amount,
846852
address:address,
853+
network_code:network_code,
847854
payment_id:payment_id,
848855
include_fee:include_fee,
849856
auto_commit:auto_commit,
@@ -1008,38 +1015,45 @@ def transfer_money_to_another_user(currency:, amount:, by:, identifier:)
10081015
# https://api.exchange.cryptomkt.com/#get-transactions-history
10091016
#
10101017
# ==== Params
1011-
# +Array[String]+ +transaction ids+:: Optional. List of transaction identifiers to query
1012-
# +Array[String]+ +transaction types+:: Optional. List of types to query. valid types are: 'DEPOSIT', 'WITHDRAW', 'TRANSFER' and 'SWAP'
1013-
# +Array[String]+ +transaction subtyes+:: Optional. List of subtypes to query. valid subtypes are: 'UNCLASSIFIED', 'BLOCKCHAIN', 'AIRDROP', 'AFFILIATE', 'STAKING', 'BUY_CRYPTO', 'OFFCHAIN', 'FIAT', 'SUB_ACCOUNT', 'WALLET_TO_SPOT', 'SPOT_TO_WALLET', 'WALLET_TO_DERIVATIVES', 'DERIVATIVES_TO_WALLET', 'CHAIN_SWITCH_FROM', 'CHAIN_SWITCH_TO' and 'INSTANT_EXCHANGE'
1014-
# +Array[String]+ +transaction statuses+:: Optional. List of statuses to query. valid subtypes are: 'CREATED', 'PENDING', 'FAILED', 'SUCCESS' and 'ROLLED_BACK'
1015-
# +String+ +order by+:: Optional. sorting parameter.'created_at' or 'id'. Default is 'created_at'
1018+
# +Array[String]+ +tx_ids+:: Optional. List of transaction identifiers to query
1019+
# +Array[String]+ +types+:: Optional. List of transaction types to query. valid types are: 'DEPOSIT', 'WITHDRAW', 'TRANSFER' and 'SWAP'
1020+
# +Array[String]+ +subtyes+:: Optional. List of transaction subtypes to query. valid subtypes are: 'UNCLASSIFIED', 'BLOCKCHAIN', 'AIRDROP', 'AFFILIATE', 'STAKING', 'BUY_CRYPTO', 'OFFCHAIN', 'FIAT', 'SUB_ACCOUNT', 'WALLET_TO_SPOT', 'SPOT_TO_WALLET', 'WALLET_TO_DERIVATIVES', 'DERIVATIVES_TO_WALLET', 'CHAIN_SWITCH_FROM', 'CHAIN_SWITCH_TO' and 'INSTANT_EXCHANGE'
1021+
# +Array[String]+ +statuses+:: Optional. List of statuses to query. valid subtypes are: 'CREATED', 'PENDING', 'FAILED', 'SUCCESS' and 'ROLLED_BACK'
1022+
# +Array[String]+ +currencies+:: Optional. Currency codes of the transactions to fetch
1023+
# +Array[String]+ +networks+:: Optional. Network codes of the transactions to fetch
1024+
# +String+ +order_by+:: Optional. sorting parameter.'created_at' or 'id'. Default is 'created_at'
10161025
# +String+ +from+:: Optional. Interval initial value when ordering by 'created_at'. As Datetime
10171026
# +String+ +till+:: Optional. Interval end value when ordering by 'created_at'. As Datetime
1018-
# +String+ +id from+:: Optional. Interval initial value when ordering by id. Min is 0
1019-
# +String+ +id till+:: Optional. Interval end value when ordering by id. Min is 0
1027+
# +String+ +id_from+:: Optional. Interval initial value when ordering by id. Min is 0
1028+
# +String+ +id_till+:: Optional. Interval end value when ordering by id. Min is 0
10201029
# +String+ +sort+:: Optional. Sort direction. 'ASC' or 'DESC'. Default is 'DESC'
10211030
# +Integer+ +limit+:: Optional. Transactions per query. Defaul is 100. Max is 1000
10221031
# +Integer+ +offset+:: Optional. Default is 0. Max is 100000
1032+
# +bool+ +group_transactions+:: Optional. Flag indicating whether the returned transactions will be parts of a single operation. Default is false
10231033

10241034
def get_transaction_history(
10251035
currency:nil,
1036+
from:nil,
10261037
till:nil,
10271038
types:nil,
10281039
subtypes:nil,
10291040
statuses:nil,
10301041
currencies:nil,
1042+
networks:nil,
10311043
id_from:nil,
10321044
id_till:nil,
10331045
tx_ids:nil,
10341046
order_by:nil,
10351047
sort:nil,
10361048
limit:nil,
1037-
offset:nil
1049+
offset:nil,
1050+
group_transactions:nil
10381051
)
10391052
return get(
10401053
"wallet/transactions",
10411054
{
10421055
currency:currency,
1056+
from:from,
10431057
till:till,
10441058
types:types,
10451059
subtypes:subtypes,
@@ -1051,7 +1065,8 @@ def get_transaction_history(
10511065
order_by:order_by,
10521066
sort:sort,
10531067
limit:limit,
1054-
offset:offset
1068+
offset:offset,
1069+
group_transactions:group_transactions
10551070
}
10561071
)
10571072
end

lib/cryptomarket/websocket/walletClient.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ def get_wallet_balance_of_currency(currency:, callback:)
139139
# +String+ +sort+:: Optional. Sort direction. 'ASC' or 'DESC'. Default is 'DESC'
140140
# +Integer+ +limit+:: Optional. Transactions per query. Defaul is 100. Max is 1000
141141
# +Integer+ +offset+:: Optional. Default is 0. Max is 100000
142+
# +bool+ +group_transactions+:: Optional. Flag indicating whether the returned transactions will be parts of a single operation. Default is false
142143

143144
def get_transactions(
144145
callback:,
@@ -154,7 +155,8 @@ def get_transactions(
154155
order_by:nil,
155156
sort:nil,
156157
limit:nil,
157-
offset:nil
158+
offset:nil,
159+
group_transactions:nil
158160
)
159161
send_by_id('get_transactions', callback, {
160162
tx_ids:tx_ids,
@@ -169,7 +171,8 @@ def get_transactions(
169171
order_by:order_by,
170172
sort:sort,
171173
limit:limit,
172-
offset:offset
174+
offset:offset,
175+
group_transactions:group_transactions
173176
})
174177
end
175178
end

0 commit comments

Comments
 (0)