-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add draft docs for
sign_raw_transaction
- Loading branch information
Showing
4 changed files
with
175 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/pages/atomicdex/api/common_structures/wallet/index.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
export const title = "Komodo DeFi SDK Common Structures: Wallet Operations"; | ||
export const description = "Starting with version beta-2.1.3434, the Komodo DeFi SDK supports the standardized protocol format called mmrpc 2.0."; | ||
|
||
# Wallet Operations Structures | ||
|
||
### RawTxInfo | ||
|
||
The `RawTxInfo` object includes the following items: | ||
|
||
| Parameter | Type | Description | | ||
| ----------- | ------- | ------------------------------------------------------------------------------------------------------------- | | ||
| tx_hex | string | UTXO only. The raw unsigned hex of a proposed transaction. | | ||
| prev_txns | list | UTXO only. A list of standard [InputTxns objects](/atomicdex/api/common_structures/wallet/#input-txns). | | ||
| to | string | ETH/EVM only. A destination address to send the funds to. | | ||
| value | string | ETH/EVM only. The amount of funds to be sent as a string with a `0x` prefix, in [wei](https://ethereum.stackexchange.com/questions/253/the-ether-denominations-are-called-finney-szabo-and-wei-what-who-are-these-na) units. | | ||
| gas_limit | string | ETH/EVM only. The maximum gas to be used for sending the transaction, in [gwei](https://eth-converter.com/) units. | | ||
|
||
<DevComment> | ||
TODO: Confirm units used in ETH/EVM transactions. | ||
</DevComment> | ||
|
||
<CollapsibleSection expandedText="Hide UTXO Example" collapsedText="Show UTXO Example"> | ||
```json | ||
{ | ||
"tx_hex": "02000000010d23d763f12d77a337cc16df2696ac3f48552dda373c9977fa1f5dd8d5025cb20100000000fdffffff01f40100000000000016001488accd2145b7232b958db5cdf09336ad619541e200000000", | ||
"prev_txns": [ | ||
... | ||
] | ||
} | ||
``` | ||
</CollapsibleSection> | ||
|
||
<CollapsibleSection expandedText="Hide ETH/EVM Example" collapsedText="Show ETH/EVM Example"> | ||
```json | ||
{ | ||
"to": "0x7Bc1bBDD6A0a722fC9bffC49c921B685ECB84b94", | ||
"value": "0x1000", | ||
"gas_limit": "21000" | ||
} | ||
``` | ||
</CollapsibleSection> | ||
|
||
|
||
### InputTxns | ||
|
||
The `InputTxns` object includes the following items: | ||
|
||
| Parameter | Type | Description | | ||
| --------------- | ------- | ----------------------------------------------------------------------------------------------------- | | ||
| tx_hash | string | The transaction id of an unspent transaction from the same wallet output. | | ||
| index | integer | The [output index(https://bitcoin.stackexchange.com/questions/100765/what-does-the-index-of-an-utxo-stand-for)] of this unspent transaction output. | | ||
| script_pub_key | string | The [scriptpubkey](https://learnmeabitcoin.com/technical/scriptPubKey) of this unspent transaction output. | | ||
| amount | float | The value of this unspent transaction output. | | ||
amount | ||
|
||
<CollapsibleSection expandedText="Hide Example" collapsedText="Show Example"> | ||
```json | ||
{ | ||
"tx_hash": "0d23d763f12d77a337cc16df2696ac3f48552dda373c9977fa1f5dd8d5025cb2", | ||
"index": 1, | ||
"script_pub_key": "001449e3b6b4684c4d4a914b29411af51843c59bfff0", | ||
"amount": 0.00001000 | ||
} | ||
``` | ||
</CollapsibleSection> |
104 changes: 104 additions & 0 deletions
104
src/pages/atomicdex/api/v20/sign_raw_transaction/index.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
export const title = "AtomicDEX: Sign Raw Transactions"; | ||
export const description = "The methods in this document allow you to create and sign raw transactions."; | ||
|
||
# Sign Raw Transactions | ||
|
||
This method allows users to: | ||
- Create a signed UTXO raw transaction given a set of prior transaction inputs. | ||
- Create a signed EVM raw transaction. | ||
- Sign a previously created raw transaction. | ||
|
||
The transaction can then be broadcasted to the network using the [`send_raw_transaction`](/atomicdex/api/legacy/send_raw_transaction/) to complete the process. | ||
|
||
### Arguments | ||
|
||
| Structure | Type | Description | | ||
| --------- | ------ | ------------------------------------------------------------------------------------ | | ||
| coin | string | The coin to create raw transaction with | | ||
| type | string | The operation type. Accepted values: UTXO ( for utxo coins), ETH (for emv coins) | | ||
| tx | object | A standard [RawTxInfo object](/atomicdex/api/common_structures/wallet/#raw-tx-info) | | ||
|
||
|
||
### Response | ||
|
||
| Structure | Type | Description | | ||
| --------- | ------ | --------------------------------------- | | ||
| signature | string | The signature generated for the message | | ||
|
||
#### Create signed UTXO raw transaction | ||
|
||
<CodeGroup title="" tag="POST" label="sign_message" mm2MethodDecorate="true"> | ||
```json | ||
{ | ||
"userpass": "testpsw", | ||
"mmrpc":"2.0", | ||
"id": 0, | ||
"method": "sign_raw_transaction", | ||
"params": { | ||
"coin": "tBTC", | ||
"type": "UTXO", | ||
"tx": { | ||
"tx_hex": "02000000010d23d763f12d77a337cc16df2696ac3f48552dda373c9977fa1f5dd8d5025cb20100000000fdffffff01f40100000000000016001488accd2145b7232b958db5cdf09336ad619541e200000000", | ||
"prev_txns": [{ | ||
"tx_hash": "0d23d763f12d77a337cc16df2696ac3f48552dda373c9977fa1f5dd8d5025cb2", | ||
"index": 1, | ||
"script_pub_key": "001449e3b6b4684c4d4a914b29411af51843c59bfff0", | ||
"amount": 0.00001000 | ||
}] | ||
} | ||
} | ||
} | ||
``` | ||
</CodeGroup> | ||
|
||
#### Response (success) | ||
|
||
```json | ||
{ | ||
"mmrpc": "2.0", | ||
"result": { | ||
"tx_hex": "020000000001010d23d763f12d77a337cc16df2696ac3f48552dda373c9977fa1f5dd8d5025cb20100000000fdffffff01f40100000000000016001488accd2145b7232b958db5cdf09336ad619541e2024730440220156d185b3fb21725c040b7ddcf84bf862b46f079bb66067eef1941023b8451e602204d877ac51b74932dea34c20874fa8112b3636eb506ac429548f7c05fe54e3faf0121039ad38f67dbc22cf5a6bd48b26920d9fac71681836faf80a9a678ddbaa0fe92f800000000" | ||
}, | ||
"id":0 | ||
} | ||
``` | ||
|
||
#### Create signed UTXO raw transaction | ||
|
||
<CodeGroup title="" tag="POST" label="sign_message" mm2MethodDecorate="true"> | ||
```json | ||
{ | ||
"userpass": "testpsw", | ||
"mmrpc":"2.0", | ||
"id": 0, | ||
"method": "sign_raw_transaction", | ||
"params": { | ||
"coin": "ETH", | ||
"type": "ETH", | ||
"tx": { | ||
"to": "0x7Bc1bBDD6A0a722fC9bffC49c921B685ECB84b94", | ||
"value": "0x1000", | ||
"gas_limit": "21000" | ||
} | ||
} | ||
} | ||
``` | ||
</CodeGroup> | ||
|
||
#### Response (success) | ||
|
||
```json | ||
{ | ||
"mmrpc": "2.0", | ||
"result": { | ||
"tx_hex": "f86680847735940083021000947bc1bbdd6a0a722fc9bffc49c921b685ecb84b948210008025a06c0ecbccf92caf5ac620b118f09a84a18c73d7b209e75696bb10e3c24c2dba64a055af3638f92daec1eb3057fb6a9ccf418325bb1aa6121a3314c3885100a5e63a" | ||
}, | ||
"id": 0 | ||
} | ||
``` | ||
<DevComment> | ||
PR: https://github.com/KomodoPlatform/komodo-defi-framework/pull/1930 | ||
- For utxo coins, is both tx_hex and prev_txns required, or are they basically the same thing represented in a different way? | ||
- For the ETH/EVM option, as there is no list of previous vouts I'm not sure how there is any fundamental difference between this method and https://developers.komodoplatform.com/basic-docs/atomicdex-api-20/withdraw.html#command-eth-erc20-and-other-eth-based-forks | ||
|
||
</DevComment> |