Understanding token creation and balance retrieval within the OmniSafe API.
This document explains how to create tokens and retrieve balances within the OmniSafe API.
Creating a Token and Minting Initial Supply
To create a new token and mint an initial supply to a specified owner address, use the POST /v1/tokens
endpoint.
POST /v1/tokens
- Create Token and Mint API ReferenceRequest Body:
The request body should conform to the TokenMintDto
schema (defined in the OpenAPI specification). It typically includes:
symbol
: The token’s symbol (e.g., “MYTOKEN”).name
: The token’s name (e.g., “My Token”).decimals
: The number of decimal places for the token (e.g., 18).initialQuantity
: The initial quantity of tokens to mint.ownerAddress
: The wallet address to receive the initial supply of tokens.Response:
201 Created
: Returns the created token address (as plain text). Example: "0x1234567890abcdef..."
Important Considerations:
ownerAddress
must be a valid wallet address within the OmniSafe system.Getting Token Balance
To retrieve the token/ETH balance for a specific wallet address, use the GET /v1/tokens/{token-address}/{owner}
endpoint.
GET /v1/tokens/{token-address}/{owner}
- Get Balance API ReferenceParameters:
token-address
(path parameter, required): The address of the token, obtained from the POST /v1/tokens
response.owner
(path parameter, required): The address of the wallet for which you want to retrieve the balance.Response:
200 OK
: Returns the wallet balance (as a number). Example: 1000
Important Considerations:
token-address
must be a valid token address that was previously created through the POST /v1/tokens
endpoint.owner
address must be a valid wallet address within the OmniSafe system.Understanding token creation and balance retrieval within the OmniSafe API.
This document explains how to create tokens and retrieve balances within the OmniSafe API.
Creating a Token and Minting Initial Supply
To create a new token and mint an initial supply to a specified owner address, use the POST /v1/tokens
endpoint.
POST /v1/tokens
- Create Token and Mint API ReferenceRequest Body:
The request body should conform to the TokenMintDto
schema (defined in the OpenAPI specification). It typically includes:
symbol
: The token’s symbol (e.g., “MYTOKEN”).name
: The token’s name (e.g., “My Token”).decimals
: The number of decimal places for the token (e.g., 18).initialQuantity
: The initial quantity of tokens to mint.ownerAddress
: The wallet address to receive the initial supply of tokens.Response:
201 Created
: Returns the created token address (as plain text). Example: "0x1234567890abcdef..."
Important Considerations:
ownerAddress
must be a valid wallet address within the OmniSafe system.Getting Token Balance
To retrieve the token/ETH balance for a specific wallet address, use the GET /v1/tokens/{token-address}/{owner}
endpoint.
GET /v1/tokens/{token-address}/{owner}
- Get Balance API ReferenceParameters:
token-address
(path parameter, required): The address of the token, obtained from the POST /v1/tokens
response.owner
(path parameter, required): The address of the wallet for which you want to retrieve the balance.Response:
200 OK
: Returns the wallet balance (as a number). Example: 1000
Important Considerations:
token-address
must be a valid token address that was previously created through the POST /v1/tokens
endpoint.owner
address must be a valid wallet address within the OmniSafe system.