Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from input-output-hk/develop
Update master with recent changes from develop
- Loading branch information
Showing
9 changed files
with
185 additions
and
56 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
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
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
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
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
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
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
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
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,36 @@ | ||
const CommonMessages = require('./common_pb.js'); | ||
const { loggingStreamHandler } = require('./util.js'); | ||
const StoreAndHashMessages = require('./storeandhash-service_pb.js'); | ||
const StoreAndHashService = require('./storeandhash-service_grpc_pb.js'); | ||
const grpc = require('@grpc/grpc-js'); | ||
|
||
const storeAndHashSvc = new StoreAndHashService.StoreAndHashServiceClient( | ||
'psg-testnet.iog.services:2001', | ||
grpc.credentials.createSsl() | ||
); | ||
|
||
// Replace CLIENT_ID and API_TOKEN with your PSG Self Serve UI account values | ||
const credentials = new CommonMessages.CredentialsMessage() | ||
.setClientId("CLIENT_ID") | ||
.setApiToken("API_TOKEN"); | ||
|
||
// Replace IPFS_HOST and IPFS_PORT with your chosen IPFS node ip address and port | ||
const IPFS_PORT = 5001 | ||
const storeAndHashIpfsRequests = [ | ||
new StoreAndHashMessages.StoreAndHashIpfsRequest() | ||
.setDetails( | ||
new StoreAndHashMessages.IpfsUploadDetails() | ||
.setIpfsaddress(new StoreAndHashMessages.IpfsAddress() | ||
.setHost("IPFS_HOST").setPort(IPFS_PORT)) | ||
.setCredentials(credentials) | ||
), | ||
|
||
new StoreAndHashMessages | ||
.StoreAndHashIpfsRequest() | ||
.setChunk(new StoreAndHashMessages.Chunk().setPart("Demo Data To Be Saved At IPFS")) | ||
] | ||
|
||
const storeAndHashIpfsCall = storeAndHashSvc.storeAndHashIpfs(); | ||
loggingStreamHandler(storeAndHashIpfsCall); | ||
storeAndHashIpfsRequests.forEach(req => storeAndHashIpfsCall.write(req)); | ||
storeAndHashIpfsCall.end(); |