Is there any available options to get an near-api-js Account object from wallet? #559
-
I want to use wallet-selector along with near-api-js, in near-api-js there are Account objects, that are used to interact with the blockchain. But I can't find any ways to get that object from wallet-selector. Maybe You guys know how it can be achived? Maybe there something like an adapter entity somewhere, that i just cannot found... Thank You a lot! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@kostyamospan wallet-selector just gives you the account id which you can access like this: You can construct the Account object using the account id like this: import { connect } from "near-api-js";
const near = await connect({...});
const accountId = selector.store.getState().accounts[0];
const account = await near.account(accountId); |
Beta Was this translation helpful? Give feedback.
@kostyamospan wallet-selector just gives you the account id which you can access like this:
selector.store.getState().accounts
. We don't give you the Account object because not all wallets are using it like that.You can construct the Account object using the account id like this: