Sandbox Token (usdHifi)
Test out our API with usdHifi in the Sandbox environment
Introduction
To simulate stablecoin movement in the Sandbox environment, we deployed the usdHifi token on POLYGON AMOY. Users will be able to simulate onramping, transferring stablecoin between wallets, and offramping with usdHifi.
Implementations
Wallet Balance
Users can use the Retrieve wallet balance endpoint to get the wallet balance.
Example Request
curl --request GET \
--url 'https://sandbox.hifibridge.com/v2/users/3df6cf60-0c3a-4371-8cd7-4fee0901594e/wallets/balance?chain=POLYGON¤cy=usdHifi' \
--header 'accept: application/json'
Example Response
{
"balance": "539000000",
"displayBalance": "539.00",
"tokenInfo": {
"chain": "POLYGON_AMOY",
"contractAddress": "0x545f651965f3322fda6232f010df37ab41969505",
"assetType": "ERC20",
"quantity": "539000000",
"symbol": "USDHIFI",
"decimals": "6"
}
}
Onramp from Fiat to usdHifi
After creating a Plaid USD onramp account, you can use the account id
created to simulate onramps from USD to usdHifi with the Create an onramp endpoint.
Example Request
curl --request POST \
--url https://sandbox.hifibridge.com/v2/onramps \
--header 'accept: application/json' \
--header 'authorization: Bearer zpka_123456789' \
--header 'content-type: application/json' \
--data '
{
"source": {
"currency": "usd",
"userId": "75d7c01f-5f93-4490-8b93-a62fd8020358",
"accountId": "0de2ae79-737d-4266-8c7d-ec82df476d3a",
"amount": 10
},
"destination": {
"currency": "usdc",
"chain": "POLYGON",
"userId": "75d7c01f-5f93-4490-8b93-a62fd8020358"
},
"fee": {
"type": "FIX"
},
"requestId": "984da3b6-b930-4641-87ab-93fc131ba0f8"
}
'
Example Response
{
"transferType": "FIAT_TO_CRYPTO",
"transferDetails": {
"id": "476989be-dac6-4c4c-929a-6f17eb25509a",
"requestId": "5737c27a-87aa-48a4-a2be-db56a10442e3",
"sourceUserId": "2c055327-1202-4c08-aa95-e3a0b5da0886",
"destinationUserId": "2c055327-1202-4c08-aa95-e3a0b5da0886",
"transactionHash": "0xb05f1e9bc8286ac15a93495fc94b1ffaa52139017db8716b31f073dd24e3d703",
"chain": "POLYGON_AMOY",
"sourceCurrency": "usd",
"amount": 140,
"destinationCurrency": "usdHifi",
"sourceAccountId": "3df6cf60-0c3a-4371-8cd7-4fee0901594e",
"createdAt": "2024-09-09T20:51:07.734702+00:00",
"updatedAt": "2024-09-09T20:58:10.975+00:00",
"status": "CREATED",
"sourceUser": {
"business_name": null,
"legal_last_name": "Man",
"compliance_email": "postman@hifibridge.com",
"legal_first_name": "Post"
},
"destinationUser": {
"business_name": null,
"legal_last_name": "Man",
"compliance_email": "postman@hifibridge.com",
"legal_first_name": "Post"
},
"sourceAccount": {
"id": "3df6cf60-0c3a-4371-8cd7-4fee0901594e",
"account_number": "1111",
"routing_number": "011401533",
"bank_name": "Bank of America"
},
"fee": null
}
}
Transfer usdHifi between Wallets
Users can also transfer usdHifi between HIFI wallets or external wallets.
Example Request
curl --request POST \
--url https://sandbox.hifibridge.com/v2/wallets/transfers \
--header 'accept: application/json' \
--header 'authorization: Bearer zpka_123456' \
--header 'content-type: application/json' \
--data '
{
"source": {
"userId": "75d7c01f-5f93-4490-8b93-a62fd8020358"
},
"destination": {
"userId": "0c91a2a3-b0da-4779-bd15-2b29b8854de4"
},
"requestId": "5d0a55aa-9a2a-486a-a57e-d5d9e576cf6d",
"amount": 10,
"currency": "usdHifi",
"chain": "POLYGON"
}
'
Example Response
{
"transferType": "CRYPTO_TO_CRYPTO",
"transferDetails": {
"id": "0b9a8c80-3ce3-4aee-9d94-8a8ac43a2543",
"requestId": "5d0a55aa-9a2a-486a-a57e-d5d9e576cf6d",
"senderUserId": "75d7c01f-5f93-4490-8b93-a62fd8020358",
"recipientUserId": "0c91a2a3-b0da-4779-bd15-2b29b8854de4",
"recipientAddress": "0x89dfD8792c7E7041c24F01223929F1d8Dd642F0c",
"chain": "POLYGON_AMOY",
"currency": "usdHifi",
"amount": 10,
"transactionHash": "0x23188acdf798d97d481f86fe1904a74cd885ed8bcff9d52d8bb7c3a2f54a3a59",
"createdAt": "2024-06-25T20:41:57.671322+00:00",
"status": "CREATED",
"contractAddress": "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
"failedReason": ""
}
}
Offramp from usdHifi to Fiat
After adding an offramp bank account as the fiat source of offramp, you can use the account id
created to simulate offramping usdHifi to fiat currency with the Create an offramp endpoint.
Example Request
curl --request POST \
--url https://sandbox.hifibridge.com/v2/offramps \
--header 'accept: application/json' \
--header 'authorization: Bearer zpka_123456' \
--header 'content-type: application/json' \
--data '
{
"source": {
"currency": "usdc",
"chain": "POLYGON",
"userId": "75d7c01f-5f93-2344-8b93-a62fd8020358",
"amount": 100
},
"destination": {
"currency": "usd",
"accountId": "daa6ad75-1234-486f-a937-1bbf4d19553c"
},
"fee": {
"type": "PERCENT",
"value": 0.01
},
"requestId": "233fb9a1-cf0d-425a-9d71-2f4b84040160"
}
'
Example Response
{
"transferType": "CRYPTO_TO_FIAT",
"transferDetails": {
"id": "12c7c56a-f91e-498a-8300-90922cdff190",
"requestId": "8b371a64-6b89-47d3-823b-5ec2b9e2eead",
"sourceUserId": "2c055327-1202-4c08-aa95-e3a0b5da0886",
"destinationUserId": "2c055327-1202-4c08-aa95-e3a0b5da0886",
"chain": "POLYGON_AMOY",
"sourceCurrency": "usdHifi",
"amount": 120,
"destinationCurrency": "usd",
"liquidationAddress": "0xdeadbeef2usdcpolygonf8dc90ad-b901-49f2-82dd-47418c25f1f8",
"destinationAccountId": "5ece0e44-c087-4edd-b45a-7412cfc2347c",
"transactionHash": null,
"createdAt": "2024-09-09T20:05:02.662681+00:00",
"updatedAt": "2024-09-10T20:43:00.757+00:00",
"status": "CREATED",
"contractAddress": "0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582",
"sourceUser": {
"business_name": null,
"legal_last_name": "Man",
"compliance_email": "postman@hifibridge.com",
"legal_first_name": "Post"
},
"destinationUser": {
"business_name": null,
"legal_last_name": "Man",
"compliance_email": "postman@hifibridge.com",
"legal_first_name": "Post"
},
"destinationAccount": {
"id": "5ece0e44-c087-4edd-b45a-7412cfc2347c",
"accountOwnerName": "Post Man",
"bankName": "Chase",
"accountNumber": "483101817824",
"routingNumber": "021000323",
"accountType": "us",
"businessIdentifierCode": null,
"bankCountry": null,
"iban": null,
"beneficiaryFirstName": null,
"beneficiaryLastName": null
},
"failedReason": "This is a simulated success response for sandbox environment only.",
"fee": null,
"conversionRate": {
"validFrom": "2024-09-09T20:05:03.158Z",
"toCurrency": "usd",
"validUntil": "2024-09-09T20:05:33.158Z",
"fromCurrency": "usdc",
"conversionRate": 1
}
}
}
Updated about 1 month ago