
Perform user-management related operations
These queries & mutations are used to create accounts for new users or authenticate as existing ones. After successful login, there are then operations that can be done to fetch various types of information about the logged in user such as transaction history and wallet ids.
Queries/mutations #
-
Login
Galoy instances currently use phone numbers and SMS codes (sent via twilio) to authenticate users. A user can first request an SMS phone code for a given phone number. If the user doesn’t exist a new user is created. The user can then use the phone number and a received SMS code to receive a JWT token that can then be included as an authorization header in all subsequent requests.
- Request SMS phone code for a given phone number
mutation userRequestAuthCode($input: UserRequestAuthCodeInput!) { userRequestAuthCode(input: $input) { success } }
- Login (or create new user) with a phone number and received SMS code
mutation userLogin($input: UserLoginInput!) { userLogin(input: $input) { authToken } }
Variables:
{ "input": { "username": "Alice" } }
- Request SMS phone code for a given phone number
-
User info
A
me
query exists that can be used to fetch different details about an authenticated user’s detaails and transactions. The following are selections from theme
query that surface different subsets of data on the user. These can also optionally be combined into single requests.-
Balances for all a user’s wallets
query me { me { defaultAccount { wallets { walletCurrency balance } } } }
- Another user’s current default wallet id given their username
query userDefaultWalletId($username: Username!) { userDefaultWalletId(username: $username) }
- The authenticated user’s default wallet
query accountDefaultWallet($username: Username!) { accountDefaultWallet(username: $username) { id walletCurrency } }
- If unset, set a username for the authenticated user
mutation setUsername($input: UserUpdateUsernameInput!) { userUpdateUsername(input:$input) { errors { message } user { username } } }
- Paginated transactions for each of the authenticated user’s wallet
query transactionsListForContact($first: Int, $after: String) { me { defaultAccount { wallets { walletCurrency transactions(first: $first, after: $after) { pageInfo { hasNextPage } edges { cursor node { __typename id settlementAmount settlementFee status direction settlementPrice { base offset # currencyUnit # formattedAmount } memo createdAt initiationVia { ... on InitiationViaOnChain { __typename address } ... on InitiationViaLn { __typename paymentHash } ... on InitiationViaIntraLedger { __typename counterPartyWalletId counterPartyUsername } } settlementVia { ... on SettlementViaOnChain { __typename transactionHash } ... on SettlementViaLn { __typename paymentSecret preImage } ... on SettlementViaIntraLedger { __typename counterPartyWalletId counterPartyUsername } } } } } } } } }
-