Skip to content

Commit da65eee

Browse files
authored
Fix Multichain getSession (#2813)
1 parent 6ed38ac commit da65eee

6 files changed

Lines changed: 7 additions & 7 deletions

File tree

metamask-connect/multichain/concepts/scopes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ A session includes:
7979
data and [`disconnect`](../reference/methods.md#disconnect) to end or modify the session.
8080

8181
```javascript
82-
const session = await client.getSession()
82+
const session = await client.provider.getSession()
8383

8484
const ethAccounts = session.sessionScopes['eip155:1']?.accounts || []
8585
const solAccounts = session.sessionScopes['solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp']?.accounts || []

metamask-connect/multichain/quickstart/javascript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Connect to MetaMask, get accounts from the session, and invoke RPC methods on ch
137137
```javascript
138138
await client.connect(['eip155:1', 'eip155:137', 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp'], [])
139139

140-
const session = await client.getSession()
140+
const session = await client.provider.getSession()
141141
const ethAccounts = session.sessionScopes['eip155:1']?.accounts || []
142142
const solAccounts = session.sessionScopes['solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp']?.accounts || []
143143
console.log('ETH accounts:', ethAccounts)

metamask-connect/multichain/quickstart/react-native.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ export default function App() {
291291
[ETH_MAINNET, POLYGON, SOLANA_MAINNET],
292292
[],
293293
)
294-
const newSession = await client.getSession()
294+
const newSession = await client.provider.getSession()
295295
setSession(newSession)
296296
} catch (err) {
297297
if (err.code === 4001) {

metamask-connect/multichain/reference/methods.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ A promise that resolves to the current `Session` object containing `sessionScope
6161
```javascript
6262
await client.connect(['eip155:1', 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp'], [])
6363

64-
const session = await client.getSession()
64+
const session = await client.provider.getSession()
6565
const ethAccounts = session.sessionScopes['eip155:1']?.accounts || []
6666
const solAccounts = session.sessionScopes['solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp']?.accounts || []
6767
```

metamask-connect/multichain/tutorials/create-multichain-dapp.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ Pass an empty array to let the user choose their own accounts.
129129
After connecting, retrieve the session to see which accounts the user authorized:
130130

131131
```typescript
132-
const session = await client.getSession()
132+
const session = await client.provider.getSession()
133133

134134
const ethAccounts = session.sessionScopes[SCOPES.ETHEREUM]?.accounts || []
135135
const lineaAccounts = session.sessionScopes[SCOPES.LINEA]?.accounts || []
@@ -390,7 +390,7 @@ export default function App() {
390390
try {
391391
const client = await getClient()
392392
await client.connect([SCOPES.ETHEREUM, SCOPES.LINEA, SCOPES.BASE, SCOPES.SOLANA], [])
393-
const session = await client.getSession()
393+
const session = await client.provider.getSession()
394394
const accts: ChainAccounts = {}
395395
for (const scope of Object.values(SCOPES)) {
396396
accts[scope] = session.sessionScopes[scope]?.accounts || []

metamask-connect/solana/quickstart/react-native.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ export default function App() {
289289
setConnecting(true)
290290
try {
291291
await client.connect([SOLANA_MAINNET], [])
292-
const session = await client.getSession()
292+
const session = await client.provider.getSession()
293293
const scopeData = session?.sessionScopes?.[SOLANA_MAINNET]
294294
const accs = scopeData?.accounts?.map((a) => a.split(':').pop()) ?? []
295295
setAccounts(accs)

0 commit comments

Comments
 (0)