Overview
Fetch pod object data, manage memberships and manager roles through the Metropolis SDK.
Importing Types
Pod and Proposal are the two types available in our SDK. Types can be imported with the following:
import { Pod, Proposal } from '@orcaprotocol/orca-sdk';
Pod
Fetching pods
Once you init the SDK, you can call getPod()
, getUserPods()
, or getAdminPods()
anywhere to fetch Pod objects.
Using these functions can help you present and organize your application accordingly to pod and pod member structures of connected users.
- Query
- Response
import { getPod, getUserPods, getAdminPods } from '@orcaprotocol/orca-sdk';
// ENS names also work for the below.
const podFromEnsName = await getPod('mypod.pod.xyz');
const podFromAddress = await getPod('0x123...456');
const podFromId = await getPod(1);
// Returns null
const notAPod = await getPod('not a pod');
// Fetches all Pods that a user is a member of
const userPods = await getUserPods(userAddress);
// Fetches all Pods that a user is a manager of
const adminPods = await getAdminPods(adminAddress);
const {
id, // Pod ID
safe, // Gnosis safe address, aka the Pod address
ensName, // E.g., metronauts.pod.xyz
admin, // Address of pod manager
imageUrl, // Source of NFT image
imageNoTextUrl, // Source of NFT image without text (used for avatars)
} = await getPod();
Check roles and memberships
For a given pod, you can check if a certain given user is a manager, manager pod member, or member pod.
const pod = await getPod(podAddress);
// Checks if user is manager of pod
const isAdminBoolean = await pod.isAdmin('0x123...456');
// Checks if user is member of a manager pod (if exists) for a given pod
const isAdminPodMemberBoolean = await pod.isAdminPodMember('0x123...456');
// Checks if user is member of pod
const isMemberBoolean = await pod.isMember('0x123...456');
// Checks if user is a member of a member pod. Returns false if the user is a member of this pod, but not any member pods.
const isSubPodMemberBoolean = await pod.isSubPodMember('0x123...456');
Fetching members, EOAs, member pods and parent pods
Once you have a given pod, you can fetch members, EOAs, member pods and parent pods with the following functions:
const pod = await getPod(podAddress);
// Fetches list of all members from the pod, as an array of Ethereum addresses.
// This includes any pods that may be members of the original pods.
const members = await pod.getMembers();
// Fetches any member EOAs (externally owned accounts). That is, any member that is not a smart contract or pod.
const memberEOAs = await pod.getMemberEOAs();
// Fetches Pod objects for any sub pods of a given pod
const memberPods = await pod.getMemberPods();
// For a given pod, fetches all sub pods a given user is a part of
const subPodsOfMember = await pod.getSubPodsByMember(userAddress);
// Fetch the parent pod of a given pod, if relevant.
const superPods = await pod.getSuperPods();