@streamr/cli-tools 103.0.0-rc.0 → 103.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/package.json +13 -7
  2. package/dist/src/client.js +3 -2
  3. package/dist/src/client.js.map +1 -1
  4. package/dist/src/command.d.ts +1 -0
  5. package/dist/src/command.js +1 -0
  6. package/dist/src/command.js.map +1 -1
  7. package/dist/src/resend.js +1 -1
  8. package/dist/src/resend.js.map +1 -1
  9. package/package.json +13 -7
  10. package/bin/streamr-internal-node-info.ts +0 -81
  11. package/bin/streamr-internal-operator-delegate.ts +0 -18
  12. package/bin/streamr-internal-operator-stake.ts +0 -18
  13. package/bin/streamr-internal-operator-undelegate.ts +0 -17
  14. package/bin/streamr-internal-operator-unstake.ts +0 -16
  15. package/bin/streamr-internal-show-sdk-config.ts +0 -11
  16. package/bin/streamr-internal-sponsorship-sponsor.ts +0 -18
  17. package/bin/streamr-internal-token-mint.ts +0 -21
  18. package/bin/streamr-internal-visualize-topology.ts +0 -122
  19. package/bin/streamr-internal.ts +0 -18
  20. package/bin/streamr-mock-data-generate.ts +0 -51
  21. package/bin/streamr-mock-data.ts +0 -10
  22. package/bin/streamr-storage-node-add-stream.ts +0 -13
  23. package/bin/streamr-storage-node-list-streams.ts +0 -21
  24. package/bin/streamr-storage-node-list.ts +0 -23
  25. package/bin/streamr-storage-node-register.ts +0 -14
  26. package/bin/streamr-storage-node-remove-stream.ts +0 -13
  27. package/bin/streamr-storage-node-show.ts +0 -13
  28. package/bin/streamr-storage-node-unregister.ts +0 -11
  29. package/bin/streamr-storage-node.ts +0 -16
  30. package/bin/streamr-stream-create.ts +0 -30
  31. package/bin/streamr-stream-grant-permission.ts +0 -10
  32. package/bin/streamr-stream-publish.ts +0 -78
  33. package/bin/streamr-stream-resend-from.ts +0 -33
  34. package/bin/streamr-stream-resend-last.ts +0 -31
  35. package/bin/streamr-stream-resend-range.ts +0 -39
  36. package/bin/streamr-stream-resend.ts +0 -12
  37. package/bin/streamr-stream-revoke-permission.ts +0 -10
  38. package/bin/streamr-stream-search.ts +0 -62
  39. package/bin/streamr-stream-show.ts +0 -37
  40. package/bin/streamr-stream-subscribe.ts +0 -43
  41. package/bin/streamr-stream.ts +0 -17
  42. package/bin/streamr-wallet-whoami.ts +0 -11
  43. package/bin/streamr-wallet.ts +0 -10
  44. package/bin/streamr.ts +0 -14
  45. package/jest.config.ts +0 -1
  46. package/src/client.ts +0 -34
  47. package/src/command.ts +0 -53
  48. package/src/common.ts +0 -43
  49. package/src/config.ts +0 -56
  50. package/src/logLevel.ts +0 -9
  51. package/src/permission.ts +0 -53
  52. package/src/resend.ts +0 -37
  53. package/test/environment.test.ts +0 -32
  54. package/test/internal-operator.test.ts +0 -57
  55. package/test/internal-sponsorship-sponsor.test.ts +0 -28
  56. package/test/mock-data.test.ts +0 -33
  57. package/test/storage-node.test.ts +0 -62
  58. package/test/stream-create.test.ts +0 -26
  59. package/test/stream-permission.test.ts +0 -29
  60. package/test/stream-publish-subscribe.test.ts +0 -108
  61. package/test/stream-resend.test.ts +0 -66
  62. package/test/stream-search.test.ts +0 -24
  63. package/test/stream-show.test.ts +0 -31
  64. package/test/utils.ts +0 -86
  65. package/test/wallet.test.ts +0 -11
  66. package/tsconfig.json +0 -3
  67. package/tsconfig.node.json +0 -16
package/dist/package.json CHANGED
@@ -1,12 +1,18 @@
1
1
  {
2
2
  "name": "@streamr/cli-tools",
3
- "version": "103.0.0-rc.0",
3
+ "version": "103.0.0-rc.2",
4
4
  "description": "Command line tools for Streamr",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/streamr-dev/network.git",
8
8
  "directory": "packages/cli-tools"
9
9
  },
