wc_new_connection
The wc_new_connection method returns a connection string which can be scanned as a QR code.
Once the connection has been established, you can activate EVM and Tendermint coins/tokens with WalletConnect via the priv_key_policy parameter in enable_eth_with_tokens and enable_tendermint_with_assets.
Arguments
| Structure | Type | Description |
|---|---|---|
| required_namespaces | object | Contains two WcConnNs objects under the keys eip155 and cosmos, which contain details of approved chains, methods and events while connected. |
Response
| Structure | Type | Description |
|---|---|---|
| url | string | A WalletConnect URI address (EIP-1328) used to send a connection request to the bridge server. |
Generally, this WalletConnect URI will be converted into a scanable QR code in graphic user interfaces, so mobile dapps can easily request a connection.
📌 Examples
Command
POST wc_new_connection
{
"method": "wc_new_connection",
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"params": {
"required_namespaces": {
"eip155": {
"chains": [
"eip155:1",
"eip155:56",
"eip155:137",
"eip155:43114"
],
"methods": [
"eth_sendTransaction",
"eth_signTransaction",
"personal_sign"
],
"events": [
"accountsChanged",
"chainChanged"
]
},
"cosmos": {
"chains": [
"cosmos:cosmoshub-4"
],
"methods": [
"cosmos_signDirect",
"cosmos_signAmino",
"cosmos_getAccounts"
],
"events": []
}
}
}
} curl --url "http://127.0.0.1:7783" --data '{
"method": "wc_new_connection",
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"params": {
"required_namespaces": {
"eip155": {
"chains": [
"eip155:1",
"eip155:56",
"eip155:137",
"eip155:43114"
],
"methods": [
"eth_sendTransaction",
"eth_signTransaction",
"personal_sign"
],
"events": [
"accountsChanged",
"chainChanged"
]
},
"cosmos": {
"chains": [
"cosmos:cosmoshub-4"
],
"methods": [
"cosmos_signDirect",
"cosmos_signAmino",
"cosmos_getAccounts"
],
"events": []
}
}
}
}' import requests
import json
url = "http://127.0.0.1:7783"
payload = {
"method": "wc_new_connection",
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"params": {
"required_namespaces": {
"eip155": {
"chains": [
"eip155:1",
"eip155:56",
"eip155:137",
"eip155:43114"
],
"methods": [
"eth_sendTransaction",
"eth_signTransaction",
"personal_sign"
],
"events": [
"accountsChanged",
"chainChanged"
]
},
"cosmos": {
"chains": [
"cosmos:cosmoshub-4"
],
"methods": [
"cosmos_signDirect",
"cosmos_signAmino",
"cosmos_getAccounts"
],
"events": []
}
}
}
}
response = requests.post(url, json=payload)
print(json.dumps(response.json(), indent=2)) const payload = {
"method": "wc_new_connection",
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"params": {
"required_namespaces": {
"eip155": {
"chains": [
"eip155:1",
"eip155:56",
"eip155:137",
"eip155:43114"
],
"methods": [
"eth_sendTransaction",
"eth_signTransaction",
"personal_sign"
],
"events": [
"accountsChanged",
"chainChanged"
]
},
"cosmos": {
"chains": [
"cosmos:cosmoshub-4"
],
"methods": [
"cosmos_signDirect",
"cosmos_signAmino",
"cosmos_getAccounts"
],
"events": []
}
}
}
};
const response = await fetch("http://127.0.0.1:7783", {
method: "POST",
body: JSON.stringify(payload),
});
console.log(await response.json()); <?php
$payload = <<<'JSON'
{
"method": "wc_new_connection",
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"params": {
"required_namespaces": {
"eip155": {
"chains": [
"eip155:1",
"eip155:56",
"eip155:137",
"eip155:43114"
],
"methods": [
"eth_sendTransaction",
"eth_signTransaction",
"personal_sign"
],
"events": [
"accountsChanged",
"chainChanged"
]
},
"cosmos": {
"chains": [
"cosmos:cosmoshub-4"
],
"methods": [
"cosmos_signDirect",
"cosmos_signAmino",
"cosmos_getAccounts"
],
"events": []
}
}
}
}
JSON;
$ch = curl_init("http://127.0.0.1:7783");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
curl_close($ch);
echo $response; package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{"method":"wc_new_connection","userpass":"RPC_UserP@SSW0RD","mmrpc":"2.0","params":{"required_namespaces":{"eip155":{"chains":["eip155:1","eip155:56","eip155:137","eip155:43114"],"methods":["eth_sendTransaction","eth_signTransaction","personal_sign"],"events":["accountsChanged","chainChanged"]},"cosmos":{"chains":["cosmos:cosmoshub-4"],"methods":["cosmos_signDirect","cosmos_signAmino","cosmos_getAccounts"],"events":[]}}}}`)
resp, err := http.Post("http://127.0.0.1:7783", "application/json", bytes.NewBuffer(payload))
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
} require 'net/http'
require 'json'
require 'uri'
uri = URI("http://127.0.0.1:7783")
payload = {
"method": "wc_new_connection",
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"params": {
"required_namespaces": {
"eip155": {
"chains": [
"eip155:1",
"eip155:56",
"eip155:137",
"eip155:43114"
],
"methods": [
"eth_sendTransaction",
"eth_signTransaction",
"personal_sign"
],
"events": [
"accountsChanged",
"chainChanged"
]
},
"cosmos": {
"chains": [
"cosmos:cosmoshub-4"
],
"methods": [
"cosmos_signDirect",
"cosmos_signAmino",
"cosmos_getAccounts"
],
"events": []
}
}
}
}
response = Net::HTTP.post(uri, payload.to_json, 'Content-Type' => 'application/json')
puts JSON.pretty_generate(JSON.parse(response.body)) Show Response
Response
{
"mmrpc": "2.0",
"result": {
"url": "wc:31ad8ac6f21312e01ef7ff656ed5507eb9fdf435662fd86331e00b301e3627bfc14@2?symKey=589807f2063d237adfacc18d9443232785b532eaabe7838162c3d78cc3a9060f&relay-protocol=irn&expiryTimestamp=1741584419"
},
"id": null
}