Skip to content

refactor(data-access): thegraph-data-access package - #931

Merged
benjlevesque merged 13 commits into
masterfrom
refactor/storage/the-graph-data-access
Oct 6, 2022
Merged

refactor(data-access): thegraph-data-access package#931
benjlevesque merged 13 commits into
masterfrom
refactor/storage/the-graph-data-access

Conversation

@benjlevesque

@benjlevesquebenjlevesque commented Oct 5, 2022

Copy link
Copy Markdown
Contributor

Description

Introduce a new package to easily re-use thegraph data access.
Move non-graph logic to their relevant places

Usage

Full

import{RequestNetworkBase}from'@requestnetwork/request-client.js';import{TheGraphDataAccess}from'@requestnetwork/thegraph-data-access';import{Wallet}from'ethers';import{IpfsStorage,EthereumStorageEthers}from'@requestnetwork/ethereum-storage';constsigner=Wallet.createRandom();conststorage=newEthereumStorageEthers({ipfsStorage: newIpfsStorage({}),
signer,network: 'private',});constdataAccess=newTheGraphDataAccess({graphql: {url: 'http://localhost:8000/subgraphs/name/RequestNetwork/request-storage'},network: 'private',
storage,});constrn=newRequestNetworkBase({ dataAccess });const{ requestId }=awaitrn.createRequest(...)constrequest=awaitrn.fromRequestId(requestId);awaitrequest.accept(...)

Read only

import{RequestNetworkBase}from'@requestnetwork/request-client.js';import{TheGraphDataAccess}from'@requestnetwork/thegraph-data-access';import{Wallet}from'ethers';constdataAccess=newTheGraphDataAccess({graphql: {url: 'http://localhost:8000/subgraphs/name/RequestNetwork/request-storage'},network: 'private',});constrn=newRequestNetworkBase({ dataAccess });// Cannot create request// await rn.createRequest()constrequest=awaitrn.fromRequestId('...');console.log(request.requestId);// Cannot modify request// await request.accept(...)

@benjlevesque
benjlevesque changed the base branch from master to refactor/payment-network-factoryOctober 5, 2022 17:19
@benjlevesquebenjlevesque changed the title refactor/storage/the graph data accessrefactor(storage): the graph data accessOct 5, 2022
@coveralls

coveralls commented Oct 5, 2022

Copy link
Copy Markdown

Coverage Status

Coverage increased (+1.04%) to 89.295% when pulling 5886f41 on refactor/storage/the-graph-data-access into 400b0d5 on master.

@benjlevesque
benjlevesque marked this pull request as ready for review October 5, 2022 18:41
@benjlevesquebenjlevesque changed the title refactor(storage): the graph data accessrefactor(data-access): thegraph-data-access packageOct 5, 2022
Comment threadpackages/request-node/src/thegraph-node.ts
Comment threadpackages/thegraph-data-access/.nycrc
Comment threadpackages/thegraph-data-access/src/data-access.ts
}

/** Interface of the storage */
export interface IStorage extends IStorageRead, IStorageWrite {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💅

@benjlevesque
benjlevesqueforce-pushed the refactor/payment-network-factory branch from 772e5de to fd82335CompareOctober 6, 2022 15:23
@benjlevesque
benjlevesqueforce-pushed the refactor/storage/the-graph-data-access branch from ec51d27 to 30896bcCompareOctober 6, 2022 15:24
Base automatically changed from refactor/payment-network-factory to masterOctober 6, 2022 17:25
@benjlevesque
benjlevesqueforce-pushed the refactor/storage/the-graph-data-access branch from 30896bc to 5886f41CompareOctober 6, 2022 17:26
@benjlevesque
benjlevesque enabled auto-merge (squash) October 6, 2022 17:27
@benjlevesque
benjlevesque merged commit cd4f55d into masterOct 6, 2022
@benjlevesque
benjlevesque deleted the refactor/storage/the-graph-data-access branch October 6, 2022 17:34

@alexandre-abriouxalexandre-abrioux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 😀

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@benjlevesque@coveralls@bertux@alexandre-abrioux@yomarion