10
+ "files": [
11
+ "dist",
12
+ "!*.tsbuildinfo",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
10
16
  "bin": {
11
17
  "streamr": "dist/bin/streamr.js"
12
18
  },
@@ -26,10 +32,10 @@
26
32
  "author": "Streamr Network AG <contact@streamr.com>",
27
33
  "license": "AGPL-3.0",
28
34
  "dependencies": {
29
- "@streamr/dht": "103.0.0-rc.0",
30
- "@streamr/sdk": "103.0.0-rc.0",
31
- "@streamr/trackerless-network": "103.0.0-rc.0",
32
- "@streamr/utils": "103.0.0-rc.0",
35
+ "@streamr/dht": "103.0.0-rc.2",
36
+ "@streamr/sdk": "103.0.0-rc.2",
37
+ "@streamr/trackerless-network": "103.0.0-rc.2",
38
+ "@streamr/utils": "103.0.0-rc.2",
33
39
  "commander": "^13.1.0",
34
40
  "easy-table": "^1.1.1",
35
41
  "ethers": "^6.13.0",
@@ -38,11 +44,11 @@
38
44
  "semver": "^7.7.1"
39
45
  },
40
46
  "devDependencies": {
41
- "@streamr/test-utils": "103.0.0-rc.0",
47
+ "@streamr/test-utils": "103.0.0-rc.2",
42
48
  "@types/event-stream": "^4.0.5",
43
49
  "@types/lodash": "^4.17.16",
44
50
  "@types/merge2": "^1.4.4",
45
- "@types/semver": "^7.5.8",
51
+ "@types/semver": "^7.7.0",
46
52
  "merge2": "^1.4.1"
47
53
  }
48
54
  }
@@ -10,8 +10,9 @@ const config_1 = require("./config");
10
10
  const getClientConfig = (commandOptions, overridenOptions = {}) => {
11
11
  const configFileJson = (0, config_1.getConfig)(commandOptions.config)?.client;
12
12
  const environmentOptions = { environment: commandOptions.env };
13
- const authenticationOptions = (commandOptions.privateKey !== undefined) ? { auth: { privateKey: commandOptions.privateKey } } : undefined;
14
- return (0, merge_1.default)(configFileJson, environmentOptions, authenticationOptions, overridenOptions);
13
+ const authenticationOptions = (commandOptions.privateKey !== undefined) ? { auth: { privateKey: commandOptions.privateKey } } : {};
14
+ const encryptionOptions = (commandOptions.quantum === true) ? { encryption: { requireQuantumResistantKeyExchange: true } } : {};
15
+ return (0, merge_1.default)(configFileJson, environmentOptions, authenticationOptions, encryptionOptions, overridenOptions);
15
16
  };
16
17
  exports.getClientConfig = getClientConfig;
17
18
  const addInterruptHand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EM,MAAM,YAAY,GAAG,CAAC,cAAuB,EAAE,mBAAwC,EAAE,EAAiB,EAAE;IAC/G,MAAM,MAAM,GAAG,IAAA,uBAAe,EAAC,cAAc,EAAE,gBAAgB,CAAC,CAAA;IAChE,MAAM,MAAM,GAAG,IAAI,mBAAa,CAAC,MAAM,CAAC,CAAA;IACxC,mBAAmB,CAAC,MAAM,CAAC,CAAA;IAC3B,OAAO,MAAM,CAAA;AACjB,CAAC,CAAA;AALY,QAAA,YAAY,gBAKxB"}
@@ -4,6 +4,7 @@ export interface Options {
4
4
  privateKey?: string;
5
5
  config?: string;
6
6
  env?: EnvironmentId;
7
+ quantum?: boolean;
7
8
  }
8
9
  export declare const createCommand: () => commander.Command;
