From 2bc8a332bb5ccf5c63e5025ad2aea4e8ab7df3fb Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Wed, 7 Apr 2021 15:53:16 -0500 Subject: [PATCH 1/2] use plugin manifests for schema resolution --- packages/js/plugins/ens/src/manifest.ts | 22 +++++++++- packages/js/plugins/ethereum/src/manifest.ts | 22 +++++++++- .../js/plugins/graph-node/src/manifest.ts | 10 ++++- packages/js/plugins/http/src/manifest.ts | 41 ++++++++++++++++++- packages/js/plugins/ipfs/src/manifest.ts | 35 +++++++++++++++- packages/js/plugins/logger/src/manifest.ts | 19 ++++++++- .../templates/api/assemblyscript/package.json | 13 ++++-- .../api/assemblyscript/src/mutation/index.ts | 6 ++- .../api/assemblyscript/src/query/index.ts | 6 ++- .../templates/api/assemblyscript/web3api.yaml | 3 -- .../typescript/{src => }/schema.graphql | 0 .../plugin/typescript/src/manifest.ts | 11 ++++- 12 files changed, 170 insertions(+), 18 deletions(-) rename packages/templates/plugin/typescript/{src => }/schema.graphql (100%) diff --git a/packages/js/plugins/ens/src/manifest.ts b/packages/js/plugins/ens/src/manifest.ts index 757bb29c45..d5eec16222 100644 --- a/packages/js/plugins/ens/src/manifest.ts +++ b/packages/js/plugins/ens/src/manifest.ts @@ -3,7 +3,27 @@ import { PluginManifest, Uri } from "@web3api/core-js"; export const manifest: PluginManifest = { // TODO: use the schema.graphql // https://github.com/web3-api/monorepo/issues/101 - schema: "type Query { dummy: String }", + schema: ` +# TODO: should import and "implements" the api-resolver core-api schema +# https://github.com/Web3-API/monorepo/issues/75 + +type Query { + tryResolveUri( + authority: String! + path: String! + ): ApiResolver_MaybeUriOrManifest + + getFile( + path: String! + ): Bytes +} + +# TODO: should get replaced with an import +# https://github.com/Web3-API/monorepo/issues/75 +type ApiResolver_MaybeUriOrManifest { + uri: String + manifest: String +}`, implemented: [new Uri("w3/api-resolver")], imported: [new Uri("ens/ethereum.web3api.eth")], }; diff --git a/packages/js/plugins/ethereum/src/manifest.ts b/packages/js/plugins/ethereum/src/manifest.ts index 734de54e4f..da664832dd 100644 --- a/packages/js/plugins/ethereum/src/manifest.ts +++ b/packages/js/plugins/ethereum/src/manifest.ts @@ -3,7 +3,27 @@ import { PluginManifest } from "@web3api/core-js"; export const manifest: PluginManifest = { // TODO: use the schema.graphql // https://github.com/web3-api/monorepo/issues/101 - schema: "type Query { dummy: String }", + schema: ` +type Query { + callView( + address: String! + method: String! + args: [String!]! + ): String! +} + +type Mutation { + sendTransaction( + address: String! + method: String! + args: [String!]! + ): String! + + deployContract( + abi: String! + bytecode: String! + ): String! +}`, implemented: [], imported: [], }; diff --git a/packages/js/plugins/graph-node/src/manifest.ts b/packages/js/plugins/graph-node/src/manifest.ts index 734de54e4f..4a0aa8f7b8 100644 --- a/packages/js/plugins/graph-node/src/manifest.ts +++ b/packages/js/plugins/graph-node/src/manifest.ts @@ -3,7 +3,15 @@ import { PluginManifest } from "@web3api/core-js"; export const manifest: PluginManifest = { // TODO: use the schema.graphql // https://github.com/web3-api/monorepo/issues/101 - schema: "type Query { dummy: String }", + schema: ` +type Query { + querySubgraph( + subgraphId: String! + query: String! + ): String! """JSON!""" + """TODO: support JSON type as base type?""" + """I think this would be helpful for dynamic data""" +}`, implemented: [], imported: [], }; diff --git a/packages/js/plugins/http/src/manifest.ts b/packages/js/plugins/http/src/manifest.ts index 734de54e4f..d54fe1aa11 100644 --- a/packages/js/plugins/http/src/manifest.ts +++ b/packages/js/plugins/http/src/manifest.ts @@ -3,7 +3,46 @@ import { PluginManifest } from "@web3api/core-js"; export const manifest: PluginManifest = { // TODO: use the schema.graphql // https://github.com/web3-api/monorepo/issues/101 - schema: "type Query { dummy: String }", + schema: ` +type Header { + key: String! + value: String! +} + +type UrlParam { + key: String! + value: String! +} + +type Response { + status: Int! + statusText: String! + headers: [Header!] + body: String +} + +type Request { + headers: [Header!] + urlParams: [UrlParam!] + responseType: String! # "TEXT" || "BINARY" + body: String +} + +# Enum types curently not supported +# +# enum ResponseType { +# TEXT +# BINARY +# } + +type Query { + get(url: String!, request: Request): Response +} + +type Mutation { + post(url: String!, request: Request): Response +} +`, implemented: [], imported: [], }; diff --git a/packages/js/plugins/ipfs/src/manifest.ts b/packages/js/plugins/ipfs/src/manifest.ts index c34c7e8d42..b65bf352f3 100644 --- a/packages/js/plugins/ipfs/src/manifest.ts +++ b/packages/js/plugins/ipfs/src/manifest.ts @@ -3,7 +3,40 @@ import { PluginManifest, Uri } from "@web3api/core-js"; export const manifest: PluginManifest = { // TODO: use the schema.graphql // https://github.com/web3-api/monorepo/issues/101 - schema: "type Query { dummy: String }", + schema: ` +# TODO: should import and "implements" the api-resolver core-api schema +# https://github.com/Web3-API/monorepo/issues/75 + +type Query { + catFile(cid: String!): Bytes! + + tryResolveUri( + authority: String! + path: String! + ): ApiResolver_MaybeUriOrManifest + + getFile( + path: String! + ): Bytes +} + +type Mutation { + # TODO: Allow for custom type CID + # https://github.com/web3-api/monorepo/issues/103 + addFile(data: Bytes!): AddResult! +} + +type AddResult { + path: String! + cid: String! +} + +# TODO: should get replaced with an import +# https://github.com/Web3-API/monorepo/issues/75 +type ApiResolver_MaybeUriOrManifest { + uri: String + manifest: String +}`, implemented: [new Uri("w3/api-resolver")], imported: [], }; diff --git a/packages/js/plugins/logger/src/manifest.ts b/packages/js/plugins/logger/src/manifest.ts index 91f4432f89..7db59fc2d9 100644 --- a/packages/js/plugins/logger/src/manifest.ts +++ b/packages/js/plugins/logger/src/manifest.ts @@ -3,7 +3,24 @@ import { PluginManifest, Uri } from "@web3api/core-js"; export const manifest: PluginManifest = { // TODO: use the schema.graphql // https://github.com/web3-api/monorepo/issues/101 - schema: "type Query { dummy: String }", + schema: ` +# TODO: should import and "implements" the logger core-api schema +# https://github.com/Web3-API/monorepo/issues/75 + +enum LogLevel { + DEBUG, + INFO, + WARN, + ERROR, +} + +type Query { + log( + level: LogLevel! + message: String! + ): Boolean! +} +`, implemented: [new Uri("w3/logger")], imported: [], }; diff --git a/packages/templates/api/assemblyscript/package.json b/packages/templates/api/assemblyscript/package.json index 4e367d144a..8cd31d98a7 100644 --- a/packages/templates/api/assemblyscript/package.json +++ b/packages/templates/api/assemblyscript/package.json @@ -4,10 +4,15 @@ "private": true, "version": "0.0.1-prealpha.10", "scripts": { - "build": "npx w3 build", - "contracts:deploy": "node ./deploy-contracts.js", - "test:env:up": "npx w3 test-env up && yarn contracts:deploy", - "test:env:down": "npx w3 test-env down" + "build": "yarn build:contract && yarn build:web3api", + "build:web3api": "npx w3 build", + "build:contract": "node ./scripts/build-contract.js", + "test:env:up": "npx w3 test-env up", + "test:env:down": "npx w3 test-env down", + "deploy": "yarn deploy:contract && yarn deploy:web3api", + "deploy:web3api": "npx w3 build --ipfs http://localhost:5001 --test-ens simplestorage.eth", + "deploy:contract": "node ./scripts/deploy-contract.js", + "test": "npx w3 query ./recipes/e2e.json" }, "devDependencies": { "@web3api/cli": "0.0.1-prealpha.10", diff --git a/packages/templates/api/assemblyscript/src/mutation/index.ts b/packages/templates/api/assemblyscript/src/mutation/index.ts index a0fb93febd..49e231f576 100644 --- a/packages/templates/api/assemblyscript/src/mutation/index.ts +++ b/packages/templates/api/assemblyscript/src/mutation/index.ts @@ -1,5 +1,7 @@ -import { Ethereum_Mutation } from "./w3/imported"; -import { Input_setData } from "./w3"; +import { + Ethereum_Mutation, + Input_setData +} from "./w3"; import { abi, bytecode } from "../contracts/SimpleStorage"; export function setData(input: Input_setData): string { diff --git a/packages/templates/api/assemblyscript/src/query/index.ts b/packages/templates/api/assemblyscript/src/query/index.ts index 220246ab16..93ee777334 100644 --- a/packages/templates/api/assemblyscript/src/query/index.ts +++ b/packages/templates/api/assemblyscript/src/query/index.ts @@ -1,5 +1,7 @@ -import { Ethereum_Query } from "./w3/imported"; -import { Input_getData } from "./w3"; +import { + Ethereum_Query, + Input_getData +} from "./w3"; export function getData(input: Input_getData): u32 { const res = Ethereum_Query.callView({ diff --git a/packages/templates/api/assemblyscript/web3api.yaml b/packages/templates/api/assemblyscript/web3api.yaml index dd426040f2..d62a5fa5a0 100644 --- a/packages/templates/api/assemblyscript/web3api.yaml +++ b/packages/templates/api/assemblyscript/web3api.yaml @@ -13,6 +13,3 @@ query: module: language: wasm/assemblyscript file: ./src/query/index.ts -import_redirects: - - uri: w3://ens/ethereum.web3api.eth - schema: ./node_modules/@web3api/ethereum-plugin-js/schema.graphql diff --git a/packages/templates/plugin/typescript/src/schema.graphql b/packages/templates/plugin/typescript/schema.graphql similarity index 100% rename from packages/templates/plugin/typescript/src/schema.graphql rename to packages/templates/plugin/typescript/schema.graphql diff --git a/packages/templates/plugin/typescript/src/manifest.ts b/packages/templates/plugin/typescript/src/manifest.ts index 35b3fb1b8f..baa34f4d1f 100644 --- a/packages/templates/plugin/typescript/src/manifest.ts +++ b/packages/templates/plugin/typescript/src/manifest.ts @@ -1,7 +1,16 @@ import { PluginManifest } from "@web3api/core-js"; export const manifest: PluginManifest = { - schema: "type Query { dummy: String }", + // TODO: use the schema.graphql + // https://github.com/web3-api/monorepo/issues/101 + schema: ` +type Query { + sampleQuery(query: String!): String! +} + +type Mutation { + sampleMutation(data: Bytes!): SampleResult! +}`, implemented: [], imported: [], }; From f7b0252506841c20b37c7be5cb12aecfe78395bc Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Wed, 7 Apr 2021 17:37:50 -0500 Subject: [PATCH 2/2] fixes required for create-as-web3api documentation walkthrough --- packages/js/plugins/ipfs/schema.graphql | 7 +------ packages/js/plugins/ipfs/src/index.ts | 14 +++++++++++--- packages/js/plugins/ipfs/src/manifest.ts | 7 +------ packages/js/plugins/ipfs/src/resolvers.ts | 7 ++----- .../assemblyscript/scripts/build-contract.js | 4 +++- .../src/contracts/SimpleStorage.json | 2 +- .../src/contracts/SimpleStorage.sol | 17 ++++++++++++++--- .../src/contracts/SimpleStorage.ts | 4 ++-- 8 files changed, 35 insertions(+), 27 deletions(-) diff --git a/packages/js/plugins/ipfs/schema.graphql b/packages/js/plugins/ipfs/schema.graphql index 5e8f6d68e8..80693b8178 100644 --- a/packages/js/plugins/ipfs/schema.graphql +++ b/packages/js/plugins/ipfs/schema.graphql @@ -17,12 +17,7 @@ type Query { type Mutation { # TODO: Allow for custom type CID # https://github.com/web3-api/monorepo/issues/103 - addFile(data: Bytes!): AddResult! -} - -type AddResult { - path: String! - cid: String! + addFile(data: Bytes!): String! } # TODO: should get replaced with an import diff --git a/packages/js/plugins/ipfs/src/index.ts b/packages/js/plugins/ipfs/src/index.ts index a70d8bdc25..d7934faf11 100644 --- a/packages/js/plugins/ipfs/src/index.ts +++ b/packages/js/plugins/ipfs/src/index.ts @@ -54,10 +54,18 @@ export class IpfsPlugin extends Plugin { public async add( data: Uint8Array ): Promise<{ - path: string; - cid: CID; + name: string; + hash: CID; }> { - return await this._ipfs.add(data); + const result = await this._ipfs.add(data); + + if (result.length === 0) { + throw Error( + `IpfsPlugin:add failed to add contents. Result of length 0 returned.` + ); + } + + return result[0]; } public async cat(cid: string): Promise { diff --git a/packages/js/plugins/ipfs/src/manifest.ts b/packages/js/plugins/ipfs/src/manifest.ts index b65bf352f3..33058cbae8 100644 --- a/packages/js/plugins/ipfs/src/manifest.ts +++ b/packages/js/plugins/ipfs/src/manifest.ts @@ -23,12 +23,7 @@ type Query { type Mutation { # TODO: Allow for custom type CID # https://github.com/web3-api/monorepo/issues/103 - addFile(data: Bytes!): AddResult! -} - -type AddResult { - path: String! - cid: String! + addFile(data: Bytes!): String! } # TODO: should get replaced with an import diff --git a/packages/js/plugins/ipfs/src/resolvers.ts b/packages/js/plugins/ipfs/src/resolvers.ts index a1b2509e05..e1db83b91c 100644 --- a/packages/js/plugins/ipfs/src/resolvers.ts +++ b/packages/js/plugins/ipfs/src/resolvers.ts @@ -6,11 +6,8 @@ import { PluginModule } from "@web3api/core-js"; // https://github.com/web3-api/monorepo/issues/101 export const mutation = (ipfs: IpfsPlugin): PluginModule => ({ addFile: async (input: { data: Uint8Array }) => { - const { path, cid } = await ipfs.add(input.data); - return { - path, - cid, - }; + const { hash } = await ipfs.add(input.data); + return hash; }, }); diff --git a/packages/templates/api/assemblyscript/scripts/build-contract.js b/packages/templates/api/assemblyscript/scripts/build-contract.js index 2b31641b66..43270b0692 100644 --- a/packages/templates/api/assemblyscript/scripts/build-contract.js +++ b/packages/templates/api/assemblyscript/scripts/build-contract.js @@ -31,7 +31,9 @@ async function main() { if (output.contracts) { console.log("✔️ Compiled SimpleStorage.sol"); } else { - throw Error(`Error: Failed to compile SimpleStorage.sol.\n${output}`); + throw Error( + `Error: Failed to compile SimpleStorage.sol.\n${JSON.stringify(output, null, 2)}` + ); } // Fetch the compiled contract's abi & bytecode diff --git a/packages/templates/api/assemblyscript/src/contracts/SimpleStorage.json b/packages/templates/api/assemblyscript/src/contracts/SimpleStorage.json index e1fb408ebb..8349da4520 100644 --- a/packages/templates/api/assemblyscript/src/contracts/SimpleStorage.json +++ b/packages/templates/api/assemblyscript/src/contracts/SimpleStorage.json @@ -1 +1 @@ -{"abi":[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"}],"name":"DataSet","type":"event"},{"inputs":[],"name":"get","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"}],"bytecode":"0x608060405234801561001057600080fd5b506101da806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806360fe47b11461003b5780636d4ce63c14610057575b600080fd5b610055600480360381019061005091906100d4565b610075565b005b61005f6100b6565b60405161006c9190610136565b60405180910390f35b806000819055507f3d38713ec8fb49acced894a52df2f06a371a15960550da9ba0f017cb7d07a8ec336040516100ab919061011b565b60405180910390a150565b60008054905090565b6000813590506100ce8161018d565b92915050565b6000602082840312156100e657600080fd5b60006100f4848285016100bf565b91505092915050565b61010681610151565b82525050565b61011581610183565b82525050565b600060208201905061013060008301846100fd565b92915050565b600060208201905061014b600083018461010c565b92915050565b600061015c82610163565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b61019681610183565b81146101a157600080fd5b5056fea26469706673582212201c077cc51c9ee22b2559a72a23b493543955b232bac1b59a2e6f2b89ac0bf39d64736f6c63430008030033"} \ No newline at end of file +{"abi":[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"data","type":"uint256"}],"name":"DataSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"string","name":"ipfsHash","type":"string"}],"name":"HashSet","type":"event"},{"inputs":[],"name":"get","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getHash","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"x","type":"string"}],"name":"setHash","outputs":[],"stateMutability":"nonpayable","type":"function"}],"bytecode":"0x608060405234801561001057600080fd5b506105d9806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80631ed83fd41461005157806360fe47b11461006d5780636d4ce63c14610089578063d13319c4146100a7575b600080fd5b61006b600480360381019061006691906102f6565b6100c5565b005b6100876004803603810190610082919061033b565b610116565b005b610091610159565b60405161009e9190610465565b60405180910390f35b6100af610162565b6040516100bc9190610443565b60405180910390f35b8181600191906100d69291906101f4565b507f7701f49eb9aabe8890631508a9092eabb511a34566c30f2d94ff4420da1ccb1333838360405161010a939291906103e8565b60405180910390a15050565b806000819055507f7c94a94848d5859b1a30c887dc5740bf8d1cf789779be90adda1d0d34dd25022338260405161014e92919061041a565b60405180910390a150565b60008054905090565b6060600180546101719061051a565b80601f016020809104026020016040519081016040528092919081815260200182805461019d9061051a565b80156101ea5780601f106101bf576101008083540402835291602001916101ea565b820191906000526020600020905b8154815290600101906020018083116101cd57829003601f168201915b5050505050905090565b8280546102009061051a565b90600052602060002090601f0160209004810192826102225760008555610269565b82601f1061023b57803560ff1916838001178555610269565b82800160010185558215610269579182015b8281111561026857823582559160200191906001019061024d565b5b509050610276919061027a565b5090565b5b8082111561029357600081600090555060010161027b565b5090565b60008083601f8401126102a957600080fd5b8235905067ffffffffffffffff8111156102c257600080fd5b6020830191508360018202830111156102da57600080fd5b9250929050565b6000813590506102f08161058c565b92915050565b6000806020838503121561030957600080fd5b600083013567ffffffffffffffff81111561032357600080fd5b61032f85828601610297565b92509250509250929050565b60006020828403121561034d57600080fd5b600061035b848285016102e1565b91505092915050565b61036d8161049c565b82525050565b600061037f838561048b565b935061038c8385846104d8565b6103958361057b565b840190509392505050565b60006103ab82610480565b6103b5818561048b565b93506103c58185602086016104e7565b6103ce8161057b565b840191505092915050565b6103e2816104ce565b82525050565b60006040820190506103fd6000830186610364565b8181036020830152610410818486610373565b9050949350505050565b600060408201905061042f6000830185610364565b61043c60208301846103d9565b9392505050565b6000602082019050818103600083015261045d81846103a0565b905092915050565b600060208201905061047a60008301846103d9565b92915050565b600081519050919050565b600082825260208201905092915050565b60006104a7826104ae565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b838110156105055780820151818401526020810190506104ea565b83811115610514576000848401525b50505050565b6000600282049050600182168061053257607f821691505b602082108114156105465761054561054c565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b610595816104ce565b81146105a057600080fd5b5056fea26469706673582212204f956d7623b7fe0a5a722d01575cc1d310a1a18086a604796ff457447881740864736f6c63430008030033"} \ No newline at end of file diff --git a/packages/templates/api/assemblyscript/src/contracts/SimpleStorage.sol b/packages/templates/api/assemblyscript/src/contracts/SimpleStorage.sol index c3de3a7bb9..415b2686c7 100644 --- a/packages/templates/api/assemblyscript/src/contracts/SimpleStorage.sol +++ b/packages/templates/api/assemblyscript/src/contracts/SimpleStorage.sol @@ -1,16 +1,27 @@ pragma solidity 0.8.3; contract SimpleStorage { - uint data; + uint256 data; + string ipfsHash; - event DataSet(address from); + event DataSet(address from, uint256 data); + event HashSet(address from, string ipfsHash); function set(uint256 x) public { data = x; - emit DataSet(msg.sender); + emit DataSet(msg.sender, x); } function get() public view returns (uint256) { return data; } + + function setHash(string calldata x) public { + ipfsHash = x; + emit HashSet(msg.sender, x); + } + + function getHash() public view returns (string memory) { + return ipfsHash; + } } diff --git a/packages/templates/api/assemblyscript/src/contracts/SimpleStorage.ts b/packages/templates/api/assemblyscript/src/contracts/SimpleStorage.ts index ff02035ffb..a3808db55b 100644 --- a/packages/templates/api/assemblyscript/src/contracts/SimpleStorage.ts +++ b/packages/templates/api/assemblyscript/src/contracts/SimpleStorage.ts @@ -1,3 +1,3 @@ /// NOTE: This file is auto-generate, see deploy-contract.js -export const abi = `[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"}],"name":"DataSet","type":"event"},{"inputs":[],"name":"get","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"}]`; -export const bytecode = "0x608060405234801561001057600080fd5b506101da806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806360fe47b11461003b5780636d4ce63c14610057575b600080fd5b610055600480360381019061005091906100d4565b610075565b005b61005f6100b6565b60405161006c9190610136565b60405180910390f35b806000819055507f3d38713ec8fb49acced894a52df2f06a371a15960550da9ba0f017cb7d07a8ec336040516100ab919061011b565b60405180910390a150565b60008054905090565b6000813590506100ce8161018d565b92915050565b6000602082840312156100e657600080fd5b60006100f4848285016100bf565b91505092915050565b61010681610151565b82525050565b61011581610183565b82525050565b600060208201905061013060008301846100fd565b92915050565b600060208201905061014b600083018461010c565b92915050565b600061015c82610163565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b61019681610183565b81146101a157600080fd5b5056fea26469706673582212201c077cc51c9ee22b2559a72a23b493543955b232bac1b59a2e6f2b89ac0bf39d64736f6c63430008030033"; +export const abi = `[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"data","type":"uint256"}],"name":"DataSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"string","name":"ipfsHash","type":"string"}],"name":"HashSet","type":"event"},{"inputs":[],"name":"get","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getHash","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"x","type":"string"}],"name":"setHash","outputs":[],"stateMutability":"nonpayable","type":"function"}]`; +export const bytecode = "0x608060405234801561001057600080fd5b506105d9806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80631ed83fd41461005157806360fe47b11461006d5780636d4ce63c14610089578063d13319c4146100a7575b600080fd5b61006b600480360381019061006691906102f6565b6100c5565b005b6100876004803603810190610082919061033b565b610116565b005b610091610159565b60405161009e9190610465565b60405180910390f35b6100af610162565b6040516100bc9190610443565b60405180910390f35b8181600191906100d69291906101f4565b507f7701f49eb9aabe8890631508a9092eabb511a34566c30f2d94ff4420da1ccb1333838360405161010a939291906103e8565b60405180910390a15050565b806000819055507f7c94a94848d5859b1a30c887dc5740bf8d1cf789779be90adda1d0d34dd25022338260405161014e92919061041a565b60405180910390a150565b60008054905090565b6060600180546101719061051a565b80601f016020809104026020016040519081016040528092919081815260200182805461019d9061051a565b80156101ea5780601f106101bf576101008083540402835291602001916101ea565b820191906000526020600020905b8154815290600101906020018083116101cd57829003601f168201915b5050505050905090565b8280546102009061051a565b90600052602060002090601f0160209004810192826102225760008555610269565b82601f1061023b57803560ff1916838001178555610269565b82800160010185558215610269579182015b8281111561026857823582559160200191906001019061024d565b5b509050610276919061027a565b5090565b5b8082111561029357600081600090555060010161027b565b5090565b60008083601f8401126102a957600080fd5b8235905067ffffffffffffffff8111156102c257600080fd5b6020830191508360018202830111156102da57600080fd5b9250929050565b6000813590506102f08161058c565b92915050565b6000806020838503121561030957600080fd5b600083013567ffffffffffffffff81111561032357600080fd5b61032f85828601610297565b92509250509250929050565b60006020828403121561034d57600080fd5b600061035b848285016102e1565b91505092915050565b61036d8161049c565b82525050565b600061037f838561048b565b935061038c8385846104d8565b6103958361057b565b840190509392505050565b60006103ab82610480565b6103b5818561048b565b93506103c58185602086016104e7565b6103ce8161057b565b840191505092915050565b6103e2816104ce565b82525050565b60006040820190506103fd6000830186610364565b8181036020830152610410818486610373565b9050949350505050565b600060408201905061042f6000830185610364565b61043c60208301846103d9565b9392505050565b6000602082019050818103600083015261045d81846103a0565b905092915050565b600060208201905061047a60008301846103d9565b92915050565b600081519050919050565b600082825260208201905092915050565b60006104a7826104ae565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b838110156105055780820151818401526020810190506104ea565b83811115610514576000848401525b50505050565b6000600282049050600182168061053257607f821691505b602082108114156105465761054561054c565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b610595816104ce565b81146105a057600080fd5b5056fea26469706673582212204f956d7623b7fe0a5a722d01575cc1d310a1a18086a604796ff457447881740864736f6c63430008030033";