Skip to content

Commit bae774c

Browse files
committed
adds wc_get_session and wc_get_sessions KDF methods
1 parent 2bf91cc commit bae774c

File tree

6 files changed

+415
-2
lines changed

6 files changed

+415
-2
lines changed

filepathSlugs.json

+19-1
Original file line numberDiff line numberDiff line change
@@ -2057,7 +2057,9 @@
20572057
"example-5",
20582058
"wc-conn-ns",
20592059
"eip-155-example",
2060-
"cosmos-example"
2060+
"cosmos-example",
2061+
"wc-session",
2062+
"example-6"
20612063
],
20622064
"src/pages/komodo-defi-framework/api/common_structures/lightning/index.mdx": [
20632065
"lightning-network-structures",
@@ -3786,6 +3788,22 @@
37863788
"command",
37873789
"response-2"
37883790
],
3791+
"src/pages/komodo-defi-framework/api/v20-dev/wc_get_session/index.mdx": [
3792+
"wc-get-session",
3793+
"arguments",
3794+
"response",
3795+
"examples",
3796+
"command",
3797+
"response-2"
3798+
],
3799+
"src/pages/komodo-defi-framework/api/v20-dev/wc_get_sessions/index.mdx": [
3800+
"wc-get-sessions",
3801+
"arguments",
3802+
"response",
3803+
"examples",
3804+
"command",
3805+
"response-2"
3806+
],
37893807
"src/pages/komodo-defi-framework/api/v20-dev/wc_new_connection/index.mdx": [
37903808
"wc-new-connection",
37913809
"arguments",

src/data/sidebar.json

+8
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,14 @@
779779
{
780780
"title": "wc_new_connection",
781781
"href": "/komodo-defi-framework/api/v20-dev/wc_new_connection/"
782+
},
783+
{
784+
"title": "wc_get_session",
785+
"href": "/komodo-defi-framework/api/v20-dev/wc_get_session/"
786+
},
787+
{
788+
"title": "wc_get_sessions",
789+
"href": "/komodo-defi-framework/api/v20-dev/wc_get_sessions/"
782790
}
783791
]
784792
}

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

+30-1
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ The `PagingOptions` object includes options of page selection to consult when lo
502502

503503
### WcConnNs
504504

