Implement method for storage based access in subgraph mapping code (#162)

* Implement storage call in subgraph mapping code

* Add test for mapping type variable storage call

* Use vulcanize graph-ts

* Revert to graph-ts version 0.22.1
This commit is contained in:
2022-08-17 16:25:49 +05:30
committed by GitHub
parent 80682e2755
commit ec56de057f
21 changed files with 503 additions and 17 deletions
@@ -0,0 +1 @@
@graphprotocol:registry=https://npm.pkg.github.com
@@ -10,7 +10,7 @@
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 example1"
},
"dependencies": {
"@graphprotocol/graph-ts": "^0.22.1",
"@graphprotocol/graph-ts": "npm:@vulcanize/graph-ts@0.22.1",
"@vulcanize/graph-cli": "0.22.5"
}
}
@@ -159,6 +159,27 @@ export function testStructEthCall (): void {
}
}
export function testGetStorageValue (): void {
log.debug('In test get storage value', []);
// Bind the contract to the address.
const contractAddress = dataSource.address();
const contract = Example1.bind(contractAddress);
const res = contract.getStorageValue('_test', []);
log.debug('Storage call result: {}', [res!.toBigInt().toString()]);
}
export function testMapStorageValue (): void {
log.debug('In test map storage value', []);
// Bind the contract to the address.
const contractAddress = dataSource.address();
const contract = Example1.bind(contractAddress);
const addressValue = ethereum.Value.fromAddress(Address.zero());
const res = contract.getStorageValue('addressUintMap', [addressValue]);
log.debug('Storage call result: {}', [res!.toBigInt().toString()]);
}
export function testBytesToHex (): string {
log.debug('In test bytesToHex', []);
@@ -23,10 +23,10 @@
chalk "^2.0.0"
js-tokens "^4.0.0"
"@graphprotocol/graph-ts@^0.22.1":
"@graphprotocol/graph-ts@npm:@vulcanize/graph-ts@0.22.1":
version "0.22.1"
resolved "https://registry.yarnpkg.com/@graphprotocol/graph-ts/-/graph-ts-0.22.1.tgz#3189b2495b33497280f617316cce68074d48e236"
integrity sha512-T5xrHN0tHJwd7ZnSTLhk5hAL3rCIp6rJ40kBCrETnv1mfK9hVyoojJK6VtBQXTbLsYtKe4SYjjD0cdOsAR9QiA==
resolved "https://npm.pkg.github.com/download/@vulcanize/graph-ts/0.22.1/7a14baaab8b99d4a88e19620dc7200aa501fbecf#7a14baaab8b99d4a88e19620dc7200aa501fbecf"
integrity sha512-0CoKeFezskYjAsLmqfdxmS7q+gWy1V1wFgiNB4tMJSa2EiPTVG62qlPKkqTduApK2gZX9//rmE5Vb2xcF/v2+w==
dependencies:
assemblyscript "0.19.10"