Skip to content

Commit 9867dbc

Browse files
authored
Merge pull request #375 from KomodoPlatform/update/kdf/sign_raw_transaction
2 parents c860054 + 1a09a0b commit 9867dbc

File tree

13 files changed

+467
-28
lines changed

13 files changed

+467
-28
lines changed

filepathSlugs.json

+33-1
Original file line numberDiff line numberDiff line change
@@ -2167,7 +2167,8 @@
21672167
"src/pages/komodo-defi-framework/api/common_structures/wallet/index.mdx": [
21682168
"wallet-operations-structures",
21692169
"raw-tx-info",
2170-
"input-txns"
2170+
"input-txns",
2171+
"pay-for-gas"
21712172
],
21722173
"src/pages/komodo-defi-framework/api/index.mdx": [
21732174
"komodo-de-fi-framework-rpc-methods"
@@ -2825,6 +2826,36 @@
28252826
"token-protocol-parse-error-error",
28262827
"unexpected-token-protocol-error"
28272828
],
2829+
"src/pages/komodo-defi-framework/api/v20/fee_management/get_eth_estimated_fee_per_gas/index.mdx": [
2830+
"get-eth-estimated-fee-per-gas",
2831+
"request",
2832+
"response"
2833+
],
2834+
"src/pages/komodo-defi-framework/api/v20/fee_management/get_swap_transaction_fee_policy/index.mdx": [
2835+
"get-swap-transaction-fee-policy",
2836+
"request",
2837+
"response"
2838+
],
2839+
"src/pages/komodo-defi-framework/api/v20/fee_management/index.mdx": [
2840+
"evm-network-fee-management",
2841+
"fee-management-methods",
2842+
"fee-management-configuration",
2843+
"in-the-coins-file",
2844+
"in-the-mm-2-json-file"
2845+
],
2846+
"src/pages/komodo-defi-framework/api/v20/fee_management/set_swap_transaction_fee_policy/index.mdx": [
2847+
"set-swap-transaction-fee-policy",
2848+
"request",
2849+
"response"
2850+
],
2851+
"src/pages/komodo-defi-framework/api/v20/fee_management/start_eth_fee_estimator/index.mdx": [
2852+
"start-eth-fee-estimator",
2853+
"response"
2854+
],
2855+
"src/pages/komodo-defi-framework/api/v20/fee_management/stop_eth_fee_estimator/index.mdx": [
2856+
"stop-eth-fee-estimator",
2857+
"response"
2858+
],
28282859
"src/pages/komodo-defi-framework/api/v20/get_current_mtp/index.mdx": [
28292860
"get-current-mtp",
28302861
"arguments",
@@ -3667,6 +3698,7 @@
36673698
"configuration-parameters",
36683699
"example-allowing-weak-password",
36693700
"example-not-allowing-weak-password",
3701+
"example-using-gas-api",
36703702
"example-wss-with-certificates",
36713703
"example-for-hd-wallets",
36723704
"coins-file-configuration",

src/data/sidebar.json

+29
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,35 @@
387387
}
388388
]
389389
},
390+
{
391+
"title": "Fee Management",
392+
"links": [
393+
{
394+
"title": "Overview",
395+
"href": "/komodo-defi-framework/api/v20/fee_management/"
396+
},
397+
{
398+
"title": "get_eth_estimated_fee_per_gas",
399+
"href": "/komodo-defi-framework/api/v20/fee_management/get_eth_estimated_fee_per_gas/"
400+
},
401+
{
402+
"title": "get_swap_transaction_fee_policy",
403+
"href": "/komodo-defi-framework/api/v20/fee_management/get_swap_transaction_fee_policy/"
404+
},
405+
{
406+
"title": "set_swap_transaction_fee_policy",
407+
"href": "/komodo-defi-framework/api/v20/fee_management/set_swap_transaction_fee_policy/"
408+
},
409+
{
410+
"title": "start_eth_fee_estimator",
411+
"href": "/komodo-defi-framework/api/v20/fee_management/start_eth_fee_estimator/"
412+
},
413+
{
414+
"title": "stop_eth_fee_estimator",
415+
"href": "/komodo-defi-framework/api/v20/fee_management/stop_eth_fee_estimator/"
416+
}
417+
]
418+
},
390419
{
391420
"title": "Market Maker Bot",
392421
"links": [

src/pages/komodo-defi-framework/api/common_structures/index.mdx

+22-14
Original file line numberDiff line numberDiff line change
@@ -438,23 +438,31 @@ The `WithdrawFee` object varies depending on the coin or token type. Refer to th
438438

439439
### FilterCriteria
440440

441-
The `FilterCriteria` object includes different criteria to filter from the different recent swaps:
441+
The 'FilterCriteria' object allows you to filter the results based on specific parameters.
442+
443+
| Parameter | Type | Description |
444+
| --------------- | ------ | ---------------------------------------------- |
445+
| status | string | Status of the transactions (e.g., "completed") |
446+
| date\_from | string | \`Start date in ISO 8601 format |
447+
| date\_to | string | End date in ISO 8601 format |
448+
| my\_coin | string | Coin being used by you for the swap/trade. |
449+
| other\_coin | string | Coin you are trading against |
450+
| from\_timestamp | number | Start timestamp in UNIX format |
451+
| to\_timestamp | number | End timestamp in UNIX format |
442452

443-
| Parameter | Type | Description |
444-
| ---------- | ------------------------ | ---------------------------------------------------------------------- |
445-
| status | object | Return only swaps that match the specified status (e.g., "completed"). |
446-
| date\_from | string (ISO 8601 format) | Return only swaps that started on or after this date. |
447-
| date\_to | string (ISO 8601 format) | Return only swaps that started before this date. |
448-
449-
<CollapsibleSection expandedText="Hide Examples" collapsedText="Show Examples">
453+
<CollapsibleSection expandedText="Hide Example" collapsedText="Show Example">
450454
#### Example
451455

452456
```json
453457
{
454458
"filter": {
455-
"status": "completed",
456-
"date_from": "2024-01-01T00:00:00Z",
457-
"date_to": "2024-07-01T00:00:00Z"
459+
"status": "completed",
460+
"date_from": "2024-01-01T00:00:00Z",
461+
"date_to": "2024-07-01T00:00:00Z",
462+
"my_coin": "BTC",
463+
"other_coin": "ETH",
464+
"from_timestamp": 1672531200,
465+
"to_timestamp": 1704067200
458466
}
459467
}
460468
```
@@ -476,9 +484,9 @@ The `PagingOptions` object includes options of page selection to consult when lo
476484
```json
477485
{
478486
"paging_options": {
479-
"from_uuid": null,
480-
"limit": 10,
481-
"page_number": 1
487+
"from_uuid": null,
488+
"limit": 10,
489+
"page_number": 1
482490
}
483491
}
484492
```

src/pages/komodo-defi-framework/api/common_structures/wallet/index.mdx

+59-10
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ export const description = "Starting with version beta-2.1.3434, the Komodo DeFi
77

88
The `RawTxInfo` object includes the following items:
99

10-
| Parameter | Type | Description |
11-
| ---------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
12-
| tx\_hex | string | UTXO only. The raw unsigned hex of a proposed transaction. |
13-
| prev\_txns | list | UTXO only. A list of standard [InputTxns objects](/komodo-defi-framework/api/common_structures/wallet/#input-txns). |
14-
| to | string | ETH/EVM only. A destination address to send the funds to. |
15-
| 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. |
16-
| gas\_limit | string | ETH/EVM only. The maximum gas to be used for sending the transaction, in [gwei](https://eth-converter.com/) units. |
10+
| Parameter | Type | Description |
11+
| ------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
12+
| tx\_hex | string | UTXO only. The raw unsigned hex of a proposed transaction. |
13+
| prev\_txns | list | UTXO only. A list of standard [InputTxns objects](/komodo-defi-framework/api/common_structures/wallet/#input-txns). |
14+
| to | string | ETH/EVM only. A destination address to send the funds to. |
15+
| 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. |
16+
| gas\_limit | string | ETH/EVM only. The maximum gas to be used for sending the transaction, in [gwei](https://eth-converter.com/) units. |
17+
| pay\_for\_gas | object | Optional, ETH/EVM only. Used for EIP-1559 fee policy config. A standard [PayForGas](/komodo-defi-framework/api/common_structures/wallet/#pay-for-gas) object. |
1718

1819
<DevComment>
1920
TODO: Confirm units used in ETH/EVM transactions.
@@ -35,7 +36,12 @@ The `RawTxInfo` object includes the following items:
3536
{
3637
"to": "0x927DaFDDa16F1742BeFcBEAE6798090354B294A9",
3738
"value": "0.85",
38-
"gas_limit": "21000"
39+
"gas_limit": "21000",
40+
"pay_for_gas": {
41+
"tx_type": "Eip1559",
42+
"max_fee_per_gas": "1234.567",
43+
"max_priority_fee_per_gas": "1.2"
44+
}
3945
}
4046
```
4147
</CollapsibleSection>
@@ -49,8 +55,7 @@ The `InputTxns` object includes the following items:
4955
| tx\_hash | string | The transaction id of an unspent transaction from the same wallet output. |
5056
| index | integer | The \[output index([https://bitcoin.stackexchange.com/questions/100765/what-does-the-index-of-an-utxo-stand-for](https://bitcoin.stackexchange.com/questions/100765/what-does-the-index-of-an-utxo-stand-for))] of this unspent transaction output. |
5157
| script\_pub\_key | string | The [scriptpubkey](https://learnmeabitcoin.com/technical/scriptPubKey) of this unspent transaction output. |
52-
| amount | float | The value of this unspent transaction output. |
53-
| amount | | |
58+
| amount | decimal | The value of this unspent transaction output. |
5459

5560
<CollapsibleSection expandedText="Hide Example" collapsedText="Show Example">
5661
```json
@@ -62,3 +67,47 @@ The `InputTxns` object includes the following items:
6267
}
6368
```
6469
</CollapsibleSection>
70+
71+
### PayForGas
72+
73+
The `PayForGas` object includes the following items:
74+
75+
| Parameter | Type | Description |
76+
| ---------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
77+
| tx\_type | string | ETH/EVM coins and tokens only. Options are `Legacy` or `Eip1559`. The type of transaction values being configured. |
78+
| gas\_price | decimal | Only used if tx\_type is `Legacy`. Values are in Gwei. The maximium price per gas unit the user is willing to pay for the transaction. |
79+
| max\_fee\_per\_gas | decimal | Only used if tx\_type is `Eip1559`. Values are in Gwei. The maximum amount to pay per unit of gas to get your transaction included in a block. |
80+
| max\_priority\_fee\_per\_gas | decimal | Only used if tx\_type is `Eip1559`. Values are in Gwei. This is paid directly to the miner, and can be set by the user to attract minimal delay in transaction confirmation. |
81+
| min\_wait\_time | integer | Optional, only used if tx\_type is `Eip1559`. Estimated minimum transaction wait time in mempool (in ms) for this priority level. |
82+
| max\_wait\_time | integer | Optional, only used if tx\_type is `Eip1559`. Estimated maximum transaction wait time in mempool (in ms) for this priority level. |
83+
84+
<Note>
85+
[Eip1559](https://www.coinbase.com/en-au/blog/the-technical-benefits-of-eip-1559) allows users to save on gas fees. To use this feature for a coin/token, its entry in your `coins` file must include fields for `chain_id` and `max_eth_tx_type`. To allow eip-1559 transactions, `max_eth_tx_type` should be set to `2`. To find the `chain_id` for an \[EVM network([https://blog.thirdweb.com/evm-compatible-blockchains-and-ethereum-virtual-machine/](https://blog.thirdweb.com/evm-compatible-blockchains-and-ethereum-virtual-machine/))], refer to [chainlist.org](https://chainlist.org). There is also a new `gas_fee_estimator` parameter in the coins file, which can be set to `provider` or `simple`.
86+
87+
By default, `simple` gas fee estimation suggests a fee based on fee history. If set `gas_fee_estimator` is set to `provider`, users must set the `gas_api` setting in their [MM2.json file](/komodo-defi-framework/setup/configure-mm2-json/) to source recommended fee values from third party providers [Infura](https://www.infura.io/) or [Blocknative](https://www.blocknative.com/).
88+
89+
Use the [start\_eth\_fee\_estimator](/komodo-defi-framework/api/v20/fee_management/start_eth_fee_estimator/) method to begin tracking the fee market for a coin (and its tokens). You can stop tracking the fee market with [stop\_eth\_fee\_estimator](/komodo-defi-framework/api/v20/fee_management/stop_eth_fee_estimator/).
90+
91+
To set or view the current swap transaction fee policy, use the [get\_swap\_transaction\_fee\_policy](/komodo-defi-framework/api/v20/fee_management/get_swap_transaction_fee_policy/) and [set\_swap\_transaction\_fee\_policy](/komodo-defi-framework/api/v20/fee_management/set_swap_transaction_fee_policy/) methods.
92+
93+
For more information about EIP1559, refer to [https://www.blocknative.com/blog/eip-1559-fees](https://www.blocknative.com/blog/eip-1559-fees)
94+
</Note>
95+
96+
<CollapsibleSection expandedText="Hide Legacy Example" collapsedText="Show Legacy Example">
97+
```json
98+
{
99+
"tx_type": "Legacy",
100+
"gas_price": "1234.567"
101+
}
102+
```
103+
</CollapsibleSection>
104+
105+
<CollapsibleSection expandedText="Hide EIP1559 Example" collapsedText="Show EIP1559 Example">
106+
```json
107+
{
108+
"tx_type": "Eip1559",
109+
"max_fee_per_gas": "1234.567",
110+
"max_priority_fee_per_gas": "1.2"
111+
}
112+
```
113+
</CollapsibleSection>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
export const title = "Komodo DeFi Framework Method: Get ETH Estimated Fee per Gas";
2+
export const description =
3+
"The get_eth_estimated_fee_per_gas method allows you to get the gas priority fees from the estimator (started with the 'start_eth_fee_estimator') for an active coin of your choice.";
4+
5+
# get\_eth\_estimated\_fee\_per\_gas
6+
7+
The `get_eth_estimated_fee_per_gas` method allows you to get the estimated gas priority fee for an active coin of your choice. Before using this method, you first need to use the [start\_eth\_fee\_estimator](/komodo-defi-framework/api/v20/fee_management/start_eth_fee_estimator/) method.
8+
9+
| parameter | Type | Description |
10+
| --------- | ------ | ---------------------------------------------------------------------------- |
11+
| coin | string | Ticker of the coin/asset for which we want to start the grass fee estimator. |
12+
13+
## Request
14+
15+
<CodeGroup title="" tag="POST" label="get_eth_estimated_fee_per_gas" mm2MethodDecorate="true">
16+
```json
17+
{
18+
"userpass": "RPC_UserP@SSW0RD",
19+
"method": "get_eth_estimated_fee_per_gas",
20+
"mmrpc": "2.0",
21+
"params": {
22+
"coin": "ETH"
23+
}
24+
}
25+
```
26+
</CodeGroup>
27+
28+
## Response
29+
30+
```json
31+
{
32+
"mmrpc": "2.0",
33+
"result": {
34+
"base_fee": "10.890879158",
35+
"low": {
36+
"max_priority_fee_per_gas": "0.1101",
37+
"max_fee_per_gas": "11.949818698",
38+
"min_wait_time": null,
39+
"max_wait_time": null
40+
},
41+
"medium": {
42+
"max_priority_fee_per_gas": "1.258084291",
43+
"max_fee_per_gas": "13.905056537",
44+
"min_wait_time": null,
45+
"max_wait_time": null
46+
},
47+
"high": {
48+
"max_priority_fee_per_gas": "2.495532249",
49+
"max_fee_per_gas": "15.949758042",
50+
"min_wait_time": null,
51+
"max_wait_time": null
52+
},
53+
"source": "simple",
54+
"base_fee_trend": "",
55+
"priority_fee_trend": "",
56+
"units": "Gwei"
57+
},
58+
"id": null
59+
}
60+
61+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
export const title = "Komodo DeFi Framework Method: Get Swap Transaction Fee Policy";
2+
export const description =
3+
"The get_swap_transaction_fee_policy method allows you to get the current gas fees policy used when estimating swap transaction fees for supported for ETH/EVM coins/tokens..";
4+
5+
# get\_swap\_transaction\_fee\_policy
6+
7+
The `get_swap_transaction_fee_policy` method allows you to get the current gas fees policy used when estimating swap transaction fees for supported for ETH/EVM coins/tokens.
8+
9+
| parameter | Type | Description |
10+
| --------- | ------ | ---------------------------------------------------------------------------------------- |
11+
| coin | string | Ticker of the supported ETH/EVM coin/asset for which we want to view the fee policy for. |
12+
13+
## Request
14+
15+
<CodeGroup title="" tag="POST" label="get_swap_transaction_fee_policy" mm2MethodDecorate="true">
16+
```json
17+
{
18+
"userpass": "RPC_UserP@SSW0RD",
19+
"method": "get_swap_transaction_fee_policy",
20+
"mmrpc": "2.0",
21+
"params": {
22+
"coin": "ETH"
23+
}
24+
}
25+
```
26+
</CodeGroup>
27+
28+
## Response
29+
30+
```json
31+
{
32+
"mmrpc": "2.0",
33+
"result": "High",
34+
"id": null
35+
}
36+
37+
```

0 commit comments

Comments
 (0)