Purchase tokens from an existing offer.
POSThttps://minatokens.com/api/v1//token/offer/buy
Allows users to purchase tokens from an existing offer on the Mina blockchain. This endpoint facilitates the transaction where tokens are transferred from the offer address to the buyer's address in exchange for the specified price.
Request
- application/json
Bodyrequired
Must be "token:offer:buy"
Possible values: [token:offer:buy
]
The address of the token contract.
The address (public key) of the sender.
The private key of the sender. It is NOT recommended to use this field. Please use the sender
field instead. Use this field at your own risk and only if you know what you are doing and do not have access to mina-signer or wallet to get the signature.
Optional. The nonce for the transaction.
Optional. A memo for the transaction.
Optional. The developer fee for the transaction.
The address of the offer to buy from.
The amount of tokens to buy.
Responses
- 200
- 400
- 401
- 403
- 429
- 500
- 503
Successfully built buy transaction.
- application/json
- Schema
- Example (auto)
- buyResponseExample
Schema
The address initiating the transaction.
The nonce for the transaction.
A memo for the transaction.
The fee for the transaction.
walletPayload objectrequired
minaSignerPayload objectrequired
The payload for the prover.
The signed data for the transaction.
The raw transaction data.
Optional. Whether to broadcast the transaction after proving.
The symbol of the token.
request objectrequired
{
"sender": "string",
"nonce": 0,
"memo": "string",
"fee": 0,
"walletPayload": {
"nonce": 0,
"transaction": "string",
"onlySign": true,
"feePayer": {
"fee": 0,
"memo": "string"
}
},
"minaSignerPayload": {
"zkappCommand": {},
"feePayer": {
"feePayer": "string",
"fee": 0,
"nonce": 0,
"memo": "string"
}
},
"proverPayload": "string",
"signedData": "string",
"transaction": "string",
"sendTransaction": true,
"symbol": "string",
"request": {
"txType": "token:launch",
"tokenAddress": "string",
"sender": "string",
"senderPrivateKey": "string",
"nonce": 0,
"memo": "string",
"developerFee": 0,
"adminContract": "standard",
"symbol": "string",
"decimals": 0,
"uri": "string",
"adminContractAddress": "string",
"tokenContractPrivateKey": "string",
"adminContractPrivateKey": "string"
}
}
Example of a successful buy response
{
"txType": "buy",
"sender": "B62qoQ7oMLTHHaW4g2DtRiKbAi41xGWRGhm59A9mof5pVZuUJhwLyUG",
"nonce": 12,
"memo": "buy 10 TEST7",
"fee": "100000000",
"walletPayload": {
"transaction": "{\"feePayer\":{\"body\":{\"publicKey\":\"B62qoQ7oMLTHHaW4g2Dt...\"}"
}
}
Bad request - invalid input parameters.
- application/json
- Schema
- Example (auto)
Schema
Error message detailing the issue.
{
"error": "string"
}
Unauthorized - user not authenticated.
- application/json
- Schema
- Example (auto)
Schema
Error message detailing the issue.
{
"error": "string"
}
Forbidden - user doesn't have permission.
- application/json
- Schema
- Example (auto)
Schema
Error message detailing the issue.
{
"error": "string"
}
Too many requests.
- application/json
- Schema
- Example (auto)
Schema
Error message detailing the issue.
{
"error": "string"
}
Internal server error - something went wrong during the request.
- application/json
- Schema
- Example (auto)
Schema
Error message detailing the issue.
{
"error": "string"
}
Service unavailable - blockchain or other external service is down.
- application/json
- Schema
- Example (auto)
Schema
Error message detailing the issue.
{
"error": "string"
}
Authorization: x-api-key
name: x-api-keytype: apiKeyin: headerdescription: API key for authorization. Get your API key at https://minatokens.com/api
- curl
- javascript
- nodejs
- python
- rust
- ocaml
- go
- java
- powershell
- CURL
curl -L 'https://minatokens.com/api/v1/token/offer/buy' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-api-key: <x-api-key>' \
-d '{
"txType": "token:offer:buy",
"tokenAddress": "string",
"sender": "string",
"senderPrivateKey": "string",
"nonce": 0,
"memo": "string",
"developerFee": 0,
"offerAddress": "string",
"amount": 0
}'