Options
All
  • Public
  • Public/Protected
  • All
Menu

@orcaprotocol/orca-sdk

Index

Type aliases

ProposalStatus: "active" | "passed" | "executed" | "rejected" | "queued"

Variables

config: { etherscanApiKey: any; etherscanUrl: any; gnosisUrl: any; multicall: any; network: any; provider: any; subgraphUrl: any } = ...

The config object. This object should not be manipulated directly, and is exported mostly for debug purposes.

Type declaration

  • etherscanApiKey: any
  • etherscanUrl: any
  • gnosisUrl: any
  • multicall: any
  • network: any
  • provider: any
  • subgraphUrl: any

Functions

  • batchTransferMembership(fromAddress: string, toAddress: string, podIds: number[], signer?: Signer): Promise<ethers.providers.TransactionResponse | { data: string; to: string }>
  • Batch transfers pod memberships. If a signer is provided, it will execute the transaction. Otherwise it will return the unsigned tx.

    throws

    If toAddress is already a member

    throws

    if fromAddress is not a member

    throws

    If provided signer is not the fromAddress

    Parameters

    • fromAddress: string

      Address that is giving up membership

    • toAddress: string

      Address that will receive membership

    • podIds: number[]

      Array of pod IDs for which the toAddress will receive membership

    • Optional signer: Signer

      If a signer is provided, then the tx will execute. Otherwise, an unsigned transaction will be returned.

    Returns Promise<ethers.providers.TransactionResponse | { data: string; to: string }>

  • createPod(args: { admin?: string; members: string[]; name: string; threshold: number }, signer?: Signer): Promise<ethers.providers.TransactionResponse | { data: string; to: string }>
  • Creates a safe and podifies it. If a signer is not provided, instead it returns an unsigned transaction.

    Parameters

    • args: { admin?: string; members: string[]; name: string; threshold: number }
      • Optional admin?: string

        Optional pod admin

      • members: string[]

        Array of pod member addresses

      • name: string

        ENS label for safe, i.e., 'orca-core'. Do not add the pod.eth/pod.xyz suffix

      • threshold: number

        Voting threshold

    • Optional signer: Signer

      Optional signer

    Returns Promise<ethers.providers.TransactionResponse | { data: string; to: string }>

  • customSubgraphQuery(query: string): Promise<any>
  • Makes a custom call on the subgraph by passing a query in directly. Note that this data will likely require manual transformation to be usable.

    Example: Making a call to retrieve pod IDs 1 through 3:

    await customSubgraphQuery(`{
    pods(where: {
    id_in: [1, 2, 3]
    }) {
    id
    users {
    id
    }
    admin
    }
    }`

    Which will return:

    { pods: [ { id: '1', users: [Array], admin: '0x0000000000000000000000000000000000000000' }, { id: '2', users: [Array], admin: '0x0000000000000000000000000000000000000000' }, { id: '3', users: [Array], admin: '0x4b4c43f66ec007d1dbe28f03dac975aab5fbb888' } ] }


    Note these are not Pod objects as defined by the SDK.

    @param query - GraphQL query
    @returns

    Parameters

    • query: string

    Returns Promise<any>

  • enableController(safe: string, signer: Signer): Promise<void>
  • Creates a SafeTx on a safe to enable the latest Controller as a module.

    throws

    If a Controller module is already enabled. If you are attempting to upgrade versions, use Pod.migratePodToLatest.

    Parameters

    • safe: string

      Safe address

    • signer: Signer

    Returns Promise<void>

  • fetchAdminPodIds(address: string): Promise<number[]>
  • Returns an array of Pod IDs from sub graph that an address is the admin of This function bypasses Pod construction and is mostly used for optimization purposes. If you're unsure on what function to use, use getAdminPods instead.

    Parameters

    • address: string

    Returns Promise<number[]>

  • fetchPodUsers(id: number): Promise<string[]>
  • Returns an array of addresses of all pod members.

    Parameters

    • id: number

    Returns Promise<string[]>

  • fetchUserPodIds(address: string): Promise<number[]>
  • Returns a list of Pod IDs from subgraph that user is a member of. This function bypasses Pod construction and is mostly used for optimization purposes. If you're unsure on what function to use, use getUserPods instead.

    Parameters

    • address: string

    Returns Promise<number[]>

  • getAdminPods(address: string): Promise<Pod[]>
  • Gets an array of Pod objects that a user is the admin of

    Parameters

    • address: string

      user address

    Returns Promise<Pod[]>

  • getPod(identifier: string | number): Promise<Pod>
  • Gets a pod object.

    Parameters

    • identifier: string | number

      Pod ID (as number), safe address, or ENS name

    Returns Promise<Pod>

  • Gets the super proposal that the sub proposal relates to

    throws

    If this proposal is not a sub proposal

    throws

    If the found super proposal does not relate to this sub proposal.

    Parameters

    Returns Promise<Proposal>

  • getUserPods(address: string): Promise<Pod[]>
  • Fetches an array of Pod objects that a user is a member of

    Parameters

    • address: string

      user address

    Returns Promise<Pod[]>

  • init(input: { network: number; provider: Provider; subgraphUrl?: string }): void
  • Initializes the SDK. This should be called on app startup.

    Parameters

    • input: { network: number; provider: Provider; subgraphUrl?: string }
      • network: number

        Network ID. Currently supporting Mainnet (id 1) and Goerli (id 5)

      • provider: Provider
      • Optional subgraphUrl?: string

        Optional override for development/debug purposes.

    Returns void

  • multiPodCreate(pods: { admin?: string; label: string; members: string[]; threshold: number }[], signer: Signer): Promise<any>
  • Creates multiple pods simultaneously.

    Each pod requires an array of members, a threshold and label, with an optional admin. Members or admins can be other pods in this create action.

    Pods can be added as members of other pods using labels, but only with pods earlier up in the array. I.e., the second pod in the array can have the first pod in the array as a member or admin, but the first pod cannot have the second pod as a member.

    The label replacement does not (currently) work with already existing pods.

    An example:

     [
    {
    label: 'orcanauts',
    // This will add the below pods as sub pods to this newly created one.
    members: ['art-nauts', 'gov-nauts'],
    threshold: 1,
    },
    {
    label: 'art-nauts',
    members: ['0x1234...', '0x2345...'],
    threshold: 1,
    },
    {
    label: 'gov-nauts',
    members: ['0x3456...', '0x4567...'],
    threshold: 1,
    // This will add the above 'orcanauts' pod as the admin to this new pod.
    admin: 'orcanauts',
    }
    ]

    Parameters

    • pods: { admin?: string; label: string; members: string[]; threshold: number }[]
    • signer: Signer

    Returns Promise<any>

  • podifySafe(args: { admin?: string; name: string; safe: string }, signer?: Signer): Promise<ethers.providers.TransactionResponse | { data: string; to: string }>
  • Adds a Gnosis Safe to the pod ecosystem. If a signer is not provided, it instead returns the unsigned transaction.

    throws
    • If Controller module was not enabled
    throws
    • If signer is not a safe owner

    Parameters

    • args: { admin?: string; name: string; safe: string }
      • Optional admin?: string

        Optional address of admin

      • name: string

        ENS label for safe, i.e., 'orca-core'. Do not add the pod.eth/pod.xyz suffix

      • safe: string

        Safe address

    • Optional signer: Signer

      Signer of a safe owner.

    Returns Promise<ethers.providers.TransactionResponse | { data: string; to: string }>

Generated using TypeDoc