Client for ORDAO system.

Constructors

Accessors

Methods

  • Return new instance that authors OREC transactions as signer.

    Parameters

    • signer: Signer

      ethers.Signer implementation that should be used to sign transactions

    Returns ORClient

    • new instance of ORClient.
  • Execute a passed proposal. Will fail if proposal is not passed yet.

    Parameters

    • propId: string

      id of proposal to execute.

    Returns Promise<ExecRes>

    await c.execute("0x2f5e1602a2e1ccc9cf707bc57361ae6587cd87e8ae27105cae38c0db12f4fab1")
    
  • Get metadata of specific Respect award NTT.

    Parameters

    • tokenId: string

      id of a token.

    Returns Promise<{
        description?: string;
        image?: string;
        name: string;
        properties: {
            burn?: null | {
                burnReason?: string;
                burnTxHash?: string;
            };
            denomination: number;
            groupNum?: number;
            level?: number;
            mintProposalId?: string;
            mintTs?: number;
            mintTxHash?: string;
            mintType: number;
            periodNumber: number;
            reason?: string;
            recipient: string;
            title?: string;
            tokenId: string;
        };
    }>

    If tokenId is an id of a burned token, this function might return a metadata for token which is burned onchain.

  • Get metadata of Respect award NTTs, sorted from latest to oldest.

    Parameters

    • Optionalspec: {
          before?: Date;
          burned?: boolean;
          limit?: number;
          recipient?: string;
      }

      specification for a query

      • before - newest mint date for a token. If specified, only tokens which were created up to this date will be returned;
      • limit - maximum number of tokens to return. If not specified, it's up to ornode implementation.
      • recipient - recipient of the awards. If specified only awards which belong to this account are returned.
      • burned - whether to return burned tokens or not. Default: false.
      • Optionalbefore?: Date
      • Optionalburned?: boolean
      • Optionallimit?: number
      • Optionalrecipient?: string

    Returns Promise<{
        description?: string;
        image?: string;
        name: string;
        properties: {
            burn?: null | {
                burnReason?: string;
                burnTxHash?: string;
            };
            denomination: number;
            groupNum?: number;
            level?: number;
            mintProposalId?: string;
            mintTs?: number;
            mintTxHash?: string;
            mintType: number;
            periodNumber: number;
            reason?: string;
            recipient: string;
            title?: string;
            tokenId: string;
        };
    }[]>

    list of token metadata objects sorted by mint datetime from latest to oldest.

    • By default this function does not return burned awards. Set burned in the spec to true to change this behaviour.
    await c.getAwards() // Return latest awards unfiltered
    await c.getAwards({ before: new Date("2024-08-30T11:42:59.000Z"), limit: 50 }) // Return up to 50 awards that happened before the specified date
    await c.getAwards({ recipient: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" }) // Get latest awards belonging to specified accounts
  • Get last meeting number (which is equal to current period number).

    Returns Promise<number>

  • Get next meeting number (which is current period number + 1).

    Returns Promise<number>

  • Get amount of old (parent) Respect an account has.

    Parameters

    • account: string

    Returns Promise<bigint>

  • Returns proposal by its id.

    Parameters

    • id: string

      proposal id

    Returns Promise<{
        addr?: string;
        cdata?: any;
        createTime: Date;
        createTxHash?: string;
        decoded?:
            | {
                groupNum: number;
                meetingNum: number;
                metadata: {
                    propDescription?: string;
                    propTitle?: string;
                };
                mintData: string;
                propType: "respectBreakout";
                rankings: string[];
            }
            | {
                account: string;
                groupNum?: number;
                meetingNum: number;
                metadata: {
                    propDescription?: string;
                    propTitle?: string;
                };
                mintType: number;
                propType: "respectAccount";
                reason: string;
                title: string;
                tokenId: string;
                value: bigint;
            }
            | {
                metadata: {
                    propDescription?: string;
                    propTitle?: string;
                };
                propType: "burnRespect";
                reason: string;
                tokenId: string;
            }
            | {
                data: string;
                link?: string;
                metadata: {
                    propDescription?: string;
                    propTitle?: string;
                };
                propType: "customSignal";
                signalType: number;
            }
            | {
                data: string;
                link?: string;
                metadata: {
                    propDescription?: string;
                    propTitle?: string;
                };
                propType: "tick";
            }
            | {
                address: string;
                cdata: string;
                metadata: {
                    propDescription?: string;
                    propTitle?: string;
                };
                propType: "customCall";
            };
        execError?: {
            args: any[];
            data: null | string;
            name: null | string;
            reason: null | string;
            selector: null | string;
            signature: null | string;
            type: ErrorType;
        };
        executeTxHash?: string;
        id: string;
        memo?: any;
        noWeight?: bigint;
        stage:
            | "Voting"
            | "Veto"
            | "Execution"
            | "Expired";
        status: "NotExecuted" | "Executed" | "ExecutionFailed";
        voteStatus:
            | "Passing"
            | "Failing"
            | "Passed"
            | "Failed";
        yesWeight?: bigint;
    }>

    await c.getProposal("0x2f5e1602a2e1ccc9cf707bc57361ae6587cd87e8ae27105cae38c0db12f4fab1")
    
  • Returns a list of proposals ordered from latest to oldest

    Parameters

    • Optionalspec: {
          before?: Date;
          execStatFilter?: ("NotExecuted" | "Executed" | "ExecutionFailed")[];
          limit?: number;
          stageFilter?: (
              | "Voting"
              | "Veto"
              | "Execution"
              | "Expired")[];
          voteStatFilter?: (
              | "Passing"
              | "Failing"
              | "Passed"
              | "Failed")[];
      }

      specification for query:

      • before - newest possible creation date for proposal. If specified, only proposals which were created up to this date will be returned;
      • limit - maximum number of proposals to return. If not specified, it's up to ornode implementation.
      • execStatFilter - list of ExecutionStatus values. Proposals which have execution status other than any of values in this list, will be filtered out. If undefined, then no filtering based on execution status is done.
      • voteStatFilter - list of VoteStatus values. Proposals which have vote status other than any of values specified in the list will be filtered out (not returned). If undefined - no filtering based on vote status is done.
      • stageFilter - list of Stage values. Proposals which are in stage other than any of stages specified in this list will be filtered out. If undefined - no filtering based on proposal stage is done.
      • Optionalbefore?: Date
      • OptionalexecStatFilter?: ("NotExecuted" | "Executed" | "ExecutionFailed")[]
      • Optionallimit?: number
      • OptionalstageFilter?: (
            | "Voting"
            | "Veto"
            | "Execution"
            | "Expired")[]
      • OptionalvoteStatFilter?: (
            | "Passing"
            | "Failing"
            | "Passed"
            | "Failed")[]

    Returns Promise<{
        addr?: string;
        cdata?: any;
        createTime: Date;
        createTxHash?: string;
        decoded?:
            | {
                groupNum: number;
                meetingNum: number;
                metadata: {
                    propDescription?: string;
                    propTitle?: string;
                };
                mintData: string;
                propType: "respectBreakout";
                rankings: string[];
            }
            | {
                account: string;
                groupNum?: number;
                meetingNum: number;
                metadata: {
                    propDescription?: string;
                    propTitle?: string;
                };
                mintType: number;
                propType: "respectAccount";
                reason: string;
                title: string;
                tokenId: string;
                value: bigint;
            }
            | {
                metadata: {
                    propDescription?: string;
                    propTitle?: string;
                };
                propType: "burnRespect";
                reason: string;
                tokenId: string;
            }
            | {
                data: string;
                link?: string;
                metadata: {
                    propDescription?: string;
                    propTitle?: string;
                };
                propType: "customSignal";
                signalType: number;
            }
            | {
                data: string;
                link?: string;
                metadata: {
                    propDescription?: string;
                    propTitle?: string;
                };
                propType: "tick";
            }
            | {
                address: string;
                cdata: string;
                metadata: {
                    propDescription?: string;
                    propTitle?: string;
                };
                propType: "customCall";
            };
        execError?: {
            args: any[];
            data: null | string;
            name: null | string;
            reason: null | string;
            selector: null | string;
            signature: null | string;
            type: ErrorType;
        };
        executeTxHash?: string;
        id: string;
        memo?: any;
        noWeight?: bigint;
        stage:
            | "Voting"
            | "Veto"
            | "Execution"
            | "Expired";
        status: "NotExecuted" | "Executed" | "ExecutionFailed";
        voteStatus:
            | "Passing"
            | "Failing"
            | "Passed"
            | "Failed";
        yesWeight?: bigint;
    }[]>

    List of proposals

    await c.getProposals()
    
  • Get metadata of fungible non-transferrable Respect token.

    Returns Promise<{
        decimals: 0;
        description?: string;
        image?: string;
        name?: string;
        properties?: {};
    }>

  • Get amount of Respect an account has.

    Parameters

    • account: string

    Returns Promise<bigint>

  • Get metadata of specific token. The token can be fungible Respect token or Respect award token (NTT).

    Parameters

    • tokenId: string

      id of a token.

    Returns Promise<{
        decimals?: number;
        description?: string;
        image?: string;
        name?: string;
        properties?: {};
    }>

    If tokenId is an id of a burned token, this function might return a metadata for token which is burned onchain.

  • Get information on votes submitted on proposals. Votes returned are sorted from newest to oldest.

    Parameters

    • Optionalspec: {
          before?: Date;
          limit?: number;
          minWeight?: number;
          propFilter?: string[];
          voterFilter?: string[];
          voteType?: "Yes" | "No";
      }

      specification for a query

      • before - newest possible date of a vote. If specified, only votes made up to this date will be returned.
      • limit - maximum number of objects to return. If not specified it is up to implementation of ornode.
      • propFilter - list of proposal ids. If specified, then only votes on proposals in this list are returned.
      • voterFilter - list of ethereum addresses. If specified, only votes from this list of accounts are returned.
      • minWeight - minimum vote weight. If specified, only votes which have equal or greater weight are returned.
      • voteType - Yes / No. If specified only votes of specified type are returned.
      • Optionalbefore?: Date
      • Optionallimit?: number
      • OptionalminWeight?: number
      • OptionalpropFilter?: string[]
      • OptionalvoterFilter?: string[]
      • OptionalvoteType?: "Yes" | "No"

    Returns Promise<{
        date?: Date;
        memo?: string;
        proposalId: string;
        txHash?: string;
        vote: "Yes" | "No" | "None";
        voter: string;
        weight: number;
    }[]>

    await c.getVotes({ 
    voterFilter: [ "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "0xcd3B766CCDd6AE721141F452C550Ca635964ce71" ],
    propFilter: [ "0xcc55ee4f4b5d61a9b90b5a5d915d8e7edede19e26b1a68be043d837654313760" ],
    limit: 10,
    minWeight: 1
    })
  • Create a proposal to award respect game participants of a single breakout room, based on results of that breakout room.

    Parameters

    • request: {
          groupNum: number;
          meetingNum?: number;
          metadata?: {
              propDescription?: string;
              propTitle?: string;
          };
          rankings: string[];
      }

      breakout room results, plus optional metadata.

      • groupNum: number
      • OptionalmeetingNum?: number
      • Optionalmetadata?: {
            propDescription?: string;
            propTitle?: string;
        }
        • OptionalpropDescription?: string
        • OptionalpropTitle?: string
      • rankings: string[]
    • vote: {
          memo?: string;
          vote?: "Yes" | "No" | "None";
      } = ...

      vote to submit with the result. Default: { vote: "Yes" }.

      • Optionalmemo?: string
      • Optionalvote?: "Yes" | "No" | "None"

    Returns Promise<ProposeRes>

    resulting proposal and its status.

    The respect amounts to award are calculated automatically based on rankings:

    • Level 6 - 55
    • Level 5 - 34
    • Level 4 - 21
    • Level 3 - 13
    • Level 2 - 8
    • Level 1 - 5

    The actual onchain proposal is just for minting Respect according to distribution above.

    If vote parameter is not specified "Yes" vote is submitted. If you want to make this proposal but don't want to vote for it, specify { vote: "None" }.

    await c.proposeBreakoutResult(
    {
    meetingNum: 1,
    groupNum: 1,
    rankings: [
    "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
    "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
    "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC",
    "0x90F79bf6EB2c4f870365E785982E1f101E93b906"
    ]
    },
    {
    memo: "Some memo",
    vote: "Yes"
    }
    )
  • Create a proposal to burn a single Respect award.

    Parameters

    • req: {
          metadata?: {
              propDescription?: string;
              propTitle?: string;
          };
          reason: string;
          tokenId: string;
      }

      specification for the award to burn, plus optional metadata.

      • Optionalmetadata?: {
            propDescription?: string;
            propTitle?: string;
        }
        • OptionalpropDescription?: string
        • OptionalpropTitle?: string
      • reason: string
      • tokenId: string
    • vote: {
          memo?: string;
          vote?: "Yes" | "No" | "None";
      } = ...

      vote to submit with the result. Default: { vote: "Yes" }.

      • Optionalmemo?: string
      • Optionalvote?: "Yes" | "No" | "None"

    Returns Promise<ProposeRes>

    resulting proposal and its status.

    If vote parameter is not specified "Yes" vote is submitted. If you want to make this proposal but don't want to vote for it, specify { vote: "None" }.

    await c.proposeBurnRespect(
    {
    tokenId: "0x000000010000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266",
    reason: "some optional reason"
    },
    {
    memo: "Some memo",
    vote: "Yes"
    }
    );
  • Create a proposal to an EVM call to some contract.

    Parameters

    • req: {
          address: string;
          cdata: string;
          metadata: {
              propDescription?: string;
              propTitle?: string;
          };
      }

      specification for the EVM message to send.

      • address: string
      • cdata: string
      • metadata: {
            propDescription?: string;
            propTitle?: string;
        }
        • OptionalpropDescription?: string
        • OptionalpropTitle?: string
    • vote: {
          memo?: string;
          vote?: "Yes" | "No" | "None";
      } = ...

      vote to submit with the result. Default: { vote: "Yes" }.

      • Optionalmemo?: string
      • Optionalvote?: "Yes" | "No" | "None"

    Returns Promise<ProposeRes>

    resulting proposal and its status.

    If vote parameter is not specified "Yes" vote is submitted. If you want to make this proposal but don't want to vote for it, specify { vote: "None" }.

  • Create a proposal to issue a custom signal event from OREC contract.

    Parameters

    • req: {
          data: string;
          link?: string;
          metadata?: {
              propDescription?: string;
              propTitle?: string;
          };
          signalType: number;
      }
      • data: string
      • Optionallink?: string
      • Optionalmetadata?: {
            propDescription?: string;
            propTitle?: string;
        }
        • OptionalpropDescription?: string
        • OptionalpropTitle?: string
      • signalType: number
    • vote: {
          memo?: string;
          vote?: "Yes" | "No" | "None";
      } = ...
      • Optionalmemo?: string
      • Optionalvote?: "Yes" | "No" | "None"

    Returns Promise<ProposeRes>

  • Propose to mint a single Respect award to a single account.

    Parameters

    • req: {
          account: string;
          groupNum?: number;
          meetingNum?: number;
          metadata?: {
              propDescription?: string;
              propTitle?: string;
          };
          mintType?: number;
          reason: string;
          title: string;
          value: bigint;
      }

      specification for the Respect award, plus optional metadata.

      • account: string
      • OptionalgroupNum?: number
      • OptionalmeetingNum?: number
      • Optionalmetadata?: {
            propDescription?: string;
            propTitle?: string;
        }
        • OptionalpropDescription?: string
        • OptionalpropTitle?: string
      • OptionalmintType?: number
      • reason: string
      • title: string
      • value: bigint
    • vote: {
          memo?: string;
          vote?: "Yes" | "No" | "None";
      } = ...

      vote to submit with the result. Default: { vote: "Yes" }.

      • Optionalmemo?: string
      • Optionalvote?: "Yes" | "No" | "None"

    Returns Promise<ProposeRes>

    resulting proposal and its status.

    If vote parameter is not specified "Yes" vote is submitted. If you want to make this proposal but don't want to vote for it, specify { vote: "None" }.

    await c.proposeRespectTo({
    meetingNum: 1,
    mintType: 1,
    account: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
    value: 10n,
    title: "Reward Title",
    reason: "Reward reason"
    })
  • Create a proposal to issue a tick signal. Tick signals increment the period / meeting number returned by orclient (see ORClient#getPeriodNum).

    Parameters

    • req: {
          data?: string;
          link?: string;
          metadata?: {
              propDescription?: string;
              propTitle?: string;
          };
      } = {}

      optional metadata to submit with a tick signal

      • Optionaldata?: string
      • Optionallink?: string
      • Optionalmetadata?: {
            propDescription?: string;
            propTitle?: string;
        }
        • OptionalpropDescription?: string
        • OptionalpropTitle?: string
    • vote: {
          memo?: string;
          vote?: "Yes" | "No" | "None";
      } = ...

      vote to submit with the result. Default: { vote: "Yes" }.

      • Optionalmemo?: string
      • Optionalvote?: "Yes" | "No" | "None"

    Returns Promise<ProposeRes>

    resulting proposal and its status.

    If vote parameter is not specified "Yes" vote is submitted. If you want to make this proposal but don't want to vote for it, specify { vote: "None" }.

    await c.proposeTick();
    
  • Vote on a proposal.

    Parameters

    • propId: string

      id of a proposal to vote on.

    • vote: "Yes" | "No" | "None"

      what to vote for.

      • 'Yes' - vote for proposals;
      • 'No' - vote against;
    • Optionalmemo: string

      memo text string to submit with proposal.

    Returns Promise<OnchainActionRes>

    Note that memo string with go with calldata of transaction, so longer string will cost more.

    await c.vote("0x2f5e1602a2e1ccc9cf707bc57361ae6587cd87e8ae27105cae38c0db12f4fab1", "Yes")
    
  • Vote on a proposal.

    Parameters

    • request: {
          memo?: string;
          propId: string;
          vote: "Yes" | "No" | "None";
      }

      parameters for a vote as an object. See ORClient#vote.

      • Optionalmemo?: string
      • propId: string
      • vote: "Yes" | "No" | "None"

    Returns Promise<OnchainActionRes>

    hash of submitted transaction

    Note that memo string with go with calldata of transaction, so longer string will cost more.

    await c.vote({
    propId: "0x2f5e1602a2e1ccc9cf707bc57361ae6587cd87e8ae27105cae38c0db12f4fab1",
    vote: "Yes",
    memo: "Optional memo"
    })