/build/rpc / cosign / cross_chain
cosign.eth_get_swap_status
- workflowcross-chain-swap·step 5 of 7Workflow: cross-chain-swap · step 5 of 7
cosign.eth_get_swap_status "htlc_address" "swap_id" ( "lock_tx_hash" ) Query HTLC swap state and confirmation depth from the Ethereum chain. Arguments: 1. htlc_address (string, required) HTLC contract address 2. swap_id (string, required) 32-byte swap ID (hex) 3. lock_tx_hash (string, optional) Lock tx hash to check confirmations Result: { (json object) "success" : true|false, (boolean) Whether query succeeded "state" : n, (numeric) HTLC state: 0=empty, 1=locked, 2=claimed, 3=refunded "state_name" : "str", (string) Human-readable state name "sender" : "str", (string) Lock sender address "recipient" : "str", (string) Lock recipient address "token_address" : "str", (string) ERC-20 address or 0x0 for native ETH "amount" : "str", (string) Locked amount (hex) "secret_hash" : "str", (string) sha256(secret) "timelock" : n, (numeric) Refund-eligible timestamp "confirmation_depth" : n (numeric) Confirmations of lock tx (null if not provided) } Examples: > bitcoin-cli cosign.eth_get_swap_status "0xHTLC" "0xSWAPID" "0xLOCKTXHASH"
Signature
cosign.eth_get_swap_status(htlc_address: string, swap_id: string, lock_tx_hash?: string) → any Code samples
curl --user "$RPC_USER:$RPC_PASS" \
--data-binary '{"jsonrpc":"1.0","id":"docs","method":"cosign.eth_get_swap_status","params":["\"<htlc_address>\"","\"<swap_id>\"","\"<lock_tx_hash>\""]}' \
-H 'content-type: text/plain;' \
http://127.0.0.1:8332/ Parameters
| Name | Type | Req. | Description |
|---|---|---|---|
| htlc_address | string | yes | HTLC contract address |
| swap_id | string | yes | 32-byte swap ID (hex) |
| lock_tx_hash | string | — | Lock tx hash to check confirmations |
Result
Type: any
{ (json object) "success" : true|false, (boolean) Whether query succeeded "state" : n, (numeric) HTLC state: 0=empty, 1=locked, 2=claimed, 3=refunded "state_name" : "str", (string) Human-readable state name "sender" : "str", (string) Lock sender address "recipient" : "str", (string) Lock recipient address "token_address" : "str", (string) ERC-20 address or 0x0 for native ETH "amount" : "str", (string) Locked amount (hex) "secret_hash" : "str", (string) sha256(secret) "timelock" : n, (numeric) Refund-eligible timestamp "confirmation_depth" : n (numeric) Confirmations of lock tx (null if not provided) }
Source: services/core-node/bcore/src/rpc/cosign.cpp:3504
C++ symbol: cosign_eth_get_swap_status