Jump to content

toohoola

Member
  • Content Count

    357
  • Joined

Posts posted by toohoola


  1. On 22/12/2019 at 10:39, Noeprellik1 said:

    Is it possible to do withdrawal using API? 

    As far as I know, everything is possible via API, that you can do on the official site, since the site uses the API as well.

    Last time I checked this was the withdrawal mutation:

    mutation CreateWithdrawalMutation(
        $address: String!,
        $amount: Float!,
        $currency: CurrencyEnum!,
        $tfaToken: String,
        $oauthToken: String
    ) {
        createWithdrawal(currency: $currency, address: $address, amount: $amount, tfaToken: $tfaToken, oauthToken: $oauthToken) {
            id
            amount
            refFee
            currency
            hash
            address
            reference {
                ... on User {
                    id
                    balances {
                        available {
                            amount
                            currency
                        }
                        vault {
                            amount
                            currency
                        }
                    }
                }
            }
        }
    }

     


  2. On 08/08/2019 at 21:24, PrimediceSuite said:

    What would the query look like to get a users deposit addresses?

    What would the query look like to get chat messages from a certain room?

    For deposit address:

    query DepositAddress($currency: CurrencyEnum!) {
    	info {
    		currency(currency: $currency) {
    			requiredConfirmations
    		}
    	}
    	user {
    		id
    		depositAddress(currency: $currency) {
    			id
    			address
    			currency
    		}
    	}
    }

     

    To get the chat messages you have 2 options, either get the history manually with this, using the limit and the offset parameters:

    query PublicChats(
    	$includeHistory: Boolean = false
    	$limit: Int
    	$offset: Int
    ) {
    	publicChats {
    		id
    		name
    		isPublic
    		messageList(limit: $limit, offset:$offset) @include(if: $includeHistory) {
    			...MessageFragment
    		}
    	}
    }

    or you can use subscription to get them as soon as possible:

    subscription ChatSubscription($chatId: String!) {
    	chatMessages(chatId: $chatId) {
    		...MessageFragment
    	}
    }

    The MessageFragment is the same in both cases, don't forget to attach it to your query. I left it out to save some space:

    fragment MessageFragment on ChatMessage {
    	id
    	data {
    		... on ChatMessageDataRace {
    			race {
    				name
    				status
    				startTime
    				leaderboard(limit: 10) {
    					...RacePositionFragment
    				}
    			}
    		}
    		... on ChatMessageDataTrivia {
    			status
    			question
    			answer
    			currency
    			amount
    			winner {
    				id
    				name
    			}
    		}
    		... on ChatMessageDataText {
    			message
    		}
    		... on ChatMessageDataBot {
    			message
    		}
    		... on ChatMessageDataTip {
    			tip {
    				id
    				amount
    				currency
    				sender: sendBy {
    					id
    					name
    				}
    				receiver: user {
    					id
    					name
    				}
    			}
    		}
    		... on ChatMessageDataRain {
    			rain {
    				amount
    				currency
    				rainUsers {
    					user {
    						id
    						name
    					}
    				}
    				giver: user {
    					id
    					name
    				}
    			}
    		}
    	}
    	createdAt
    	user {
    		id
    		name
    	}
    }
    
    fragment RacePositionFragment on RacePosition {
    	position
    	user {
    		id
    		name
    	}
    	wageredAmount
    	payoutAmount
    	currency
    }

     

×