Skip to content

Cannot use VM alongside other contracts #184

@gagdiez

Description

@gagdiez

The initNear takes a wallet selector as input. Currently, if the wallet selector creates a function access key for a contract that is not the SocialDB (for example, the user wants to login to use hello.near-examples.testnet, the following lines will logOut the user:

near.connectedContractId = walletState?.contract?.contractId;
if (
near.connectedContractId &&
near.connectedContractId !== near.config.contractName
) {
const selector = await near.selector;
const wallet = await selector.wallet();
await wallet.signOut();
near.connectedContractId = null;
walletState = selector.store.getState();
}

This is because the VM is checking if the selector being used is connected to the socialDB, and otherwise calling wallet.signOut

I would expect people to mix interactions with the VM with interactions to other contracts. In fact, I discovered this problem while trying to create a Hello World example that can talk with both BOS components, and a simple hello world smart contract.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions