Moralis Balances with Smart Wallet

I have a bit of a unique use case. Our users are given a smart wallet (ERC1271 contract) when receiving an nft. Each user interacts with our dapp in the context of this smart wallet.

Unfortunately, I don’t see a way to set a users account (or link it) to a contract address in the DB since the auth process relies on the signed message to return a user address.
Ideally, I could set a user address as the smart wallet, then be able to call funcs like: getNativeBalance and getERC20Balance on this smart wallet.

I know there is a way to watch contract events, however this doesn’t seem right for my use case as each user would have to register their smart wallet for the db to track.

Does anyone know a way to aggregate txs like raw accounts do, but with a smart contract address?

Can you give an example of one of these smart contract wallet addresses? Are your users authenticated or saved in your Moralis server? Maybe you can just associate their smart wallet address in their user object and query it, and then use that address for your API calls.

This is a Smart Wallet Contract from a rinkeby deploy: 0xF4ea4316089830740B9610ec74c993C5b8e3e3af

Owned by raw account: 0xCB57E6581263F03E48F3dcb877e51fcfD10C7D58

I tried to use, but I get a “no validation” error. I assume that’s what you mean when saying “associate their smart wallet address”?

I can authenticate with the vanilla flow (i.e raw address + custom connector), which works great. However I need the backend to track the transactions of their Smart Wallet, not their raw account. This way I can get balances and index txs for the Smart Wallet.

You could save that address to the user’s object (for their raw address) manually. And then if you want to call the API with this address, it will be available from the current user’s data.

If you want to track transactions e.g. NFT token transactions you can sync these addresses manually.

1 Like