Create or update an atomic-swap proposal.
POST/wallet/atomic-swap/tx-proposal
Create or update an atomic-swap proposal.
Request
Header Parameters
Defines the key of the wallet on which the request will be executed.
- application/json
Body
required
Data to create the proposal
Array [
]
Array [
]
Array [
]
A proposal to update. If not present a new one will be created.
receive
object
Create outputs receiving the tokens as described in this parameter.
tokens
object[]
required
Description of tokens to be received.
The value parameter must be an integer with the value in cents, i.e., 123 means 1.23 HTR.
Token id to be received. If not present, it will be interpreted as HTR.
Receive tokens in this address, if not present, an address from the wallet will be chosen.
send
object
Create inputs to send tokens from this wallet as described here. May add change outputs if needed.
tokens
object[]
required
Description of tokens to be sent.
The value parameter must be an integer with the value in cents, i.e., 123 means 1.23 HTR.
Token id to be received. If not present, it will be interpreted as HTR.
utxos
object[]
If present the wallet will try to use only these utxos and will not get more from the wallet history.
Output index of this utxo.
Transaction id of this utxo
Default value: true
If the utxos chosen for this proposal should be locked so they are not spent on another call. Use with caution.
Optional address to send the change amount.
service
object
Property containing references for this proposal on the Atomic Swap Service
Determines if this is a new proposal, so that a new proposalId is added to the response
Determines the identifier of the existing proposal that is being referenced in this request
Mandatory password for interacting with a service-mediated proposal.
Version of the proposal to be updated on the service mediator
Responses
- 200
Create a proposal.
- application/json
- Schema
- error
- success
- wallet-not-ready
- service-invalid-password
- service-new-proposal
- no-wallet-id
- invalid-wallet-id
Schema
any
Insuficient amount of tokens
{
"success": false,
"error": "Token HTR: Insufficient amount of tokens"
}
Success
{
"success": true,
"data": "PartialTx|...",
"isComplete": false
}
Wallet is not ready yet
{
"success": false,
"message": "Wallet is not ready.",
"state": 1
}
Atomic Swap Service password is invalid
{
"success": false,
"error": "Password must have at least 3 characters"
}
Success creating a service-mediated proposal.
{
"success": true,
"data": "PartialTx|...",
"isComplete": false,
"createdProposalId": "b11948c7-48..."
}
No wallet id parameter
{
"success": false,
"message": "Parameter 'wallet-id' is required."
}
Wallet id parameter is invalid
{
"success": false,
"message": "Invalid wallet-id parameter."
}