Skip to content

Backend for creating and minting phygitals in a user-friendly way by using an app specific controller key.

Notifications You must be signed in to change notification settings

Tuszy/phygital-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Phygital Backend

Backend is used by the Phygital App to create, mint, transfer and verify ownership of phygitals in a user-friendly way by utilizing an app specific key manager controller. This way the user does not have to sign every transaction manually on the browser. But before the backend can execute the transactions for the requesting universal profile, the necessary permissions must be set through the Frontend. Furthermore the Frontend must login the Universal Profile with Log-In With UP to retrieve a JWT (valid for 24 hours) to send authenticated universal profile bound requests to the backend.

Deployment

  1. Testnet: https://phygital-backend.tuszy.com

Controller

0xAc11803507C05A21daAF9D354F7100B1dC9CD590

Login

Endpoints


/api/login

HTTP POST REQUEST

{ 
    "universal_profile_address": string,
    "signature": string,
    "hash": string
}

HTTP RESPONSE

Success
HTTP STATUS CODE 200 - Content-Type: application/json
{
   "token": string
}
Fail
HTTP STATUS CODE 400 - Content-Type: application/json
{ 
    "error": string | array
}

/api/verify-token

HTTP GET REQUEST WITH JWT (includes universal profile address)

NO CONTENT BODY

HTTP RESPONSE

Success
HTTP STATUS CODE 200 - Content-Type: application/json
{
   "message": "success"
}
Fail
HTTP STATUS CODE 400 - Content-Type: application/json
{ 
    "error": string | array
}
Unauthenticated / Session expired
HTTP STATUS CODE 401 - Content-Type: application/json
{ 
    "error": "Authentication session expired"
}

/api/mint

HTTP POST REQUEST WITH JWT (includes universal profile address)

{ 
    "phygital_asset_contract_address": string,
    "phygital_address": string,
    "phygital_signature": string,
}

HTTP RESPONSE

Success
HTTP STATUS CODE 200 - Content-Type: application/json
{
   <transaction receipt>
}
Fail
HTTP STATUS CODE 400 - Content-Type: application/json
{ 
    "error": string | array
}
Unauthenticated / Session expired
HTTP STATUS CODE 401 - Content-Type: application/json
{ 
    "error": "Authentication session expired"
}

/api/transfer

HTTP POST REQUEST WITH JWT (includes universal profile address)

{ 
    "to_universal_profile_address": string,
    "phygital_asset_contract_address": string,
    "phygital_address": string,
    "phygital_signature": string
}

HTTP RESPONSE

Success
HTTP STATUS CODE 200 - Content-Type: application/json
{
   <transaction receipt>
}
Fail
HTTP STATUS CODE 400 - Content-Type: application/json
{ 
    "error": string | array
}
Unauthenticated / Session expired
HTTP STATUS CODE 401 - Content-Type: application/json
{ 
    "error": "Authentication session expired"
}

/api/verify-ownership-after-transfer

HTTP POST REQUEST WITH JWT (includes universal profile address)

{ 
    "phygital_asset_contract_address": string,
    "phygital_address": string,
    "phygital_signature": string,
}

HTTP RESPONSE

Success
HTTP STATUS CODE 200 - Content-Type: application/json
{
   <transaction receipt>
}
Fail
HTTP STATUS CODE 400 - Content-Type: application/json
{ 
    "error": string | array
}
Unauthenticated / Session expired
HTTP STATUS CODE 401 - Content-Type: application/json
{ 
    "error": "Authentication session expired"
}

/api/create

HTTP POST REQUEST WITH JWT (includes universal profile address)

{ 
    "name": string,
    "symbol": string,
    "phygital_collection": string[],
    "metadata": LSP2JSONURL,
    "base_uri": string
}

HTTP RESPONSE

Success
HTTP STATUS CODE 200 - Content-Type: application/json
{ 
    "contractAddress": string
}
Fail
HTTP STATUS CODE 400 - Content-Type: application/json
{ 
    "error": string | array
}
Unauthenticated / Session expired
HTTP STATUS CODE 401 - Content-Type: application/json
{ 
    "error": "Authentication session expired"
}

About

Backend for creating and minting phygitals in a user-friendly way by using an app specific controller key.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published