9
10
  export interface CommandOpts {
@@ -24,6 +24,7 @@ const createClientCommand = (action, opts = {
24
24
  .option('--private-key <key>', 'use an Ethereum private key to authenticate')
25
25
  .option('--config <file>', 'read connection and authentication settings from a config file')
26
26
  .option('--env <environmentId>', `use pre-defined environment (${(0, common_1.formEnumArgValueDescription)(sdk_1.ENVIRONMENT_IDS, sdk_1.DEFAULT_ENVIRONMENT_ID)})`, (0, common_1.createFnParseEnum)('env', sdk_1.ENVIRONMENT_IDS))
27
+ .option('--quantum', 'use and require quantum secure algorithms where available')
27
28
  .action(async (...args) => {
28
29
  const commandOptions = args[args.length - 1].opts();
29
30
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/command.ts"],"names":[],"mappings":";;;;;;AAAA,sCAA0G;AAC1G,yCAA8C;AAC9C,mEAAiC;AACjC,qCAAuC;AACvC,qCAAyE;AAQlE,MAAM,aAAa,GAAG,GAAsB,EAAE;IACjD,OAAO,IAAI,mBAAO,EAAE;SACf,OAAO,CAAC,sBAAG,CAAC,OAAO,CAAC;SACpB,kBAAkB,EAAE;SACpB,oBAAoB,CAAC,KAAK,CAAC,CAAA;AACpC,CAAC,CAAA;AALY,QAAA,aAAa,iBAKzB;AAOM,MAAM,mBAAm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AAM,MAAM,CAAC,OAAO,EAAE,CAAA;gBAC1B,CAAC;YACL,CAAC;QACL,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YACd,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;YAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACnB,CAAC;IACL,CAAC,CAAC,CAAA;AACV,CAAC,CAAA;AA7BY,QAAA,mBAAmB,uBA6B/B"}
@@ -24,7 +24,7 @@ const resend = async (streamId, resendOpts, client, subscribe) => {
24
24
  }
25
25
  }
26
26
  catch (err) {
27
- console.error(err.message ? err.message : err);
27
+ console.error(err.message ?? err);
28
28
  process.exit(1);
29
29
  }
30
30
  };
@@ -1 +1 @@
1
- {"version":3,"file":"resend.js","sourceRoot":"","sources":["../../src/resend.ts"],"names":[],"mappings":";;;AAEO,MAAM,uBAAuB,GAAG,CACnC,OAAgB,EAChB,OAAgB,EAChB,YAAoB,EACpB,cAAiB,EACL,EAAE;IACd,IAAI,CAAC,OAAO,IAAI,cAAc,IAAI,CAAC,CAAC,OAAO,IAAI,cAAc,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,cAAc,IAAI,CAAC,CAAC,OAAO,IAAI,cAAc,CAAC,CAAC,EAAE,CAAC;QAC7H,OAAO,CAAC,KAAK,CAAC,UAAU,YAAY,EAAE,CAAC,CAAA;QACvC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACnB,CAAC;AACL,CAAC,CAAA;AAVY,QAAA,uBAAuB,2BAUnC;AAEM,MAAM,MAAM,GAAG,KAAK,EACvB,QAAgB,EAChB,UAAyB,EACzB,MAAqB,EACrB,SAAkB,EACL,EAAE;IACf,IAAI,CAAC;QACD,MAAM,OAAO,GAAG,CAAC,OAAY,EAAE,EAAE;YAC7B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;QACzC,CAAC,CAAA;QACD,IAAI,SAAS,EAAE,CAA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CAAA;QACzC,CAAC,CAAA;QACD,IAAI,SAAS,EAAE,CAAC;YACZ,MAAM,MAAM,CAAC,SAAS,CAAC;gBACnB,MAAM,EAAE,QAAQ;gBAChB,MAAM,EAAE,UAAU;aACrB,EAAE,OAAO,CAAC,CAAA;QACf,CAAC;aAAM,CAAC;YACJ,MAAM,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;QACtD,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,CAAA;QACjC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACnB,CAAC;AACL,CAAC,CAAA;AAtBY,QAAA,MAAM,UAsBlB"}
package/package.json CHANGED
@@ -1,12 +1,18 @@
1
1
  {
2
2
  "name": "@streamr/cli-tools",
3
- "version": "103.0.0-rc.0",
3
+ "version": "103.0.0-rc.2",
4
4
  "description": "Command line tools for Streamr",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/streamr-dev/network.git",
8
8
  "directory": "packages/cli-tools"
9
9
  },
10
+ "files": [
11
+ "dist",
12
+ "!*.tsbuildinfo",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
10
16
  "bin": {
11
17
  "streamr": "dist/bin/streamr.js"
12
18
  },
@@ -26,10 +32,10 @@
26
32
  "author": "Streamr Network AG <contact@streamr.com>",
27
33
  "license": "AGPL-3.0",
28
34
  "dependencies": {
29
- "@streamr/dht": "103.0.0-rc.0",
30
- "@streamr/sdk": "103.0.0-rc.0",
31
- "@streamr/trackerless-network": "103.0.0-rc.0",
32
- "@streamr/utils": "103.0.0-rc.0",
35
+ "@streamr/dht": "103.0.0-rc.2",
36
+ "@streamr/sdk": "103.0.0-rc.2",
37
+ "@streamr/trackerless-network": "103.0.0-rc.2",
38
+ "@streamr/utils": "103.0.0-rc.2",
33
39
  "commander": "^13.1.0",
34
40
  "easy-table": "^1.1.1",
35
41
  "ethers": "^6.13.0",
@@ -38,11 +44,11 @@
38
44
  "semver": "^7.7.1"
39
45
  },
40
46
  "devDependencies": {
41
- "@streamr/test-utils": "103.0.0-rc.0",
47
+ "@streamr/test-utils": "103.0.0-rc.2",
42
48
  "@types/event-stream": "^4.0.5",
43
49
  "@types/lodash": "^4.17.16",
44
50
  "@types/merge2": "^1.4.4",
45
- "@types/semver": "^7.5.8",
51
+ "@types/semver": "^7.7.0",
46
52
  "merge2": "^1.4.1"
47
53
  }
48
54
  }
@@ -1,81 +0,0 @@
1
- #!/usr/bin/env node
2
- import '../src/logLevel'
3
-
4
- import { DhtNode, PeerDescriptor, toDhtAddress, toNodeId } from '@streamr/dht'
5
- import StreamrClient, { DhtAddress } from '@streamr/sdk'
6
- import { NetworkNode, NodeInfo, StreamPartitionInfo } from '@streamr/trackerless-network'
7
- import { binaryToHex, ChangeFieldType, Logger } from '@streamr/utils'
8
- import { createClientCommand } from '../src/command'
9
- import semver from 'semver'
10
-
11
- const logger = new Logger(module)
12
-
13
- export type NormalizedNodeInfo = ChangeFieldType<
14
- NodeInfo,
15
- 'streamPartitions',
16
- Omit<StreamPartitionInfo, 'deprecatedContentDeliveryLayerNeighbors'>[]>
17
-
18
- const toNormalizeNodeInfo = (info: NodeInfo): NormalizedNodeInfo => {
19
- const isLegacyFormat = semver.satisfies(semver.coerce(info.applicationVersion)!, '< 102.0.0')
20
- return {
21
- ...info,
22
- streamPartitions: info.streamPartitions.map((sp: StreamPartitionInfo) => ({
23
- ...sp,
24
- contentDeliveryLayerNeighbors: !isLegacyFormat
25
- ? sp.contentDeliveryLayerNeighbors
26
- : sp.deprecatedContentDeliveryLayerNeighbors.map((n) => ({
27
- peerDescriptor: n
28
- }))
29
- }))
30
- }
31
- }
32
-
33
- const createPeerDescriptorOutput = (peerDescriptor: PeerDescriptor) => {
34
- return {
35
- nodeId: toNodeId(peerDescriptor),
36
- type: peerDescriptor.type,
37
- udp: peerDescriptor.udp,
38
- tcp: peerDescriptor.tcp,
39
- websocket: peerDescriptor.websocket,
40
- region: peerDescriptor.region,
41
- ipAddress: peerDescriptor.ipAddress,
42
- publicKey: (peerDescriptor.publicKey !== undefined) ? binaryToHex(peerDescriptor.publicKey) : undefined,
43
- signature: (peerDescriptor.signature !== undefined) ? binaryToHex(peerDescriptor.signature) : undefined
44
- }
45
- }
46
-
47
- const createNodeInfoOutput = (nodeInfo: NormalizedNodeInfo) => {
48
- return {
49
- peerDescriptor: createPeerDescriptorOutput(nodeInfo.peerDescriptor),
50
- controlLayer: {
51
- neighbors: nodeInfo.controlLayer.neighbors.map((n) => toNodeId(n)),
52
- connections: nodeInfo.controlLayer.connections.map((n) => toNodeId(n))
53
- },
54
- streamPartitions: nodeInfo.streamPartitions.map((sp) => ({
55
- id: sp.id,
56
- controlLayerNeighbors: sp.controlLayerNeighbors.map((n) => toNodeId(n)),
57
- contentDeliveryLayerNeighbors: sp.contentDeliveryLayerNeighbors.map((n) => ({
58
- nodeId: toNodeId(n.peerDescriptor),
59
- rtt: n.rtt
60
- }))
61
- })),
62
- applicationVersion: nodeInfo.applicationVersion
63
- }
64
- }
65
-
66
- createClientCommand(async (client: StreamrClient, nodeId: string) => {
67
- const networkNode = await client.getNode().getNode() as NetworkNode
68
- const controlLayerNode = networkNode.stack.getControlLayerNode()
69
- const peerDescriptors = await (controlLayerNode as DhtNode).findClosestNodesFromDht(nodeId as DhtAddress)
70
- const peerDescriptor = peerDescriptors.find((pd) => toDhtAddress(pd.nodeId) === nodeId)
71
- if (peerDescriptor !== undefined) {
72
- const info = await networkNode.stack.fetchNodeInfo(peerDescriptor)
73
- const normalizedInfo = toNormalizeNodeInfo(info)
74
- console.info(JSON.stringify(createNodeInfoOutput(normalizedInfo), undefined, 4))
75
- } else {
76
- logger.error('No peer descriptor found')
77
- }
78
- })
79
- .description('show detailed information about a node')
80
- .arguments('nodeId')
81
- .parseAsync()
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env node
2
- import '../src/logLevel'
3
-
4
- import { StreamrClient, _operatorContractUtils } from '@streamr/sdk'
5
- import { createClientCommand } from '../src/command'
6
- import { parseEther } from 'ethers'
7
-
8
- createClientCommand(async (client: StreamrClient, operatorAddress: string, dataTokenAmount: string) => {
9
- await _operatorContractUtils.delegate(
10
- await client.getSigner(),
11
- operatorAddress,
12
- parseEther(dataTokenAmount),
13
- _operatorContractUtils.getTestTokenContract()
14
- )
15
- })
16
- .description('delegate funds to an operator')
17
- .arguments('<operatorAddress> <dataTokenAmount>')
18
- .parseAsync()
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env node
2
- import '../src/logLevel'
3
-
4
- import { StreamrClient, _operatorContractUtils } from '@streamr/sdk'
5
- import { createClientCommand } from '../src/command'
6
- import { parseEther } from 'ethers'
7
-
8
- createClientCommand(async (client: StreamrClient, operatorContractAddress: string, sponsorshipAddress: string, dataTokenAmount: string) => {
9
- const operatorContract = _operatorContractUtils.getOperatorContract(operatorContractAddress).connect(await client.getSigner())
10
- await _operatorContractUtils.stake(
11
- operatorContract,
12
- sponsorshipAddress,
13
- parseEther(dataTokenAmount)
14
- )
15
- })
16
- .description('stake funds to a sponsorship')
17
- .arguments('<operatorContractAddress> <sponsorshipAddress> <dataTokenAmount>')
18
- .parseAsync()
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env node
2
- import '../src/logLevel'
3
-
4
- import { StreamrClient, _operatorContractUtils } from '@streamr/sdk'
5
- import { createClientCommand } from '../src/command'
6
- import { parseEther } from 'ethers'
7
-
8
- createClientCommand(async (client: StreamrClient, operatorAddress: string, dataTokenAmount: string) => {
9
- await _operatorContractUtils.undelegate(
10
- await client.getSigner(),
11
- _operatorContractUtils.getOperatorContract(operatorAddress),
12
- parseEther(dataTokenAmount)
13
- )
14
- })
15
- .description('undelegate funds from an operator')
16
- .arguments('<operatorAddress> <dataTokenAmount>')
17
- .parseAsync()
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env node
2
- import '../src/logLevel'
3
-
4
- import { StreamrClient, _operatorContractUtils } from '@streamr/sdk'
5
- import { createClientCommand } from '../src/command'
6
-
7
- createClientCommand(async (client: StreamrClient, operatorContractAddress: string, sponsorshipAddress: string) => {
8
- const operatorContract = _operatorContractUtils.getOperatorContract(operatorContractAddress).connect(await client.getSigner())
9
- await _operatorContractUtils.unstake(
10
- operatorContract,
11
- sponsorshipAddress
12
- )
13
- })
14
- .arguments('<operatorContractAddress> <sponsorshipAddress>')
15
- .description('unstake all funds from a sponsorship')
16
- .parseAsync()
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env node
2
- import '../src/logLevel'
3
-
4
- import StreamrClient from '@streamr/sdk'
5
- import { createClientCommand } from '../src/command'
6
-
7
- createClientCommand(async (client: StreamrClient) => {
8
- const config = client.getConfig()
9
- console.info(JSON.stringify(config, undefined, 4))
10
- })
11
- .parseAsync()
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env node
2
- import '../src/logLevel'
3
-
4
- import { StreamrClient, _operatorContractUtils } from '@streamr/sdk'
5
- import { createClientCommand } from '../src/command'
6
- import { parseEther } from 'ethers'
7
-
8
- createClientCommand(async (client: StreamrClient, sponsorshipAddress: string, dataTokenAmount: string) => {
9
- await _operatorContractUtils.sponsor(
10
- await client.getSigner(),
11
- sponsorshipAddress,
12
- parseEther(dataTokenAmount),
13
- _operatorContractUtils.getTestTokenContract()
14
- )
15
- })
16
- .description('sponsor a stream')
17
- .arguments('<sponsorshipAddress> <tokenAmount>')
18
- .parseAsync()
@@ -1,21 +0,0 @@
1
- #!/usr/bin/env node
2
- import '../src/logLevel'
3
-
4
- import { _operatorContractUtils } from '@streamr/sdk'
5
- import { parseEther } from 'ethers'
6
- import { createCommand } from '../src/command'
7
-
8
- createCommand().action(async (targetAddress: string, dataTokenAmount: string, gasAmount?: string) => {
9
- const adminWallet = _operatorContractUtils.getTestAdminWallet()
10
- const token = _operatorContractUtils.getTestTokenContract().connect(adminWallet)
11
- await (await token.mint(targetAddress, parseEther(dataTokenAmount))).wait()
12
- if (gasAmount !== undefined) {
13
- await (await adminWallet.sendTransaction({
14
- to: targetAddress,
15
- value: parseEther(gasAmount)
16
- })).wait()
17
- }
18
- })
19
- .arguments('<targetAddress> <dataTokenAmount> [gasAmount]')
20
- .description('mint test tokens and optionally transfer gas to the given Ethereum address')
21
- .parseAsync()
@@ -1,122 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createCommand } from '../src/command'
3
- import fs from 'fs'
4
-
5
- interface Topology {
6
- neighbors: Record<string, string[]>
7
- labels?: Record<string, string>
8
- route?: string[]
9
- }
10
-
11
- const SHORT_ID_LENGTH = 4
12
-
13
- const generateGradientColors = (count: number): string[] => {
14
- const START_COLOR = 'eeee22'
15
- const END_COLOR = '88ee20'
16
- const startRGB = parseInt(START_COLOR, 16)
17
- const endRGB = parseInt(END_COLOR, 16)
18
- const getComponent = (rgb: number, shift: number) => (rgb >> shift) & 0xFF
19
- const startR = getComponent(startRGB, 16)
20
- const startG = getComponent(startRGB, 8)
21
- const startB = getComponent(startRGB, 0)
22
- const endR = getComponent(endRGB, 16)
23
- const endG = getComponent(endRGB, 8)
24
- const endB = getComponent(endRGB, 0)
25
- const colors: string[] = []
26
- for (let step = 0; step < count; step++) {
27
- const getOutput = (start: number, end: number) => Math.round(start + ((end - start) * step / count)).toString(16).padStart(2, '0')
28
- const stepR = getOutput(startR, endR)
29
- const stepG = getOutput(startG, endG)
30
- const stepB = getOutput(startB, endB)
31
- colors.push(`#${stepR}${stepG}${stepB}`)
32
- }
33
- return colors
34
- }
35
-
36
- const getNodeIds = (topology: Topology): Set<string> => {
37
- const result: Set<string> = new Set()
38
- for (const nodeId of Object.keys(topology.neighbors)) {
39
- result.add(nodeId)
40
- for (const neighborId of topology.neighbors[nodeId]) {
41
- result.add(neighborId)
42
- }
43
- }
44
- return result
45
- }
46
-
47
- const createGraph = (topology: Topology) => {
48
- const lines = ['strict graph {']
49
- lines.push(' layout="fdp"')
50
- lines.push(' size="16,9"')
51
- lines.push(' ratio="fill"')
52
- lines.push(' overlap=false')
53
- lines.push(' node [style=filled]')
54
- lines.push(' graph [splines=curved]')
55
- for (const nodeId of getNodeIds(topology)) {
56
- const shortNodeId = nodeId.substring(0, SHORT_ID_LENGTH)
57
- const explicitLabel = (topology.labels !== undefined) ? topology.labels[nodeId] : undefined
58
- const attributes = (explicitLabel !== undefined)
59
- ? `label="${explicitLabel}: ${shortNodeId}", penwidth=3`
60
- : `label="${shortNodeId}"`
61
- lines.push(` "${nodeId}" [${attributes}]`)
62
- }
63
- if (topology.route !== undefined) {
64
- const colors = generateGradientColors(topology.route.length)
65
- for (let i = 0; i < topology.route.length; i++) {
66
- lines.push(` "${topology.route[i]}" [fillcolor="${colors[i]}"]`)
67
- }
68
- }
69
- for (const nodeId of Object.keys(topology.neighbors)) {
70
- for (const neighborId of topology.neighbors[nodeId]) {
71
- lines.push(` "${nodeId}" -- "${neighborId}"`)
72
- }
73
- }
74
- lines.push('}')
75
- return lines.join('\n')
76
- }
77
-
78
- const readStdin = async (): Promise<string> => {
79
- let text = ''
80
- for await (const chunk of process.stdin) {
81
- text += chunk
82
- }
83
- return text
84
- }
85
-
86
- const description = `Generates a DOT graph to visualize a network topology.
87
- To render the output you can use e.g.:
88
- - web site https://dreampuf.github.io/GraphvizOnline/
89
- - Graphwiz application (https://formulae.brew.sh/formula/graphviz)
90
- (dot -Tsvg topology.dot -o topology.svg)
91
-
92
- The definition JSON must contain neighbor definitions. It may optionally
93
- contain labels and/or a route definition. Format:
94
- {
95
- "neighbors": {
96
- "1111": ["2222", "3333"],
97
- "2222": ["3333", "4444"],
98
- "3333": ["2222", "4444", "5555"],
99
- "4444": ["5555", "8888"],
100
- "5555": ["6666", "7777", "9999"],
101
- "6666": ["8888", "9999"],
102
- "7777": ["1111"],
103
- "8888": ["9999", "3333"]
104
- },
105
- "labels": {
106
- "1111": "Foo",
107
- "5555": "Bar"
108
- },
109
- "route": ["3333", "4444", "5555", "6666", "8888"]
110
- }`
111
-
112
- createCommand()
113
- .description(description)
114
- .arguments('[topologyDefinitionFile]')
115
- .action(async (topologyDefinitionFile?: string) => {
116
- const topologyDefinition = (topologyDefinitionFile !== undefined)
117
- ? fs.readFileSync(topologyDefinitionFile, 'utf-8')
118
- : await readStdin()
119
- // TODO could validate the content
120
- console.info(createGraph(JSON.parse(topologyDefinition) as Topology))
121
- })
122
- .parse()
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env node
2
- import { program } from 'commander'
3
- import pkg from '../package.json'
4
-
5
- program
6
- .version(pkg.version)
7
- .usage('<command> [<args>]')
8
- .description('subcommands for internal use, the API of the commands may change')
9
- .command('node-info', 'info about a node')
10
- .command('visualize-topology', 'visualize network topology')
11
- .command('show-sdk-config', 'show config used by internal StreamrClient')
12
- .command('sponsorship-sponsor', 'sponsor a sponsorship')
13
- .command('operator-delegate', 'delegate funds to an operator')
14
- .command('operator-undelegate', 'undelegate funds from an operator')
15
- .command('operator-stake', 'stake operator\'s funds to a sponsorship')
16
- .command('operator-unstake', 'unstake all operator\'s funds from a sponsorship')
17
- .command('token-mint', 'mint test tokens')
18
- .parse()
@@ -1,51 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createFnParseInt } from '../src/common'
3
- import { createCommand, Options as BaseOptions } from '../src/command'
4
- import { randomString } from '@streamr/utils'
5
- import crypto from 'crypto'
6
-
7
- interface Options extends BaseOptions {
8
- rate: number
9
- binary: boolean
10
- minLength: number
11
- maxLength: number
12
- }
13
-
14
- function genArray<T>(size: number, elementFn: () => T): T[] {
15
- const arr = []
16
- for (let i = 0; i < size; ++i) {
17
- arr.push(elementFn())
18
- }
19
- return arr
20
- }
21
-
22
- export const generateJson = (): string => {
23
- return JSON.stringify({
24
- someText: randomString(64),
25
- aNumber: Math.random() * 10000,
26
- bNumber: Math.random(),
27
- yesOrNo: Math.random() > 0.5,
28
- arrayOfStrings: genArray(Math.floor(Math.random() * 20), () => randomString(8)),
29
- arrayOfIntegers: genArray(Math.floor(Math.random() * 10), () => Math.floor(Math.random() * 100))
30
- })
31
- }
32
-
33
- export const generateBinary = ({ minLength, maxLength }: Options): string => {
34
- const length = Math.floor(Math.random() * (maxLength - minLength + 1)) + minLength
35
- const buffer = crypto.randomBytes(length)
36
- return buffer.toString('hex')
37
- }
38
-
39
- createCommand()
40
- .description('generate and print semi-random JSON data or random binary data (hexadecimal) to stdout')
41
- .option('-r, --rate <n>', 'rate in milliseconds', createFnParseInt('--rate'), 500)
42
- .option('--binary', 'generate binary data instead of JSON')
43
- .option('--min-length <n>', 'minimum message length in bytes (only for binary data)', createFnParseInt('--min-length'), 512)
44
- .option('--max-length <n>', 'maximum message length in bytes (only for binary data)', createFnParseInt('--max-length'), 4096)
45
- .action((options: Options) => {
46
- const generate = options.binary ? generateBinary : generateJson
47
- setInterval(() => {
48
- console.info(generate(options))
49
- }, options.rate)
50
- })
51
- .parse()
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- import { program } from 'commander'
3
- import pkg from '../package.json'
4
-
5
- program
6
- .version(pkg.version)
7
- .usage('<command> [<args>]')
8
- .description('mock-data subcommands')
9
- .command('generate', 'generate random JSON or binary data')
10
- .parse()
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env node
2
- import '../src/logLevel'
3
-
4
- import { StreamrClient } from '@streamr/sdk'
5
- import { createClientCommand } from '../src/command'
6
-
7
- createClientCommand(async (client: StreamrClient, storageNodeAddress: string, streamId: string) => {
8
- const stream = await client.getStream(streamId)
9
- await stream.addToStorageNode(storageNodeAddress)
10
- })
11
- .arguments('<storageNodeAddress> <streamId>')
12
- .description('add stream to a storage node')
13
- .parseAsync()
@@ -1,21 +0,0 @@
1
- #!/usr/bin/env node
2
- import '../src/logLevel'
3
-
4
- import EasyTable from 'easy-table'
5
- import { StreamrClient } from '@streamr/sdk'
6
- import { createClientCommand } from '../src/command'
7
-
8
- createClientCommand((async (client: StreamrClient, storageNodeAddress: string) => {
9
- const { streams } = await client.getStoredStreams(storageNodeAddress)
10
- if (streams.length > 0) {
11
- console.info(EasyTable.print(await Promise.all(streams.map(async (stream) => {
12
- return {
13
- id: stream.id,
14
- partitions: await stream.getPartitionCount()
15
- }
16
- }))))
17
- }
18
- }))
19
- .arguments('<storageNodeAddress>')
20
- .description('list stream parts in a storage node')
21
- .parseAsync()
@@ -1,23 +0,0 @@
1
- #!/usr/bin/env node
2
- import '../src/logLevel'
3
-
4
- import { StreamrClient } from '@streamr/sdk'
5
- import EasyTable from 'easy-table'
6
- import { createClientCommand, Options as BaseOptions } from '../src/command'
7
-
8
- interface Options extends BaseOptions {
9
- stream?: string
10
- }
11
-
12
- createClientCommand(async (client: StreamrClient, options: Options) => {
13
- const streamId = options.stream
14
- const addresses = await client.getStorageNodes(streamId)
15
- if (addresses.length > 0) {
16
- console.info(EasyTable.print(addresses.map((address: string) => ({
17
- address
18
- }))))
19
- }
20
- })
21
- .description('fetch a list of storage nodes')
22
- .option('-s, --stream <streamId>', 'only storage nodes which store the given stream (needs authentication)')
23
- .parseAsync()