问题标签 [thegraph]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
86 浏览

ethereum - How to get the function call corresponding to a Transaction in Ethereum

When a Transaction occurs, how do you get the functions(and contract address) called during the execution of the Transaction? It seems that the graph provides similar functions.

https://thegraph.com/docs/developer/create-subgraph-hosted#defining-a-call-handler

0 投票
0 回答
33 浏览

api - 使用 Google 表格上的 TheGraph 应用脚本?

您有想法使用 App 脚本/Google 表格在 TheGraph 上编写请求脚本吗?

我在这里尝试子图https://thegraph.com/legacy-explorer/subgraph/levinswap/uniswap-v2

我有一个结果

{tokenDayDatas{token(where :{name_contains :"Specific token"}){name}priceUSD}}

但我不明白如何使用 App 脚本...

你能帮助我吗 ?

谢谢

0 投票
0 回答
18 浏览

javascript - TheGraph Subgraph - 如何在 ETH 区块链中部署像寿司一样的子图

我尝试使用以下示例 QUERY 从 theGraph 获取数据:

我应该看到我的主厨的合约地址,但实际上我什么也没看到。我不知道我的 mapping.ts 有什么问题:

0 投票
0 回答
49 浏览

ethereum - 如何在智能合约中编写开始彩票

我按照 Pancakeswap Lottery 的说明(https://bscscan.com/address/0x5af6d33de2ccec94efb1bdf8f92bd58085432d2c#code)写“startLottery”。但是写这个函数是错误的。我使用元掩码。我还将 ChainLink 的随机数生成器用于我的彩票。

我正在使用 The Graph 作为我的彩票数据。但我的实体是空的。我认为原因是我不能写“startLottery”。

图表1

我填写的“startLottery” 2

0 投票
0 回答
13 浏览

node.js - Rails 应用程序和使用图形协议创建的子图可以共享同一个 postgres 数据库吗?

你知道rails(或nodejs)应用程序是否可以与使用图形协议创建的子图共享相同的postgres db?还是子图需要专用数据库?如果是这样,从多个数据库读取的 Rails 应用程序会是更好的策略吗?

您可以分享的任何指针将不胜感激!

0 投票
0 回答
24 浏览

graphql - thegraph如何保存事件数组参数

solidity 代码将发出 uint256[] 数组事件

但使用 yarn codegen 然后将转换为字节。

我将在一个实体上记录 attrID/值。怎么做...

0 投票
2 回答
61 浏览

subgraph - 定义对象类型时出错'' is not assignable to type in assembly script (thegraph development)

I'm developing subgraph for indexing blockchain events, but I get error when defining and object

⠋ Compile subgraphERROR TS2322: Type 

I'm developing subgraph for indexing blockchain events, but I get error when defining and object


After some trial and error changing that in this way solved my problem:

I think assembly script has problems with defining objects ( in the functions input parameters you cant use object {} )

0 投票
1 回答
183 浏览

blockchain - 以去中心化方式从 Chainlink 访问代币历史价格数据的最佳方式是什么?

我需要获取从特定时间到最近一轮的代币的 Chainlink 价格。此时间根据用户输入而有所不同,但根据令牌的心跳,将是相对较短的窗口(最多 1 天到 2 周)。这用于计算智能合约和应用程序主页上的支付价格。

要获取历史价格数据,Chainlink 需要一个“roundId”,它是一个非增量值。

从 Chainlink 获取给定时间窗口的所有 roundId 或以开放、去中心化且可以在 Solidity 智能合约中访问的方式记录它们的最佳方法是什么?

0 投票
0 回答
63 浏览

typescript - TS2363:算术运算的右侧必须是“any”、“number”、“bigint”类型或枚举类型

我在 GraphQl 中使用 typeScript(在 TheQraph 项目中),这是我的实体:

这是我的映射:

当以太坊事件发生时,我计算“userBorrow.balance”,我得到这个错误:

我怎么解决这个问题?

0 投票
0 回答
75 浏览

python-3.x - 自省结果无效或不完整

当我尝试运行此订阅代码时,我收到错误消息:- TypeError:自省结果无效或不完整。确保您正在传递自省响应的“数据”属性,并且没有同时返回“错误”:无。

我能做些什么来纠正这个问题?