505-
The WcConnNs\` object contains details of approved chains, methods and events while connected via [WalletConnect](https://specs.walletconnect.com/2.0/).
505+
The `WcConnNs` object contains details of approved chains, methods and events while connected via [WalletConnect](https://specs.walletconnect.com/2.0/).
506506

507507
| Parameter | Type | Description |
508508
| --------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -551,3 +551,32 @@ The WcConnNs\` object contains details of approved chains, methods and events wh
551551
}
552552
```
553553
</CollapsibleSection>
554+
555+
### WcSession
556+
557+
The `WcSession` object contains details of active WalletConnect sessions.
558+
559+
| Parameter | Type | Description |
560+
| ---------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
561+
| topic | string | The session topic hex string, used to identify the session for communications with the external wallet/dapp. |
562+
| metadata | object | Arbitrary data returned from the external wallet/dapp on connection. |
563+
| peer\_pubkey | string | TBA |
564+
| pairing\_topic | string | The pairing topic hex string, used for the initial external wallet/dapp connection. |
565+
| namespaces | object | Contains the same two [WcConnNs](/komodo-defi-framework/api/common_structures/#wc-conn-ns) objects for Cosmos/EIP155 which were input when initialising the connection via [wc\_new\_connection](/komodo-defi-framework/api/v20-dev/wc_new_connection/#wc-new-connection). |
566+
| subscription\_id | string | A hex string to identify the connection's subscription |
567+
| properties | Null | TBA |
568+
| expiry | integer | A timestamp in [unix epoch format](https://www.epochconverter.com/) indicating when the connection will expire if not otherwise closed. |
569+
570+
<CollapsibleSection expandedText="Hide Examples" collapsedText="Show Examples">
571+
#### Example
572+
573+
```json
574+
575+
576+
```
577+
</CollapsibleSection>
578+
579+
Within each session object, there are a some values which are required as input in other WalletConnect methods:
580+
581+
* `pairing_topic`: Only used when initally connecting with external wallets/dapps.
582+
* `topic`: Once connected, this is use for communications with the connected external wallet/dapp.

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

+2
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods:
148148
| [validateaddress](/komodo-defi-framework/api/legacy/validateaddress/#validateaddress) | | |
149149
| | [verify\_message](/komodo-defi-framework/api/v20/utils/message_signing/#verify-message) | |
150150
| [version](/komodo-defi-framework/api/legacy/version/#version) | | |
151+
| | | [wc\_get\_session](/komodo-defi-framework/api/v20-dev/wc_get_session/#wc-get-session) |
152+
| | | [wc\_get\_sessions](/komodo-defi-framework/api/v20-dev/wc_get_sessions/#wc-get-sessions) |
151153
| | | [wc\_new\_connection](/komodo-defi-framework/api/v20-dev/wc_new_connection/#wc-new-connection) |
152154
| [withdraw](/komodo-defi-framework/api/legacy/withdraw/#withdraw) | [withdraw](/komodo-defi-framework/api/v20/wallet/tx/withdraw/#withdraw) | |
153155
| | [withdraw\_nft](/komodo-defi-framework/api/v20/non_fungible_tokens/withdraw_nft/#withdraw-nfts) | |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
export const title = "Komodo DeFi Framework Method: Walletconnect: Get session";
2+
export const description =
3+
"The wc_get_session method returns details for a specific WalletConnect session.";
4+
5+
# wc\_get\_session
6+
7+
The `wc_get_session` method returns details for a specific WalletConnect session.
8+
For details on a full list of active WalletConnect sessions, use the [wc\_get\_sessions](/komodo-defi-framework/api/v20-dev/wc_get_sessions/#wc-get-sessions) method instead.
9+
10+
## Arguments
11+
12+
| Structure | Type | Description |
13+
| -------------------- | ------ | -------------------------------------- |
14+
| with\_pairing\_topic | bool | This method takes no input parameters. |
15+
| topic | string | An active session topic hex string. |
16+
17+
## Response
18+
19+
| Structure | Type | Description |
20+
| --------- | ------ | ---------------------------------------------------------------------------------------- |
21+
| session | object | A standard [WcSession](/komodo-defi-framework/api/common_structures/#wc-session) object. |
22+
23+
#### 📌 Examples
24+
25+
#### Command
26+
27+
<CodeGroup title="" tag="POST" label="wc_get_session" mm2MethodDecorate="true">
28+
```json
29+
{
30+
"method": "wc_get_session",
31+
"userpass": "RPC_UserP@SSW0RD",
32+
"mmrpc": "2.0",
33+
"params": {
34+
"with_pairing_topic": true,
35+
"topic": "efe5d00ff97750d40e96f0e794cc10106245da8b98091af69d2d42faa94efcd5"
36+
}
37+
}
38+
```
39+
</CodeGroup>
40+
41+
<CollapsibleSection expandedText="Hide Response" collapsedText="Show Response">
42+
#### Response
43+
44+
```json
45+
{
46+
"mmrpc": "2.0",
47+
"result": {
48+
"session": {
49+
"topic": "732f19eca1865ea4086ba767b9cf16e8521be6303aa92aadb02d46f711f374b7",
50+
"metadata": {
51+
"description": "Trust Wallet is a secure and easy-to-use mobile wallet",
52+
"url": "https://trustwallet.com",
53+
"icons": [
54+
"https://trustwallet.com/assets/images/media/assets/TWT.png"
55+
],
56+
"name": "Trust Wallet"
57+
},
58+
"peer_pubkey": "8596319241d1b10cfef894758188d604fde70ab3246a0b8ccd29d1935b034b66",
59+
"pairing_topic": "0e9712d8aff1825cf738621d96c62f73a1a0037428e2f258b2e81410b6172f68",
60+
"namespaces": {
61+
"cosmos": {
62+
"chains": [
63+
"cosmos:cosmoshub-4"
64+
],
65+
"accounts": [
66+
"cosmos:cosmoshub-4:cosmos1r5expjvu46u4s9yd4d2lpmss22p848lw2a7wa8"
67+
],
68+
"methods": [
69+
"cosmos_getAccounts",
70+
"cosmos_signAmino",
71+
"cosmos_signDirect"
72+
],
73+
"events": []
74+
},
75+
"eip155": {
76+
"chains": [
77+
"eip155:137",
78+
"eip155:43114"
79+
],
80+
"accounts": [
81+
"eip155:137:0x85ed99633e9d03a30ed60209079944e1f4272048",
82+
"eip155:43114:0x85ed99633e9d03a30ed60209079944e1f4272048"
83+
],
84+
"methods": [
85+
"eth_sendTransaction",
86+
"eth_signTransaction",
87+
"personal_sign"
88+
],
89+
"events": [
90+
"accountsChanged",
91+
"chainChanged"
92+
]
93+
}
94+
},
95+
"subscription_id": "9f0b670f0f8a3bc8fbbbc740dc21fe17efea25bc131462df485577ab91a07280",
96+
"properties": null,
97+
"expiry": 1742187580
98+
}
99+
},
100+
"id": null
101+
}
102+
```
103+
</CollapsibleSection>

0 commit comments

Comments
 (0)