Scorum
Functions
Atomic Swap

Wallet Atomic Swap API. More...

Functions

atomicswap_contract_result_api_obj scorum::wallet::wallet_api::atomicswap_initiate (const std::string &initiator, const std::string &participant, const asset &amount, const std::string &metadata, const uint8_t secret_length, bool broadcast)
 
atomicswap_contract_result_api_obj scorum::wallet::wallet_api::atomicswap_participate (const std::string &secret_hash, const std::string &participant, const std::string &initiator, const asset &amount, const std::string &metadata, bool broadcast)
 
atomicswap_contract_info_api_obj scorum::wallet::wallet_api::atomicswap_auditcontract (const std::string &from, const std::string &to, const std::string &secret_hash)
 
annotated_signed_transaction scorum::wallet::wallet_api::atomicswap_redeem (const std::string &from, const std::string &to, const std::string &secret, bool broadcast)
 
std::string scorum::wallet::wallet_api::atomicswap_extractsecret (const std::string &from, const std::string &to, const std::string &secret_hash)
 
annotated_signed_transaction scorum::wallet::wallet_api::atomicswap_refund (const std::string &participant, const std::string &initiator, const std::string &secret_hash, bool broadcast)
 
std::vector< atomicswap_contract_api_objscorum::wallet::wallet_api::get_atomicswap_contracts (const std::string &owner)
 

Detailed Description

Wallet Atomic Swap API.

Function Documentation

◆ atomicswap_auditcontract()

atomicswap_contract_info_api_obj scorum::wallet::wallet_api::atomicswap_auditcontract ( const std::string &  from,
const std::string &  to,
const std::string &  secret_hash 
)

The Atomic Swap helper to get contract info.

Parameters
fromthe transfer 'from' address
tothe transfer 'to' address
secret_hashthe secret hash

Definition at line 3173 of file wallet.cpp.

◆ atomicswap_extractsecret()

std::string scorum::wallet::wallet_api::atomicswap_extractsecret ( const std::string &  from,
const std::string &  to,
const std::string &  secret_hash 
)

Extracting secret from participant contract if it is redeemed by initiator.

Parameters
fromthe transfer 'from' address
tothe transfer 'to' address
secret_hashthe secret hash

Definition at line 3179 of file wallet.cpp.

◆ atomicswap_initiate()

atomicswap_contract_result_api_obj scorum::wallet::wallet_api::atomicswap_initiate ( const std::string &  initiator,
const std::string &  participant,
const asset amount,
const std::string &  metadata,
const uint8_t  secret_length,
bool  broadcast 
)

Initiating Atomic Swap transfer from initiator to participant.

Asset (amount) will be locked for 48 hours while is not redeemed or refund automatically by timeout.

Warning
API prints secret string to memorize. API prints secret hash as well.
Parameters
initiatorthe new contract owner
participant
amountSCR to transfer
metadatathe additional contract info (obligations, courses)
secret_lengththe length of secret in bytes or 0 to choose length randomly
broadcasttrue if you wish to broadcast the transaction

Definition at line 3091 of file wallet.cpp.

◆ atomicswap_participate()

atomicswap_contract_result_api_obj scorum::wallet::wallet_api::atomicswap_participate ( const std::string &  secret_hash,
const std::string &  participant,
const std::string &  initiator,
const asset amount,
const std::string &  metadata,
bool  broadcast 
)

Initiating Atomic Swap transfer from participant to initiator.

Asset (amount) will be locked for 24 hours while is not redeemed or refund before redeem.

Warning
The secret hash is obtained from atomicswap_initiate operation.
Parameters
secret_hashthe secret hash (received from initiator)
participantthe new contract owner
initiator
amountSCR to transfer
metadatathe additional contract info (obligations, courses)
broadcasttrue if you wish to broadcast the transaction

Definition at line 3125 of file wallet.cpp.

◆ atomicswap_redeem()

annotated_signed_transaction scorum::wallet::wallet_api::atomicswap_redeem ( const std::string &  from,
const std::string &  to,
const std::string &  secret,
bool  broadcast 
)

Redeeming Atomic Swap contract.

This API transfers asset to participant balance and declassifies the secret.

Parameters
fromthe transfer 'from' address
tothe transfer 'to' address
secretthe secret ("my secret") that was set in atomicswap_initiate
broadcasttrue if you wish to broadcast the transaction

Definition at line 3152 of file wallet.cpp.

◆ atomicswap_refund()

annotated_signed_transaction scorum::wallet::wallet_api::atomicswap_refund ( const std::string &  participant,
const std::string &  initiator,
const std::string &  secret_hash,
bool  broadcast 
)

Refunding contact by participant.

Warning
Can't refund initiator contract. It is refunded automatically in 48 hours.
Parameters
participantthe refunded contract owner
initiatorthe initiator of Atomic Swap
secret_hashthe secret hash (that was set in atomicswap_participate)
broadcasttrue if you wish to broadcast the transaction

Definition at line 3189 of file wallet.cpp.

◆ get_atomicswap_contracts()

std::vector< atomicswap_contract_api_obj > scorum::wallet::wallet_api::get_atomicswap_contracts ( const std::string &  owner)

Atomic Swap helper to get list of contract info.

Parameters
owner

Definition at line 3209 of file wallet.cpp.