Developer Wallets
Introduction
This guide will walk you through setting up a developer wallet for your project, and the possible transactions that can be done with the wallets.
Setup: Dev wallet key & secret
So that only you can control your developer wallet, we will assign you a wallet key. These will be required to authorize transactions involving currency and assets from your developer wallet, so make sure it is stored in a safe place (and is separate from your GameShift api key). This wallet key is separate from your GameShift key, which enables access to the rest of GameShift’s APIs. We do not store these credentials and therefore cannot recover access to your developer wallet if you lose them.
In this user guide:
- x-api-key will refer to the GameShift key
- x-wallet-key will refer to the Dev Wallet key
Developer Wallet Address
Each developer wallet has its own unique address. To retrieve your developer wallet address, make sure you generate a wallet key, and fetch your developer wallet address as so
curl -X GET "https://api.gameshift.dev/nx/developer-wallet" \
-H "accept: application/json" \
-H "content-type: application/json" \
-H "x-api-key: <your api key>"
Response
{
"walletAddress": "De6z1482rsTpD2Zh8Lqot12MnFMz16U8CgDdPGhMiGEA"
}
Items
Developer wallets allow you to interact with game items, namely fetching and transferring Currencies and Unique Assets. Transferring assets gives you a pending transaction which we will address in the next section.
Fetch developer wallet currency balances
curl -X 'GET'
'https://api.gameshift.dev/nx/developer-wallet/items'
-H 'accept: application/json'
-H 'x-api-key: <your api key>'
Response
{
"items": {
"data": [
{
"type": "Currency",
"item": {
"id": "SOL",
"mintAddress": "11111111111111111111111111111111",
"name": "SOL",
"symbol": "SOL"
},
"quantity": "0"
},
{
"type": "Currency",
"item": {
"id": "USDC",
"mintAddress": "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",
"name": "USD Coin",
"symbol": "USDC"
},
"quantity": "0"
},
],
"meta": {
"page": 1,
"perPage": 50,
"totalPages": 1
}
}
}
Transfer Currency
curl -X 'POST'
'https://api.gameshift.dev/nx/developer-wallet/items/9e18288b-9665-4c7b-8c2a-90cf737ec79c/transfer'
-H 'accept: application/json'
-H 'x-api-key: <gameshift_key>'
-H 'x-wallet-key: <wallet_key>'
-H 'Content-Type: application/json'
-d '{
"destinationUserReferenceId": "h2",
"quantity": 1
}'
Response
{
"id": "08d14450-babf-4fe3-b4a8-f6623fc46207",
"created": "2024-04-02T19:22:42.658Z",
"status": {
"status": "Confirmed",
"txHash": "42CvVXRpmrYUVNEBD2utXDtqg23mzxTAd2Qamx2Ui9SGzLRySYCY3K5zyqWeJY39LQQFekvxAGnoYZTJ6cxeUKUs"
},
"details": {
"type": "TransferTokenFromDeveloper",
"token": {
"id": "9e18288b-9665-4c7b-8c2a-90cf737ec79c",
"mintAddress": "2UnQyZJLQ2zQTXbguWmpJkyxVy9kcvdrPyzvcVod5KmF",
"name": "2UnQ...5KmF",
"symbol": "2UnQ...5KmF"
}
}
}
Transfer Unique Asset
curl -X 'POST' \
'http://api.gameshift.dev/nx/developer-wallet/items/86b60d93-800a-4e82-b7be-8cf8974f054b/transfer' \
-H 'accept: application/json' \
-H 'x-api-key: <gameshift_key>' \
-H 'x-wallet-key: <wallet_key>' \
-H 'Content-Type: application/json' \
-d '{
"destinationUserReferenceId": "h2",
"quantity": "1"
}'
Response:
{
"id": "19f4ae4a-2f22-48b4-96e9-5fd65ab8b6dc",
"created": "2024-07-08T18:12:34.585Z",
"status": {
"status": "Pending"
},
"details": {
"type": "TransferAssetFromDeveloper",
"item": {
"id": "86b60d93-800a-4e82-b7be-8cf8974f054b",
"collection": {
"id": "c63f99df-7917-4d3f-b608-1ef636596a16",
"name": "Default",
"description": "",
"environment": "Development",
"imported": false,
"mintAddress": "9TLcFuCyWeHR3tySiMr7PjGmeUHhpFDiaJ4ykUQ2RyDu",
"created": 1719955846661
},
"created": 1720462301177,
"attributes": [],
"name": "desc",
"description": "de",
"environment": "Development",
"escrow": false,
"imageUrl": "https://google.com",
"imported": false,
"priceCents": null,
"status": "Committed",
"mintAddress": "HWPqLMgcFietwaJFi7biKg623wuyejTkg8rMDpZaBGGx",
"owner": {
"address": "CXd7mA3oRJegi7fvauVJRzULupxs161CF34WQzUg9SNC",
"referenceId": "self"
}
}
}
}
Transactions
Upon completing a transfer, you will receive a transactionId, which you can check on the status of the transaction by making a GET request to /transactions/:transactionId.
Transaction Status:
curl -X 'GET'
'https://api.gameshift.dev/transactions/2b830800-5c02-47d4-90db-152258850291'
-H 'accept: application/json'
-H 'x-api-key: <gameshift_key>'
Response
{
"id": "138cad90-4da7-4be0-ab58-eabfabbc1bad",
"created": "2024-04-12T05:57:18.431Z",
"status": {
"status": "Confirmed",
"txHash": "5fJVtHGk2t5HzqBVGjc3qvkHkzyokA3k9eH4VwUnKK1jMm7MLeqW5r8nC719ABoq3wLQEkZaHsFJ3ovJZtec9xEA"
},
"details": {
"type": "TransferAssetFromDeveloper",
"asset": {
"id": "d07beaef-2470-46d4-b0af-0b3d89008005",
"collection": {
"id": "dee70df7-089e-4229-befb-22d58c4bfa61",
"name": "Default",
"description": "",
"environment": "Development",
"imported": false,
"mintAddress": "9TLcFuCyWeHR3tySiMr7PjGmeUHhpFDiaJ4ykUQ2RyDu",
"created": 1712634916821
},
"created": 1712901407202,
"attributes": [
{
"value": "string",
"traitType": "string"
}
],
"name": "charlie",
"description": "string",
"environment": "Development",
"escrow": false,
"imageUrl": "https://google.com",
"imported": false,
"priceCents": null,
"status": "Committed",
"mintAddress": "5aa6s1ZhGGGtCLjsesPDhepP4Kxo8vBmDMSdh7wi8JEh",
"owner": {
"address": "ErsM278pdLGyVcRZR32RzfExzoF8pBNSKq9VctSCdbnw",
"referenceId": "h1"
}
}
}
}
Updated 5 months ago