API Link Game Account to Eragon

Eragon account is used to store player achievements such as EGON, POP, POS...

Create Eragon reference account

Use your user ID as "uid" to create Eragon reference account. This API return an user access token to interact with Eragon system.

Method: POST

URL:

/games/login-user

Body:

{
    "uid": string,
    "name": string
}

Header:

{
    "x-eragon-game-api-key":{APIKEY}
}

Response:

{
    "statusCode": 201,
    "time": "2024-09-13T04:07:20.814Z",
    "data": {
        "accessToken": "eyJh..."
    }
}

Get user info by access token

Get user information using user access token from above API.

Method: GET

URL:

/users/me

Header:

{
    "Authorization": "Bearer {accessToken}"
}

Response:

{
    "statusCode": 200,
    "time": "2024-09-13T04:14:07.360Z",
    "data": {
        "_id": "66a9e476895018d43745b973",
        "uid": "tele",
        "name": "test ",
        "wallets": [],
        "loginMethod": "Game",
        "status": "ACTIVE",
        "era3": 0,
        "eragonDeps": 0,
        "pot": 0,
        "potLevel": 0,
        "pos": 0,
        "posLevel": 0,
        "pop": 0,
        "popLevel": 1,
        "startMineEra3Ts": 1722410102315,
        "sessionEra3Rate": 0.0007045555,
        "sessionEra3Duration": 86400,
        "isVerifiedDeveloper": false,
        "avatarActiveTs": null,
        "avatarDieTs": 1722410102340,
        "lastCalcAvatarTs": null,
        "point": 0,
        "shield": 0,
        "lastCalcRollTicketTs": null,
        "baseRollTicket": 0,
        "spentRollTicket": 0,
        "wastedRollTicket": 0,
        "rewardRollTicket": 7,
        "rollTicketRefillTime": null,
        "lastAttackedTs": null,
        "attackOpponents": [],
        "orgAttackOpponents": [],
        "particleWallets": [],
        "particleLoginMethod": "other",
        "smartAccounts": {},
        "equipments": {
            "head": null,
            "weapon": null,
            "body": null,
            "accessory": null,
            "theme": null
        },
        "equipmentInventory": [],
        "equipmentRollTime": 0,
        "referralCode": "EGFBFW7UB5",
        "referrers": [],
        "registerDate": "2024-07-31T07:15:02.343Z",
        "newRegistRefRewardLastDate": "20240807",
        "game": "66a14648291a748b95739ee7",
        "createdAt": "2024-07-31T07:15:02.349Z",
        "updatedAt": "2024-09-13T04:07:20.804Z",
        "__v": 0,
        "aptosAddress": "0x70f83279acb22dc6d5b1c6659471481bfab8c79862aec6da624c58c097361213",
        "sessionEra3Seconds": 86400,
        "sessionEra3Value": 60.8735952,
        "rollTicket": 0,
        "maxSessionEra3Rate": 0.006341,
        "avatarBoostRate": 1,
        "giftCodeBoostRate": 1
    }
}

Get Aptos wallet

When account is created, Eragon system also create a wallet (includes private key). You can use this wallet to interact with Aptos chain.

Method: GET

URL:

/users/getAptosWallet

Header:

{
    "Authorization": "Bearer {accessToken}"
}

Response:

{
    "statusCode": 200,
    "time": "2024-09-13T04:17:03.738Z",
    "data": {
        "_id": "66e3ba78d2d6628c17ea79d4",
        "privKey": "0x78a...",
        "pubKey": "0xc37040459b4b794db654dca626",
        "address": "0x70f8...",
        "user": "66a9e476895018d43745b973",
        "uid": "tele",
        "createdAt": "2024-09-13T04:07:20.784Z",
        "updatedAt": "2024-09-13T04:07:20.784Z"
    }
}

Transfer EGON between accounts

Transfer user property between linked account

Method: POST

URL:

/users/transferEgonBetweenAccounts

Header:

{
    "Authorization": "Bearer {accessToken}"
}

Body

{
    "toAccountId":string,
    "amount":1
}

Response:

