Jump to content

Dan

Forum Admin
  • Content Count

    894
  • Joined

  • Last visited

  • Days Won

    34

Posts posted by Dan


  1. 17 hours ago, paddyspub said:

    @Dan can you pls provide me with an example of requests which returns the next info: 

    -my current balance in specific currency

    -list of users who tipped me (name / currency / amount / date )

    example of request how to tip to user. 

    I can't use a lot of requests here because of  "message": "API access restricted". (i got token in header but still) 

     

     

    Account balances

    {
      user {
        id
        name
        balances {
          available {
            currency
            amount
          }
          vault {
            currency
            amount
          }
        }
      }
    }

    Tiplist

    {
      user {
        tipList(limit: 50, offset: 0) {
          user {
            name
            id
          }
          amount
          currency
          createdAt
        }
      }
    }

     


  2. On 13/09/2019 at 01:13, Awais said:

    I am new to programing

    Please can you tell 

    How i ahutenticate with token in javascript 

    And place bet in javascript 

    In my browser counsel

    I serched many sites on google but didn't help.

    You cant run graphql mutations and queries within your browser console, or at least its not advised.

    How are you running the primedice roll mutation? You need to add the access token header to your code.


  3. Hi All,

    Unfortunately, our current server provider is not allowing us to accept Russian customers. If you are trying to enter Primedice through a Russian VPN, or your location is Russia, you will be automatically redirected to our Forum. If you have an account that you can no longer access that has balance in it, please contact Support and they will be able to help you out. This decision is out of our control, and we hope to have further updates when or if they become available.

    We apologies for any inconveniences this may cause.


  4. On 05/08/2019 at 09:55, PrimediceSuite said:

    Hello,

    I had used Primedice's API several years ago and want to start working with it again - but the switch to GraphQL has thrown me off.  This is the first time I've worked with GraphQL.  This topic seems to be the only documentation on the current API that I could find, and while I have figured out how to do simple things like retrieve a user's name and balances, I can't seem to figure out how to get the user's deposit address, or retrieve chat messages from a specific room...

     

    I would love some guidance on this matter if possible.  Thank you!

    You can query the user object once you have authenticated (explained how to in original post.)

     

    Example user query:

    {
      user {
        id
        balances {
          available {
            currency
            amount
          }
          vault {
            currency
            amount
          }
        }
      }
    }

     

    On 05/08/2019 at 11:44, JstLikeMagyk said:

    Thanks for adding the tip mutation that's really handy, and if the BetID issue could be resolved that'd be awesome @Dan or are you planning to leave it as is?

    The betiid implementation was a decision made by the lead developers. It's certainly not ideal, but it's the only solution they could come too with the problems we were heading into.

    10 hours ago, dicedice said:

    Hi @Dan,

    2 moths ago (or so) this request was working:
     

    
    {"operationName":null,"variables":{},"query":"mutation {\n  primediceRoll(amount: 0.001, target: 90.0, condition: above, currency: doge) {\n    ...BetFragment\n    ...PrimediceBetStateFragment\n    __typename\n  }\n}\n\nfragment BetFragment on Bet {\n  active\n  id\n  iid\n  payoutMultiplier\n  amountMultiplier\n  amount\n  payout\n  updatedAt\n  currency\n  game\n  nonce\n  serverSeed {\n    seedHash\n  }\n  clientSeed {\n    seed\n  }\n  user {\n    id\n    name\n    balances {\n      available {\n        currency\n        amount\n      }\n    }\n    __typename\n  }\n  __typename\n}\n\nfragment PrimediceBetStateFragment on Bet {\n  state {\n    ... on BetGamePrimedice {\n      result\n      target\n      condition\n      __typename\n    }\n    __typename\n  }\n  __typename\n}\n"}

    Today it returns "HTTP Error 400: Bad Request"

    This code is working ok:
     

    
    {"operationName":"ActiveRaces","variables":{},"query":"query ActiveRaces {\n  activeRaces {\n    ...RaceFragment\n    __typename\n  }\n}\n\nfragment RaceFragment on Race {\n  id\n  name\n  currency\n  type\n  startTime\n  endTime\n  status\n  __typename\n}\n"}
    

    so probably is problem only in query and the rest code is ok:

    What was changed in API last weeks? How to fix roll dice request?
     

    iid is no longer available as a return field from a dice roll, if oyu remove it, then the mutaiton will work, as such:

    mutation {
      primediceRoll(amount: 0.001, target: 90.0, condition: above, currency: doge) {
        id
        payout
        amountMultiplier
        payoutMultiplier
        createdAt
        nonce
      }
    }

     


  5. Using the Primedice API
    Graphql endpoint: https://api.primedice.com/graphql 

    Authentication

    You can authenticate with graphql via the http header. We utilise jwt token's for authentication which can be found via https://primedice.com/settings/tokens or for an unrestricted token (access to everything on your account) you can obtain it from your browser's local storage.

    Authenticated requests require that you use this token in your header by adding it to the "x-access-token" property.

    {
      "x-access-token": "token goes here"
    }

     

    Schema

    Our schema is now locked down and private. To help support developers, I have created this topic to provide assistance to those who would like insights into certain queries or mutations. When someone requests details for a certain aspect of the schema, I will append this topic with the relevant details required to conduct such a query or mutation.

    Terminology: With graphql, queries are the equivalent of a GET request, where you are asking for information to be returned, whereas a mutation is a POST request where you generally invoke an action.

     

    API Client

    When working with debugging queries using our API, theres a fair few API clients you can utilise to test that you are getting the responses you need. I currently use (and highly recommend) https://insomnia.rest/. It allows you to not only do standard REST requests with API's but also GraphQL requests. It's a great way to test that your queries are working before you throw them into your projects.

     

    Examples

    Send Message Mutation (sends a message to a chat channel)  [Authenticated]

    mutation {
      sendMessage(chatId: "chat_id_goes_here", message: "message_goes_here") {
        id
        user {
          name
        }
      }
    }

    Public Chats Query (search for all public chat channels) [Unrestricted]

    query {
      publicChats {
        id
        name
      }
    }

    Bet List Query (lookup a players bet history)  [Unrestricted]

    {
      user(name: "Dan") {
        houseBetList(limit: 50, offset: 0) {
          id
          iid
          bet {
            ... on CasinoBet {
              game
              payout
              amountMultiplier
              payoutMultiplier
              amount
              currency
              createdAt
            }
          }
        }
      }
    }

    Bet Info Query (lookup a specific bet)  [Unrestricted]

    {
      bet(iid: "house:32361565304") {
        id
        iid
        bet {
          ... on CasinoBet {
            game
            payout
            payoutMultiplier
            amount
            createdAt
            currency
            user {
              name
            }
            state {
              ... on CasinoGamePrimedice {
                result
                target
                condition
              }
            }
          }
        }
      }
    }

    Roll Dice (make a dice bet) [Authenticated]

    mutation {
      primediceRoll(amount: 1, target: 50, condition: above, currency: doge) {
        id
        payout
        amountMultiplier
        payoutMultiplier
        createdAt
        nonce
      }
    }

     

    Please use this topic to submit a request on how to do a certain action with our API and I will ensure to get back to you with the necessary information.


  6. 4 hours ago, MrNice23 said:

    Hello @Dan thanks for your answer , well i'm pretty confused as well , i made like 3 posts under "Primedice Dicussion" Section and i haven't got credited for ....

    I don't know why, maybe sometimes the algo managing the payments is not working well or is delaying payments... Anyways i won't cry for few sats , i just thought i got like a sanction , no worries for that if that happens again i will let you know, Cheers man! 

    That would happen if it isn't high enough quality. If you would like, you can link me the three posts in that section and I can let you know what is wrong with the quality.


  7. On 13/05/2019 at 03:54, prashblah said:

    Hi @Dan

    I am trying to use the graphql api and i send the api token x-access-token in the http header. But when I try to use any restricted api, I get the below error:

    
    {
      "errors": [
        {
          "path": [
            "depositList"
          ],
          "message": "Your API key doesn't have the permission to do this.",
          "errorType": "restrictedScope"
        }
      ],
      "data": null
    }

    Do I need to do anything to get access or am I doing something wrong.

     

    Thanks

    Are you adding it here? https://api.primedice.com/graphql

     

    Screen Shot 2019-05-15 at 3.13.30 pm.png


  8. I'm not too sure how many people are actively interested in the growth of the lightning network and its adoption, but as of late there has been a tremendous growth, which could potentially see some price rising across the whole spectrum of the crypto universe.

    Now with a total capacity of 601 BTC ($2,053,000), the Lightning network has added over 15% of capacity growth during the first month of 2019. The total node count now sits just below 6000, the equivalent of a 16% monthly rise, while there are now above 22,000 channels – 36% more than a month ago.

    It's certainly hard to argue against the fact that this sort of growth in the middle of a relentless bear market is saying something. Could this be a turning point and a great investment opportunity to buy back in? Only time will tell!

    You can find more relevant statistics about the network here: https://1ml.com/


  9. 1 hour ago, MateuszHDHR1 said:

    That changed a little bit because the price now is far lower, so I'd have to make a lot more posts, it was around 400$ if im right

    At the current price that sounds terrible, but hold on to it and you should be a very wealthy person in a few years 😛 

×