Wallet API endpoints
The latest documentation for endpoints is always on the DevPortal: https://partner.socios.com/devportal/apis/1464738d-213b-4073-8599-46b63390a6ea/test
Authorizations
Responses
200
Successfully retrieved User's wallet
application/json
Responseall of
get
GET /wallet/1.0.0/user/wallet HTTP/1.1
Host: api-public.socios.com
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
200
Successfully retrieved User's wallet
{
"data": [
{
"id": "a2567e3a-9c00-4094-8196-9ec92b98f3a5",
"totalBalance": "100.123",
"currencyNetwork": {
"id": "a2567e3a-9c00-4094-8196-9ec92b98f3a5",
"shortCode": "CHZ",
"type": "crypto",
"symbol": "$CHZ",
"precision": 18,
"networkType": "ethereum",
"images": [
{
"url": "https://url.com/partner/d66eb9d2-56c6-4b1b-8f56-31f8aa319abe/partner_logo/38aca876-86a8-4a10-a0e8-b0859614c8b3.png?version=1653577420",
"type": "png",
"format": "desktop",
"width": "500",
"height": "500"
}
]
},
"blockchainAddress": "0x11225D5D1230B07e814BE63C5e2FF6EaE43b45A0"
}
]
}
⬇️ ALTERNATIVE: Retrieve User Token Balance ⬇️
import { createPublicClient, http } from 'viem';
import { abi as erc20ABI } from './ERC20ABI.json';
const client = createPublicClient({
transport: http('https://rpc.ankr.com/chiliz'),
});
const tokenAddress = '0xYourTokenAddress'; // Replace with the actual ERC-20 contract address
const userAddress = '0xUserWalletAddress'; // Replace with the user's wallet address
async function getTokenBalance() {
const balance = await client.readContract({
address: tokenAddress, // Contract address of the token
abi: erc20ABI, // ERC-20 ABI
functionName: 'balanceOf', // Standard ERC-20 function to get balance
args: [userAddress], // User's address whose balance you want to check
});
return balance.toString();
}
// Example usage
getTokenBalance().then(console.log);
Authorizations
Body
messagestringRequiredExample:
The message to be signed.
Responses
200
Successfully retrieved signature
application/json
Responseall of
400
Bad Request
application/json
post
POST /wallet/1.0.0/user/wallet/sign-message HTTP/1.1
Host: api-public.socios.com
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 39
{
"message": "The message to be signed."
}
{
"data": [
{
"signedMessage": "1.6843624793958161E+156"
}
]
}
REMOVED WITH NO ALTERNATIVE AVAILABLE
Authorizations
Path parameters
transactionIdstring · uuidRequired
Id of the transaction
Responses
200
Successfully retrieved User wallet transaction details
application/json
Responseall of
400
Bad Request
application/json
get
GET /wallet/1.0.0/user/wallet/{transactionId} HTTP/1.1
Host: api-public.socios.com
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
{
"data": [
{
"transactionId": "a2567e3a-9c00-4094-8196-9ec92b98f3a5",
"amount": "3.5",
"totalAmount": "3.5",
"paidCHZAmount": "11.95",
"status": "text",
"createdAt": "2020-11-02T07:26:40+00:00",
"referenceNumber": "text",
"consumerName": "marketplace",
"fee": 1,
"vat": 1,
"currency": {
"shortCode": "CHZ",
"symbol": "$CHZ",
"type": "crypto"
},
"lockFund": {
"status": "locked",
"remainingAmount": "12.5"
}
}
]
}
⬇️ ALTERNATIVE: Retrieve a User's Transaction ⬇️
async function getTransaction(txHash) {
const transaction = await client.getTransaction({
hash: txHash, // Replace with the actual transaction hash
});
return transaction;
}
// Example usage
getTransaction('0xTransactionHash').then(console.log);
Authorizations
Query parameters
pageinteger · integerOptional
limitinteger · integerOptional
Responses
200
Successfully retrieved User wallet transaction history
application/json
Responseall of
400
Bad Request
application/json
get
GET /wallet/1.0.0/user/wallet/transaction-history/fan-token HTTP/1.1
Host: api-public.socios.com
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
{
"data": [
{
"transactionId": "text",
"status": "text",
"transactionTypeName": "Redeem CHZ from Voucher",
"amount": "10.90",
"date": "2020-11-02T07:26:40Z",
"isNegativeBalance": true,
"currencySymbol": "$CHZ",
"currencyShortCode": "CHZ",
"partnerId": "text",
"isPending": true,
"currencyId": "text",
"transactionBatchType": "text",
"transactionType": "text"
}
],
"metadata": {
"total_items": 588,
"current_page": 2,
"last_page": 4,
"cursor": "text"
}
}
Authorizations
Body
Payload to transfer fantoken
amountstringRequiredExample:
Amount to transfer
23.00
currencyIdstring · uuidRequiredExample:
CurrencyId to transfer
f9d5eaae-230d-4bec-9d8e-51732ad6b664
fromWalletIdstring · uuidRequiredExample:
b1168a48-22c3-4e26-ac0c-0150e89d050d
toWalletIdstring · uuidRequiredExample:
6a56ffda-62a6-4205-8c01-7fff01a500b7
uniqueIdstringRequiredExample:
Generate a unique ID for each transaction
3a56ffda-62a6-4205-8c01-7fff01a500b7
Responses
200
Success
400
Bad Request
application/json
post
POST /wallet/1.0.0/admin/wallet/transfer/fan-token HTTP/1.1
Host: api-public.socios.com
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 226
{
"amount": "23.00",
"currencyId": "f9d5eaae-230d-4bec-9d8e-51732ad6b664",
"fromWalletId": "b1168a48-22c3-4e26-ac0c-0150e89d050d",
"toWalletId": "6a56ffda-62a6-4205-8c01-7fff01a500b7",
"uniqueId": "3a56ffda-62a6-4205-8c01-7fff01a500b7"
}
No content
⬇️ ALTERNATIVE: Send ERC-20 Tokens to a User Wallet ⬇️
import { createWalletClient, privateKeyToAccount } from 'viem';
const privateKey = '0xSenderPrivateKey'; // Replace with the sender's private key
const account = privateKeyToAccount(privateKey);
const walletClient = createWalletClient({
account,
transport: http('https://rpc.ankr.com/chiliz'),
});
async function sendTokens(to, amount) {
const txHash = await walletClient.writeContract({
address: '0xYourTokenAddress', // Replace with the ERC-20 token contract address
abi: erc20ABI, // ERC-20 ABI
functionName: 'transfer', // Standard ERC-20 function to transfer tokens
args: [to, BigInt(amount * 1e18)], // Replace 'to' with recipient address and 'amount' with the amount to send
});
return txHash;
}
// Example usage
sendTokens('0xRecipientAddress', 10).then(console.log);
Last updated