{
    "statusCode": 201,
    "time": "2024-09-13T04:21:57.091Z",
    "data": {
        "fromUser": {
            "_id": "66a9e476895018d43745b973",
            "uid": "tele",
            "name": "test ",
            "wallets": [],
            "loginMethod": "Game",
            "status": "ACTIVE",
            "era3": 0,
            "eragonDeps": 12119,
            "pot": 0,
            "potLevel": 0,
            "pos": 0,
            "posLevel": 0,
            "pop": 0,
            "popLevel": 1,
            "startMineEra3Ts": 1722410102315,
            "sessionEra3Rate": 0.0007045555,
            "sessionEra3Duration": 86400,
            "isVerifiedDeveloper": false,
            "avatarActiveTs": null,
            "avatarDieTs": 1722410102340,
            "lastCalcAvatarTs": null,
            "point": 0,
            "shield": 0,
            "lastCalcRollTicketTs": null,
            "baseRollTicket": 0,
            "spentRollTicket": 0,
            "wastedRollTicket": 0,
            "rewardRollTicket": 7,
            "rollTicketRefillTime": null,
            "lastAttackedTs": null,
            "attackOpponents": [],
            "orgAttackOpponents": [],
            "particleWallets": [],
            "particleLoginMethod": "other",
            "smartAccounts": {},
            "equipments": {
                "head": null,
                "weapon": null,
                "body": null,
                "accessory": null,
                "theme": null
            },
            "equipmentInventory": [],
            "equipmentRollTime": 0,
            "referralCode": "EGFBFW7UB5",
            "referrers": [],
            "registerDate": "2024-07-31T07:15:02.343Z",
            "newRegistRefRewardLastDate": "20240807",
            "game": "66a14648291a748b95739ee7",
            "createdAt": "2024-07-31T07:15:02.349Z",
            "updatedAt": "2024-09-13T04:21:57.070Z",
            "__v": 0,
            "aptosAddress": "0x70f83279acb22dc6d5b1c6659471481bfab8c79862aec6da624c58c097361213",
            "eragonUser": "6683b8cdc4976d0db0159ab7"
        },
        "toUser": {
            "_id": "6683b8cdc4976d0db0159ab7",
            "uid": "[email protected]",
            "email": "[email protected]",
            "name": "test",
            "picture": "https://lh3.googlegCZws17vewEXw=s96-c",
            "wallets": [],
            "aptosAddress": "0xe58e732326a2cfdc01fbd5",
            "loginMethod": "Keyless",
            "status": "ACTIVE",
            "era3": 401.52820166,
            "eragonDeps": 4489.30207873,
            "pot": 0,
            "potLevel": 0,
            "pos": 0,
            "posLevel": 0,
            "pop": 1500000,
            "popLevel": 46,
            "startMineEra3Ts": 1725944366650,
            "sessionEra3Rate": 0.000792625,
            "sessionEra3Duration": 86400,
            "isVerifiedDeveloper": false,
            "avatarActiveTs": null,
            "avatarDieTs": 1719908557852,
            "lastCalcAvatarTs": null,
            "point": 0,
            "shield": 0,
            "lastCalcRollTicketTs": null,
            "baseRollTicket": 0,
            "spentRollTicket": 0,
            "wastedRollTicket": 0,
            "rewardRollTicket": 7,
            "rollTicketRefillTime": null,
            "lastAttackedTs": null,
            "attackOpponents": [],
            "orgAttackOpponents": [],
            "particleWallets": [],
            "particleLoginMethod": "other",
            "smartAccounts": {},
            "equipments": {
                "head": null,
                "weapon": null,
                "body": null,
                "accessory": null,
                "theme": null
            },
            "equipmentInventory": [],
            "equipmentRollTime": 0,
            "referralCode": "EGTLYMFIL7",
            "referrer": "661674f3ef522c9801b732bb",
            "referrers": [
                "661674f3ef522c9801b732bb",
                "654e1373907962fe76aaa846",
                "6555d4e3db799f2d8e5643c7"
            ],
            "registerDate": "2024-07-02T08:22:37.855Z",
            "newRegistRefRewardLastDate": "20240709",
            "createdAt": "2024-07-02T08:22:37.863Z",
            "updatedAt": "2024-09-13T04:21:57.083Z",
            "__v": 0
        }
    }
}

Create link account code to let customer manual link account to their Eragon keyless account

Method: GET

URL:

/users/createLinkCode

Header:

{
    "Authorization": "Bearer {accessToken}"
}

Response:

{
    "statusCode": 201,
    "time": "2024-09-13T04:24:15.239Z",
    "data": "https://devnet.eragon.gg/link-account?access_token=47502G4XG1EJ"
}

Get linked account

Get list linked account to this account

Method: GET

URL:

/users/linkedAccountsFromGame

Header:

{
    "Authorization": "Bearer {accessToken}"
}

Response:

{
    "statusCode": 200,
    "time": "2024-09-13T04:26:35.743Z",
    "data": {
        "users": [
            {
                "_id": "6683b8cdc4976d0db0159ab7",
                "updatedAt": "2024-09-13T04:21:57.083Z",
                ...
            },
            {
                "_id": "66a9e4ec895018d43745b985",
                "uid": "601729616",
                "name": "Tùng Béo",
                "eragonUser": "6683b8cdc4976d0db0159ab7",
                ...
            }
        ]
    }
}

Last updated