From b58b25da5508d1a0b0e996505d1a3c1bf5ce8046 Mon Sep 17 00:00:00 2001 From: ArkDev Date: Mon, 17 Jun 2024 18:06:13 -0700 Subject: [PATCH] Spec upadte --- private-spec.json | 2 +- spec.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/private-spec.json b/private-spec.json index 1bfc4c4..f5ee98c 100644 --- a/private-spec.json +++ b/private-spec.json @@ -1 +1 @@ -{"openapi":"3.0.0","info":{"title":"HYPLAY API","version":"1.0.0","description":"HYPLAY API Specification","termsOfService":"https://hyplay.com","contact":{"name":"HYCHAIN Team","email":"braydon@hytopia.com","url":"https://hychain.com"}},"servers":[{"description":"HYPLAY API Server","url":"https://api.hyplay.com"},{"description":"HYPLAY API Staging Server","url":"https://staging-api.hyplay.com"},{"description":"Local Development Server","url":"http://localhost:8001"}],"components":{"parameters":{"headerAuthorizationUser":{"name":"x-authorization","in":"header","description":"The `accessToken` of the authenticating user.","example":"user_at_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP","required":true,"schema":{"type":"string"}},"headerAuthorizationUserOptional":{"name":"x-authorization","in":"header","description":"The `accessToken` of the authenticating user.","example":"user_at_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP","required":false,"schema":{"type":"string"}},"headerAuthorizationAppSecret":{"name":"x-app-authorization","in":"header","description":"The `secretKey` or `testSecretKey` of the authenticating app.","example":"test_app_sk_pBEHOVTIZjQFT6WpiQLT8c_VFfd6Vb2XHj_9IIV8-Zi06SdMIruJxIe2QMaca_X6","required":true,"schema":{"type":"string"}},"headerAuthorizationAppSecretOptional":{"name":"x-app-authorization","in":"header","description":"The `secretKey` or `testSecretKey` of the authenticating app.","example":"test_app_sk_pBEHOVTIZjQFT6WpiQLT8c_VFfd6Vb2XHj_9IIV8-Zi06SdMIruJxIe2QMaca_X6","required":false,"schema":{"type":"string"}},"headerAuthorizationSession":{"name":"x-session-authorization","in":"header","description":"The `accessToken` of the authenticating session.","example":"sca_sat_pBEHOVTIZjQFT6WpiQLT8c_VFfd6Vb2XHj_9IIV8-Zi06SdMIruJxIe2QMaca_X6","required":true,"schema":{"type":"string"}},"headerAuthorizationSessionOptional":{"name":"x-session-authorization","in":"header","description":"The `accessToken` of the authenticating session.","example":"sca_sat_pBEHOVTIZjQFT6WpiQLT8c_VFfd6Vb2XHj_9IIV8-Zi06SdMIruJxIe2QMaca_X6","required":false,"schema":{"type":"string"}},"headerAuthorizationNonce":{"name":"x-nonce","in":"header","description":"The nonce of the authenticating user.","required":true,"schema":{"type":"string"}},"headerAuthorizationNonceSignature":{"name":"x-nonce-signature","in":"header","description":"The nonce signature of the authenticating user.","required":true,"schema":{"type":"string"}},"pathAppId":{"name":"appId","in":"path","description":"An application id.","required":true,"schema":{"type":"string"}},"pathAssetId":{"name":"assetId","in":"path","description":"An asset id.","required":true,"schema":{"type":"string"}},"pathContractId":{"name":"contractId","in":"path","description":"A contract id.","required":true,"schema":{"type":"string"}},"pathContractIdOrAddress":{"name":"contractIdOrAddress","in":"path","description":"A contract id or address.","required":true,"schema":{"type":"string"}},"pathSessionId":{"name":"sessionId","in":"path","description":"A session id.","required":true,"schema":{"type":"string"}},"pathTemplateId":{"name":"templateId","in":"path","description":"A template id.","required":true,"schema":{"type":"string"}},"pathTransactionId":{"name":"transactionId","in":"path","description":"A transaction id.","required":true,"schema":{"type":"string"}},"pathUserId":{"name":"userId","in":"path","description":"A user id.","required":true,"schema":{"type":"string"}},"pathWalletIdOrAddress":{"name":"walletIdOrAddress","in":"path","description":"A wallet id or address.","required":true,"schema":{"type":"string"}},"queryAccessTokenExpiresAt":{"name":"accessTokenExpiresAt","in":"query","description":"An optional unix timestamp in seconds specifying when the returned `accessToken` should expire. If this value is provided, all prior `accessToken` will be invalidated and a new `accessToken` will be issued in the response. If no value is provided, the returned `accessToken` will not expire unless it is invalidated.","example":1677197460,"required":false,"schema":{"type":"number"}},"queryAppId":{"name":"appId","in":"query","description":"An application id.","required":false,"schema":{"type":"string"}},"queryArgs":{"name":"args","in":"query","description":"An array of arguments.","required":false,"schema":{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]}}]}}},"queryAs":{"name":"as","in":"query","description":"An address or walletId to perform as.","required":false,"schema":{"type":"string"}},"queryChain":{"name":"chain","in":"query","description":"A chain name.","required":false,"schema":{"type":"string","enum":["HYCHAIN","HYCHAIN_TESTNET","LOCAL"]}},"queryFunc":{"name":"func","in":"query","description":"A function name or function signature.","required":true,"schema":{"type":"string"}},"queryDiscordAuthCode":{"name":"discordAuthCode","in":"query","description":"A Discord OAuth 2.0 code.","required":false,"schema":{"type":"string"}},"queryFacebookAuthCode":{"name":"facebookAuthCode","in":"query","description":"A Facebook OAuth 2.0 code.","required":false,"schema":{"type":"string"}},"queryGoogleAuthCode":{"name":"googleAuthCode","in":"query","description":"A Google OAuth 2.0 code.","required":false,"schema":{"type":"string"}},"queryTwitterAuthCode":{"name":"twitterAuthCode","in":"query","description":"A Twitter OAuth 2.0 code.","required":false,"schema":{"type":"string"}},"queryTemplateApproved":{"name":"approved","in":"query","description":"Set this query parameter to `true` to filter for approved templates.","example":"true","required":false,"schema":{"type":"string"}},"queryTemplateName":{"name":"name","in":"query","description":"A template name to partially or exactly match.","example":"token","required":false,"schema":{"type":"string"}},"queryResetAccessToken":{"name":"resetAccessToken","in":"query","description":"Set this query parameter to `true` to reset accessToken and authorityKey.","example":"true","required":false,"schema":{"type":"string"}},"queryRecaptchaToken":{"name":"hcaptchaResponse","in":"query","description":"A hCaptcha token generated client-side by completion of a user-facing hCaptcha request.","required":true,"schema":{"type":"string"}},"querySessionId":{"name":"sessionId","in":"query","description":"A session id.","required":false,"schema":{"type":"string"}},"queryUsername":{"name":"username","in":"query","description":"A user username.","example":"arkdev","required":false,"schema":{"type":"string"}},"queryUserId":{"name":"userId","in":"query","description":"A user id.","required":false,"schema":{"type":"string"}},"queryWalletId":{"name":"walletId","in":"query","description":"A wallet id.","required":false,"schema":{"type":"string"}},"queryStateKey":{"name":"key","in":"query","description":"A string identifier unique to an app for looking up state data.","required":false,"schema":{"type":"string"}}},"responses":{"400":{"description":"An API level error occurred. This is often due to problematic data being provided by you.","content":{"application/json":{"schema":{"type":"string"}}}},"401":{"description":"An authorization error occured. This is often due to incorrect tokens or keys being provided, or accessing a resource that the provided tokens or keys do not have access to.","content":{"application/json":{"schema":{"type":"string"}}}}},"schemas":{"AppModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"userId":{"type":"string","description":"This field has not had a description added."},"walletId":{"type":"string","description":"This field has not had a description added."},"iconImageAssetId":{"type":"string","description":"This field has not had a description added."},"backgroundImageAssetId":{"type":"string","description":"This field has not had a description added."},"logoImageAssetId":{"type":"string","description":"This field has not had a description added."},"secretKey":{"type":"string","description":"This field has not had a description added."},"testSecretKey":{"type":"string","description":"This field has not had a description added."},"name":{"type":"string","description":"This field has not had a description added."},"description":{"type":"string","description":"This field has not had a description added."},"url":{"type":"string","description":"This field has not had a description added."},"discordUrl":{"type":"string","description":"This field has not had a description added."},"redirectUris":{"type":"object","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"AppReferralsModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"appId":{"type":"string","description":"This field has not had a description added."},"referredUserId":{"type":"string","description":"This field has not had a description added."},"referrerUserId":{"type":"string","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"AssetModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"userId":{"type":"string","description":"This field has not had a description added."},"s3Url":{"type":"string","description":"This field has not had a description added."},"cdnUrl":{"type":"string","description":"This field has not had a description added."},"mime":{"type":"string","description":"This field has not had a description added."},"extension":{"type":"string","description":"This field has not had a description added."},"checksum":{"type":"string","description":"This field has not had a description added."},"size":{"type":"integer","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"ContractModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"userId":{"type":"string","description":"This field has not had a description added."},"templateId":{"type":"string","description":"This field has not had a description added."},"chain":{"type":"string","description":"This field has not had a description added."},"abi":{"type":"object","description":"This field has not had a description added."},"address":{"type":"string","description":"This field has not had a description added."},"name":{"type":"string","description":"This field has not had a description added."},"description":{"type":"string","description":"This field has not had a description added."},"metadata":{"type":"object","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"NonceModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"walletId":{"type":"string","description":"This field has not had a description added."},"nonce":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"SessionModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"appId":{"type":"string","description":"This field has not had a description added."},"userId":{"type":"string","description":"This field has not had a description added."},"chain":{"type":"string","description":"This field has not had a description added."},"accessToken":{"type":"string","description":"This field has not had a description added."},"exchangeCode":{"type":"string","description":"This field has not had a description added."},"contractFunctionSelectors":{"type":"object","description":"This field has not had a description added."},"nativeAllowance":{"type":"string","description":"This field has not had a description added."},"erc20Allowances":{"type":"object","description":"This field has not had a description added."},"erc721Allowances":{"type":"object","description":"This field has not had a description added."},"erc1155Allowances":{"type":"object","description":"This field has not had a description added."},"nonce":{"type":"string","description":"This field has not had a description added."},"signatures":{"type":"object","description":"This field has not had a description added."},"deadline":{"type":"string","description":"This field has not had a description added."},"expiresAt":{"type":"string","description":"This field has not had a description added."},"endedAt":{"type":"string","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"TemplateModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"userId":{"type":"string","description":"This field has not had a description added."},"name":{"type":"string","description":"This field has not had a description added."},"description":{"type":"string","description":"This field has not had a description added."},"solidity":{"type":"string","description":"This field has not had a description added."},"target":{"type":"string","description":"This field has not had a description added."},"bytecode":{"type":"string","description":"This field has not had a description added."},"abi":{"type":"object","description":"This field has not had a description added."},"errors":{"type":"object","description":"This field has not had a description added."},"approved":{"type":"boolean","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"TransactionModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"walletId":{"type":"string","description":"This field has not had a description added."},"sessionId":{"type":"string","description":"This field has not had a description added."},"chain":{"type":"string","description":"This field has not had a description added."},"relayerAddress":{"type":"string","description":"This field has not had a description added."},"func":{"type":"string","description":"This field has not had a description added."},"args":{"type":"object","description":"This field has not had a description added."},"value":{"type":"string","description":"This field has not had a description added."},"hash":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"UserModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"walletId":{"type":"string","description":"This field has not had a description added."},"username":{"type":"string","description":"This field has not had a description added."},"email":{"type":"string","description":"This field has not had a description added."},"phone":{"type":"string","description":"This field has not had a description added."},"discordId":{"type":"string","description":"This field has not had a description added."},"facebookId":{"type":"string","description":"This field has not had a description added."},"googleId":{"type":"string","description":"This field has not had a description added."},"microsoftId":{"type":"string","description":"This field has not had a description added."},"twitterId":{"type":"string","description":"This field has not had a description added."},"accessToken":{"type":"string","description":"This field has not had a description added."},"isChild":{"type":"boolean","description":"This field has not had a description added."},"accessTokenExpiresAt":{"type":"string","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"WalletModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"type":{"type":"string","description":"This field has not had a description added."},"address":{"type":"string","description":"This field has not had a description added."},"authorityCiphertext":{"type":"string","description":"This field has not had a description added."},"authorityBackupCiphertexts":{"type":"object","description":"This field has not had a description added."},"authorityProofSignature":{"type":"string","description":"This field has not had a description added."},"backupQuestions":{"type":"object","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"AnyValue":{"description":"Can be anything. String, number, object, array, boolean, etc."}},"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic","description":"Basic authentication must be send in the format of usernameOrEmail:shaPassword, where usernameOrEmail can be the username or email associated with an account, andshaPassword is a sha256 hash of the users provided plaintext password."}}},"tags":[{"name":"Users","description":"User related operations"}],"paths":{"/v1/apps":{"get":{"operationId":"getApps","summary":"Get apps","description":"Returns an array of apps owned by the authorized user, or public apps across HYPLAY if no authorization is provided.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUserOptional"}],"responses":{"200":{"description":"Returns an array of apps owned by the authorized user or public apps across HYPLAY if no authorization is provided.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/AppModel"},{"type":"object","properties":{"iconImageAsset":{"$ref":"#/components/schemas/AssetModel"},"backgroundImageAsset":{"$ref":"#/components/schemas/AssetModel"},"logoImageAsset":{"$ref":"#/components/schemas/AssetModel"},"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}},"post":{"operationId":"createApp","summary":"Create app","description":"Create a new app for the authorized user.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"iconImageAssetId":{"type":"string","description":"The assetId of the icon image. Icon images are recommended to be a 1:1 aspect ratio and at least 512x512 pixels."},"backgroundImageAssetId":{"type":"string","description":"The assetId of the background image. Background images are recommended to be a 16:9 aspect ratio and at least 1920x1080 pixels."},"logoImageAssetId":{"type":"string","description":"The assetId of the logo image. Logo image are used on pages like preregistration, questing, etc and can be any aspect ratio."},"name":{"type":"string","description":"The name of the app."},"description":{"type":"string","description":"A brief description of the app and what it is and does."},"url":{"type":"string","description":"The URL of the app, such as its website or where users can learn more about it."},"discordUrl":{"type":"string","description":"The URL of the app's Discord server."},"redirectUris":{"type":"array","description":"An array of valid redirect URIs for the user authorization flows of the app.","items":{"type":"string"}}},"required":["iconImageAssetId","backgroundImageAssetId","name","description","redirectUris"]}}}},"responses":{"200":{"description":"Successfully created a new app. Returns an app object.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/AppModel"},{"type":"object","properties":{"iconImageAsset":{"$ref":"#/components/schemas/AssetModel"},"backgroundImageAsset":{"$ref":"#/components/schemas/AssetModel"},"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/apps/{appId}":{"get":{"operationId":"getPublicApp","summary":"Get public app","description":"Return a public app object for the provided appId.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/pathAppId"}],"responses":{"200":{"description":"Returns a public app object.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/AppModel"},{"type":"object","properties":{"iconImageAsset":{"$ref":"#/components/schemas/AssetModel"},"backgroundImageAsset":{"$ref":"#/components/schemas/AssetModel"},"logoImageAsset":{"$ref":"#/components/schemas/AssetModel"},"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"}}},"patch":{"operationId":"updateApp","summary":"Update app","description":"Update an app owned by the authorized user for the provided appId.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"},{"$ref":"#/components/parameters/pathAppId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"iconImageAssetId":{"type":"string","description":"The assetId of the icon image."},"backgroundImageAssetId":{"type":"string","description":"The assetId of the background image."},"logoImageAssetId":{"type":"string","description":"The assetId of the logo image."},"name":{"type":"string","description":"The name of the app."},"description":{"type":"string","description":"A brief description of the app and what it is and does."},"url":{"type":"string","description":"The URL of the app, such as its website or where users can learn more about it."},"discordUrl":{"type":"string","description":"The URL of the app's Discord server."},"redirectUris":{"type":"array","description":"An array of valid redirect URIs for the user authorization flows of the app.","items":{"type":"string"}},"resetSecretKey":{"type":"boolean","description":"If true, reset the secretKey of the app."},"resetTestSecretKey":{"type":"boolean","description":"If true, reset the testSecretKey of the app."}}}}}},"responses":{"200":{"description":"Returns the updated app object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/apps/{appId}/states":{"get":{"operationId":"getAppState","summary":"Get app state","description":"Get the public, protected, private state of an app, user or key.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/pathAppId"},{"$ref":"#/components/parameters/queryStateKey"},{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"},{"$ref":"#/components/parameters/headerAuthorizationSessionOptional"}],"responses":{"200":{"description":"Returns a state object that may contain public, protected, and/or private state for the app, key or user for the authorized user session.","content":{"application/json":{"schema":{"type":"object","properties":{"publicState":{"type":"object","description":"Public state data for the app or user."},"protectedState":{"type":"object","description":"Protected state data for the app or user."},"privateState":{"type":"object","description":"Private state data for the app or user."}},"required":["public","protected"]}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}},"post":{"operationId":"setAppState","summary":"Set app state","description":"Set arbitrary JSON blobs for public, protected and/or private state specific to an application or authorized user of an application. This is useful for saving different types of data specific to users or global configuration of your app or game in many different situations. It is intended to be highly flexible. State set for a user of your app, a unique lookup key, and the app itself are all isolated to your application. State storage is not globablly shared between applications.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/pathAppId"},{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"},{"$ref":"#/components/parameters/headerAuthorizationSessionOptional"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","description":"Any unique lookup key for this data. This can be things such as a hyplay user id, an internal battle match id for your game, some arbitrary settings identifier for a system of your app and more. Keys are flexible ways to create string based lookup identifiers for data you want to store/lookup. Keys are unique to your application and are not shared globally."},"publicState":{"type":"object","description":"Public state data to set for the app or user."},"protectedState":{"type":"object","description":"Protected state data to set for the app or user."},"privateState":{"type":"object","description":"Private state data to set for the app or user."},"overwrite":{"type":"boolean","description":"If true, the state will be overwritten with the provided state. If false or omitted, the state will be deep merged with the provided state."}}}}}},"responses":{"200":{"description":"Returns a state object that may contain public, protected, and/or private state for the app, or user of the app for the provided userId.","content":{"application/json":{"schema":{"type":"object","properties":{"publicState":{"type":"object","description":"Public state data for the app or user."},"protectedState":{"type":"object","description":"Protected state data for the app or user."},"privateState":{"type":"object","description":"Private state data for the app or user."}},"required":["publicState","protectedState"]}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/apps/{appId}/users":{"get":{"operationId":"getAppUsers","summary":"Get app users","description":"Returns an array of public users objects representing users of the apps. A HYPLAY user is considered a user of the app if they have had at least 1 active session for the provided appId.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/pathAppId"},{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"}],"responses":{"200":{"description":"Returns an array of public user objects.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/UserModel"},{"type":"object","properties":{"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/apps/{appId}/users/{userId}":{"get":{"operationId":"getAppUser","summary":"Get app user","description":"Returns a public user object representing a user of the app that also includes the `totalAppReferrals` property which represents the number of other users the user for the provided userId has referred to the provided appId.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/pathAppId"},{"$ref":"#/components/parameters/pathUserId"}],"responses":{"200":{"description":"Returns a public user object that includes a `totalAppReferrals` property.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/UserModel"},{"type":"object","properties":{"wallet":{"$ref":"#/components/schemas/WalletModel"}}},{"type":"object","properties":{"totalAppReferrals":{"type":"integer"}}}]}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/assets":{"get":{"operationId":"getAssets","summary":"Get assets","description":"Returns an array of assets that have been uploaded by the authorized user ordered by most recent creation.","tags":["Assets"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"responses":{"200":{"description":"Returns an array of asset objects.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AssetModel"}}}}},"400":{"$ref":"#/components/responses/400"}}},"post":{"operationId":"createAsset","summary":"Create asset","description":"Create an asset object by uploading a file in base64. Returns an asset object.","tags":["Assets"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"fileBase64":{"type":"string","description":"The base64 string of the asset being uploaded. Uploads may not exceed 5mb."}}}}}},"responses":{"200":{"description":"Returns a created asset object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetModel"}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/assets/{assetId}":{"get":{"operationId":"getAsset","summary":"Get asset","description":"Return an asset object that has been uploaded by the authorized user for the provided assetId.","tags":["Assets"],"parameters":[{"$ref":"#/components/parameters/pathAssetId"},{"$ref":"#/components/parameters/headerAuthorizationUser"}],"responses":{"200":{"description":"Returns an asset object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetModel"}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/contracts":{"get":{"operationId":"getOwnedContracts","summary":"Get owned contracts","description":"Returned an array of contracts owned by the authorized user.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"responses":{"200":{"description":"Returns an array of contracts owned by the authorized user.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ContractModel"}}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}},"post":{"operationId":"createContract","summary":"Create contract","description":"Creates a new contract for the authorized user.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"chain":{"type":"string","description":"The chain the contract is deployed on.","enum":["HYCHAIN","HYCHAIN_TESTNET","LOCAL"]},"abi":{"type":"string","format":"json","description":"JSON string of the contract's ABI."},"address":{"type":"string","description":"The contract's address."},"name":{"type":"string","description":"The contract's name."},"description":{"type":"string","description":"A description of the contract."},"metadata":{"type":"string","format":"json","description":"A JSON string of metadata for the contract."}},"required":["chain","abi","address"]}}}},"responses":{"200":{"description":"Successfully created a new contract. Returns a contract object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/contracts/{contractId}":{"get":{"operationId":"getContract","summary":"Get contract","description":"Returns a contract object for the provided contractId.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/pathContractId"}],"responses":{"200":{"description":"Returns a contract object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractModel"}}}},"400":{"$ref":"#/components/responses/400"}}},"patch":{"operationId":"updateContract","summary":"Update contract","description":"Updates a contract owned by the authorized user for the provided contractId.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"},{"$ref":"#/components/parameters/pathContractId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"abi":{"type":"string","format":"json","description":"JSON string of the contract's ABI."},"name":{"type":"string","description":"The contract's name. Named contracts are easier for users to identify during app or game authorization flows through HYPLAY."},"description":{"type":"string","description":"A description of the contract and what it does."},"metadata":{"type":"string","format":"json","description":"A JSON string of arbitrary metadata for the contract. May be used by developers for a variety of reasons."}}}}}},"responses":{"200":{"description":"Returns the updated contract object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/contracts/{contractIdOrAddress}/read":{"get":{"operationId":"readContract","summary":"Read contract","description":"Get the value from a read function of a target contract. This endpoint is designed to be highly flexible. It can read any contract by providing a contract address for `contractIdOrAddress`. It can also read using contracts created in the HYCHAIN systems through the `POST /v1/contracts` endpoint, which will utilize the contract's ABI.\n\nAdditionally, reads can be performed as a HYCHAIN app, user or user's session provided, through header authorization, or any arbitrary address or walletId provided through the `as` query parameter. Alternatively you can omit all of this and perform a read as no specific address.\n\nThe `func` query parameter accepts a complete function signature with parameters, such as `getCount()` or `readCounter(address,uint256)`, or a known function name without parameters if a contractId was provided for `contractIdOrAddress` and the contract's ABI is known. Such as `readCounter`.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/pathContractIdOrAddress"},{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"},{"$ref":"#/components/parameters/headerAuthorizationSessionOptional"},{"$ref":"#/components/parameters/headerAuthorizationUserOptional"},{"$ref":"#/components/parameters/queryChain"},{"$ref":"#/components/parameters/queryFunc"},{"$ref":"#/components/parameters/queryArgs"},{"$ref":"#/components/parameters/queryAs"}],"responses":{"200":{"description":"Returns the result of the contract read as a string.","content":{"application/json":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/sessions":{"post":{"x-visibility":"private","operationId":"startSession","summary":"Start session","description":"Starts a new session for the authorized user for an app. All prior sessions between the user and target app will become invalidated. Operates through an oauth 2.0-like flow, allowing a `code` or `token` response type.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"appId":{"type":"string","description":"The id of the app to start a session for."},"referrerId":{"type":"string","description":"The id of the user that referred the user to the app."},"nativeAllowance":{"type":"string","description":"The maximum sum of $TOPIA that may be transferred during this session, as a wei string.","example":502124124124},"contractFunctionSelectors":{"type":"array","description":"The contracts and function selectors approved for this session.","items":{"type":"object","properties":{"address":{"type":"string","description":"Target contract's address."},"functionSelectors":{"type":"array","description":"An array of function signatures or bytes4 function selectors to approve.","items":{"type":"string"}}}}},"erc20Allowances":{"type":"array","description":"The erc20 tokens and the maximum amount that may be transferred during this session.","items":{"type":"object","properties":{"address":{"type":"string","description":"Target erc20's contract address."},"allowance":{"type":"string","description":"The maximum sum of this erc20 token that may be transferred during this session, as a wei string."}}}},"erc721Allowances":{"type":"array","description":"The erc721 token ids that may be transferred during this session.","items":{"type":"object","properties":{"address":{"type":"string","description":"Target erc721's contract address."},"approveAll":{"type":"boolean","description":"If true, app is allowed through this session to transfer all tokens of the user without limits."},"tokenIds":{"type":"array","description":"The token ids this session is allowed to transfer during this session.","items":{"type":"string"}}}}},"erc1155Allowances":{"type":"array","description":"The erc1155 token ids and the maximum amount of each unique id that may be transferred during this session.","items":{"type":"object","properties":{"address":{"type":"string","description":"Target erc1155's contract address."},"approveAll":{"type":"boolean","description":"If true, app is allowed through this session to transfer any amount of all tokens of the user without limits."},"tokenIds":{"type":"array","description":"The maximum sum of the token ids this session is allowed to transfer during this session.","items":{"type":"string"}},"allowances":{"type":"array","description":"The token id allowances this session is allowed to interact or transfer during this session.","items":{"type":"string"}}}}},"chain":{"type":"string","description":"The chain the session is to be started for.","enum":["HYCHAIN","HYCHAIN_TESTNET","LOCAL"]},"nonce":{"type":"string","description":"A positive arbitrary integer as a string to be used as this session's nonce. Nonces are a one-time use per user. For example, User A and User B can both individually use nonce \"1\", but nonce \"1\", cannot be used again in the future for User A or User B to start a different session.","example":1},"signatures":{"type":"array","description":"An array of 1 or more session start signatures, generated by the authority(s) of a user's smart contract account. These signatures are most easily generated using the `hychain-crypto-js` npm package's `generateSessionSignature()`.","items":{"type":"string"}},"deadline":{"type":"number","description":"A timestamp in seconds of when the signature(s) for the session authorization request expire. If the deadline has been passed, attempting to start a session will fail."},"expiresAt":{"type":"number","description":"A timestamp in seconds when the session is to expire."},"responseType":{"type":"string","description":"The response type for session auth flows. If `code` is used, an accessToken will not be included, and a `exchangeCode` property will be included in the response object. This `exchangeCode` must then be exchanged using both the app's secret + exchange code to acquire the session access token. Alternatively, `token` can be used which returns a populated `accessToken` property in the response. This is less secure and essentially identical in usage for Oauth 2.0's implicit auth flow.","enum":["code","token"]}},"required":["appId","chain","nonce","signatures","deadline","expiresAt","responseType"]}}}},"responses":{"200":{"description":"Successfully started a new session. Returns a session object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}},"delete":{"operationId":"endSession","summary":"End session","description":"Ends all active sessions for a given user. This endpoint is flexible and can end sessions in a number of ways. An app can end any user's sessions of their app directly, or a user can end their own sessions for an app, or a session access token can be used to end its associated session.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUserOptional"},{"$ref":"#/components/parameters/headerAuthorizationSessionOptional"},{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"appId":{"type":"string","description":"If the `X-App-Authorization` or `X-Session-Authorization` header is not set, `appId` must be provided to indicate the application for which to end user sessions for."},"userId":{"type":"string","description":"If the user's `X-Authorization` or `X-Session-Authorization` header is not set, `userId` must be provided to indicate the user for which to end sessions for."},"chain":{"type":"string","description":"The chain to end sessions for.","enum":["HYCHAIN","HYCHAIN_TESTNET","LOCAL"]}},"required":["chain"]}}}},"responses":{"204":{"description":"Returns an empty response indicating the session has been ended."},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/sessions/token":{"post":{"operationId":"grantSessionToken","summary":"Grant session token","description":"Returns a session object with a valid access token when the associated exchangeCode and application authorized by using its secret key is provided.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationAppSecret"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"exchangeCode":{"type":"string","description":"An unused exchange code associated with the provided session id. Exchange codes can only be used once and then become invalid."}},"required":["exchangeCode"]}}}},"responses":{"200":{"description":"Returns an updated session object with an `accessToken` set.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/templates":{"get":{"operationId":"getTemplates","summary":"Get templates","description":"Returns an array of templates. Templates can be used to quickly deploy contracts to HYCHAIN and HYCHAIN_TESTNET. Templates can also be reviewed and approved by the HYPLAY team to be made available for anyone to deploy. Templates that are not approved can be deployed by anyone to HYCHAIN_TESTNET, and only deployed by the creator to HYCHAIN mainnet.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/queryUserId"},{"$ref":"#/components/parameters/queryTemplateName"},{"$ref":"#/components/parameters/queryTemplateApproved"}],"responses":{"200":{"description":"Returns an array of template objects.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TemplateModel"}}}}},"400":{"$ref":"#/components/responses/400"}}},"post":{"operationId":"createTemplate","summary":"Create template","description":"Creates a new template. Templates can be used to quickly deploy pre-approved types of contracts to HYCHAIN and HYCHAIN_TESTNET.","tags":["Contracts"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"The name of the template."},"description":{"type":"string","description":"A description of the template."},"solidity":{"type":"string","description":"The solidity source code of the template to compile. This must be a flattened contract with all imports inlined."},"target":{"type":"string","description":"The contract from the inlined solidity source code that is intended to be deployed for this template.","example":"MyErc20Contract"}},"required":["name","solidity","target"]}}}},"responses":{"200":{"description":"Returns the created template object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/templates/{templateId}":{"get":{"operationId":"getTemplate","summary":"Get template","description":"Returns a template object with abi, bytecode and compilation errors or warnings included.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/pathTemplateId"}],"responses":{"200":{"description":"Returns a template object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateModel"}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/transactions":{"get":{"operationId":"getTransactions","summary":"Get transactions","description":"Returns an array of transactions for the provided appId, sessionId, userId or walletId. Transactions are returned in descending order of creation date.","tags":["Transactions"],"parameters":[{"$ref":"#/components/parameters/queryAppId"},{"$ref":"#/components/parameters/querySessionId"},{"$ref":"#/components/parameters/queryUserId"},{"$ref":"#/components/parameters/queryWalletId"},{"$ref":"#/components/parameters/queryChain"}],"responses":{"200":{"description":"Returns an array of transaction objects.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TransactionModel"}}}}},"400":{"$ref":"#/components/responses/400"}}},"post":{"operationId":"createTransaction","summary":"Create transaction","description":"Create and submit a transaction to the target contract id or address. Transactions are submitted on behalf of the authorization type used, such as an app, user or user via a user's session.\n\nTransaction submission supports contract function invocation and native transfers to contracts or externally owned accounts (EOAs).\n\nThis endpoint is designed to be highly flexible. Please refer to the HYCHAIN guides and documentation for detailed examples of the many ways this endpoint can be used.","tags":["Transactions"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"},{"$ref":"#/components/parameters/headerAuthorizationSessionOptional"},{"$ref":"#/components/parameters/headerAuthorizationUserOptional"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"contractId":{"type":"string","description":"The contract id to target."},"address":{"type":"string","description":"The address to target."},"func":{"type":"string","description":"The function name or function signature of the contract."},"args":{"type":"array","description":"An array of arguments to pass to the function.","items":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]}}]}},"value":{"type":"number","description":"The amount of native token to send with the transaction."},"nonce":{"type":"string","description":"The nonce of the transaction."},"deadline":{"type":"number","description":"The deadline for the transaction as a timestamp in seconds."},"signatures":{"type":"array","description":"An array of signatures for the transaction.","items":{"type":"string"}},"chain":{"type":"string","description":"The chain the session is to be started for.","enum":["HYCHAIN","HYCHAIN_TESTNET","LOCAL"]}}}}}},"responses":{"200":{"description":"Returns a transaction object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/transactions/{transactionId}":{"get":{"operationId":"getTransaction","summary":"Get transaction","description":"Returns a transaction object for the provided transactionId.","tags":["Transactions"],"parameters":[{"$ref":"#/components/parameters/pathTransactionId"}],"responses":{"200":{"description":"Returns a transaction object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionModel"}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/users":{"get":{"operationId":"getUser","summary":"Get user","description":"Returns a public user object when provided a username.","tags":["Users"],"parameters":[{"$ref":"#/components/parameters/queryUsername"}],"responses":{"200":{"description":"Returns a public user object.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/UserModel"},{"type":"object","properties":{"preregistered":{"type":"boolean"}}},{"type":"object","properties":{"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"}}},"post":{"x-visibility":"private","operationId":"createUser","summary":"Create user","description":"Creates a new user using a provided username and password. A user must have an authority wallet assigned before it can be used for transactions or authorize sessions.","tags":["Users"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"username":{"type":"string","minLength":4,"description":"The users desired username."},"email":{"type":"string","format":"email","description":"An email address to associate with the user for account recovery."},"shaPassword":{"type":"string","minLength":64,"maxLength":64,"format":"password","description":"A sha256 hash of the users plaintext password.","example":"07ecafaf8304b8a12016ad05fd498e2ab338c1bcac31cb3f002386ef4ea917ad"}},"required":["username","shaPassword"]}}}},"responses":{"200":{"description":"Successfully created a new user. Returns a user object. Before the users can start session or perform transactions, their authority wallet must first be set using the PATCH /v1/users endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserModel"}}}},"400":{"$ref":"#/components/responses/400"}}},"patch":{"x-visibility":"private","operationId":"updateCurrentUser","summary":"Update current user","description":"Update various fields specific to the current user.","tags":["Users"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"},{"$ref":"#/components/parameters/headerAuthorizationNonce"},{"$ref":"#/components/parameters/headerAuthorizationNonceSignature"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","description":"A valid, unique email address that is not currently assigned to another account."},"authorityAddress":{"type":"string","description":"The wallet address associated with the private key used to generate the authorityProofSignature. This should be generated by the `hytopia-crypto-js` library. 1-time assignment, intended for setting of newly registered accounts."},"authorityCiphertext":{"type":"string","description":"The encrypted ciphertext of the private key associated with the provided authorityAddress. This should be generated by the `hytopia-crypto-js` library. 1-time assignment, intended for setting of newly registered accounts."},"authorityBackupCiphertexts":{"type":"string","description":"A ciphertext from encrypting a players authority private key with an arbitrary backup code generated and store on their client."},"authorityBackupQuestionsCiphertext":{"type":"string","description":"A ciphertext from encrypting a players authority private key with the concatenanted answers to their recovery questions."},"authorityProofSignature":{"type":"string","description":"The proof signature required for deferred smart contract account creation. This should be generated by the `hytopia-crypto-js` library. 1-time assignment, intended for setting of newly registered accounts."},"salt":{"type":"string","description":"An arbitrary salt used by the player's client along with their client-side provided password to derive a PBKDF2 key for decrypting their authority wallet's private key. 1-time assignment, intended for setting of preregistration accounts."},"backupQuestions":{"type":"array","description":"An array of any arbitrary questions to display to the user when going through account recovery.","items":{"type":"string"}},"isChild":{"type":"boolean","description":"A true or false value indicating if a child is younger than 13 (true), or older (false)."},"shaPassword":{"type":"string","description":"A sha256 hash of the users new password. Cannot be set for users who joined using an SSO option such as Discord, Twitter, Facebook, etc. Authority wallet credentials should be re-encrypted using the new plaintext password on the client side as well, with the new ciphertext being provided with the password update to prevent divergence between a users account password and wallet decryption password."},"resetAccessToken":{"type":"boolean","description":"Revokes the user's current access token and returns a new one if true."}}}}}},"responses":{"200":{"description":"Returns the updated user object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/users/auth":{"get":{"x-visibility":"private","operationId":"authUser","summary":"Authenticate user","description":"Authenticates a user for the provided email/username and shaPassword, or creates or retrieves a user for the provided sso auth code. Return a user object containing an access token.\nIf a user is preregistered or has not completed their account setup such as assigning their authority wallet or setting their password, as long as they have had an email assigned to their account, a one-time password can be emailed to the user. This can be done by using the basic auth flow and omitting the password field or passing an empty string for the password.\nYou can then auth the user by providing the sha256(one time password) equivalent as the password for this auth endpoint.","tags":["Users"],"parameters":[{"$ref":"#/components/parameters/queryAccessTokenExpiresAt"},{"$ref":"#/components/parameters/queryResetAccessToken"},{"$ref":"#/components/parameters/queryDiscordAuthCode"},{"$ref":"#/components/parameters/queryFacebookAuthCode"},{"$ref":"#/components/parameters/queryGoogleAuthCode"},{"$ref":"#/components/parameters/queryTwitterAuthCode"}],"security":[{"basicAuth":[]},{}],"responses":{"200":{"description":"Successfully authorized the user and returns a user object.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/UserModel"},{"type":"object","properties":{"socialKeyMaterial":{"type":"string"},"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"204":{"description":"Successfully emailed a one-time password to a preregistered user."},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/users/me":{"get":{"operationId":"getCurrentUser","summary":"Get current user","description":"Returns a public user object associated with the provided session access token.","tags":["Users"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationSession"}],"responses":{"200":{"description":"Returns a public user object.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/UserModel"},{"type":"object","properties":{"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/wallets/{walletIdOrAddress}":{"get":{"operationId":"getWallet","summary":"Get wallet","description":"Returns a wallet object for the provided walletIdOrAddress. If walletIdOrAddress is a HYCHAIN system wallet id, it will return a matching wallet for the id. If walletIdOrAddress is a on chain smart contract wallet address, it will return a matching wallet from the HYCHAIN system. If a wallet is not found in HYCHAIN's systems for the address or walletId provided, a 400 error will be returned.","tags":["Wallets"],"parameters":[{"$ref":"#/components/parameters/pathWalletIdOrAddress"}],"responses":{"200":{"description":"Returns a wallet object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WalletModel"}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/wallets/{walletIdOrAddress}/balance":{"get":{"operationId":"getWalletBalance","summary":"Get wallet balance","description":"Returns the native token balance for the smart contract wallet associated with a wallet id provided for walletIdOrAddress. Or, if any address is provided for walletIdOrAddress, it will return the native token balance for the address.","tags":["Wallets"],"parameters":[{"$ref":"#/components/parameters/pathWalletIdOrAddress"},{"$ref":"#/components/parameters/queryChain"}],"responses":{"200":{"description":"Returns the native token balance for the wallet in readable string format. For example a 1e18 balance would be '1.0'.","content":{"application/json":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/400"}}}}}} \ No newline at end of file +{"openapi":"3.0.0","info":{"title":"HYPLAY API","version":"1.0.0","description":"HYPLAY API Specification","termsOfService":"https://hyplay.com","contact":{"name":"HYCHAIN Team","email":"braydon@hytopia.com","url":"https://hychain.com"}},"servers":[{"description":"HYPLAY API Server","url":"https://api.hyplay.com"},{"description":"HYPLAY API Staging Server","url":"https://staging-api.hyplay.com"},{"description":"Local Development Server","url":"http://localhost:8001"}],"components":{"parameters":{"headerAuthorizationUser":{"name":"x-authorization","in":"header","description":"The `accessToken` of the authenticating user.","example":"user_at_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP","required":true,"schema":{"type":"string"}},"headerAuthorizationUserOptional":{"name":"x-authorization","in":"header","description":"The `accessToken` of the authenticating user.","example":"user_at_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP","required":false,"schema":{"type":"string"}},"headerAuthorizationAppSecret":{"name":"x-app-authorization","in":"header","description":"The `secretKey` or `testSecretKey` of the authenticating app.","example":"test_app_sk_pBEHOVTIZjQFT6WpiQLT8c_VFfd6Vb2XHj_9IIV8-Zi06SdMIruJxIe2QMaca_X6","required":true,"schema":{"type":"string"}},"headerAuthorizationAppSecretOptional":{"name":"x-app-authorization","in":"header","description":"The `secretKey` or `testSecretKey` of the authenticating app.","example":"test_app_sk_pBEHOVTIZjQFT6WpiQLT8c_VFfd6Vb2XHj_9IIV8-Zi06SdMIruJxIe2QMaca_X6","required":false,"schema":{"type":"string"}},"headerAuthorizationSession":{"name":"x-session-authorization","in":"header","description":"The `accessToken` of the authenticating session.","example":"sca_sat_pBEHOVTIZjQFT6WpiQLT8c_VFfd6Vb2XHj_9IIV8-Zi06SdMIruJxIe2QMaca_X6","required":true,"schema":{"type":"string"}},"headerAuthorizationSessionOptional":{"name":"x-session-authorization","in":"header","description":"The `accessToken` of the authenticating session.","example":"sca_sat_pBEHOVTIZjQFT6WpiQLT8c_VFfd6Vb2XHj_9IIV8-Zi06SdMIruJxIe2QMaca_X6","required":false,"schema":{"type":"string"}},"headerAuthorizationNonce":{"name":"x-nonce","in":"header","description":"The nonce of the authenticating user.","required":true,"schema":{"type":"string"}},"headerAuthorizationNonceSignature":{"name":"x-nonce-signature","in":"header","description":"The nonce signature of the authenticating user.","required":true,"schema":{"type":"string"}},"pathAppId":{"name":"appId","in":"path","description":"An application id.","required":true,"schema":{"type":"string"}},"pathAssetId":{"name":"assetId","in":"path","description":"An asset id.","required":true,"schema":{"type":"string"}},"pathContractId":{"name":"contractId","in":"path","description":"A contract id.","required":true,"schema":{"type":"string"}},"pathContractIdOrAddress":{"name":"contractIdOrAddress","in":"path","description":"A contract id or address.","required":true,"schema":{"type":"string"}},"pathSessionId":{"name":"sessionId","in":"path","description":"A session id.","required":true,"schema":{"type":"string"}},"pathTemplateId":{"name":"templateId","in":"path","description":"A template id.","required":true,"schema":{"type":"string"}},"pathTransactionId":{"name":"transactionId","in":"path","description":"A transaction id.","required":true,"schema":{"type":"string"}},"pathUserId":{"name":"userId","in":"path","description":"A user id.","required":true,"schema":{"type":"string"}},"pathWalletIdOrAddress":{"name":"walletIdOrAddress","in":"path","description":"A wallet id or address.","required":true,"schema":{"type":"string"}},"queryAccessTokenExpiresAt":{"name":"accessTokenExpiresAt","in":"query","description":"An optional unix timestamp in seconds specifying when the returned `accessToken` should expire. If this value is provided, all prior `accessToken` will be invalidated and a new `accessToken` will be issued in the response. If no value is provided, the returned `accessToken` will not expire unless it is invalidated.","example":1677197460,"required":false,"schema":{"type":"number"}},"queryAppId":{"name":"appId","in":"query","description":"An application id.","required":false,"schema":{"type":"string"}},"queryArgs":{"name":"args","in":"query","description":"An array of arguments.","required":false,"schema":{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]}}]}}},"queryAs":{"name":"as","in":"query","description":"An address or walletId to perform as.","required":false,"schema":{"type":"string"}},"queryChain":{"name":"chain","in":"query","description":"A chain name.","required":false,"schema":{"type":"string","enum":["HYCHAIN","HYCHAIN_TESTNET","LOCAL"]}},"queryFunc":{"name":"func","in":"query","description":"A function name or function signature.","required":true,"schema":{"type":"string"}},"queryDiscordAuthCode":{"name":"discordAuthCode","in":"query","description":"A Discord OAuth 2.0 code.","required":false,"schema":{"type":"string"}},"queryFacebookAuthCode":{"name":"facebookAuthCode","in":"query","description":"A Facebook OAuth 2.0 code.","required":false,"schema":{"type":"string"}},"queryGoogleAuthCode":{"name":"googleAuthCode","in":"query","description":"A Google OAuth 2.0 code.","required":false,"schema":{"type":"string"}},"queryTwitterAuthCode":{"name":"twitterAuthCode","in":"query","description":"A Twitter OAuth 2.0 code.","required":false,"schema":{"type":"string"}},"queryTemplateApproved":{"name":"approved","in":"query","description":"Set this query parameter to `true` to filter for approved templates.","example":"true","required":false,"schema":{"type":"string"}},"queryTemplateName":{"name":"name","in":"query","description":"A template name to partially or exactly match.","example":"token","required":false,"schema":{"type":"string"}},"queryResetAccessToken":{"name":"resetAccessToken","in":"query","description":"Set this query parameter to `true` to reset accessToken and authorityKey.","example":"true","required":false,"schema":{"type":"string"}},"queryRecaptchaToken":{"name":"hcaptchaResponse","in":"query","description":"A hCaptcha token generated client-side by completion of a user-facing hCaptcha request.","required":true,"schema":{"type":"string"}},"querySessionId":{"name":"sessionId","in":"query","description":"A session id.","required":false,"schema":{"type":"string"}},"queryUsername":{"name":"username","in":"query","description":"A user username.","example":"arkdev","required":false,"schema":{"type":"string"}},"queryUserId":{"name":"userId","in":"query","description":"A user id.","required":false,"schema":{"type":"string"}},"queryWalletId":{"name":"walletId","in":"query","description":"A wallet id.","required":false,"schema":{"type":"string"}},"queryStateKey":{"name":"key","in":"query","description":"A string identifier unique to an app for looking up state data.","required":false,"schema":{"type":"string"}}},"responses":{"400":{"description":"An API level error occurred. This is often due to problematic data being provided by you.","content":{"application/json":{"schema":{"type":"string"}}}},"401":{"description":"An authorization error occured. This is often due to incorrect tokens or keys being provided, or accessing a resource that the provided tokens or keys do not have access to.","content":{"application/json":{"schema":{"type":"string"}}}}},"schemas":{"AppModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"userId":{"type":"string","description":"This field has not had a description added."},"walletId":{"type":"string","description":"This field has not had a description added."},"iconImageAssetId":{"type":"string","description":"This field has not had a description added."},"backgroundImageAssetId":{"type":"string","description":"This field has not had a description added."},"logoImageAssetId":{"type":"string","description":"This field has not had a description added."},"secretKey":{"type":"string","description":"This field has not had a description added."},"testSecretKey":{"type":"string","description":"This field has not had a description added."},"name":{"type":"string","description":"This field has not had a description added."},"description":{"type":"string","description":"This field has not had a description added."},"url":{"type":"string","description":"This field has not had a description added."},"discordUrl":{"type":"string","description":"This field has not had a description added."},"redirectUris":{"type":"object","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"AppReferralsModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"appId":{"type":"string","description":"This field has not had a description added."},"referredUserId":{"type":"string","description":"This field has not had a description added."},"referrerUserId":{"type":"string","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"AssetModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"userId":{"type":"string","description":"This field has not had a description added."},"s3Url":{"type":"string","description":"This field has not had a description added."},"cdnUrl":{"type":"string","description":"This field has not had a description added."},"mime":{"type":"string","description":"This field has not had a description added."},"extension":{"type":"string","description":"This field has not had a description added."},"checksum":{"type":"string","description":"This field has not had a description added."},"size":{"type":"integer","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"ContractModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"userId":{"type":"string","description":"This field has not had a description added."},"templateId":{"type":"string","description":"This field has not had a description added."},"chain":{"type":"string","description":"This field has not had a description added."},"abi":{"type":"object","description":"This field has not had a description added."},"address":{"type":"string","description":"This field has not had a description added."},"name":{"type":"string","description":"This field has not had a description added."},"description":{"type":"string","description":"This field has not had a description added."},"metadata":{"type":"object","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"NonceModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"walletId":{"type":"string","description":"This field has not had a description added."},"nonce":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"SessionModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"appId":{"type":"string","description":"This field has not had a description added."},"userId":{"type":"string","description":"This field has not had a description added."},"chain":{"type":"string","description":"This field has not had a description added."},"accessToken":{"type":"string","description":"This field has not had a description added."},"exchangeCode":{"type":"string","description":"This field has not had a description added."},"contractFunctionSelectors":{"type":"object","description":"This field has not had a description added."},"nativeAllowance":{"type":"string","description":"This field has not had a description added."},"erc20Allowances":{"type":"object","description":"This field has not had a description added."},"erc721Allowances":{"type":"object","description":"This field has not had a description added."},"erc1155Allowances":{"type":"object","description":"This field has not had a description added."},"nonce":{"type":"string","description":"This field has not had a description added."},"signatures":{"type":"object","description":"This field has not had a description added."},"deadline":{"type":"string","description":"This field has not had a description added."},"expiresAt":{"type":"string","description":"This field has not had a description added."},"endedAt":{"type":"string","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"TemplateModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"userId":{"type":"string","description":"This field has not had a description added."},"name":{"type":"string","description":"This field has not had a description added."},"description":{"type":"string","description":"This field has not had a description added."},"solidity":{"type":"string","description":"This field has not had a description added."},"target":{"type":"string","description":"This field has not had a description added."},"bytecode":{"type":"string","description":"This field has not had a description added."},"abi":{"type":"object","description":"This field has not had a description added."},"errors":{"type":"object","description":"This field has not had a description added."},"approved":{"type":"boolean","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"TransactionModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"walletId":{"type":"string","description":"This field has not had a description added."},"sessionId":{"type":"string","description":"This field has not had a description added."},"chain":{"type":"string","description":"This field has not had a description added."},"relayerAddress":{"type":"string","description":"This field has not had a description added."},"func":{"type":"string","description":"This field has not had a description added."},"args":{"type":"object","description":"This field has not had a description added."},"value":{"type":"string","description":"This field has not had a description added."},"hash":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"UserModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"walletId":{"type":"string","description":"This field has not had a description added."},"username":{"type":"string","description":"This field has not had a description added."},"email":{"type":"string","description":"This field has not had a description added."},"phone":{"type":"string","description":"This field has not had a description added."},"discordId":{"type":"string","description":"This field has not had a description added."},"facebookId":{"type":"string","description":"This field has not had a description added."},"googleId":{"type":"string","description":"This field has not had a description added."},"microsoftId":{"type":"string","description":"This field has not had a description added."},"twitterId":{"type":"string","description":"This field has not had a description added."},"accessToken":{"type":"string","description":"This field has not had a description added."},"isChild":{"type":"boolean","description":"This field has not had a description added."},"accessTokenExpiresAt":{"type":"string","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"WalletModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"type":{"type":"string","description":"This field has not had a description added."},"address":{"type":"string","description":"This field has not had a description added."},"authorityCiphertext":{"type":"string","description":"This field has not had a description added."},"authorityBackupCiphertexts":{"type":"object","description":"This field has not had a description added."},"authorityProofSignature":{"type":"string","description":"This field has not had a description added."},"backupQuestions":{"type":"object","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"AnyValue":{"description":"Can be anything. String, number, object, array, boolean, etc."}},"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic","description":"Basic authentication must be send in the format of usernameOrEmail:shaPassword, where usernameOrEmail can be the username or email associated with an account, andshaPassword is a sha256 hash of the users provided plaintext password."}}},"tags":[{"name":"Users","description":"User related operations"}],"paths":{"/v1/apps":{"get":{"operationId":"getApps","summary":"Get apps","description":"Returns an array of apps owned by the authorized user, or public apps across HYPLAY if no authorization is provided.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUserOptional"}],"responses":{"200":{"description":"Returns an array of apps owned by the authorized user or public apps across HYPLAY if no authorization is provided.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/AppModel"},{"type":"object","properties":{"iconImageAsset":{"$ref":"#/components/schemas/AssetModel"},"backgroundImageAsset":{"$ref":"#/components/schemas/AssetModel"},"logoImageAsset":{"$ref":"#/components/schemas/AssetModel"},"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}},"post":{"operationId":"createApp","summary":"Create app","description":"Create a new app for the authorized user.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"iconImageAssetId":{"type":"string","description":"The assetId of the icon image. Icon images are recommended to be a 1:1 aspect ratio and at least 512x512 pixels."},"backgroundImageAssetId":{"type":"string","description":"The assetId of the background image. Background images are recommended to be a 16:9 aspect ratio and at least 1920x1080 pixels."},"logoImageAssetId":{"type":"string","description":"The assetId of the logo image. Logo image are used on pages like preregistration, questing, etc and can be any aspect ratio."},"name":{"type":"string","description":"The name of the app."},"description":{"type":"string","description":"A brief description of the app and what it is and does."},"url":{"type":"string","description":"The URL of the app, such as its website or where users can learn more about it."},"discordUrl":{"type":"string","description":"The URL of the app's Discord server."},"redirectUris":{"type":"array","description":"An array of valid redirect URIs for the user authorization flows of the app.","items":{"type":"string"}}},"required":["iconImageAssetId","backgroundImageAssetId","name","description","redirectUris"]}}}},"responses":{"200":{"description":"Successfully created a new app. Returns an app object.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/AppModel"},{"type":"object","properties":{"iconImageAsset":{"$ref":"#/components/schemas/AssetModel"},"backgroundImageAsset":{"$ref":"#/components/schemas/AssetModel"},"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/apps/{appId}":{"get":{"operationId":"getPublicApp","summary":"Get public app","description":"Return a public app object for the provided appId.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/pathAppId"}],"responses":{"200":{"description":"Returns a public app object.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/AppModel"},{"type":"object","properties":{"iconImageAsset":{"$ref":"#/components/schemas/AssetModel"},"backgroundImageAsset":{"$ref":"#/components/schemas/AssetModel"},"logoImageAsset":{"$ref":"#/components/schemas/AssetModel"},"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"}}},"patch":{"operationId":"updateApp","summary":"Update app","description":"Update an app owned by the authorized user for the provided appId.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"},{"$ref":"#/components/parameters/pathAppId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"iconImageAssetId":{"type":"string","description":"The assetId of the icon image."},"backgroundImageAssetId":{"type":"string","description":"The assetId of the background image."},"logoImageAssetId":{"type":"string","description":"The assetId of the logo image."},"name":{"type":"string","description":"The name of the app."},"description":{"type":"string","description":"A brief description of the app and what it is and does."},"url":{"type":"string","description":"The URL of the app, such as its website or where users can learn more about it."},"discordUrl":{"type":"string","description":"The URL of the app's Discord server."},"redirectUris":{"type":"array","description":"An array of valid redirect URIs for the user authorization flows of the app.","items":{"type":"string"}},"resetSecretKey":{"type":"boolean","description":"If true, reset the secretKey of the app."},"resetTestSecretKey":{"type":"boolean","description":"If true, reset the testSecretKey of the app."}}}}}},"responses":{"200":{"description":"Returns the updated app object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/apps/{appId}/states":{"get":{"operationId":"getAppState","summary":"Get app state","description":"Get the public, protected, private state of an app, user or key.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/pathAppId"},{"$ref":"#/components/parameters/queryStateKey"},{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"},{"$ref":"#/components/parameters/headerAuthorizationSessionOptional"}],"responses":{"200":{"description":"Returns a state object that may contain public, protected, and/or private state for the app, key or user for the authorized user session.","content":{"application/json":{"schema":{"type":"object","properties":{"publicState":{"type":"object","description":"Public state data for the app or user."},"protectedState":{"type":"object","description":"Protected state data for the app or user."},"privateState":{"type":"object","description":"Private state data for the app or user."}},"required":["public","protected"]}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}},"post":{"operationId":"setAppState","summary":"Set app state","description":"Set arbitrary JSON blobs for public, protected and/or private state specific to an application or authorized user of an application. This is useful for saving different types of data specific to users or global configuration of your app or game in many different situations. It is intended to be highly flexible. State set for a user of your app, a unique lookup key, and the app itself are all isolated to your application. State storage is not globablly shared between applications.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/pathAppId"},{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"},{"$ref":"#/components/parameters/headerAuthorizationSessionOptional"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","description":"Any unique lookup key for this data. This can be things such as a hyplay user id, an internal battle match id for your game, some arbitrary settings identifier for a system of your app and more. Keys are flexible ways to create string based lookup identifiers for data you want to store/lookup. Keys are unique to your application and are not shared globally."},"publicState":{"type":"object","description":"Public state data to set for the app or user."},"protectedState":{"type":"object","description":"Protected state data to set for the app or user."},"privateState":{"type":"object","description":"Private state data to set for the app or user."},"overwrite":{"type":"boolean","description":"If true, the state will be overwritten with the provided state. If false or omitted, the state will be deep merged with the provided state."}}}}}},"responses":{"200":{"description":"Returns a state object that may contain public, protected, and/or private state for the app, or user of the app for the provided userId.","content":{"application/json":{"schema":{"type":"object","properties":{"publicState":{"type":"object","description":"Public state data for the app or user."},"protectedState":{"type":"object","description":"Protected state data for the app or user."},"privateState":{"type":"object","description":"Private state data for the app or user."}},"required":["publicState","protectedState"]}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/apps/{appId}/users":{"get":{"operationId":"getAppUsers","summary":"Get app users","description":"Returns an array of public users objects representing users of the apps. A HYPLAY user is considered a user of the app if they have had at least 1 active session for the provided appId.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/pathAppId"},{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"}],"responses":{"200":{"description":"Returns an array of public user objects.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/UserModel"},{"type":"object","properties":{"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/apps/{appId}/users/{userId}":{"get":{"operationId":"getAppUser","summary":"Get app user","description":"Returns a public user object representing a user of the app that also includes the `totalAppReferrals` property which represents the number of other users the user for the provided userId has referred to the provided appId.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/pathAppId"},{"$ref":"#/components/parameters/pathUserId"}],"responses":{"200":{"description":"Returns a public user object that includes a `totalAppReferrals` property.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/UserModel"},{"type":"object","properties":{"wallet":{"$ref":"#/components/schemas/WalletModel"}}},{"type":"object","properties":{"totalAppReferrals":{"type":"integer"}}}]}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/assets":{"get":{"operationId":"getAssets","summary":"Get assets","description":"Returns an array of assets that have been uploaded by the authorized user ordered by most recent creation.","tags":["Assets"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"responses":{"200":{"description":"Returns an array of asset objects.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AssetModel"}}}}},"400":{"$ref":"#/components/responses/400"}}},"post":{"operationId":"createAsset","summary":"Create asset","description":"Create an asset object by uploading a file in base64. Returns an asset object.","tags":["Assets"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"fileBase64":{"type":"string","description":"The base64 string of the asset being uploaded. Uploads may not exceed 5mb."}}}}}},"responses":{"200":{"description":"Returns a created asset object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetModel"}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/assets/{assetId}":{"get":{"operationId":"getAsset","summary":"Get asset","description":"Return an asset object that has been uploaded by the authorized user for the provided assetId.","tags":["Assets"],"parameters":[{"$ref":"#/components/parameters/pathAssetId"},{"$ref":"#/components/parameters/headerAuthorizationUser"}],"responses":{"200":{"description":"Returns an asset object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetModel"}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/contracts":{"get":{"operationId":"getOwnedContracts","summary":"Get owned contracts","description":"Returned an array of contracts owned by the authorized user.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"responses":{"200":{"description":"Returns an array of contracts owned by the authorized user.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ContractModel"}}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}},"post":{"operationId":"createContract","summary":"Create contract","description":"Creates a new contract for the authorized user.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"chain":{"type":"string","description":"The chain the contract is deployed on.","enum":["HYCHAIN","HYCHAIN_TESTNET","LOCAL"]},"abi":{"type":"string","format":"json","description":"JSON string of the contract's ABI."},"address":{"type":"string","description":"The contract's address."},"name":{"type":"string","description":"The contract's name."},"description":{"type":"string","description":"A description of the contract."},"metadata":{"type":"string","format":"json","description":"A JSON string of metadata for the contract."}},"required":["chain","abi","address"]}}}},"responses":{"200":{"description":"Successfully created a new contract. Returns a contract object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/contracts/{contractId}":{"get":{"operationId":"getContract","summary":"Get contract","description":"Returns a contract object for the provided contractId.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/pathContractId"}],"responses":{"200":{"description":"Returns a contract object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractModel"}}}},"400":{"$ref":"#/components/responses/400"}}},"patch":{"operationId":"updateContract","summary":"Update contract","description":"Updates a contract owned by the authorized user for the provided contractId.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"},{"$ref":"#/components/parameters/pathContractId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"abi":{"type":"string","format":"json","description":"JSON string of the contract's ABI."},"name":{"type":"string","description":"The contract's name. Named contracts are easier for users to identify during app or game authorization flows through HYPLAY."},"description":{"type":"string","description":"A description of the contract and what it does."},"metadata":{"type":"string","format":"json","description":"A JSON string of arbitrary metadata for the contract. May be used by developers for a variety of reasons."}}}}}},"responses":{"200":{"description":"Returns the updated contract object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/contracts/{contractIdOrAddress}/read":{"get":{"operationId":"readContract","summary":"Read contract","description":"Get the value from a read function of a target contract. This endpoint is designed to be highly flexible. It can read any contract by providing a contract address for `contractIdOrAddress`. It can also read using contracts created in the HYCHAIN systems through the `POST /v1/contracts` endpoint, which will utilize the contract's ABI.\n\nAdditionally, reads can be performed as a HYCHAIN app, user or user's session provided, through header authorization, or any arbitrary address or walletId provided through the `as` query parameter. Alternatively you can omit all of this and perform a read as no specific address.\n\nThe `func` query parameter accepts a complete function signature with parameters, such as `getCount()` or `readCounter(address,uint256)`, or a known function name without parameters if a contractId was provided for `contractIdOrAddress` and the contract's ABI is known. Such as `readCounter`.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/pathContractIdOrAddress"},{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"},{"$ref":"#/components/parameters/headerAuthorizationSessionOptional"},{"$ref":"#/components/parameters/headerAuthorizationUserOptional"},{"$ref":"#/components/parameters/queryChain"},{"$ref":"#/components/parameters/queryFunc"},{"$ref":"#/components/parameters/queryArgs"},{"$ref":"#/components/parameters/queryAs"}],"responses":{"200":{"description":"Returns the result of the contract read as a string.","content":{"application/json":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/sessions":{"post":{"x-visibility":"private","operationId":"startSession","summary":"Start session","description":"Starts a new session for the authorized user for an app. All prior sessions between the user and target app will become invalidated. Operates through an oauth 2.0-like flow, allowing a `code` or `token` response type.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"appId":{"type":"string","description":"The id of the app to start a session for."},"referrerId":{"type":"string","description":"The id of the user that referred the user to the app."},"nativeAllowance":{"type":"string","description":"The maximum sum of $TOPIA that may be transferred during this session, as a wei string.","example":502124124124},"contractFunctionSelectors":{"type":"array","description":"The contracts and function selectors approved for this session.","items":{"type":"object","properties":{"address":{"type":"string","description":"Target contract's address."},"functionSelectors":{"type":"array","description":"An array of function signatures or bytes4 function selectors to approve.","items":{"type":"string"}}}}},"erc20Allowances":{"type":"array","description":"The erc20 tokens and the maximum amount that may be transferred during this session.","items":{"type":"object","properties":{"address":{"type":"string","description":"Target erc20's contract address."},"allowance":{"type":"string","description":"The maximum sum of this erc20 token that may be transferred during this session, as a wei string."}}}},"erc721Allowances":{"type":"array","description":"The erc721 token ids that may be transferred during this session.","items":{"type":"object","properties":{"address":{"type":"string","description":"Target erc721's contract address."},"approveAll":{"type":"boolean","description":"If true, app is allowed through this session to transfer all tokens of the user without limits."},"tokenIds":{"type":"array","description":"The token ids this session is allowed to transfer during this session.","items":{"type":"string"}}}}},"erc1155Allowances":{"type":"array","description":"The erc1155 token ids and the maximum amount of each unique id that may be transferred during this session.","items":{"type":"object","properties":{"address":{"type":"string","description":"Target erc1155's contract address."},"approveAll":{"type":"boolean","description":"If true, app is allowed through this session to transfer any amount of all tokens of the user without limits."},"tokenIds":{"type":"array","description":"The maximum sum of the token ids this session is allowed to transfer during this session.","items":{"type":"string"}},"allowances":{"type":"array","description":"The token id allowances this session is allowed to interact or transfer during this session.","items":{"type":"string"}}}}},"chain":{"type":"string","description":"The chain the session is to be started for.","enum":["HYCHAIN","HYCHAIN_TESTNET","LOCAL"]},"nonce":{"type":"string","description":"A positive arbitrary integer as a string to be used as this session's nonce. Nonces are a one-time use per user. For example, User A and User B can both individually use nonce \"1\", but nonce \"1\", cannot be used again in the future for User A or User B to start a different session.","example":1},"signatures":{"type":"array","description":"An array of 1 or more session start signatures, generated by the authority(s) of a user's smart contract account. These signatures are most easily generated using the `hychain-crypto-js` npm package's `generateSessionSignature()`.","items":{"type":"string"}},"deadline":{"type":"number","description":"A timestamp in seconds of when the signature(s) for the session authorization request expire. If the deadline has been passed, attempting to start a session will fail."},"expiresAt":{"type":"number","description":"A timestamp in seconds when the session is to expire."},"responseType":{"type":"string","description":"The response type for session auth flows. If `code` is used, an accessToken will not be included, and a `exchangeCode` property will be included in the response object. This `exchangeCode` must then be exchanged using both the app's secret + exchange code to acquire the session access token. Alternatively, `token` can be used which returns a populated `accessToken` property in the response. This is less secure and essentially identical in usage for Oauth 2.0's implicit auth flow.","enum":["code","token"]}},"required":["appId","chain","nonce","signatures","deadline","expiresAt","responseType"]}}}},"responses":{"200":{"description":"Successfully started a new session. Returns a session object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}},"delete":{"operationId":"endSession","summary":"End session","description":"Ends all active sessions for a given user. This endpoint is flexible and can end sessions in a number of ways. An app can end any user's sessions of their app directly, or a user can end their own sessions for an app, or a session access token can be used to end its associated session.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUserOptional"},{"$ref":"#/components/parameters/headerAuthorizationSessionOptional"},{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"appId":{"type":"string","description":"If the `X-App-Authorization` or `X-Session-Authorization` header is not set, `appId` must be provided to indicate the application for which to end user sessions for."},"userId":{"type":"string","description":"If the user's `X-Authorization` or `X-Session-Authorization` header is not set, `userId` must be provided to indicate the user for which to end sessions for."},"chain":{"type":"string","description":"The chain to end sessions for.","enum":["HYCHAIN","HYCHAIN_TESTNET","LOCAL"]}},"required":["chain"]}}}},"responses":{"204":{"description":"Returns an empty response indicating the session has been ended."},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/sessions/token":{"post":{"operationId":"grantSessionToken","summary":"Grant session token","description":"Returns a session object with a valid access token when the associated exchangeCode and application authorized by using its secret key is provided.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationAppSecret"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"exchangeCode":{"type":"string","description":"An unused exchange code associated with the provided session id. Exchange codes can only be used once and then become invalid."}},"required":["exchangeCode"]}}}},"responses":{"200":{"description":"Returns an updated session object with an `accessToken` set.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/templates":{"get":{"operationId":"getTemplates","summary":"Get templates","description":"Returns an array of templates. Templates can be used to quickly deploy contracts to HYCHAIN and HYCHAIN_TESTNET. Templates can also be reviewed and approved by the HYPLAY team to be made available for anyone to deploy. Templates that are not approved can be deployed by anyone to HYCHAIN_TESTNET, and only deployed by the creator to HYCHAIN mainnet.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/queryUserId"},{"$ref":"#/components/parameters/queryTemplateName"},{"$ref":"#/components/parameters/queryTemplateApproved"}],"responses":{"200":{"description":"Returns an array of template objects.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TemplateModel"}}}}},"400":{"$ref":"#/components/responses/400"}}},"post":{"operationId":"createTemplate","summary":"Create template","description":"Creates a new template. Templates can be used to quickly deploy pre-approved types of contracts to HYCHAIN and HYCHAIN_TESTNET.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"The name of the template."},"description":{"type":"string","description":"A description of the template."},"solidity":{"type":"string","description":"The solidity source code of the template to compile. This must be a flattened contract with all imports inlined."},"target":{"type":"string","description":"The contract from the inlined solidity source code that is intended to be deployed for this template.","example":"MyErc20Contract"}},"required":["name","solidity","target"]}}}},"responses":{"200":{"description":"Returns the created template object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/templates/{templateId}":{"get":{"operationId":"getTemplate","summary":"Get template","description":"Returns a template object with abi, bytecode and compilation errors or warnings included.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/pathTemplateId"}],"responses":{"200":{"description":"Returns a template object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateModel"}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/transactions":{"get":{"operationId":"getTransactions","summary":"Get transactions","description":"Returns an array of transactions for the provided appId, sessionId, userId or walletId. Transactions are returned in descending order of creation date.","tags":["Transactions"],"parameters":[{"$ref":"#/components/parameters/queryAppId"},{"$ref":"#/components/parameters/querySessionId"},{"$ref":"#/components/parameters/queryUserId"},{"$ref":"#/components/parameters/queryWalletId"},{"$ref":"#/components/parameters/queryChain"}],"responses":{"200":{"description":"Returns an array of transaction objects.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TransactionModel"}}}}},"400":{"$ref":"#/components/responses/400"}}},"post":{"operationId":"createTransaction","summary":"Create transaction","description":"Create and submit a transaction to the target contract id or address. Transactions are submitted on behalf of the authorization type used, such as an app, user or user via a user's session.\n\nTransaction submission supports contract function invocation and native transfers to contracts or externally owned accounts (EOAs).\n\nThis endpoint is designed to be highly flexible. Please refer to the HYCHAIN guides and documentation for detailed examples of the many ways this endpoint can be used.","tags":["Transactions"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"},{"$ref":"#/components/parameters/headerAuthorizationSessionOptional"},{"$ref":"#/components/parameters/headerAuthorizationUserOptional"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"contractId":{"type":"string","description":"The contract id to target."},"address":{"type":"string","description":"The address to target."},"func":{"type":"string","description":"The function name or function signature of the contract."},"args":{"type":"array","description":"An array of arguments to pass to the function.","items":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]}}]}},"value":{"type":"number","description":"The amount of native token to send with the transaction."},"nonce":{"type":"string","description":"The nonce of the transaction."},"deadline":{"type":"number","description":"The deadline for the transaction as a timestamp in seconds."},"signatures":{"type":"array","description":"An array of signatures for the transaction.","items":{"type":"string"}},"chain":{"type":"string","description":"The chain the session is to be started for.","enum":["HYCHAIN","HYCHAIN_TESTNET","LOCAL"]}}}}}},"responses":{"200":{"description":"Returns a transaction object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/transactions/{transactionId}":{"get":{"operationId":"getTransaction","summary":"Get transaction","description":"Returns a transaction object for the provided transactionId.","tags":["Transactions"],"parameters":[{"$ref":"#/components/parameters/pathTransactionId"}],"responses":{"200":{"description":"Returns a transaction object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionModel"}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/users":{"get":{"operationId":"getUser","summary":"Get user","description":"Returns a public user object when provided a username.","tags":["Users"],"parameters":[{"$ref":"#/components/parameters/queryUsername"}],"responses":{"200":{"description":"Returns a public user object.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/UserModel"},{"type":"object","properties":{"preregistered":{"type":"boolean"}}},{"type":"object","properties":{"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"}}},"post":{"x-visibility":"private","operationId":"createUser","summary":"Create user","description":"Creates a new user using a provided username and password. A user must have an authority wallet assigned before it can be used for transactions or authorize sessions.","tags":["Users"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"username":{"type":"string","minLength":4,"description":"The users desired username."},"email":{"type":"string","format":"email","description":"An email address to associate with the user for account recovery."},"shaPassword":{"type":"string","minLength":64,"maxLength":64,"format":"password","description":"A sha256 hash of the users plaintext password.","example":"07ecafaf8304b8a12016ad05fd498e2ab338c1bcac31cb3f002386ef4ea917ad"}},"required":["username","shaPassword"]}}}},"responses":{"200":{"description":"Successfully created a new user. Returns a user object. Before the users can start session or perform transactions, their authority wallet must first be set using the PATCH /v1/users endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserModel"}}}},"400":{"$ref":"#/components/responses/400"}}},"patch":{"x-visibility":"private","operationId":"updateCurrentUser","summary":"Update current user","description":"Update various fields specific to the current user.","tags":["Users"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"},{"$ref":"#/components/parameters/headerAuthorizationNonce"},{"$ref":"#/components/parameters/headerAuthorizationNonceSignature"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","description":"A valid, unique email address that is not currently assigned to another account."},"authorityAddress":{"type":"string","description":"The wallet address associated with the private key used to generate the authorityProofSignature. This should be generated by the `hytopia-crypto-js` library. 1-time assignment, intended for setting of newly registered accounts."},"authorityCiphertext":{"type":"string","description":"The encrypted ciphertext of the private key associated with the provided authorityAddress. This should be generated by the `hytopia-crypto-js` library. 1-time assignment, intended for setting of newly registered accounts."},"authorityBackupCiphertexts":{"type":"string","description":"A ciphertext from encrypting a players authority private key with an arbitrary backup code generated and store on their client."},"authorityBackupQuestionsCiphertext":{"type":"string","description":"A ciphertext from encrypting a players authority private key with the concatenanted answers to their recovery questions."},"authorityProofSignature":{"type":"string","description":"The proof signature required for deferred smart contract account creation. This should be generated by the `hytopia-crypto-js` library. 1-time assignment, intended for setting of newly registered accounts."},"salt":{"type":"string","description":"An arbitrary salt used by the player's client along with their client-side provided password to derive a PBKDF2 key for decrypting their authority wallet's private key. 1-time assignment, intended for setting of preregistration accounts."},"backupQuestions":{"type":"array","description":"An array of any arbitrary questions to display to the user when going through account recovery.","items":{"type":"string"}},"isChild":{"type":"boolean","description":"A true or false value indicating if a child is younger than 13 (true), or older (false)."},"shaPassword":{"type":"string","description":"A sha256 hash of the users new password. Cannot be set for users who joined using an SSO option such as Discord, Twitter, Facebook, etc. Authority wallet credentials should be re-encrypted using the new plaintext password on the client side as well, with the new ciphertext being provided with the password update to prevent divergence between a users account password and wallet decryption password."},"resetAccessToken":{"type":"boolean","description":"Revokes the user's current access token and returns a new one if true."}}}}}},"responses":{"200":{"description":"Returns the updated user object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/users/auth":{"get":{"x-visibility":"private","operationId":"authUser","summary":"Authenticate user","description":"Authenticates a user for the provided email/username and shaPassword, or creates or retrieves a user for the provided sso auth code. Return a user object containing an access token.\nIf a user is preregistered or has not completed their account setup such as assigning their authority wallet or setting their password, as long as they have had an email assigned to their account, a one-time password can be emailed to the user. This can be done by using the basic auth flow and omitting the password field or passing an empty string for the password.\nYou can then auth the user by providing the sha256(one time password) equivalent as the password for this auth endpoint.","tags":["Users"],"parameters":[{"$ref":"#/components/parameters/queryAccessTokenExpiresAt"},{"$ref":"#/components/parameters/queryResetAccessToken"},{"$ref":"#/components/parameters/queryDiscordAuthCode"},{"$ref":"#/components/parameters/queryFacebookAuthCode"},{"$ref":"#/components/parameters/queryGoogleAuthCode"},{"$ref":"#/components/parameters/queryTwitterAuthCode"}],"security":[{"basicAuth":[]},{}],"responses":{"200":{"description":"Successfully authorized the user and returns a user object.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/UserModel"},{"type":"object","properties":{"socialKeyMaterial":{"type":"string"},"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"204":{"description":"Successfully emailed a one-time password to a preregistered user."},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/users/me":{"get":{"operationId":"getCurrentUser","summary":"Get current user","description":"Returns a public user object associated with the provided session access token.","tags":["Users"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationSession"}],"responses":{"200":{"description":"Returns a public user object.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/UserModel"},{"type":"object","properties":{"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/wallets/{walletIdOrAddress}":{"get":{"operationId":"getWallet","summary":"Get wallet","description":"Returns a wallet object for the provided walletIdOrAddress. If walletIdOrAddress is a HYCHAIN system wallet id, it will return a matching wallet for the id. If walletIdOrAddress is a on chain smart contract wallet address, it will return a matching wallet from the HYCHAIN system. If a wallet is not found in HYCHAIN's systems for the address or walletId provided, a 400 error will be returned.","tags":["Wallets"],"parameters":[{"$ref":"#/components/parameters/pathWalletIdOrAddress"}],"responses":{"200":{"description":"Returns a wallet object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WalletModel"}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/wallets/{walletIdOrAddress}/balance":{"get":{"operationId":"getWalletBalance","summary":"Get wallet balance","description":"Returns the native token balance for the smart contract wallet associated with a wallet id provided for walletIdOrAddress. Or, if any address is provided for walletIdOrAddress, it will return the native token balance for the address.","tags":["Wallets"],"parameters":[{"$ref":"#/components/parameters/pathWalletIdOrAddress"},{"$ref":"#/components/parameters/queryChain"}],"responses":{"200":{"description":"Returns the native token balance for the wallet in readable string format. For example a 1e18 balance would be '1.0'.","content":{"application/json":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/400"}}}}}} \ No newline at end of file diff --git a/spec.json b/spec.json index 7c04967..ef4e396 100644 --- a/spec.json +++ b/spec.json @@ -1 +1 @@ -{"openapi":"3.0.0","info":{"title":"HYPLAY API","version":"1.0.0","description":"HYPLAY API Specification","termsOfService":"https://hyplay.com","contact":{"name":"HYCHAIN Team","email":"braydon@hytopia.com","url":"https://hychain.com"}},"servers":[{"description":"HYPLAY API Server","url":"https://api.hyplay.com"},{"description":"HYPLAY API Staging Server","url":"https://staging-api.hyplay.com"},{"description":"Local Development Server","url":"http://localhost:8001"}],"components":{"parameters":{"headerAuthorizationUser":{"name":"x-authorization","in":"header","description":"The `accessToken` of the authenticating user.","example":"user_at_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP","required":true,"schema":{"type":"string"}},"headerAuthorizationUserOptional":{"name":"x-authorization","in":"header","description":"The `accessToken` of the authenticating user.","example":"user_at_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP","required":false,"schema":{"type":"string"}},"headerAuthorizationAppSecret":{"name":"x-app-authorization","in":"header","description":"The `secretKey` or `testSecretKey` of the authenticating app.","example":"test_app_sk_pBEHOVTIZjQFT6WpiQLT8c_VFfd6Vb2XHj_9IIV8-Zi06SdMIruJxIe2QMaca_X6","required":true,"schema":{"type":"string"}},"headerAuthorizationAppSecretOptional":{"name":"x-app-authorization","in":"header","description":"The `secretKey` or `testSecretKey` of the authenticating app.","example":"test_app_sk_pBEHOVTIZjQFT6WpiQLT8c_VFfd6Vb2XHj_9IIV8-Zi06SdMIruJxIe2QMaca_X6","required":false,"schema":{"type":"string"}},"headerAuthorizationSession":{"name":"x-session-authorization","in":"header","description":"The `accessToken` of the authenticating session.","example":"sca_sat_pBEHOVTIZjQFT6WpiQLT8c_VFfd6Vb2XHj_9IIV8-Zi06SdMIruJxIe2QMaca_X6","required":true,"schema":{"type":"string"}},"headerAuthorizationSessionOptional":{"name":"x-session-authorization","in":"header","description":"The `accessToken` of the authenticating session.","example":"sca_sat_pBEHOVTIZjQFT6WpiQLT8c_VFfd6Vb2XHj_9IIV8-Zi06SdMIruJxIe2QMaca_X6","required":false,"schema":{"type":"string"}},"headerAuthorizationNonce":{"name":"x-nonce","in":"header","description":"The nonce of the authenticating user.","required":true,"schema":{"type":"string"}},"headerAuthorizationNonceSignature":{"name":"x-nonce-signature","in":"header","description":"The nonce signature of the authenticating user.","required":true,"schema":{"type":"string"}},"pathAppId":{"name":"appId","in":"path","description":"An application id.","required":true,"schema":{"type":"string"}},"pathAssetId":{"name":"assetId","in":"path","description":"An asset id.","required":true,"schema":{"type":"string"}},"pathContractId":{"name":"contractId","in":"path","description":"A contract id.","required":true,"schema":{"type":"string"}},"pathContractIdOrAddress":{"name":"contractIdOrAddress","in":"path","description":"A contract id or address.","required":true,"schema":{"type":"string"}},"pathSessionId":{"name":"sessionId","in":"path","description":"A session id.","required":true,"schema":{"type":"string"}},"pathTemplateId":{"name":"templateId","in":"path","description":"A template id.","required":true,"schema":{"type":"string"}},"pathTransactionId":{"name":"transactionId","in":"path","description":"A transaction id.","required":true,"schema":{"type":"string"}},"pathUserId":{"name":"userId","in":"path","description":"A user id.","required":true,"schema":{"type":"string"}},"pathWalletIdOrAddress":{"name":"walletIdOrAddress","in":"path","description":"A wallet id or address.","required":true,"schema":{"type":"string"}},"queryAccessTokenExpiresAt":{"name":"accessTokenExpiresAt","in":"query","description":"An optional unix timestamp in seconds specifying when the returned `accessToken` should expire. If this value is provided, all prior `accessToken` will be invalidated and a new `accessToken` will be issued in the response. If no value is provided, the returned `accessToken` will not expire unless it is invalidated.","example":1677197460,"required":false,"schema":{"type":"number"}},"queryAppId":{"name":"appId","in":"query","description":"An application id.","required":false,"schema":{"type":"string"}},"queryArgs":{"name":"args","in":"query","description":"An array of arguments.","required":false,"schema":{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]}}]}}},"queryAs":{"name":"as","in":"query","description":"An address or walletId to perform as.","required":false,"schema":{"type":"string"}},"queryChain":{"name":"chain","in":"query","description":"A chain name.","required":false,"schema":{"type":"string","enum":["HYCHAIN","HYCHAIN_TESTNET","LOCAL"]}},"queryFunc":{"name":"func","in":"query","description":"A function name or function signature.","required":true,"schema":{"type":"string"}},"queryDiscordAuthCode":{"name":"discordAuthCode","in":"query","description":"A Discord OAuth 2.0 code.","required":false,"schema":{"type":"string"}},"queryFacebookAuthCode":{"name":"facebookAuthCode","in":"query","description":"A Facebook OAuth 2.0 code.","required":false,"schema":{"type":"string"}},"queryGoogleAuthCode":{"name":"googleAuthCode","in":"query","description":"A Google OAuth 2.0 code.","required":false,"schema":{"type":"string"}},"queryTwitterAuthCode":{"name":"twitterAuthCode","in":"query","description":"A Twitter OAuth 2.0 code.","required":false,"schema":{"type":"string"}},"queryTemplateApproved":{"name":"approved","in":"query","description":"Set this query parameter to `true` to filter for approved templates.","example":"true","required":false,"schema":{"type":"string"}},"queryTemplateName":{"name":"name","in":"query","description":"A template name to partially or exactly match.","example":"token","required":false,"schema":{"type":"string"}},"queryResetAccessToken":{"name":"resetAccessToken","in":"query","description":"Set this query parameter to `true` to reset accessToken and authorityKey.","example":"true","required":false,"schema":{"type":"string"}},"queryRecaptchaToken":{"name":"hcaptchaResponse","in":"query","description":"A hCaptcha token generated client-side by completion of a user-facing hCaptcha request.","required":true,"schema":{"type":"string"}},"querySessionId":{"name":"sessionId","in":"query","description":"A session id.","required":false,"schema":{"type":"string"}},"queryUsername":{"name":"username","in":"query","description":"A user username.","example":"arkdev","required":false,"schema":{"type":"string"}},"queryUserId":{"name":"userId","in":"query","description":"A user id.","required":false,"schema":{"type":"string"}},"queryWalletId":{"name":"walletId","in":"query","description":"A wallet id.","required":false,"schema":{"type":"string"}},"queryStateKey":{"name":"key","in":"query","description":"A string identifier unique to an app for looking up state data.","required":false,"schema":{"type":"string"}}},"responses":{"400":{"description":"An API level error occurred. This is often due to problematic data being provided by you.","content":{"application/json":{"schema":{"type":"string"}}}},"401":{"description":"An authorization error occured. This is often due to incorrect tokens or keys being provided, or accessing a resource that the provided tokens or keys do not have access to.","content":{"application/json":{"schema":{"type":"string"}}}}},"schemas":{"AppModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"userId":{"type":"string","description":"This field has not had a description added."},"walletId":{"type":"string","description":"This field has not had a description added."},"iconImageAssetId":{"type":"string","description":"This field has not had a description added."},"backgroundImageAssetId":{"type":"string","description":"This field has not had a description added."},"logoImageAssetId":{"type":"string","description":"This field has not had a description added."},"secretKey":{"type":"string","description":"This field has not had a description added."},"testSecretKey":{"type":"string","description":"This field has not had a description added."},"name":{"type":"string","description":"This field has not had a description added."},"description":{"type":"string","description":"This field has not had a description added."},"url":{"type":"string","description":"This field has not had a description added."},"discordUrl":{"type":"string","description":"This field has not had a description added."},"redirectUris":{"type":"object","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"AppReferralsModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"appId":{"type":"string","description":"This field has not had a description added."},"referredUserId":{"type":"string","description":"This field has not had a description added."},"referrerUserId":{"type":"string","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"AssetModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"userId":{"type":"string","description":"This field has not had a description added."},"s3Url":{"type":"string","description":"This field has not had a description added."},"cdnUrl":{"type":"string","description":"This field has not had a description added."},"mime":{"type":"string","description":"This field has not had a description added."},"extension":{"type":"string","description":"This field has not had a description added."},"checksum":{"type":"string","description":"This field has not had a description added."},"size":{"type":"integer","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"ContractModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"userId":{"type":"string","description":"This field has not had a description added."},"templateId":{"type":"string","description":"This field has not had a description added."},"chain":{"type":"string","description":"This field has not had a description added."},"abi":{"type":"object","description":"This field has not had a description added."},"address":{"type":"string","description":"This field has not had a description added."},"name":{"type":"string","description":"This field has not had a description added."},"description":{"type":"string","description":"This field has not had a description added."},"metadata":{"type":"object","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"NonceModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"walletId":{"type":"string","description":"This field has not had a description added."},"nonce":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"SessionModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"appId":{"type":"string","description":"This field has not had a description added."},"userId":{"type":"string","description":"This field has not had a description added."},"chain":{"type":"string","description":"This field has not had a description added."},"accessToken":{"type":"string","description":"This field has not had a description added."},"exchangeCode":{"type":"string","description":"This field has not had a description added."},"contractFunctionSelectors":{"type":"object","description":"This field has not had a description added."},"nativeAllowance":{"type":"string","description":"This field has not had a description added."},"erc20Allowances":{"type":"object","description":"This field has not had a description added."},"erc721Allowances":{"type":"object","description":"This field has not had a description added."},"erc1155Allowances":{"type":"object","description":"This field has not had a description added."},"nonce":{"type":"string","description":"This field has not had a description added."},"signatures":{"type":"object","description":"This field has not had a description added."},"deadline":{"type":"string","description":"This field has not had a description added."},"expiresAt":{"type":"string","description":"This field has not had a description added."},"endedAt":{"type":"string","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"TemplateModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"userId":{"type":"string","description":"This field has not had a description added."},"name":{"type":"string","description":"This field has not had a description added."},"description":{"type":"string","description":"This field has not had a description added."},"solidity":{"type":"string","description":"This field has not had a description added."},"target":{"type":"string","description":"This field has not had a description added."},"bytecode":{"type":"string","description":"This field has not had a description added."},"abi":{"type":"object","description":"This field has not had a description added."},"errors":{"type":"object","description":"This field has not had a description added."},"approved":{"type":"boolean","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"TransactionModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"walletId":{"type":"string","description":"This field has not had a description added."},"sessionId":{"type":"string","description":"This field has not had a description added."},"chain":{"type":"string","description":"This field has not had a description added."},"relayerAddress":{"type":"string","description":"This field has not had a description added."},"func":{"type":"string","description":"This field has not had a description added."},"args":{"type":"object","description":"This field has not had a description added."},"value":{"type":"string","description":"This field has not had a description added."},"hash":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"UserModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"walletId":{"type":"string","description":"This field has not had a description added."},"username":{"type":"string","description":"This field has not had a description added."},"email":{"type":"string","description":"This field has not had a description added."},"phone":{"type":"string","description":"This field has not had a description added."},"discordId":{"type":"string","description":"This field has not had a description added."},"facebookId":{"type":"string","description":"This field has not had a description added."},"googleId":{"type":"string","description":"This field has not had a description added."},"microsoftId":{"type":"string","description":"This field has not had a description added."},"twitterId":{"type":"string","description":"This field has not had a description added."},"accessToken":{"type":"string","description":"This field has not had a description added."},"isChild":{"type":"boolean","description":"This field has not had a description added."},"accessTokenExpiresAt":{"type":"string","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"WalletModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"type":{"type":"string","description":"This field has not had a description added."},"address":{"type":"string","description":"This field has not had a description added."},"authorityCiphertext":{"type":"string","description":"This field has not had a description added."},"authorityBackupCiphertexts":{"type":"object","description":"This field has not had a description added."},"authorityProofSignature":{"type":"string","description":"This field has not had a description added."},"backupQuestions":{"type":"object","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"AnyValue":{"description":"Can be anything. String, number, object, array, boolean, etc."}},"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic","description":"Basic authentication must be send in the format of usernameOrEmail:shaPassword, where usernameOrEmail can be the username or email associated with an account, andshaPassword is a sha256 hash of the users provided plaintext password."}}},"tags":[{"name":"Users","description":"User related operations"}],"paths":{"/v1/apps":{"get":{"operationId":"getApps","summary":"Get apps","description":"Returns an array of apps owned by the authorized user, or public apps across HYPLAY if no authorization is provided.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUserOptional"}],"responses":{"200":{"description":"Returns an array of apps owned by the authorized user or public apps across HYPLAY if no authorization is provided.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/AppModel"},{"type":"object","properties":{"iconImageAsset":{"$ref":"#/components/schemas/AssetModel"},"backgroundImageAsset":{"$ref":"#/components/schemas/AssetModel"},"logoImageAsset":{"$ref":"#/components/schemas/AssetModel"},"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}},"post":{"operationId":"createApp","summary":"Create app","description":"Create a new app for the authorized user.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"iconImageAssetId":{"type":"string","description":"The assetId of the icon image. Icon images are recommended to be a 1:1 aspect ratio and at least 512x512 pixels."},"backgroundImageAssetId":{"type":"string","description":"The assetId of the background image. Background images are recommended to be a 16:9 aspect ratio and at least 1920x1080 pixels."},"logoImageAssetId":{"type":"string","description":"The assetId of the logo image. Logo image are used on pages like preregistration, questing, etc and can be any aspect ratio."},"name":{"type":"string","description":"The name of the app."},"description":{"type":"string","description":"A brief description of the app and what it is and does."},"url":{"type":"string","description":"The URL of the app, such as its website or where users can learn more about it."},"discordUrl":{"type":"string","description":"The URL of the app's Discord server."},"redirectUris":{"type":"array","description":"An array of valid redirect URIs for the user authorization flows of the app.","items":{"type":"string"}}},"required":["iconImageAssetId","backgroundImageAssetId","name","description","redirectUris"]}}}},"responses":{"200":{"description":"Successfully created a new app. Returns an app object.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/AppModel"},{"type":"object","properties":{"iconImageAsset":{"$ref":"#/components/schemas/AssetModel"},"backgroundImageAsset":{"$ref":"#/components/schemas/AssetModel"},"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/apps/{appId}":{"get":{"operationId":"getPublicApp","summary":"Get public app","description":"Return a public app object for the provided appId.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/pathAppId"}],"responses":{"200":{"description":"Returns a public app object.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/AppModel"},{"type":"object","properties":{"iconImageAsset":{"$ref":"#/components/schemas/AssetModel"},"backgroundImageAsset":{"$ref":"#/components/schemas/AssetModel"},"logoImageAsset":{"$ref":"#/components/schemas/AssetModel"},"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"}}},"patch":{"operationId":"updateApp","summary":"Update app","description":"Update an app owned by the authorized user for the provided appId.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"},{"$ref":"#/components/parameters/pathAppId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"iconImageAssetId":{"type":"string","description":"The assetId of the icon image."},"backgroundImageAssetId":{"type":"string","description":"The assetId of the background image."},"logoImageAssetId":{"type":"string","description":"The assetId of the logo image."},"name":{"type":"string","description":"The name of the app."},"description":{"type":"string","description":"A brief description of the app and what it is and does."},"url":{"type":"string","description":"The URL of the app, such as its website or where users can learn more about it."},"discordUrl":{"type":"string","description":"The URL of the app's Discord server."},"redirectUris":{"type":"array","description":"An array of valid redirect URIs for the user authorization flows of the app.","items":{"type":"string"}},"resetSecretKey":{"type":"boolean","description":"If true, reset the secretKey of the app."},"resetTestSecretKey":{"type":"boolean","description":"If true, reset the testSecretKey of the app."}}}}}},"responses":{"200":{"description":"Returns the updated app object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/apps/{appId}/states":{"get":{"operationId":"getAppState","summary":"Get app state","description":"Get the public, protected, private state of an app, user or key.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/pathAppId"},{"$ref":"#/components/parameters/queryStateKey"},{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"},{"$ref":"#/components/parameters/headerAuthorizationSessionOptional"}],"responses":{"200":{"description":"Returns a state object that may contain public, protected, and/or private state for the app, key or user for the authorized user session.","content":{"application/json":{"schema":{"type":"object","properties":{"publicState":{"type":"object","description":"Public state data for the app or user."},"protectedState":{"type":"object","description":"Protected state data for the app or user."},"privateState":{"type":"object","description":"Private state data for the app or user."}},"required":["public","protected"]}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}},"post":{"operationId":"setAppState","summary":"Set app state","description":"Set arbitrary JSON blobs for public, protected and/or private state specific to an application or authorized user of an application. This is useful for saving different types of data specific to users or global configuration of your app or game in many different situations. It is intended to be highly flexible. State set for a user of your app, a unique lookup key, and the app itself are all isolated to your application. State storage is not globablly shared between applications.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/pathAppId"},{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"},{"$ref":"#/components/parameters/headerAuthorizationSessionOptional"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","description":"Any unique lookup key for this data. This can be things such as a hyplay user id, an internal battle match id for your game, some arbitrary settings identifier for a system of your app and more. Keys are flexible ways to create string based lookup identifiers for data you want to store/lookup. Keys are unique to your application and are not shared globally."},"publicState":{"type":"object","description":"Public state data to set for the app or user."},"protectedState":{"type":"object","description":"Protected state data to set for the app or user."},"privateState":{"type":"object","description":"Private state data to set for the app or user."},"overwrite":{"type":"boolean","description":"If true, the state will be overwritten with the provided state. If false or omitted, the state will be deep merged with the provided state."}}}}}},"responses":{"200":{"description":"Returns a state object that may contain public, protected, and/or private state for the app, or user of the app for the provided userId.","content":{"application/json":{"schema":{"type":"object","properties":{"publicState":{"type":"object","description":"Public state data for the app or user."},"protectedState":{"type":"object","description":"Protected state data for the app or user."},"privateState":{"type":"object","description":"Private state data for the app or user."}},"required":["publicState","protectedState"]}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/apps/{appId}/users":{"get":{"operationId":"getAppUsers","summary":"Get app users","description":"Returns an array of public users objects representing users of the apps. A HYPLAY user is considered a user of the app if they have had at least 1 active session for the provided appId.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/pathAppId"},{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"}],"responses":{"200":{"description":"Returns an array of public user objects.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/UserModel"},{"type":"object","properties":{"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/apps/{appId}/users/{userId}":{"get":{"operationId":"getAppUser","summary":"Get app user","description":"Returns a public user object representing a user of the app that also includes the `totalAppReferrals` property which represents the number of other users the user for the provided userId has referred to the provided appId.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/pathAppId"},{"$ref":"#/components/parameters/pathUserId"}],"responses":{"200":{"description":"Returns a public user object that includes a `totalAppReferrals` property.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/UserModel"},{"type":"object","properties":{"wallet":{"$ref":"#/components/schemas/WalletModel"}}},{"type":"object","properties":{"totalAppReferrals":{"type":"integer"}}}]}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/assets":{"get":{"operationId":"getAssets","summary":"Get assets","description":"Returns an array of assets that have been uploaded by the authorized user ordered by most recent creation.","tags":["Assets"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"responses":{"200":{"description":"Returns an array of asset objects.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AssetModel"}}}}},"400":{"$ref":"#/components/responses/400"}}},"post":{"operationId":"createAsset","summary":"Create asset","description":"Create an asset object by uploading a file in base64. Returns an asset object.","tags":["Assets"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"fileBase64":{"type":"string","description":"The base64 string of the asset being uploaded. Uploads may not exceed 5mb."}}}}}},"responses":{"200":{"description":"Returns a created asset object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetModel"}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/assets/{assetId}":{"get":{"operationId":"getAsset","summary":"Get asset","description":"Return an asset object that has been uploaded by the authorized user for the provided assetId.","tags":["Assets"],"parameters":[{"$ref":"#/components/parameters/pathAssetId"},{"$ref":"#/components/parameters/headerAuthorizationUser"}],"responses":{"200":{"description":"Returns an asset object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetModel"}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/contracts":{"get":{"operationId":"getOwnedContracts","summary":"Get owned contracts","description":"Returned an array of contracts owned by the authorized user.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"responses":{"200":{"description":"Returns an array of contracts owned by the authorized user.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ContractModel"}}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}},"post":{"operationId":"createContract","summary":"Create contract","description":"Creates a new contract for the authorized user.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"chain":{"type":"string","description":"The chain the contract is deployed on.","enum":["HYCHAIN","HYCHAIN_TESTNET","LOCAL"]},"abi":{"type":"string","format":"json","description":"JSON string of the contract's ABI."},"address":{"type":"string","description":"The contract's address."},"name":{"type":"string","description":"The contract's name."},"description":{"type":"string","description":"A description of the contract."},"metadata":{"type":"string","format":"json","description":"A JSON string of metadata for the contract."}},"required":["chain","abi","address"]}}}},"responses":{"200":{"description":"Successfully created a new contract. Returns a contract object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/contracts/{contractId}":{"get":{"operationId":"getContract","summary":"Get contract","description":"Returns a contract object for the provided contractId.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/pathContractId"}],"responses":{"200":{"description":"Returns a contract object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractModel"}}}},"400":{"$ref":"#/components/responses/400"}}},"patch":{"operationId":"updateContract","summary":"Update contract","description":"Updates a contract owned by the authorized user for the provided contractId.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"},{"$ref":"#/components/parameters/pathContractId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"abi":{"type":"string","format":"json","description":"JSON string of the contract's ABI."},"name":{"type":"string","description":"The contract's name. Named contracts are easier for users to identify during app or game authorization flows through HYPLAY."},"description":{"type":"string","description":"A description of the contract and what it does."},"metadata":{"type":"string","format":"json","description":"A JSON string of arbitrary metadata for the contract. May be used by developers for a variety of reasons."}}}}}},"responses":{"200":{"description":"Returns the updated contract object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/contracts/{contractIdOrAddress}/read":{"get":{"operationId":"readContract","summary":"Read contract","description":"Get the value from a read function of a target contract. This endpoint is designed to be highly flexible. It can read any contract by providing a contract address for `contractIdOrAddress`. It can also read using contracts created in the HYCHAIN systems through the `POST /v1/contracts` endpoint, which will utilize the contract's ABI.\n\nAdditionally, reads can be performed as a HYCHAIN app, user or user's session provided, through header authorization, or any arbitrary address or walletId provided through the `as` query parameter. Alternatively you can omit all of this and perform a read as no specific address.\n\nThe `func` query parameter accepts a complete function signature with parameters, such as `getCount()` or `readCounter(address,uint256)`, or a known function name without parameters if a contractId was provided for `contractIdOrAddress` and the contract's ABI is known. Such as `readCounter`.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/pathContractIdOrAddress"},{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"},{"$ref":"#/components/parameters/headerAuthorizationSessionOptional"},{"$ref":"#/components/parameters/headerAuthorizationUserOptional"},{"$ref":"#/components/parameters/queryChain"},{"$ref":"#/components/parameters/queryFunc"},{"$ref":"#/components/parameters/queryArgs"},{"$ref":"#/components/parameters/queryAs"}],"responses":{"200":{"description":"Returns the result of the contract read as a string.","content":{"application/json":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/sessions":{"delete":{"operationId":"endSession","summary":"End session","description":"Ends all active sessions for a given user. This endpoint is flexible and can end sessions in a number of ways. An app can end any user's sessions of their app directly, or a user can end their own sessions for an app, or a session access token can be used to end its associated session.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUserOptional"},{"$ref":"#/components/parameters/headerAuthorizationSessionOptional"},{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"appId":{"type":"string","description":"If the `X-App-Authorization` or `X-Session-Authorization` header is not set, `appId` must be provided to indicate the application for which to end user sessions for."},"userId":{"type":"string","description":"If the user's `X-Authorization` or `X-Session-Authorization` header is not set, `userId` must be provided to indicate the user for which to end sessions for."},"chain":{"type":"string","description":"The chain to end sessions for.","enum":["HYCHAIN","HYCHAIN_TESTNET","LOCAL"]}},"required":["chain"]}}}},"responses":{"204":{"description":"Returns an empty response indicating the session has been ended."},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/sessions/token":{"post":{"operationId":"grantSessionToken","summary":"Grant session token","description":"Returns a session object with a valid access token when the associated exchangeCode and application authorized by using its secret key is provided.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationAppSecret"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"exchangeCode":{"type":"string","description":"An unused exchange code associated with the provided session id. Exchange codes can only be used once and then become invalid."}},"required":["exchangeCode"]}}}},"responses":{"200":{"description":"Returns an updated session object with an `accessToken` set.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/templates":{"get":{"operationId":"getTemplates","summary":"Get templates","description":"Returns an array of templates. Templates can be used to quickly deploy contracts to HYCHAIN and HYCHAIN_TESTNET. Templates can also be reviewed and approved by the HYPLAY team to be made available for anyone to deploy. Templates that are not approved can be deployed by anyone to HYCHAIN_TESTNET, and only deployed by the creator to HYCHAIN mainnet.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/queryUserId"},{"$ref":"#/components/parameters/queryTemplateName"},{"$ref":"#/components/parameters/queryTemplateApproved"}],"responses":{"200":{"description":"Returns an array of template objects.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TemplateModel"}}}}},"400":{"$ref":"#/components/responses/400"}}},"post":{"operationId":"createTemplate","summary":"Create template","description":"Creates a new template. Templates can be used to quickly deploy pre-approved types of contracts to HYCHAIN and HYCHAIN_TESTNET.","tags":["Contracts"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"The name of the template."},"description":{"type":"string","description":"A description of the template."},"solidity":{"type":"string","description":"The solidity source code of the template to compile. This must be a flattened contract with all imports inlined."},"target":{"type":"string","description":"The contract from the inlined solidity source code that is intended to be deployed for this template.","example":"MyErc20Contract"}},"required":["name","solidity","target"]}}}},"responses":{"200":{"description":"Returns the created template object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/templates/{templateId}":{"get":{"operationId":"getTemplate","summary":"Get template","description":"Returns a template object with abi, bytecode and compilation errors or warnings included.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/pathTemplateId"}],"responses":{"200":{"description":"Returns a template object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateModel"}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/transactions":{"get":{"operationId":"getTransactions","summary":"Get transactions","description":"Returns an array of transactions for the provided appId, sessionId, userId or walletId. Transactions are returned in descending order of creation date.","tags":["Transactions"],"parameters":[{"$ref":"#/components/parameters/queryAppId"},{"$ref":"#/components/parameters/querySessionId"},{"$ref":"#/components/parameters/queryUserId"},{"$ref":"#/components/parameters/queryWalletId"},{"$ref":"#/components/parameters/queryChain"}],"responses":{"200":{"description":"Returns an array of transaction objects.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TransactionModel"}}}}},"400":{"$ref":"#/components/responses/400"}}},"post":{"operationId":"createTransaction","summary":"Create transaction","description":"Create and submit a transaction to the target contract id or address. Transactions are submitted on behalf of the authorization type used, such as an app, user or user via a user's session.\n\nTransaction submission supports contract function invocation and native transfers to contracts or externally owned accounts (EOAs).\n\nThis endpoint is designed to be highly flexible. Please refer to the HYCHAIN guides and documentation for detailed examples of the many ways this endpoint can be used.","tags":["Transactions"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"},{"$ref":"#/components/parameters/headerAuthorizationSessionOptional"},{"$ref":"#/components/parameters/headerAuthorizationUserOptional"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"contractId":{"type":"string","description":"The contract id to target."},"address":{"type":"string","description":"The address to target."},"func":{"type":"string","description":"The function name or function signature of the contract."},"args":{"type":"array","description":"An array of arguments to pass to the function.","items":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]}}]}},"value":{"type":"number","description":"The amount of native token to send with the transaction."},"nonce":{"type":"string","description":"The nonce of the transaction."},"deadline":{"type":"number","description":"The deadline for the transaction as a timestamp in seconds."},"signatures":{"type":"array","description":"An array of signatures for the transaction.","items":{"type":"string"}},"chain":{"type":"string","description":"The chain the session is to be started for.","enum":["HYCHAIN","HYCHAIN_TESTNET","LOCAL"]}}}}}},"responses":{"200":{"description":"Returns a transaction object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/transactions/{transactionId}":{"get":{"operationId":"getTransaction","summary":"Get transaction","description":"Returns a transaction object for the provided transactionId.","tags":["Transactions"],"parameters":[{"$ref":"#/components/parameters/pathTransactionId"}],"responses":{"200":{"description":"Returns a transaction object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionModel"}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/users":{"get":{"operationId":"getUser","summary":"Get user","description":"Returns a public user object when provided a username.","tags":["Users"],"parameters":[{"$ref":"#/components/parameters/queryUsername"}],"responses":{"200":{"description":"Returns a public user object.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/UserModel"},{"type":"object","properties":{"preregistered":{"type":"boolean"}}},{"type":"object","properties":{"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/users/me":{"get":{"operationId":"getCurrentUser","summary":"Get current user","description":"Returns a public user object associated with the provided session access token.","tags":["Users"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationSession"}],"responses":{"200":{"description":"Returns a public user object.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/UserModel"},{"type":"object","properties":{"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/wallets/{walletIdOrAddress}":{"get":{"operationId":"getWallet","summary":"Get wallet","description":"Returns a wallet object for the provided walletIdOrAddress. If walletIdOrAddress is a HYCHAIN system wallet id, it will return a matching wallet for the id. If walletIdOrAddress is a on chain smart contract wallet address, it will return a matching wallet from the HYCHAIN system. If a wallet is not found in HYCHAIN's systems for the address or walletId provided, a 400 error will be returned.","tags":["Wallets"],"parameters":[{"$ref":"#/components/parameters/pathWalletIdOrAddress"}],"responses":{"200":{"description":"Returns a wallet object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WalletModel"}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/wallets/{walletIdOrAddress}/balance":{"get":{"operationId":"getWalletBalance","summary":"Get wallet balance","description":"Returns the native token balance for the smart contract wallet associated with a wallet id provided for walletIdOrAddress. Or, if any address is provided for walletIdOrAddress, it will return the native token balance for the address.","tags":["Wallets"],"parameters":[{"$ref":"#/components/parameters/pathWalletIdOrAddress"},{"$ref":"#/components/parameters/queryChain"}],"responses":{"200":{"description":"Returns the native token balance for the wallet in readable string format. For example a 1e18 balance would be '1.0'.","content":{"application/json":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/400"}}}}}} \ No newline at end of file +{"openapi":"3.0.0","info":{"title":"HYPLAY API","version":"1.0.0","description":"HYPLAY API Specification","termsOfService":"https://hyplay.com","contact":{"name":"HYCHAIN Team","email":"braydon@hytopia.com","url":"https://hychain.com"}},"servers":[{"description":"HYPLAY API Server","url":"https://api.hyplay.com"},{"description":"HYPLAY API Staging Server","url":"https://staging-api.hyplay.com"},{"description":"Local Development Server","url":"http://localhost:8001"}],"components":{"parameters":{"headerAuthorizationUser":{"name":"x-authorization","in":"header","description":"The `accessToken` of the authenticating user.","example":"user_at_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP","required":true,"schema":{"type":"string"}},"headerAuthorizationUserOptional":{"name":"x-authorization","in":"header","description":"The `accessToken` of the authenticating user.","example":"user_at_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP","required":false,"schema":{"type":"string"}},"headerAuthorizationAppSecret":{"name":"x-app-authorization","in":"header","description":"The `secretKey` or `testSecretKey` of the authenticating app.","example":"test_app_sk_pBEHOVTIZjQFT6WpiQLT8c_VFfd6Vb2XHj_9IIV8-Zi06SdMIruJxIe2QMaca_X6","required":true,"schema":{"type":"string"}},"headerAuthorizationAppSecretOptional":{"name":"x-app-authorization","in":"header","description":"The `secretKey` or `testSecretKey` of the authenticating app.","example":"test_app_sk_pBEHOVTIZjQFT6WpiQLT8c_VFfd6Vb2XHj_9IIV8-Zi06SdMIruJxIe2QMaca_X6","required":false,"schema":{"type":"string"}},"headerAuthorizationSession":{"name":"x-session-authorization","in":"header","description":"The `accessToken` of the authenticating session.","example":"sca_sat_pBEHOVTIZjQFT6WpiQLT8c_VFfd6Vb2XHj_9IIV8-Zi06SdMIruJxIe2QMaca_X6","required":true,"schema":{"type":"string"}},"headerAuthorizationSessionOptional":{"name":"x-session-authorization","in":"header","description":"The `accessToken` of the authenticating session.","example":"sca_sat_pBEHOVTIZjQFT6WpiQLT8c_VFfd6Vb2XHj_9IIV8-Zi06SdMIruJxIe2QMaca_X6","required":false,"schema":{"type":"string"}},"headerAuthorizationNonce":{"name":"x-nonce","in":"header","description":"The nonce of the authenticating user.","required":true,"schema":{"type":"string"}},"headerAuthorizationNonceSignature":{"name":"x-nonce-signature","in":"header","description":"The nonce signature of the authenticating user.","required":true,"schema":{"type":"string"}},"pathAppId":{"name":"appId","in":"path","description":"An application id.","required":true,"schema":{"type":"string"}},"pathAssetId":{"name":"assetId","in":"path","description":"An asset id.","required":true,"schema":{"type":"string"}},"pathContractId":{"name":"contractId","in":"path","description":"A contract id.","required":true,"schema":{"type":"string"}},"pathContractIdOrAddress":{"name":"contractIdOrAddress","in":"path","description":"A contract id or address.","required":true,"schema":{"type":"string"}},"pathSessionId":{"name":"sessionId","in":"path","description":"A session id.","required":true,"schema":{"type":"string"}},"pathTemplateId":{"name":"templateId","in":"path","description":"A template id.","required":true,"schema":{"type":"string"}},"pathTransactionId":{"name":"transactionId","in":"path","description":"A transaction id.","required":true,"schema":{"type":"string"}},"pathUserId":{"name":"userId","in":"path","description":"A user id.","required":true,"schema":{"type":"string"}},"pathWalletIdOrAddress":{"name":"walletIdOrAddress","in":"path","description":"A wallet id or address.","required":true,"schema":{"type":"string"}},"queryAccessTokenExpiresAt":{"name":"accessTokenExpiresAt","in":"query","description":"An optional unix timestamp in seconds specifying when the returned `accessToken` should expire. If this value is provided, all prior `accessToken` will be invalidated and a new `accessToken` will be issued in the response. If no value is provided, the returned `accessToken` will not expire unless it is invalidated.","example":1677197460,"required":false,"schema":{"type":"number"}},"queryAppId":{"name":"appId","in":"query","description":"An application id.","required":false,"schema":{"type":"string"}},"queryArgs":{"name":"args","in":"query","description":"An array of arguments.","required":false,"schema":{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]}}]}}},"queryAs":{"name":"as","in":"query","description":"An address or walletId to perform as.","required":false,"schema":{"type":"string"}},"queryChain":{"name":"chain","in":"query","description":"A chain name.","required":false,"schema":{"type":"string","enum":["HYCHAIN","HYCHAIN_TESTNET","LOCAL"]}},"queryFunc":{"name":"func","in":"query","description":"A function name or function signature.","required":true,"schema":{"type":"string"}},"queryDiscordAuthCode":{"name":"discordAuthCode","in":"query","description":"A Discord OAuth 2.0 code.","required":false,"schema":{"type":"string"}},"queryFacebookAuthCode":{"name":"facebookAuthCode","in":"query","description":"A Facebook OAuth 2.0 code.","required":false,"schema":{"type":"string"}},"queryGoogleAuthCode":{"name":"googleAuthCode","in":"query","description":"A Google OAuth 2.0 code.","required":false,"schema":{"type":"string"}},"queryTwitterAuthCode":{"name":"twitterAuthCode","in":"query","description":"A Twitter OAuth 2.0 code.","required":false,"schema":{"type":"string"}},"queryTemplateApproved":{"name":"approved","in":"query","description":"Set this query parameter to `true` to filter for approved templates.","example":"true","required":false,"schema":{"type":"string"}},"queryTemplateName":{"name":"name","in":"query","description":"A template name to partially or exactly match.","example":"token","required":false,"schema":{"type":"string"}},"queryResetAccessToken":{"name":"resetAccessToken","in":"query","description":"Set this query parameter to `true` to reset accessToken and authorityKey.","example":"true","required":false,"schema":{"type":"string"}},"queryRecaptchaToken":{"name":"hcaptchaResponse","in":"query","description":"A hCaptcha token generated client-side by completion of a user-facing hCaptcha request.","required":true,"schema":{"type":"string"}},"querySessionId":{"name":"sessionId","in":"query","description":"A session id.","required":false,"schema":{"type":"string"}},"queryUsername":{"name":"username","in":"query","description":"A user username.","example":"arkdev","required":false,"schema":{"type":"string"}},"queryUserId":{"name":"userId","in":"query","description":"A user id.","required":false,"schema":{"type":"string"}},"queryWalletId":{"name":"walletId","in":"query","description":"A wallet id.","required":false,"schema":{"type":"string"}},"queryStateKey":{"name":"key","in":"query","description":"A string identifier unique to an app for looking up state data.","required":false,"schema":{"type":"string"}}},"responses":{"400":{"description":"An API level error occurred. This is often due to problematic data being provided by you.","content":{"application/json":{"schema":{"type":"string"}}}},"401":{"description":"An authorization error occured. This is often due to incorrect tokens or keys being provided, or accessing a resource that the provided tokens or keys do not have access to.","content":{"application/json":{"schema":{"type":"string"}}}}},"schemas":{"AppModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"userId":{"type":"string","description":"This field has not had a description added."},"walletId":{"type":"string","description":"This field has not had a description added."},"iconImageAssetId":{"type":"string","description":"This field has not had a description added."},"backgroundImageAssetId":{"type":"string","description":"This field has not had a description added."},"logoImageAssetId":{"type":"string","description":"This field has not had a description added."},"secretKey":{"type":"string","description":"This field has not had a description added."},"testSecretKey":{"type":"string","description":"This field has not had a description added."},"name":{"type":"string","description":"This field has not had a description added."},"description":{"type":"string","description":"This field has not had a description added."},"url":{"type":"string","description":"This field has not had a description added."},"discordUrl":{"type":"string","description":"This field has not had a description added."},"redirectUris":{"type":"object","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"AppReferralsModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"appId":{"type":"string","description":"This field has not had a description added."},"referredUserId":{"type":"string","description":"This field has not had a description added."},"referrerUserId":{"type":"string","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"AssetModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"userId":{"type":"string","description":"This field has not had a description added."},"s3Url":{"type":"string","description":"This field has not had a description added."},"cdnUrl":{"type":"string","description":"This field has not had a description added."},"mime":{"type":"string","description":"This field has not had a description added."},"extension":{"type":"string","description":"This field has not had a description added."},"checksum":{"type":"string","description":"This field has not had a description added."},"size":{"type":"integer","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"ContractModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"userId":{"type":"string","description":"This field has not had a description added."},"templateId":{"type":"string","description":"This field has not had a description added."},"chain":{"type":"string","description":"This field has not had a description added."},"abi":{"type":"object","description":"This field has not had a description added."},"address":{"type":"string","description":"This field has not had a description added."},"name":{"type":"string","description":"This field has not had a description added."},"description":{"type":"string","description":"This field has not had a description added."},"metadata":{"type":"object","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"NonceModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"walletId":{"type":"string","description":"This field has not had a description added."},"nonce":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"SessionModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"appId":{"type":"string","description":"This field has not had a description added."},"userId":{"type":"string","description":"This field has not had a description added."},"chain":{"type":"string","description":"This field has not had a description added."},"accessToken":{"type":"string","description":"This field has not had a description added."},"exchangeCode":{"type":"string","description":"This field has not had a description added."},"contractFunctionSelectors":{"type":"object","description":"This field has not had a description added."},"nativeAllowance":{"type":"string","description":"This field has not had a description added."},"erc20Allowances":{"type":"object","description":"This field has not had a description added."},"erc721Allowances":{"type":"object","description":"This field has not had a description added."},"erc1155Allowances":{"type":"object","description":"This field has not had a description added."},"nonce":{"type":"string","description":"This field has not had a description added."},"signatures":{"type":"object","description":"This field has not had a description added."},"deadline":{"type":"string","description":"This field has not had a description added."},"expiresAt":{"type":"string","description":"This field has not had a description added."},"endedAt":{"type":"string","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"TemplateModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"userId":{"type":"string","description":"This field has not had a description added."},"name":{"type":"string","description":"This field has not had a description added."},"description":{"type":"string","description":"This field has not had a description added."},"solidity":{"type":"string","description":"This field has not had a description added."},"target":{"type":"string","description":"This field has not had a description added."},"bytecode":{"type":"string","description":"This field has not had a description added."},"abi":{"type":"object","description":"This field has not had a description added."},"errors":{"type":"object","description":"This field has not had a description added."},"approved":{"type":"boolean","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"TransactionModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"walletId":{"type":"string","description":"This field has not had a description added."},"sessionId":{"type":"string","description":"This field has not had a description added."},"chain":{"type":"string","description":"This field has not had a description added."},"relayerAddress":{"type":"string","description":"This field has not had a description added."},"func":{"type":"string","description":"This field has not had a description added."},"args":{"type":"object","description":"This field has not had a description added."},"value":{"type":"string","description":"This field has not had a description added."},"hash":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"UserModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"walletId":{"type":"string","description":"This field has not had a description added."},"username":{"type":"string","description":"This field has not had a description added."},"email":{"type":"string","description":"This field has not had a description added."},"phone":{"type":"string","description":"This field has not had a description added."},"discordId":{"type":"string","description":"This field has not had a description added."},"facebookId":{"type":"string","description":"This field has not had a description added."},"googleId":{"type":"string","description":"This field has not had a description added."},"microsoftId":{"type":"string","description":"This field has not had a description added."},"twitterId":{"type":"string","description":"This field has not had a description added."},"accessToken":{"type":"string","description":"This field has not had a description added."},"isChild":{"type":"boolean","description":"This field has not had a description added."},"accessTokenExpiresAt":{"type":"string","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"WalletModel":{"type":"object","properties":{"id":{"type":"string","description":"This field has not had a description added."},"type":{"type":"string","description":"This field has not had a description added."},"address":{"type":"string","description":"This field has not had a description added."},"authorityCiphertext":{"type":"string","description":"This field has not had a description added."},"authorityBackupCiphertexts":{"type":"object","description":"This field has not had a description added."},"authorityProofSignature":{"type":"string","description":"This field has not had a description added."},"backupQuestions":{"type":"object","description":"This field has not had a description added."},"updatedAt":{"type":"string","description":"This field has not had a description added."},"createdAt":{"type":"string","description":"This field has not had a description added."}}},"AnyValue":{"description":"Can be anything. String, number, object, array, boolean, etc."}},"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic","description":"Basic authentication must be send in the format of usernameOrEmail:shaPassword, where usernameOrEmail can be the username or email associated with an account, andshaPassword is a sha256 hash of the users provided plaintext password."}}},"tags":[{"name":"Users","description":"User related operations"}],"paths":{"/v1/apps":{"get":{"operationId":"getApps","summary":"Get apps","description":"Returns an array of apps owned by the authorized user, or public apps across HYPLAY if no authorization is provided.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUserOptional"}],"responses":{"200":{"description":"Returns an array of apps owned by the authorized user or public apps across HYPLAY if no authorization is provided.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/AppModel"},{"type":"object","properties":{"iconImageAsset":{"$ref":"#/components/schemas/AssetModel"},"backgroundImageAsset":{"$ref":"#/components/schemas/AssetModel"},"logoImageAsset":{"$ref":"#/components/schemas/AssetModel"},"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}},"post":{"operationId":"createApp","summary":"Create app","description":"Create a new app for the authorized user.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"iconImageAssetId":{"type":"string","description":"The assetId of the icon image. Icon images are recommended to be a 1:1 aspect ratio and at least 512x512 pixels."},"backgroundImageAssetId":{"type":"string","description":"The assetId of the background image. Background images are recommended to be a 16:9 aspect ratio and at least 1920x1080 pixels."},"logoImageAssetId":{"type":"string","description":"The assetId of the logo image. Logo image are used on pages like preregistration, questing, etc and can be any aspect ratio."},"name":{"type":"string","description":"The name of the app."},"description":{"type":"string","description":"A brief description of the app and what it is and does."},"url":{"type":"string","description":"The URL of the app, such as its website or where users can learn more about it."},"discordUrl":{"type":"string","description":"The URL of the app's Discord server."},"redirectUris":{"type":"array","description":"An array of valid redirect URIs for the user authorization flows of the app.","items":{"type":"string"}}},"required":["iconImageAssetId","backgroundImageAssetId","name","description","redirectUris"]}}}},"responses":{"200":{"description":"Successfully created a new app. Returns an app object.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/AppModel"},{"type":"object","properties":{"iconImageAsset":{"$ref":"#/components/schemas/AssetModel"},"backgroundImageAsset":{"$ref":"#/components/schemas/AssetModel"},"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/apps/{appId}":{"get":{"operationId":"getPublicApp","summary":"Get public app","description":"Return a public app object for the provided appId.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/pathAppId"}],"responses":{"200":{"description":"Returns a public app object.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/AppModel"},{"type":"object","properties":{"iconImageAsset":{"$ref":"#/components/schemas/AssetModel"},"backgroundImageAsset":{"$ref":"#/components/schemas/AssetModel"},"logoImageAsset":{"$ref":"#/components/schemas/AssetModel"},"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"}}},"patch":{"operationId":"updateApp","summary":"Update app","description":"Update an app owned by the authorized user for the provided appId.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"},{"$ref":"#/components/parameters/pathAppId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"iconImageAssetId":{"type":"string","description":"The assetId of the icon image."},"backgroundImageAssetId":{"type":"string","description":"The assetId of the background image."},"logoImageAssetId":{"type":"string","description":"The assetId of the logo image."},"name":{"type":"string","description":"The name of the app."},"description":{"type":"string","description":"A brief description of the app and what it is and does."},"url":{"type":"string","description":"The URL of the app, such as its website or where users can learn more about it."},"discordUrl":{"type":"string","description":"The URL of the app's Discord server."},"redirectUris":{"type":"array","description":"An array of valid redirect URIs for the user authorization flows of the app.","items":{"type":"string"}},"resetSecretKey":{"type":"boolean","description":"If true, reset the secretKey of the app."},"resetTestSecretKey":{"type":"boolean","description":"If true, reset the testSecretKey of the app."}}}}}},"responses":{"200":{"description":"Returns the updated app object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/apps/{appId}/states":{"get":{"operationId":"getAppState","summary":"Get app state","description":"Get the public, protected, private state of an app, user or key.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/pathAppId"},{"$ref":"#/components/parameters/queryStateKey"},{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"},{"$ref":"#/components/parameters/headerAuthorizationSessionOptional"}],"responses":{"200":{"description":"Returns a state object that may contain public, protected, and/or private state for the app, key or user for the authorized user session.","content":{"application/json":{"schema":{"type":"object","properties":{"publicState":{"type":"object","description":"Public state data for the app or user."},"protectedState":{"type":"object","description":"Protected state data for the app or user."},"privateState":{"type":"object","description":"Private state data for the app or user."}},"required":["public","protected"]}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}},"post":{"operationId":"setAppState","summary":"Set app state","description":"Set arbitrary JSON blobs for public, protected and/or private state specific to an application or authorized user of an application. This is useful for saving different types of data specific to users or global configuration of your app or game in many different situations. It is intended to be highly flexible. State set for a user of your app, a unique lookup key, and the app itself are all isolated to your application. State storage is not globablly shared between applications.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/pathAppId"},{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"},{"$ref":"#/components/parameters/headerAuthorizationSessionOptional"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","description":"Any unique lookup key for this data. This can be things such as a hyplay user id, an internal battle match id for your game, some arbitrary settings identifier for a system of your app and more. Keys are flexible ways to create string based lookup identifiers for data you want to store/lookup. Keys are unique to your application and are not shared globally."},"publicState":{"type":"object","description":"Public state data to set for the app or user."},"protectedState":{"type":"object","description":"Protected state data to set for the app or user."},"privateState":{"type":"object","description":"Private state data to set for the app or user."},"overwrite":{"type":"boolean","description":"If true, the state will be overwritten with the provided state. If false or omitted, the state will be deep merged with the provided state."}}}}}},"responses":{"200":{"description":"Returns a state object that may contain public, protected, and/or private state for the app, or user of the app for the provided userId.","content":{"application/json":{"schema":{"type":"object","properties":{"publicState":{"type":"object","description":"Public state data for the app or user."},"protectedState":{"type":"object","description":"Protected state data for the app or user."},"privateState":{"type":"object","description":"Private state data for the app or user."}},"required":["publicState","protectedState"]}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/apps/{appId}/users":{"get":{"operationId":"getAppUsers","summary":"Get app users","description":"Returns an array of public users objects representing users of the apps. A HYPLAY user is considered a user of the app if they have had at least 1 active session for the provided appId.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/pathAppId"},{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"}],"responses":{"200":{"description":"Returns an array of public user objects.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/UserModel"},{"type":"object","properties":{"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/apps/{appId}/users/{userId}":{"get":{"operationId":"getAppUser","summary":"Get app user","description":"Returns a public user object representing a user of the app that also includes the `totalAppReferrals` property which represents the number of other users the user for the provided userId has referred to the provided appId.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/pathAppId"},{"$ref":"#/components/parameters/pathUserId"}],"responses":{"200":{"description":"Returns a public user object that includes a `totalAppReferrals` property.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/UserModel"},{"type":"object","properties":{"wallet":{"$ref":"#/components/schemas/WalletModel"}}},{"type":"object","properties":{"totalAppReferrals":{"type":"integer"}}}]}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/assets":{"get":{"operationId":"getAssets","summary":"Get assets","description":"Returns an array of assets that have been uploaded by the authorized user ordered by most recent creation.","tags":["Assets"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"responses":{"200":{"description":"Returns an array of asset objects.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AssetModel"}}}}},"400":{"$ref":"#/components/responses/400"}}},"post":{"operationId":"createAsset","summary":"Create asset","description":"Create an asset object by uploading a file in base64. Returns an asset object.","tags":["Assets"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"fileBase64":{"type":"string","description":"The base64 string of the asset being uploaded. Uploads may not exceed 5mb."}}}}}},"responses":{"200":{"description":"Returns a created asset object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetModel"}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/assets/{assetId}":{"get":{"operationId":"getAsset","summary":"Get asset","description":"Return an asset object that has been uploaded by the authorized user for the provided assetId.","tags":["Assets"],"parameters":[{"$ref":"#/components/parameters/pathAssetId"},{"$ref":"#/components/parameters/headerAuthorizationUser"}],"responses":{"200":{"description":"Returns an asset object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetModel"}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/contracts":{"get":{"operationId":"getOwnedContracts","summary":"Get owned contracts","description":"Returned an array of contracts owned by the authorized user.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"responses":{"200":{"description":"Returns an array of contracts owned by the authorized user.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ContractModel"}}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}},"post":{"operationId":"createContract","summary":"Create contract","description":"Creates a new contract for the authorized user.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"chain":{"type":"string","description":"The chain the contract is deployed on.","enum":["HYCHAIN","HYCHAIN_TESTNET","LOCAL"]},"abi":{"type":"string","format":"json","description":"JSON string of the contract's ABI."},"address":{"type":"string","description":"The contract's address."},"name":{"type":"string","description":"The contract's name."},"description":{"type":"string","description":"A description of the contract."},"metadata":{"type":"string","format":"json","description":"A JSON string of metadata for the contract."}},"required":["chain","abi","address"]}}}},"responses":{"200":{"description":"Successfully created a new contract. Returns a contract object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/contracts/{contractId}":{"get":{"operationId":"getContract","summary":"Get contract","description":"Returns a contract object for the provided contractId.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/pathContractId"}],"responses":{"200":{"description":"Returns a contract object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractModel"}}}},"400":{"$ref":"#/components/responses/400"}}},"patch":{"operationId":"updateContract","summary":"Update contract","description":"Updates a contract owned by the authorized user for the provided contractId.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"},{"$ref":"#/components/parameters/pathContractId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"abi":{"type":"string","format":"json","description":"JSON string of the contract's ABI."},"name":{"type":"string","description":"The contract's name. Named contracts are easier for users to identify during app or game authorization flows through HYPLAY."},"description":{"type":"string","description":"A description of the contract and what it does."},"metadata":{"type":"string","format":"json","description":"A JSON string of arbitrary metadata for the contract. May be used by developers for a variety of reasons."}}}}}},"responses":{"200":{"description":"Returns the updated contract object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/contracts/{contractIdOrAddress}/read":{"get":{"operationId":"readContract","summary":"Read contract","description":"Get the value from a read function of a target contract. This endpoint is designed to be highly flexible. It can read any contract by providing a contract address for `contractIdOrAddress`. It can also read using contracts created in the HYCHAIN systems through the `POST /v1/contracts` endpoint, which will utilize the contract's ABI.\n\nAdditionally, reads can be performed as a HYCHAIN app, user or user's session provided, through header authorization, or any arbitrary address or walletId provided through the `as` query parameter. Alternatively you can omit all of this and perform a read as no specific address.\n\nThe `func` query parameter accepts a complete function signature with parameters, such as `getCount()` or `readCounter(address,uint256)`, or a known function name without parameters if a contractId was provided for `contractIdOrAddress` and the contract's ABI is known. Such as `readCounter`.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/pathContractIdOrAddress"},{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"},{"$ref":"#/components/parameters/headerAuthorizationSessionOptional"},{"$ref":"#/components/parameters/headerAuthorizationUserOptional"},{"$ref":"#/components/parameters/queryChain"},{"$ref":"#/components/parameters/queryFunc"},{"$ref":"#/components/parameters/queryArgs"},{"$ref":"#/components/parameters/queryAs"}],"responses":{"200":{"description":"Returns the result of the contract read as a string.","content":{"application/json":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/sessions":{"delete":{"operationId":"endSession","summary":"End session","description":"Ends all active sessions for a given user. This endpoint is flexible and can end sessions in a number of ways. An app can end any user's sessions of their app directly, or a user can end their own sessions for an app, or a session access token can be used to end its associated session.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUserOptional"},{"$ref":"#/components/parameters/headerAuthorizationSessionOptional"},{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"appId":{"type":"string","description":"If the `X-App-Authorization` or `X-Session-Authorization` header is not set, `appId` must be provided to indicate the application for which to end user sessions for."},"userId":{"type":"string","description":"If the user's `X-Authorization` or `X-Session-Authorization` header is not set, `userId` must be provided to indicate the user for which to end sessions for."},"chain":{"type":"string","description":"The chain to end sessions for.","enum":["HYCHAIN","HYCHAIN_TESTNET","LOCAL"]}},"required":["chain"]}}}},"responses":{"204":{"description":"Returns an empty response indicating the session has been ended."},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/sessions/token":{"post":{"operationId":"grantSessionToken","summary":"Grant session token","description":"Returns a session object with a valid access token when the associated exchangeCode and application authorized by using its secret key is provided.","tags":["Apps"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationAppSecret"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"exchangeCode":{"type":"string","description":"An unused exchange code associated with the provided session id. Exchange codes can only be used once and then become invalid."}},"required":["exchangeCode"]}}}},"responses":{"200":{"description":"Returns an updated session object with an `accessToken` set.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/templates":{"get":{"operationId":"getTemplates","summary":"Get templates","description":"Returns an array of templates. Templates can be used to quickly deploy contracts to HYCHAIN and HYCHAIN_TESTNET. Templates can also be reviewed and approved by the HYPLAY team to be made available for anyone to deploy. Templates that are not approved can be deployed by anyone to HYCHAIN_TESTNET, and only deployed by the creator to HYCHAIN mainnet.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/queryUserId"},{"$ref":"#/components/parameters/queryTemplateName"},{"$ref":"#/components/parameters/queryTemplateApproved"}],"responses":{"200":{"description":"Returns an array of template objects.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TemplateModel"}}}}},"400":{"$ref":"#/components/responses/400"}}},"post":{"operationId":"createTemplate","summary":"Create template","description":"Creates a new template. Templates can be used to quickly deploy pre-approved types of contracts to HYCHAIN and HYCHAIN_TESTNET.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationUser"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"The name of the template."},"description":{"type":"string","description":"A description of the template."},"solidity":{"type":"string","description":"The solidity source code of the template to compile. This must be a flattened contract with all imports inlined."},"target":{"type":"string","description":"The contract from the inlined solidity source code that is intended to be deployed for this template.","example":"MyErc20Contract"}},"required":["name","solidity","target"]}}}},"responses":{"200":{"description":"Returns the created template object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/templates/{templateId}":{"get":{"operationId":"getTemplate","summary":"Get template","description":"Returns a template object with abi, bytecode and compilation errors or warnings included.","tags":["Contracts"],"parameters":[{"$ref":"#/components/parameters/pathTemplateId"}],"responses":{"200":{"description":"Returns a template object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateModel"}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/transactions":{"get":{"operationId":"getTransactions","summary":"Get transactions","description":"Returns an array of transactions for the provided appId, sessionId, userId or walletId. Transactions are returned in descending order of creation date.","tags":["Transactions"],"parameters":[{"$ref":"#/components/parameters/queryAppId"},{"$ref":"#/components/parameters/querySessionId"},{"$ref":"#/components/parameters/queryUserId"},{"$ref":"#/components/parameters/queryWalletId"},{"$ref":"#/components/parameters/queryChain"}],"responses":{"200":{"description":"Returns an array of transaction objects.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TransactionModel"}}}}},"400":{"$ref":"#/components/responses/400"}}},"post":{"operationId":"createTransaction","summary":"Create transaction","description":"Create and submit a transaction to the target contract id or address. Transactions are submitted on behalf of the authorization type used, such as an app, user or user via a user's session.\n\nTransaction submission supports contract function invocation and native transfers to contracts or externally owned accounts (EOAs).\n\nThis endpoint is designed to be highly flexible. Please refer to the HYCHAIN guides and documentation for detailed examples of the many ways this endpoint can be used.","tags":["Transactions"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationAppSecretOptional"},{"$ref":"#/components/parameters/headerAuthorizationSessionOptional"},{"$ref":"#/components/parameters/headerAuthorizationUserOptional"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"contractId":{"type":"string","description":"The contract id to target."},"address":{"type":"string","description":"The address to target."},"func":{"type":"string","description":"The function name or function signature of the contract."},"args":{"type":"array","description":"An array of arguments to pass to the function.","items":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]}}]}},"value":{"type":"number","description":"The amount of native token to send with the transaction."},"nonce":{"type":"string","description":"The nonce of the transaction."},"deadline":{"type":"number","description":"The deadline for the transaction as a timestamp in seconds."},"signatures":{"type":"array","description":"An array of signatures for the transaction.","items":{"type":"string"}},"chain":{"type":"string","description":"The chain the session is to be started for.","enum":["HYCHAIN","HYCHAIN_TESTNET","LOCAL"]}}}}}},"responses":{"200":{"description":"Returns a transaction object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionModel"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}},"/v1/transactions/{transactionId}":{"get":{"operationId":"getTransaction","summary":"Get transaction","description":"Returns a transaction object for the provided transactionId.","tags":["Transactions"],"parameters":[{"$ref":"#/components/parameters/pathTransactionId"}],"responses":{"200":{"description":"Returns a transaction object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionModel"}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/users":{"get":{"operationId":"getUser","summary":"Get user","description":"Returns a public user object when provided a username.","tags":["Users"],"parameters":[{"$ref":"#/components/parameters/queryUsername"}],"responses":{"200":{"description":"Returns a public user object.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/UserModel"},{"type":"object","properties":{"preregistered":{"type":"boolean"}}},{"type":"object","properties":{"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/users/me":{"get":{"operationId":"getCurrentUser","summary":"Get current user","description":"Returns a public user object associated with the provided session access token.","tags":["Users"],"parameters":[{"$ref":"#/components/parameters/headerAuthorizationSession"}],"responses":{"200":{"description":"Returns a public user object.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/UserModel"},{"type":"object","properties":{"wallet":{"$ref":"#/components/schemas/WalletModel"}}}]}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/wallets/{walletIdOrAddress}":{"get":{"operationId":"getWallet","summary":"Get wallet","description":"Returns a wallet object for the provided walletIdOrAddress. If walletIdOrAddress is a HYCHAIN system wallet id, it will return a matching wallet for the id. If walletIdOrAddress is a on chain smart contract wallet address, it will return a matching wallet from the HYCHAIN system. If a wallet is not found in HYCHAIN's systems for the address or walletId provided, a 400 error will be returned.","tags":["Wallets"],"parameters":[{"$ref":"#/components/parameters/pathWalletIdOrAddress"}],"responses":{"200":{"description":"Returns a wallet object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WalletModel"}}}},"400":{"$ref":"#/components/responses/400"}}}},"/v1/wallets/{walletIdOrAddress}/balance":{"get":{"operationId":"getWalletBalance","summary":"Get wallet balance","description":"Returns the native token balance for the smart contract wallet associated with a wallet id provided for walletIdOrAddress. Or, if any address is provided for walletIdOrAddress, it will return the native token balance for the address.","tags":["Wallets"],"parameters":[{"$ref":"#/components/parameters/pathWalletIdOrAddress"},{"$ref":"#/components/parameters/queryChain"}],"responses":{"200":{"description":"Returns the native token balance for the wallet in readable string format. For example a 1e18 balance would be '1.0'.","content":{"application/json":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/400"}}}}}} \ No newline at end of file