forked from polywrap/wrap-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
3,045 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
build | ||
codegen | ||
yarn-error.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Subgraph | ||
- [ ] Generate Subgraph.yaml w/ proper network & addresses | ||
- [ ] Codegen queries & mutations & subgraph | ||
- [ ] build queries & mutations & subgraph |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "@web3api/examples-simple-storage", | ||
"scripts": { | ||
"contracts:build": "", | ||
"subgraph:codegen": "cd subgraph && graph codegen --out-dir codegen/", | ||
"subgraph:build": "cd subgraph && graph build" | ||
}, | ||
"devDependencies": { | ||
"@graphprotocol/graph-cli": "^0.18.0", | ||
"@graphprotocol/graph-ts": "^0.18.1" | ||
} | ||
} |
Empty file.
26 changes: 26 additions & 0 deletions
26
packages/examples/simple-storage/scripts/deploy-contracts.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { ethers } from "@nomiclabs/buidler"; | ||
import { exec } from 'child_process' | ||
|
||
async function main() { | ||
const factory = await ethers.getContract("SimpleStorage"); | ||
|
||
// If we had constructor arguments, they would be passed into deploy() | ||
let contract = await factory.deploy(); | ||
|
||
// The address the Contract WILL have once mined | ||
console.log("Contract at address: " + contract.address); | ||
|
||
// The transaction that was sent to the network to deploy the Contract | ||
console.log("Tx hash: " + contract.deployTransaction.hash); | ||
|
||
// The contract is NOT deployed yet; we must wait until it is mined | ||
await contract.deployed(); | ||
exec(`npx buidler verify-contract --contract-name SimpleStorage --address ${contract.address}`) | ||
} | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export function getData() { | ||
|
||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { store } from '@graphprotocol/graph-ts' | ||
import { | ||
DataSet as DataSetEvent, | ||
SimpleStorage | ||
} from './codegen/schema' | ||
|
||
function getStorage(id: string): SimpleStorage { | ||
let storage = SimpleStorage.load(id) | ||
|
||
if (storage === null) { | ||
storage = new SimpleStorage(id) | ||
storage.save() | ||
} | ||
|
||
return storage | ||
} | ||
|
||
export function handleDataSet(event: DataSetEvent) { | ||
const storage = getStorage(event.address.toHexString()) | ||
storage.lastSetBy = event.params.from.toHexString() | ||
storage.save() | ||
} |
2 changes: 1 addition & 1 deletion
2
...es/simple-storage/subgraph/schema.graphql → ...imple-storage/src/subgraph/schema.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
type SimpleStorage @entity { | ||
id: ID! | ||
lastSet: Address | ||
lastSetBy: Address | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
TODO: | ||
1. Deploy contract | ||
2. Deploy subgraph | ||
3. Deploy Web3API | ||
4. initWeb3API(signer) | ||
5. query("QmMY_API", "{ setData('hey') { id } }") | ||
*/ |
Oops, something went wrong.