Comments (2)
can you share the ABI or the contract address?
from graph-tooling.
Thx for reply. Here's the function abi gened by solc 0.8.20:
{
"inputs": [
{
"internalType": "uint256[]",
"name": "tokenIds",
"type": "uint256[]"
}
],
"name": "getPositionsByTokenIds",
"outputs": [
{
"components": [
{
"components": [
{
"components": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "contract IVault",
"name": "collateralTokenVault",
"type": "address"
},
{
"internalType": "address",
"name": "indexToken",
"type": "address"
},
{
"internalType": "bool",
"name": "isLong",
"type": "bool"
},
{
"internalType": "uint256",
"name": "giantTokenId",
"type": "uint256"
}
],
"internalType": "struct Keys.PositionKeyInfo",
"name": "keyInfo",
"type": "tuple"
},
{
"internalType": "uint256",
"name": "giantTokenId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "size",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "collateral",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "averagePrice",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "fundingPerSize",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "claimableFundingPerSize",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "accBorrowingRate",
"type": "uint256"
},
{
"internalType": "int256",
"name": "realisedPnL",
"type": "int256"
},
{
"internalType": "uint256",
"name": "shares",
"type": "uint256"
},
{
"internalType": "bool",
"name": "isLong",
"type": "bool"
},
{
"components": [
{
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
},
{
"components": [
{
"internalType": "uint256",
"name": "min",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "max",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
}
],
"internalType": "struct Market.Price",
"name": "collateralTokenPrice",
"type": "tuple"
},
{
"components": [
{
"internalType": "uint256",
"name": "min",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "max",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
}
],
"internalType": "struct Market.Price",
"name": "indexTokenPrice",
"type": "tuple"
}
],
"internalType": "struct Position.UpdateInfo",
"name": "increasedInfo",
"type": "tuple"
},
{
"components": [
{
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
},
{
"components": [
{
"internalType": "uint256",
"name": "min",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "max",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
}
],
"internalType": "struct Market.Price",
"name": "collateralTokenPrice",
"type": "tuple"
},
{
"components": [
{
"internalType": "uint256",
"name": "min",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "max",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
}
],
"internalType": "struct Market.Price",
"name": "indexTokenPrice",
"type": "tuple"
}
],
"internalType": "struct Position.UpdateInfo",
"name": "decreasedInfo",
"type": "tuple"
}
],
"internalType": "struct Position.Props",
"name": "position",
"type": "tuple"
},
{
"internalType": "address",
"name": "collateralToken",
"type": "address"
}
],
"internalType": "struct Position.PositionInfo[][]",
"name": "",
"type": "tuple[][]"
}
],
"stateMutability": "view",
"type": "function"
},
It gens ts code:
getPositionsByTokenIds(
tokenIds: Array<BigInt>
): Array<Reader__getPositionsByTokenIdsResultValue0Struct> {
let result = super.call(
"getPositionsByTokenIds",
"getPositionsByTokenIds(uint256[]):((((uint256,address,address,bool,uint256),uint256,uint256,uint256,uint256,uint256,uint256,uint256,int256,uint256,bool,(uint256,(uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256)),(uint256,(uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256))),address)[][])",
[ethereum.Value.fromUnsignedBigIntArray(tokenIds)]
);
return result[0].toTupleMatrix<>();
}
try_getPositionsByTokenIds(
tokenIds: Array<BigInt>
): ethereum.CallResult<
Array<Reader__getPositionsByTokenIdsResultValue0Struct>
> {
let result = super.tryCall(
"getPositionsByTokenIds",
"getPositionsByTokenIds(uint256[]):((((uint256,address,address,bool,uint256),uint256,uint256,uint256,uint256,uint256,uint256,uint256,int256,uint256,bool,(uint256,(uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256)),(uint256,(uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256))),address)[][])",
[ethereum.Value.fromUnsignedBigIntArray(tokenIds)]
);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toTupleMatrix<>());
}
static error in return
:
It is not possible to assign type "CallResult<Tuple[][]>" to type "CallResult<Reader__getPositionsByTokenIdsResultValue0Struct[]>". ]>".
Type "Tuple[][]" cannot be assigned to type "Reader__getPositionsByTokenIdsResultValue0Struct[]". ts(2322)
from graph-tooling.
Related Issues (20)
- CLI exits with 0 even when graph deploy has failed HOT 3
- Tests failing silently HOT 2
- "Mainnet" term for "Ethereum Mainnet" not self explanatory when initializing a subgraph HOT 2
- Missing support for Solana subgraphs
- if yarn v2+ is globally then prefer `npm` or recommend to downgrade to `yarn classic` globally
- Blast-Sepolia HOT 1
- [Bug] Graph on Optimism Sepolia can't be deployed HOT 2
- Error: Unable to fetch available networks from API HOT 2
- generate `docker-compose.yml` with `graph init` HOT 6
- Duplicate identifier Error from Generated file
- Adding second contract fails if contract is not verified.
- graphCLI using the wrong endpoint for etherscan ethereum HOT 1
- outdated assemblyscript dependency
- handle the tuple returned this error: "LendAsLimitOrder(indexed ..." not found in contract "Contract" of data source
- `graph protogen` command HOT 5
- Order list of evm chains in `graph init` HOT 7
- fix `etherlink-testnet` url HOT 1
- allow passing `spkg.io` from `graph init` HOT 4
- Project Roadmap HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graph-tooling.