當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。