MULTI-WALLET PER TENANT
In v1 each tenant could link exactly one wallet address. v1.1 relaxes that: you can now link multiple wallets to a single IndiPoli account, give each one a friendly label, and switch the active wallet at runtime from the dashboard. Only one wallet is active at a time and only the active wallet is used for new trades.
WHY
- Separate test and production wallets. Run the dev instance against a throwaway wallet; switch to your real one for production trades without signing out.
- Separate strategies. Run one wallet with conservative limits and another with aggressive limits by flipping the active wallet around an opportunity.
- Key rotation. Link a new wallet, move USDC.e, activate the new one, unlink the old one — all without losing your tenant’s history.
INVARIANTS
- A wallet address can still belong to only one tenant. (Two different users cannot both link the same address.)
- A tenant can have 1..N linked wallets.
- Exactly one wallet per tenant is
is_active=1. The active wallet is the one every trade preparation flow will target. - Unlinking the currently-active wallet auto-promotes the newest remaining wallet to active. If you unlink the last wallet, the tenant has zero wallets and trade preparation will refuse until you link a new one.
- Allowance state is per-wallet and lives on-chain. Switching the active wallet does not transfer allowance — each wallet must have its own approved allowance to the Polymarket CTF Exchange.
HOW TO LINK A SECOND WALLET
- Go to /app/dashboard.
- In the Wallet Status widget, click + Add wallet.
- The Reown AppKit flow opens. Select the new wallet (or a different account in the same extension) and approve the connection.
- Sign the SIWE link message. The new wallet is added to your tenant.
- If this is your first wallet it becomes active automatically. Otherwise it stays inactive — you’ll be asked “Make this the active wallet?”.
- Approve USDC.e allowance for the new wallet before trading with it.
HOW TO SWITCH THE ACTIVE WALLET
The Wallet Status widget shows a dropdown of all your linked wallets, each formatted as:
[label] 0x1234...abcd
Pick one and the change is committed via POST /app/wallet/active.
All trade preparation from this point on will use the newly-active wallet.
A short advisory lock prevents a concurrent switch race.
HOW TO UNLINK A WALLET
- Open the wallet dropdown and click the trash icon next to the wallet you want to remove.
- Confirm.
POST /app/wallet/unlinkdeletes that one row. - If the deleted wallet was active, the newest remaining wallet is auto-promoted.
- On-chain allowance is not revoked by unlinking. If you want to revoke it, use your wallet extension or re-link the wallet briefly and hit Revoke allowance.
LABELS
Labels are freeform strings up to 64 characters (e.g. “main”, “dev”, “conservative”). They are tenant-private and never leave your instance. You can edit them by clicking the pencil icon next to the wallet row.
API ENDPOINTS (FOR SCRIPTING / DEBUG)
| Method | Path | Purpose |
|---|---|---|
| POST | /app/wallet/nonce | Issue SIWE nonce (unchanged from v1) |
| POST | /app/wallet/link | Verify SIWE signature and add a new wallet row |
| POST | /app/wallet/active | Set {id} as the active wallet |
| POST | /app/wallet/unlink | Delete {id}; auto-promote if active |
| POST | /app/wallet/approvals | Record an on-chain USDC allowance tx for a linked wallet |
MIGRATION NOTES (FROM v1.0)
When you run the v1.1 migrations, the existing UNIQUE (tenant_id)
index on wallet_links is dropped. Any existing single-wallet
row is backfilled with is_active=1 and label='', so
your current wallet keeps working exactly as before. No user action required
during the upgrade.