当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript dispatch-json-rpc-request.dispatchJsonRpcRequest函数代码示例

本文整理汇总了TypeScript中src/server/dispatch-json-rpc-request.dispatchJsonRpcRequest函数的典型用法代码示例。如果您正苦于以下问题:TypeScript dispatchJsonRpcRequest函数的具体用法?TypeScript dispatchJsonRpcRequest怎么用?TypeScript dispatchJsonRpcRequest使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dispatchJsonRpcRequest函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: test

  test("get successfulDisputes and redeemedPositions", async () => {
    // make local modifications to not affect other tests which
    // would happen if we edit global seeds data
    const crowdsourcersData = [{
      crowdsourcerId: "0x0000000000000000001000000000000000000008",
      marketId: "0x0000000000000000000000000000000000000011",
      feeWindow: "0x2000000000000000000000000000000000000000",
      payoutId: 3,
      size: "20000",
      amountStaked: "20000",
      blockNumber: 1400101,
      completed: 1,
      transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000E01",
      logIndex: 0,
      disavowed: 0,
    }];

    const disputesData = [{
      transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000D07",
      logIndex: 0,
      blockNumber: 1500002,
      reporter: "0x0000000000000000000000000000000000000b0c",
      crowdsourcerId: "0x0000000000000000001000000000000000000008",
      amountStaked: "16",
    }];

    const tradingProceedsData = [{
      transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000D00",
      logIndex: 0,
      account: "0x0000000000000000000000000000000000000b0c",
      marketId: "0x0000000000000000000000000000000000000011",
      blockNumber: 1400001,
      shareToken: "0x480791cb5aa266e023198f2fdb90872b7da08c2e", // completely invalid value
    }];

    await db("trading_proceeds").del()
    await db.batchInsert("disputes", disputesData, disputesData.length);
    await db.batchInsert("crowdsourcers", crowdsourcersData, crowdsourcersData.length);
    await db.batchInsert("trading_proceeds", tradingProceedsData, tradingProceedsData.length);

    const params = {
      universe: "0x000000000000000000000000000000000000000b",
      account: "0x0000000000000000000000000000000000000b0c",
      endTime: null,
      startTime: null,
    };
    return await expect(dispatchJsonRpcRequest(db, {
      method: "getAccountTimeRangedStats",
      params,
    }, null)).resolves.toEqual({
      "marketsCreated": 0,
      "marketsTraded": 0,
      "numberOfTrades": 0,
      "positions": 0,
      "redeemedPositions": 1,
      "successfulDisputes": 1,
    });
  });
开发者ID:AugurProject,项目名称:augur_node,代码行数:58,代码来源:get-account-time-ranged-stats.ts

示例2: test

  test("main stats query in specific time range beyond available block numbers", async () => {
    const params = {
      universe: "0x000000000000000000000000000000000000000b",
      startTime: 1000000,
      endTime: 1606480016,
    };

    return await expect(dispatchJsonRpcRequest(db, {
      method: "getPlatformActivityStats",
      params,
    }, augur)).rejects.toEqual(new Error("startTime/endTime error"));
  });
开发者ID:AugurProject,项目名称:augur_node,代码行数:12,代码来源:get-platform-activity-stats.ts


注:本文中的src/server/dispatch-json-rpc-request.dispatchJsonRpcRequest函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。