@towns-protocol/react-sdk 0.0.349 → 0.0.351
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -26,12 +26,12 @@ import {
|
|
|
26
26
|
TownsSyncProvider,
|
|
27
27
|
useAgentConnection,
|
|
28
28
|
} from "@towns-protocol/react-sdk";
|
|
29
|
-
import {
|
|
29
|
+
import { townsEnv } from "@towns-protocol/sdk";
|
|
30
30
|
import { WagmiProvider } from "wagmi";
|
|
31
31
|
import { useEthersSigner } from "./utils/viem-to-ethers";
|
|
32
32
|
import { wagmiConfig } from "./config/wagmi";
|
|
33
33
|
|
|
34
|
-
const
|
|
34
|
+
const townsConfig = townsEnv().makeTownsConfig("gamma");
|
|
35
35
|
|
|
36
36
|
const App = ({ children }: { children: React.ReactNode }) => {
|
|
37
37
|
return (
|
|
@@ -52,7 +52,7 @@ const ConnectTowns = () => {
|
|
|
52
52
|
if (!signer) {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
|
-
connect(signer, {
|
|
55
|
+
connect(signer, { townsConfig });
|
|
56
56
|
}}
|
|
57
57
|
>
|
|
58
58
|
{isConnecting ? "Disconnect" : "Connect"}
|
|
@@ -9,10 +9,10 @@ import { useTownsSync } from './internals/useTownsSync';
|
|
|
9
9
|
* ### Bearer Token
|
|
10
10
|
* ```tsx
|
|
11
11
|
* import { useAgentConnection } from '@towns-protocol/react-sdk'
|
|
12
|
-
* import {
|
|
12
|
+
* import { townsEnv } from '@towns-protocol/sdk'
|
|
13
13
|
* import { useState } from 'react'
|
|
14
14
|
*
|
|
15
|
-
* const
|
|
15
|
+
* const townsConfig = townsEnv().makeTownsConfig('gamma')
|
|
16
16
|
*
|
|
17
17
|
* const Login = () => {
|
|
18
18
|
* const { connectUsingBearerToken, isAgentConnecting, isAgentConnected } = useAgentConnection()
|
|
@@ -21,7 +21,7 @@ import { useTownsSync } from './internals/useTownsSync';
|
|
|
21
21
|
* return (
|
|
22
22
|
* <>
|
|
23
23
|
* <input value={bearerToken} onChange={(e) => setBearerToken(e.target.value)} />
|
|
24
|
-
* <button onClick={() => connectUsingBearerToken(bearerToken, {
|
|
24
|
+
* <button onClick={() => connectUsingBearerToken(bearerToken, { townsConfig })}>
|
|
25
25
|
* Login
|
|
26
26
|
* </button>
|
|
27
27
|
* {isAgentConnecting && <span>Connecting... ⏳</span>}
|
|
@@ -37,10 +37,10 @@ import { useTownsSync } from './internals/useTownsSync';
|
|
|
37
37
|
*
|
|
38
38
|
* ```tsx
|
|
39
39
|
* import { useAgentConnection } from '@towns-protocol/react-sdk'
|
|
40
|
-
* import {
|
|
40
|
+
* import { townsEnv } from '@towns-protocol/sdk'
|
|
41
41
|
* import { useEthersSigner } from './utils/viem-to-ethers'
|
|
42
42
|
*
|
|
43
|
-
* const
|
|
43
|
+
* const townsConfig = townsEnv().makeTownsConfig('gamma')
|
|
44
44
|
*
|
|
45
45
|
* const Login = () => {
|
|
46
46
|
* const { connect, isAgentConnecting, isAgentConnected } = useAgentConnection()
|
|
@@ -52,7 +52,7 @@ import { useTownsSync } from './internals/useTownsSync';
|
|
|
52
52
|
* if (!signer) {
|
|
53
53
|
* return
|
|
54
54
|
* }
|
|
55
|
-
* connect(signer, {
|
|
55
|
+
* connect(signer, { townsConfig })
|
|
56
56
|
* }}>
|
|
57
57
|
* Login
|
|
58
58
|
* </button>
|
|
@@ -122,7 +122,7 @@ export const useAgentConnection = () => {
|
|
|
122
122
|
/** Whether the agent is connected */
|
|
123
123
|
isAgentConnected,
|
|
124
124
|
/** The environment of the current connection (gamma, omega, alpha, local_dev, etc.) */
|
|
125
|
-
env: towns?.syncAgent?.config.
|
|
125
|
+
env: towns?.syncAgent?.config.townsConfig.environmentId,
|
|
126
126
|
};
|
|
127
127
|
};
|
|
128
128
|
//# sourceMappingURL=useAgentConnection.js.map
|
|
@@ -9,10 +9,10 @@ type AgentConnectConfig = Omit<SyncAgentConfig, 'context' | 'onTokenExpired'>;
|
|
|
9
9
|
* ### Bearer Token
|
|
10
10
|
* ```tsx
|
|
11
11
|
* import { useAgentConnection } from '@towns-protocol/react-sdk'
|
|
12
|
-
* import {
|
|
12
|
+
* import { townsEnv } from '@towns-protocol/sdk'
|
|
13
13
|
* import { useState } from 'react'
|
|
14
14
|
*
|
|
15
|
-
* const
|
|
15
|
+
* const townsConfig = townsEnv().makeTownsConfig('gamma')
|
|
16
16
|
*
|
|
17
17
|
* const Login = () => {
|
|
18
18
|
* const { connectUsingBearerToken, isAgentConnecting, isAgentConnected } = useAgentConnection()
|
|
@@ -21,7 +21,7 @@ type AgentConnectConfig = Omit<SyncAgentConfig, 'context' | 'onTokenExpired'>;
|
|
|
21
21
|
* return (
|
|
22
22
|
* <>
|
|
23
23
|
* <input value={bearerToken} onChange={(e) => setBearerToken(e.target.value)} />
|
|
24
|
-
* <button onClick={() => connectUsingBearerToken(bearerToken, {
|
|
24
|
+
* <button onClick={() => connectUsingBearerToken(bearerToken, { townsConfig })}>
|
|
25
25
|
* Login
|
|
26
26
|
* </button>
|
|
27
27
|
* {isAgentConnecting && <span>Connecting... ⏳</span>}
|
|
@@ -37,10 +37,10 @@ type AgentConnectConfig = Omit<SyncAgentConfig, 'context' | 'onTokenExpired'>;
|
|
|
37
37
|
*
|
|
38
38
|
* ```tsx
|
|
39
39
|
* import { useAgentConnection } from '@towns-protocol/react-sdk'
|
|
40
|
-
* import {
|
|
40
|
+
* import { townsEnv } from '@towns-protocol/sdk'
|
|
41
41
|
* import { useEthersSigner } from './utils/viem-to-ethers'
|
|
42
42
|
*
|
|
43
|
-
* const
|
|
43
|
+
* const townsConfig = townsEnv().makeTownsConfig('gamma')
|
|
44
44
|
*
|
|
45
45
|
* const Login = () => {
|
|
46
46
|
* const { connect, isAgentConnecting, isAgentConnected } = useAgentConnection()
|
|
@@ -52,7 +52,7 @@ type AgentConnectConfig = Omit<SyncAgentConfig, 'context' | 'onTokenExpired'>;
|
|
|
52
52
|
* if (!signer) {
|
|
53
53
|
* return
|
|
54
54
|
* }
|
|
55
|
-
* connect(signer, {
|
|
55
|
+
* connect(signer, { townsConfig })
|
|
56
56
|
* }}>
|
|
57
57
|
* Login
|
|
58
58
|
* </button>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@towns-protocol/react-sdk",
|
|
3
3
|
"description": "React Hooks for Towns Protocol SDK",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.351",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/esm/index.js",
|
|
7
7
|
"types": "./dist/types/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"watch": "yarn build -w"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@towns-protocol/sdk": "^0.0.
|
|
21
|
+
"@towns-protocol/sdk": "^0.0.351",
|
|
22
22
|
"ethers": "^5.7.2"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
},
|
|
71
71
|
"sideEffects": false,
|
|
72
72
|
"typings": "./dist/types/index.d.ts",
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "3d663ee82a29f48f4b9fe6ab6af960c6c12b0100"
|
|
74
74
|
}
|
|
@@ -14,10 +14,10 @@ type AgentConnectConfig = Omit<SyncAgentConfig, 'context' | 'onTokenExpired'>
|
|
|
14
14
|
* ### Bearer Token
|
|
15
15
|
* ```tsx
|
|
16
16
|
* import { useAgentConnection } from '@towns-protocol/react-sdk'
|
|
17
|
-
* import {
|
|
17
|
+
* import { townsEnv } from '@towns-protocol/sdk'
|
|
18
18
|
* import { useState } from 'react'
|
|
19
19
|
*
|
|
20
|
-
* const
|
|
20
|
+
* const townsConfig = townsEnv().makeTownsConfig('gamma')
|
|
21
21
|
*
|
|
22
22
|
* const Login = () => {
|
|
23
23
|
* const { connectUsingBearerToken, isAgentConnecting, isAgentConnected } = useAgentConnection()
|
|
@@ -26,7 +26,7 @@ type AgentConnectConfig = Omit<SyncAgentConfig, 'context' | 'onTokenExpired'>
|
|
|
26
26
|
* return (
|
|
27
27
|
* <>
|
|
28
28
|
* <input value={bearerToken} onChange={(e) => setBearerToken(e.target.value)} />
|
|
29
|
-
* <button onClick={() => connectUsingBearerToken(bearerToken, {
|
|
29
|
+
* <button onClick={() => connectUsingBearerToken(bearerToken, { townsConfig })}>
|
|
30
30
|
* Login
|
|
31
31
|
* </button>
|
|
32
32
|
* {isAgentConnecting && <span>Connecting... ⏳</span>}
|
|
@@ -42,10 +42,10 @@ type AgentConnectConfig = Omit<SyncAgentConfig, 'context' | 'onTokenExpired'>
|
|
|
42
42
|
*
|
|
43
43
|
* ```tsx
|
|
44
44
|
* import { useAgentConnection } from '@towns-protocol/react-sdk'
|
|
45
|
-
* import {
|
|
45
|
+
* import { townsEnv } from '@towns-protocol/sdk'
|
|
46
46
|
* import { useEthersSigner } from './utils/viem-to-ethers'
|
|
47
47
|
*
|
|
48
|
-
* const
|
|
48
|
+
* const townsConfig = townsEnv().makeTownsConfig('gamma')
|
|
49
49
|
*
|
|
50
50
|
* const Login = () => {
|
|
51
51
|
* const { connect, isAgentConnecting, isAgentConnected } = useAgentConnection()
|
|
@@ -57,7 +57,7 @@ type AgentConnectConfig = Omit<SyncAgentConfig, 'context' | 'onTokenExpired'>
|
|
|
57
57
|
* if (!signer) {
|
|
58
58
|
* return
|
|
59
59
|
* }
|
|
60
|
-
* connect(signer, {
|
|
60
|
+
* connect(signer, { townsConfig })
|
|
61
61
|
* }}>
|
|
62
62
|
* Login
|
|
63
63
|
* </button>
|
|
@@ -138,6 +138,6 @@ export const useAgentConnection = () => {
|
|
|
138
138
|
/** Whether the agent is connected */
|
|
139
139
|
isAgentConnected,
|
|
140
140
|
/** The environment of the current connection (gamma, omega, alpha, local_dev, etc.) */
|
|
141
|
-
env: towns?.syncAgent?.config.
|
|
141
|
+
env: towns?.syncAgent?.config.townsConfig.environmentId,
|
|
142
142
|
}
|
|
143
143
|
}
|