Skip to content

Commit

Permalink
update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Feb 1, 2023
1 parent 59e5eb5 commit 6001bb6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const stopBlockNum = "+10";
const substreams = new Substreams(outputModule, {
startBlockNum,
stopBlockNum,
authorization: process.env.SUBSTREAMS_API_TOKEN
authorization: process.env.STREAMINGFAST_KEY // or SUBSTREAMS_API_TOKEN
});

(async () => {
Expand Down
2 changes: 1 addition & 1 deletion example.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const stopBlockNum = "+10";
const substreams = new Substreams(outputModule, {
startBlockNum,
stopBlockNum,
authorization: "<STREAMINGFAST_KEY or SUBSTREAMS_API_TOKEN>"
authorization: process.env.STREAMINGFAST_KEY // or SUBSTREAMS_API_TOKEN
});

(async () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/subtivity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const stopBlockNum = "+10";
const substreams = new Substreams(outputModule, {
startBlockNum,
stopBlockNum,
authorization: process.env.STREAMINGFAST_KEY
authorization: process.env.STREAMINGFAST_KEY // or SUBSTREAMS_API_TOKEN
});

(async () => {
Expand Down
3 changes: 2 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export async function authentication_token(api_key: string) {

export async function parseAuthorization(authorization: string ) {
if ( authorization.includes("server_") ) {
return (await authentication_token(authorization)).token;
const { token } = await authentication_token(authorization);
return token;
}
return authorization;
}
Expand Down

0 comments on commit 6001bb6

Please sign in to comment.