-
Notifications
You must be signed in to change notification settings - Fork 16
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 #368 from textileio/asutula/pow-2.3.1
Pow 2.3.1
- Loading branch information
Showing
14 changed files
with
1,937 additions
and
1,924 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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
"docs": "npx -p typescript -p typedoc@next typedoc --plugin none --mode library --out docs --excludeNotExported --includeDeclarations --ignoreCompilerErrors src/index.ts", | ||
"docs:test": "npm run docs:clean && npm run docs:md && npm run docs:verify", | ||
"docs:clean": "rm -rf docs", | ||
"docs:md": "typedoc --plugin typedoc-plugin-markdown", | ||
"docs:md": "typedoc --plugin typedoc-plugin-markdown src/index.ts", | ||
"docs:verify": "typescript-docs-verifier --input-files=`find docs -type f -name '**.md'`", | ||
"localnet:up": "cd powergate-docker && make localnet", | ||
"localnet:down": "cd powergate-docker && make localnet-down", | ||
|
@@ -34,43 +34,43 @@ | |
"author": "Textile <[email protected]>", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@commitlint/cli": "^11.0.0", | ||
"@commitlint/config-conventional": "^11.0.0", | ||
"@types/chai": "^4.2.12", | ||
"@commitlint/cli": "^12.0.1", | ||
"@commitlint/config-conventional": "^12.0.1", | ||
"@types/chai": "^4.2.15", | ||
"@types/dirty-chai": "^2.0.2", | ||
"@types/mocha": "^8.0.3", | ||
"@types/node": "^14.11.2", | ||
"@typescript-eslint/eslint-plugin": "^4.3.0", | ||
"@typescript-eslint/parser": "^4.3.0", | ||
"chai": "^4.2.0", | ||
"@types/mocha": "^8.2.1", | ||
"@types/node": "^14.14.34", | ||
"@typescript-eslint/eslint-plugin": "^4.18.0", | ||
"@typescript-eslint/parser": "^4.18.0", | ||
"chai": "^4.3.4", | ||
"dirty-chai": "^2.0.1", | ||
"eslint": "^7.10.0", | ||
"eslint-config-prettier": "^6.12.0", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"husky": "^4.3.0", | ||
"eslint": "^7.22.0", | ||
"eslint-config-prettier": "^8.1.0", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"husky": "^5.1.3", | ||
"json": "^10.0.0", | ||
"mocha": "^8.1.3", | ||
"mocha": "^8.3.2", | ||
"polendina": "^1.1.0", | ||
"prettier": "^2.1.2", | ||
"prettier": "^2.2.1", | ||
"prettier-plugin-organize-imports": "^1.1.1", | ||
"rimraf": "^3.0.2", | ||
"touch": "^3.1.0", | ||
"ts-loader": "^8.0.4", | ||
"ts-node": "^9.0.0", | ||
"typedoc": "^0.19.2", | ||
"typedoc-plugin-markdown": "^3.0.3", | ||
"typescript": "^4.0.3", | ||
"typescript-docs-verifier": "^1.1.2", | ||
"wait-on": "^5.2.0" | ||
"ts-loader": "^8.0.18", | ||
"ts-node": "^9.1.1", | ||
"typedoc": "^0.20.32", | ||
"typedoc-plugin-markdown": "^3.6.0", | ||
"typescript": "^4.2.3", | ||
"typescript-docs-verifier": "^1.1.3", | ||
"wait-on": "^5.2.1" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS" | ||
} | ||
}, | ||
"dependencies": { | ||
"@textile/grpc-powergate-client": "2.0.0", | ||
"@textile/grpc-transport": "0.0.3", | ||
"@textile/grpc-powergate-client": "2.3.1", | ||
"@textile/grpc-transport": "^0.4.0", | ||
"ipfs-http-client": "^47.0.1", | ||
"it-block": "^2.0.0" | ||
} | ||
|
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,57 @@ | ||
import { grpc } from "@improbable-eng/grpc-web" | ||
import { | ||
GetMinerInfoRequest, | ||
GetMinerInfoResponse, | ||
GetMinersRequest, | ||
GetMinersResponse, | ||
} from "@textile/grpc-powergate-client/dist/powergate/admin/v1/admin_pb" | ||
import { AdminServiceClient } from "@textile/grpc-powergate-client/dist/powergate/admin/v1/admin_pb_service" | ||
import { Config } from "../../types" | ||
import { promise } from "../../util" | ||
import { AdminGetMinersOptions } from "./types" | ||
|
||
export { AdminGetMinersOptions } | ||
|
||
export interface AdminIndices { | ||
/** | ||
* Gets a list of miner addresses that satisfies the provided filters. | ||
* @returns An object containing a list of miner addresses. | ||
*/ | ||
getMiners: (opts?: AdminGetMinersOptions) => Promise<GetMinersResponse.AsObject> | ||
|
||
/** | ||
* Gets all known indices data for the provided miner addresses. | ||
* @returns An object containing a list of miner info. | ||
*/ | ||
getMinerInfo: (...miners: string[]) => Promise<GetMinerInfoResponse.AsObject> | ||
} | ||
|
||
/** | ||
* @ignore | ||
*/ | ||
export const createIndices = (config: Config, getMeta: () => grpc.Metadata): AdminIndices => { | ||
const client = new AdminServiceClient(config.host, config) | ||
return { | ||
getMiners: (opts?: AdminGetMinersOptions) => { | ||
const req = new GetMinersRequest() | ||
if (opts?.withPower) { | ||
req.setWithPower(opts.withPower) | ||
} | ||
return promise( | ||
(cb) => client.getMiners(req, getMeta(), cb), | ||
(resp: GetMinersResponse) => resp.toObject(), | ||
) | ||
}, | ||
|
||
getMinerInfo: (...miners: string[]) => { | ||
const req = new GetMinerInfoRequest() | ||
if (miners) { | ||
req.setMinersList(miners) | ||
} | ||
return promise( | ||
(cb) => client.getMinerInfo(req, getMeta(), cb), | ||
(resp: GetMinerInfoResponse) => resp.toObject(), | ||
) | ||
}, | ||
} | ||
} |
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 interface AdminGetMinersOptions { | ||
withPower?: boolean | ||
} |
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,63 @@ | ||
import { grpc } from "@improbable-eng/grpc-web" | ||
import { | ||
GetUpdatedRetrievalRecordsSinceRequest, | ||
GetUpdatedRetrievalRecordsSinceResponse, | ||
GetUpdatedStorageDealRecordsSinceRequest, | ||
GetUpdatedStorageDealRecordsSinceResponse, | ||
} from "@textile/grpc-powergate-client/dist/powergate/admin/v1/admin_pb" | ||
import { AdminServiceClient } from "@textile/grpc-powergate-client/dist/powergate/admin/v1/admin_pb_service" | ||
import { Timestamp } from "google-protobuf/google/protobuf/timestamp_pb" | ||
import { Config } from "../../types" | ||
import { promise } from "../../util" | ||
|
||
export interface AdminRecords { | ||
/** | ||
* Get the retrieval records that were created or modified since the specified date. | ||
* @returns An object containing a list of retrieval records. | ||
*/ | ||
getUpdatedRetrievalRecordsSince: ( | ||
time: Date, | ||
limit: number, | ||
) => Promise<GetUpdatedRetrievalRecordsSinceResponse.AsObject> | ||
|
||
/** | ||
* Get the storage-deal records that were created or modified since the specified date. | ||
* @returns An object containing a list of storage-deal records. | ||
*/ | ||
getUpdatedStorageDealRecordsSince: ( | ||
time: Date, | ||
limit: number, | ||
) => Promise<GetUpdatedStorageDealRecordsSinceResponse.AsObject> | ||
} | ||
|
||
/** | ||
* @ignore | ||
*/ | ||
export const createRecords = (config: Config, getMeta: () => grpc.Metadata): AdminRecords => { | ||
const client = new AdminServiceClient(config.host, config) | ||
return { | ||
getUpdatedRetrievalRecordsSince: (time: Date, limit: number) => { | ||
const req = new GetUpdatedRetrievalRecordsSinceRequest() | ||
const since = new Timestamp() | ||
since.fromDate(time) | ||
req.setSince(since) | ||
req.setLimit(limit) | ||
return promise( | ||
(cb) => client.getUpdatedRetrievalRecordsSince(req, getMeta(), cb), | ||
(resp: GetUpdatedRetrievalRecordsSinceResponse) => resp.toObject(), | ||
) | ||
}, | ||
|
||
getUpdatedStorageDealRecordsSince: (time: Date, limit: number) => { | ||
const req = new GetUpdatedStorageDealRecordsSinceRequest() | ||
const since = new Timestamp() | ||
since.fromDate(time) | ||
req.setSince(since) | ||
req.setLimit(limit) | ||
return promise( | ||
(cb) => client.getUpdatedStorageDealRecordsSince(req, getMeta(), cb), | ||
(resp: GetUpdatedStorageDealRecordsSinceResponse) => resp.toObject(), | ||
) | ||
}, | ||
} | ||
} |
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
Oops, something went wrong.