@streamr/cli-tools 102.0.0-beta.0 → 102.0.0-beta.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.
- package/README.md +1 -1
- package/bin/streamr-internal-node-info.ts +81 -0
- package/bin/streamr-internal-operator-delegate.ts +18 -0
- package/bin/streamr-internal-operator-stake.ts +18 -0
- package/bin/streamr-internal-operator-undelegate.ts +17 -0
- package/bin/streamr-internal-operator-unstake.ts +16 -0
- package/bin/streamr-internal-show-sdk-config.ts +11 -0
- package/bin/streamr-internal-sponsorship-sponsor.ts +18 -0
- package/bin/streamr-internal-visualize-topology.ts +1 -1
- package/bin/streamr-internal.ts +7 -0
- package/bin/streamr-mock-data-generate.ts +26 -13
- package/bin/streamr-mock-data.ts +1 -1
- package/bin/streamr-storage-node-list-streams.ts +3 -3
- package/bin/streamr-stream-create.ts +1 -1
- package/bin/streamr-stream-publish.ts +22 -12
- package/bin/streamr-stream-search.ts +2 -2
- package/bin/streamr-stream-show.ts +10 -2
- package/bin/streamr-stream-subscribe.ts +1 -1
- package/bin/streamr-wallet-whoami.ts +1 -1
- package/dist/bin/streamr-internal-node-info.d.ts +5 -0
- package/dist/bin/streamr-internal-node-info.js +75 -0
- package/dist/bin/streamr-internal-node-info.js.map +1 -0
- package/dist/bin/streamr-internal-operator-delegate.d.ts +2 -0
- package/dist/bin/streamr-internal-operator-delegate.js +14 -0
- package/dist/bin/streamr-internal-operator-delegate.js.map +1 -0
- package/dist/bin/streamr-internal-operator-stake.d.ts +2 -0
- package/dist/bin/streamr-internal-operator-stake.js +15 -0
- package/dist/bin/streamr-internal-operator-stake.js.map +1 -0
- package/dist/bin/streamr-internal-operator-undelegate.d.ts +2 -0
- package/dist/bin/streamr-internal-operator-undelegate.js +14 -0
- package/dist/bin/streamr-internal-operator-undelegate.js.map +1 -0
- package/dist/bin/streamr-internal-operator-unstake.d.ts +2 -0
- package/dist/bin/streamr-internal-operator-unstake.js +14 -0
- package/dist/bin/streamr-internal-operator-unstake.js.map +1 -0
- package/dist/bin/streamr-internal-show-sdk-config.d.ts +2 -0
- package/dist/bin/streamr-internal-show-sdk-config.js +11 -0
- package/dist/bin/streamr-internal-show-sdk-config.js.map +1 -0
- package/dist/bin/streamr-internal-sponsorship-sponsor.d.ts +2 -0
- package/dist/bin/streamr-internal-sponsorship-sponsor.js +14 -0
- package/dist/bin/streamr-internal-sponsorship-sponsor.js.map +1 -0
- package/dist/bin/streamr-internal-visualize-topology.js +1 -1
- package/dist/bin/streamr-internal-visualize-topology.js.map +1 -1
- package/dist/bin/streamr-internal.js +7 -0
- package/dist/bin/streamr-internal.js.map +1 -1
- package/dist/bin/streamr-mock-data-generate.d.ts +10 -1
- package/dist/bin/streamr-mock-data-generate.js +29 -15
- package/dist/bin/streamr-mock-data-generate.js.map +1 -1
- package/dist/bin/streamr-mock-data.js +1 -1
- package/dist/bin/streamr-mock-data.js.map +1 -1
- package/dist/bin/streamr-storage-node-list-streams.js +3 -3
- package/dist/bin/streamr-storage-node-list-streams.js.map +1 -1
- package/dist/bin/streamr-stream-create.js +1 -1
- package/dist/bin/streamr-stream-create.js.map +1 -1
- package/dist/bin/streamr-stream-publish.js +21 -11
- package/dist/bin/streamr-stream-publish.js.map +1 -1
- package/dist/bin/streamr-stream-search.js +2 -2
- package/dist/bin/streamr-stream-search.js.map +1 -1
- package/dist/bin/streamr-stream-show.js +9 -2
- package/dist/bin/streamr-stream-show.js.map +1 -1
- package/dist/bin/streamr-stream-subscribe.js +1 -1
- package/dist/bin/streamr-stream-subscribe.js.map +1 -1
- package/dist/bin/streamr-wallet-whoami.js +1 -1
- package/dist/bin/streamr-wallet-whoami.js.map +1 -1
- package/dist/package.json +12 -8
- package/dist/src/client.d.ts +1 -1
- package/dist/src/client.js +3 -4
- package/dist/src/client.js.map +1 -1
- package/dist/src/command.d.ts +3 -3
- package/dist/src/command.js +3 -1
- package/dist/src/command.js.map +1 -1
- package/dist/src/common.d.ts +3 -0
- package/dist/src/common.js +20 -2
- package/dist/src/common.js.map +1 -1
- package/dist/src/permission.js +1 -1
- package/dist/src/permission.js.map +1 -1
- package/jest.config.ts +1 -0
- package/package.json +12 -8
- package/src/client.ts +3 -4
- package/src/command.ts +5 -3
- package/src/common.ts +18 -0
- package/src/permission.ts +1 -1
- package/test/environment.test.ts +32 -0
- package/test/internal-operator.test.ts +57 -0
- package/test/internal-sponsorship-sponsor.test.ts +28 -0
- package/test/mock-data.test.ts +14 -0
- package/test/storage-node.test.ts +3 -3
- package/test/stream-create.test.ts +1 -1
- package/test/stream-permission.test.ts +1 -1
- package/test/stream-publish-subscribe.test.ts +1 -1
- package/test/stream-resend.test.ts +1 -1
- package/test/utils.ts +5 -5
- package/tsconfig.json +1 -14
- package/tsconfig.node.json +16 -0
- package/.eslintignore +0 -2
- package/.eslintrc +0 -6
package/README.md
CHANGED
|
@@ -169,7 +169,7 @@ You must pass either the `--private-key` or `--config` option.
|
|
|
169
169
|
User can specify environment and authentication details with the following command line arguments:
|
|
170
170
|
- `--private-key <key>`, e.g. `--private-key 0x1234567890123456789012345678901234567890123456789012345678901234`
|
|
171
171
|
- `--config <file>`, e.g. `--config foobar.json`
|
|
172
|
-
- `--
|
|
172
|
+
- `--env` use a pre-defined environment, e.g. `--env dev2` to use the [development environment](https://github.com/streamr-dev/streamr-docker-dev)
|
|
173
173
|
|
|
174
174
|
The `--config` argument tries to read a configuration file from the current working directory (either without a file extension, or with `.json` extension added). It also tries to read it from `~/.streamr/config/${id}.json` dotfile.
|
|
175
175
|
|
|
@@ -0,0 +1,81 @@
|
|
|
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()
|
|
@@ -0,0 +1,18 @@
|
|
|
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()
|
|
@@ -0,0 +1,18 @@
|
|
|
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()
|
|
@@ -0,0 +1,17 @@
|
|
|
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()
|
|
@@ -0,0 +1,16 @@
|
|
|
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()
|
|
@@ -0,0 +1,11 @@
|
|
|
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()
|
|
@@ -0,0 +1,18 @@
|
|
|
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()
|
|
@@ -117,6 +117,6 @@ createCommand()
|
|
|
117
117
|
? fs.readFileSync(topologyDefinitionFile, 'utf-8')
|
|
118
118
|
: await readStdin()
|
|
119
119
|
// TODO could validate the content
|
|
120
|
-
console.
|
|
120
|
+
console.info(createGraph(JSON.parse(topologyDefinition) as Topology))
|
|
121
121
|
})
|
|
122
122
|
.parse()
|
package/bin/streamr-internal.ts
CHANGED
|
@@ -6,5 +6,12 @@ program
|
|
|
6
6
|
.version(pkg.version)
|
|
7
7
|
.usage('<command> [<args>]')
|
|
8
8
|
.description('subcommands for internal use, the API of the commands may change')
|
|
9
|
+
.command('node-info', 'info about a node')
|
|
9
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')
|
|
10
17
|
.parse()
|
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
import { createFnParseInt } from '../src/common'
|
|
3
3
|
import { createCommand, Options as BaseOptions } from '../src/command'
|
|
4
4
|
import { randomString } from '@streamr/utils'
|
|
5
|
+
import crypto from 'crypto'
|
|
5
6
|
|
|
6
7
|
interface Options extends BaseOptions {
|
|
7
8
|
rate: number
|
|
9
|
+
binary: boolean
|
|
10
|
+
minLength: number
|
|
11
|
+
maxLength: number
|
|
8
12
|
}
|
|
9
13
|
|
|
10
14
|
function genArray<T>(size: number, elementFn: () => T): T[] {
|
|
@@ -15,24 +19,33 @@ function genArray<T>(size: number, elementFn: () => T): T[] {
|
|
|
15
19
|
return arr
|
|
16
20
|
}
|
|
17
21
|
|
|
18
|
-
export const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
+
}
|
|
27
32
|
|
|
28
|
-
|
|
29
|
-
|
|
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')
|
|
30
37
|
}
|
|
31
38
|
|
|
32
39
|
createCommand()
|
|
33
|
-
.description('generate and print semi-random JSON data to stdout')
|
|
40
|
+
.description('generate and print semi-random JSON data or random binary data (hexadecimal) to stdout')
|
|
34
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)
|
|
35
45
|
.action((options: Options) => {
|
|
36
|
-
generate
|
|
46
|
+
const generate = options.binary ? generateBinary : generateJson
|
|
47
|
+
setInterval(() => {
|
|
48
|
+
console.info(generate(options))
|
|
49
|
+
}, options.rate)
|
|
37
50
|
})
|
|
38
51
|
.parse()
|
package/bin/streamr-mock-data.ts
CHANGED
|
@@ -8,12 +8,12 @@ import { createClientCommand } from '../src/command'
|
|
|
8
8
|
createClientCommand((async (client: StreamrClient, storageNodeAddress: string) => {
|
|
9
9
|
const { streams } = await client.getStoredStreams(storageNodeAddress)
|
|
10
10
|
if (streams.length > 0) {
|
|
11
|
-
console.info(EasyTable.print(streams.map((stream) => {
|
|
11
|
+
console.info(EasyTable.print(await Promise.all(streams.map(async (stream) => {
|
|
12
12
|
return {
|
|
13
13
|
id: stream.id,
|
|
14
|
-
partitions: stream.
|
|
14
|
+
partitions: await stream.getPartitionCount()
|
|
15
15
|
}
|
|
16
|
-
})))
|
|
16
|
+
}))))
|
|
17
17
|
}
|
|
18
18
|
}))
|
|
19
19
|
.arguments('<storageNodeAddress>')
|
|
@@ -19,7 +19,7 @@ createClientCommand(async (client: StreamrClient, streamIdOrPath: string, option
|
|
|
19
19
|
partitions: options.partitions
|
|
20
20
|
}
|
|
21
21
|
const stream = await client.createStream(body)
|
|
22
|
-
console.info(JSON.stringify({ id: stream.id, ...stream.getMetadata() }, null, 2))
|
|
22
|
+
console.info(JSON.stringify({ id: stream.id, ...await stream.getMetadata() }, null, 2))
|
|
23
23
|
})
|
|
24
24
|
.arguments('<streamId>')
|
|
25
25
|
.description('create a new stream')
|
|
@@ -3,7 +3,7 @@ import '../src/logLevel'
|
|
|
3
3
|
|
|
4
4
|
import { Writable } from 'stream'
|
|
5
5
|
import { StreamrClient } from '@streamr/sdk'
|
|
6
|
-
import { wait } from '@streamr/utils'
|
|
6
|
+
import { hexToBinary, wait } from '@streamr/utils'
|
|
7
7
|
import es from 'event-stream'
|
|
8
8
|
import { createClientCommand, Options as BaseOptions } from '../src/command'
|
|
9
9
|
|
|
@@ -11,6 +11,10 @@ interface Options extends BaseOptions {
|
|
|
11
11
|
partitionKeyField?: string
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
const isHexadecimal = (str: string): boolean => {
|
|
15
|
+
return /^[0-9a-fA-F]+$/.test(str)
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
const publishStream = (
|
|
15
19
|
stream: string,
|
|
16
20
|
partitionKeyField: string | undefined,
|
|
@@ -19,21 +23,26 @@ const publishStream = (
|
|
|
19
23
|
const writable = new Writable({
|
|
20
24
|
objectMode: true,
|
|
21
25
|
write: (data: any, _: any, done: any) => {
|
|
22
|
-
let
|
|
26
|
+
let message = null
|
|
23
27
|
// ignore newlines, etc
|
|
24
28
|
if (!data || String(data).trim() === '') {
|
|
25
29
|
done()
|
|
26
30
|
return
|
|
27
31
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
const trimmedData = String(data).trim()
|
|
33
|
+
if (isHexadecimal(trimmedData)) {
|
|
34
|
+
message = hexToBinary(trimmedData)
|
|
35
|
+
} else {
|
|
36
|
+
try {
|
|
37
|
+
message = JSON.parse(trimmedData)
|
|
38
|
+
} catch (e) {
|
|
39
|
+
console.error(data.toString())
|
|
40
|
+
done(e)
|
|
41
|
+
return
|
|
42
|
+
}
|
|
34
43
|
}
|
|
35
|
-
const partitionKey = (partitionKeyField !== undefined) ?
|
|
36
|
-
client.publish(stream,
|
|
44
|
+
const partitionKey = (partitionKeyField !== undefined && typeof message === 'object') ? message[partitionKeyField] : undefined
|
|
45
|
+
client.publish(stream, message, { partitionKey }).then(
|
|
37
46
|
() => done(),
|
|
38
47
|
(err) => done(err)
|
|
39
48
|
)
|
|
@@ -63,6 +72,7 @@ createClientCommand(async (client: StreamrClient, streamId: string, options: Opt
|
|
|
63
72
|
})
|
|
64
73
|
})
|
|
65
74
|
.arguments('<streamId>')
|
|
66
|
-
.description('publish to a stream by reading JSON messages from stdin line-by-line')
|
|
67
|
-
|
|
75
|
+
.description('publish to a stream by reading JSON messages from stdin line-by-line or hexadecimal strings for binary data')
|
|
76
|
+
// eslint-disable-next-line max-len
|
|
77
|
+
.option('-k, --partition-key-field <string>', 'field name in each message to use for assigning the message to a stream partition (only for JSON data)')
|
|
68
78
|
.parseAsync()
|
|
@@ -23,7 +23,7 @@ const createPermissionFilter = async (
|
|
|
23
23
|
): Promise<SearchStreamsPermissionFilter | undefined> => {
|
|
24
24
|
if (user !== undefined) {
|
|
25
25
|
return {
|
|
26
|
-
|
|
26
|
+
userId: (getOptionType(user) === OptionType.ARGUMENT) ? user as string : await client.getUserId(),
|
|
27
27
|
allowPublic: allowPublic ?? false,
|
|
28
28
|
allOf,
|
|
29
29
|
anyOf
|
|
@@ -50,7 +50,7 @@ createClientCommand(async (client: StreamrClient, term: string | undefined, opti
|
|
|
50
50
|
)
|
|
51
51
|
const streams = client.searchStreams(term, permissionFilter)
|
|
52
52
|
for await (const stream of streams) {
|
|
53
|
-
console.
|
|
53
|
+
console.info(stream.id)
|
|
54
54
|
}
|
|
55
55
|
})
|
|
56
56
|
.arguments('[term]')
|
|
@@ -4,19 +4,27 @@ import '../src/logLevel'
|
|
|
4
4
|
import { StreamrClient } from '@streamr/sdk'
|
|
5
5
|
import { createClientCommand, Options as BaseOptions } from '../src/command'
|
|
6
6
|
import { getPermissionId } from '../src/permission'
|
|
7
|
+
import { omit } from 'lodash'
|
|
7
8
|
|
|
8
9
|
interface Options extends BaseOptions {
|
|
9
10
|
includePermissions: boolean
|
|
10
11
|
}
|
|
11
12
|
|
|
13
|
+
const withRenamedField = (obj: any, from: string, to: string) => {
|
|
14
|
+
return {
|
|
15
|
+
...omit(obj, from),
|
|
16
|
+
[to]: obj[from]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
12
20
|
createClientCommand(async (client: StreamrClient, streamId: string, options: Options) => {
|
|
13
21
|
const stream = await client.getStream(streamId)
|
|
14
|
-
const obj: any = { id: stream.id, ...stream.getMetadata() }
|
|
22
|
+
const obj: any = { id: stream.id, ...await stream.getMetadata() }
|
|
15
23
|
if (options.includePermissions) {
|
|
16
24
|
const assigments = await stream.getPermissions()
|
|
17
25
|
obj.permissions = assigments.map((assignment) => {
|
|
18
26
|
return {
|
|
19
|
-
...assignment,
|
|
27
|
+
...withRenamedField(assignment, 'userId', 'user'),
|
|
20
28
|
permissions: assignment.permissions.map(getPermissionId)
|
|
21
29
|
}
|
|
22
30
|
})
|
|
@@ -16,7 +16,7 @@ interface Options extends BaseOptions {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
createClientCommand(async (client: StreamrClient, streamId: string, options: Options) => {
|
|
19
|
-
const formContent = (content: unknown) =>
|
|
19
|
+
const formContent = (content: unknown) => content instanceof Uint8Array ? binaryToHex(content) : content
|
|
20
20
|
const formMessage = options.withMetadata
|
|
21
21
|
? (content: unknown, metadata: MessageMetadata) => ({ content: formContent(content), metadata: omit(metadata, 'streamMessage') })
|
|
22
22
|
: (content: unknown) => formContent(content)
|
|
@@ -5,7 +5,7 @@ import { StreamrClient } from '@streamr/sdk'
|
|
|
5
5
|
import { createClientCommand } from '../src/command'
|
|
6
6
|
|
|
7
7
|
createClientCommand(async (client: StreamrClient) => {
|
|
8
|
-
console.info(await client.
|
|
8
|
+
console.info(await client.getUserId())
|
|
9
9
|
})
|
|
10
10
|
.description('displays your public address')
|
|
11
11
|
.parseAsync()
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import '../src/logLevel';
|
|
3
|
+
import { NodeInfo, StreamPartitionInfo } from '@streamr/trackerless-network';
|
|
4
|
+
import { ChangeFieldType } from '@streamr/utils';
|
|
5
|
+
export type NormalizedNodeInfo = ChangeFieldType<NodeInfo, 'streamPartitions', Omit<StreamPartitionInfo, 'deprecatedContentDeliveryLayerNeighbors'>[]>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
require("../src/logLevel");
|
|
8
|
+
const dht_1 = require("@streamr/dht");
|
|
9
|
+
const utils_1 = require("@streamr/utils");
|
|
10
|
+
const command_1 = require("../src/command");
|
|
11
|
+
const semver_1 = __importDefault(require("semver"));
|
|
12
|
+
const logger = new utils_1.Logger(module);
|
|
13
|
+
const toNormalizeNodeInfo = (info) => {
|
|
14
|
+
const isLegacyFormat = semver_1.default.satisfies(semver_1.default.coerce(info.applicationVersion), '< 102.0.0');
|
|
15
|
+
return {
|
|
16
|
+
...info,
|
|
17
|
+
streamPartitions: info.streamPartitions.map((sp) => ({
|
|
18
|
+
...sp,
|
|
19
|
+
contentDeliveryLayerNeighbors: !isLegacyFormat
|
|
20
|
+
? sp.contentDeliveryLayerNeighbors
|
|
21
|
+
: sp.deprecatedContentDeliveryLayerNeighbors.map((n) => ({
|
|
22
|
+
peerDescriptor: n
|
|
23
|
+
}))
|
|
24
|
+
}))
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
const createPeerDescriptorOutput = (peerDescriptor) => {
|
|
28
|
+
return {
|
|
29
|
+
nodeId: (0, dht_1.toNodeId)(peerDescriptor),
|
|
30
|
+
type: peerDescriptor.type,
|
|
31
|
+
udp: peerDescriptor.udp,
|
|
32
|
+
tcp: peerDescriptor.tcp,
|
|
33
|
+
websocket: peerDescriptor.websocket,
|
|
34
|
+
region: peerDescriptor.region,
|
|
35
|
+
ipAddress: peerDescriptor.ipAddress,
|
|
36
|
+
publicKey: (peerDescriptor.publicKey !== undefined) ? (0, utils_1.binaryToHex)(peerDescriptor.publicKey) : undefined,
|
|
37
|
+
signature: (peerDescriptor.signature !== undefined) ? (0, utils_1.binaryToHex)(peerDescriptor.signature) : undefined
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
const createNodeInfoOutput = (nodeInfo) => {
|
|
41
|
+
return {
|
|
42
|
+
peerDescriptor: createPeerDescriptorOutput(nodeInfo.peerDescriptor),
|
|
43
|
+
controlLayer: {
|
|
44
|
+
neighbors: nodeInfo.controlLayer.neighbors.map((n) => (0, dht_1.toNodeId)(n)),
|
|
45
|
+
connections: nodeInfo.controlLayer.connections.map((n) => (0, dht_1.toNodeId)(n))
|
|
46
|
+
},
|
|
47
|
+
streamPartitions: nodeInfo.streamPartitions.map((sp) => ({
|
|
48
|
+
id: sp.id,
|
|
49
|
+
controlLayerNeighbors: sp.controlLayerNeighbors.map((n) => (0, dht_1.toNodeId)(n)),
|
|
50
|
+
contentDeliveryLayerNeighbors: sp.contentDeliveryLayerNeighbors.map((n) => ({
|
|
51
|
+
nodeId: (0, dht_1.toNodeId)(n.peerDescriptor),
|
|
52
|
+
rtt: n.rtt
|
|
53
|
+
}))
|
|
54
|
+
})),
|
|
55
|
+
applicationVersion: nodeInfo.applicationVersion
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
(0, command_1.createClientCommand)(async (client, nodeId) => {
|
|
59
|
+
const networkNode = await client.getNode().getNode();
|
|
60
|
+
const controlLayerNode = networkNode.stack.getControlLayerNode();
|
|
61
|
+
const peerDescriptors = await controlLayerNode.findClosestNodesFromDht(nodeId);
|
|
62
|
+
const peerDescriptor = peerDescriptors.find((pd) => (0, dht_1.toDhtAddress)(pd.nodeId) === nodeId);
|
|
63
|
+
if (peerDescriptor !== undefined) {
|
|
64
|
+
const info = await networkNode.stack.fetchNodeInfo(peerDescriptor);
|
|
65
|
+
const normalizedInfo = toNormalizeNodeInfo(info);
|
|
66
|
+
console.info(JSON.stringify(createNodeInfoOutput(normalizedInfo), undefined, 4));
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
logger.error('No peer descriptor found');
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
.description('show detailed information about a node')
|
|
73
|
+
.arguments('nodeId')
|
|
74
|
+
.parseAsync();
|
|
75
|
+
//# sourceMappingURL=streamr-internal-node-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streamr-internal-node-info.js","sourceRoot":"","sources":["../../bin/streamr-internal-node-info.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
require("../src/logLevel");
|
|
5
|
+
const sdk_1 = require("@streamr/sdk");
|
|
6
|
+
const command_1 = require("../src/command");
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
(0, command_1.createClientCommand)(async (client, operatorAddress, dataTokenAmount) => {
|
|
9
|
+
await sdk_1._operatorContractUtils.delegate(await client.getSigner(), operatorAddress, (0, ethers_1.parseEther)(dataTokenAmount), sdk_1._operatorContractUtils.getTestTokenContract());
|
|
10
|
+
})
|
|
11
|
+
.description('delegate funds to an operator')
|
|
12
|
+
.arguments('<operatorAddress> <dataTokenAmount>')
|
|
13
|
+
.parseAsync();
|
|
14
|
+
//# sourceMappingURL=streamr-internal-operator-delegate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streamr-internal-operator-delegate.js","sourceRoot":"","sources":["../../bin/streamr-internal-operator-delegate.ts"],"names":[],"mappings":";;;AACA,2BAAwB;AAExB,sCAAoE;AACpE,4CAAoD;AACpD,mCAAmC;AAEnC,IAAA,6BAAmB,EAAC,KAAK,EAAE,MAAqB,EAAE,eAAuB,EAAE,eAAuB,EAAE,EAAE;IAClG,MAAM,4BAAsB,CAAC,QAAQ,CACjC,MAAM,MAAM,CAAC,SAAS,EAAE,EACxB,eAAe,EACf,IAAA,mBAAU,EAAC,eAAe,CAAC,EAC3B,4BAAsB,CAAC,oBAAoB,EAAE,CAChD,CAAA;AACL,CAAC,CAAC;KACG,WAAW,CAAC,+BAA+B,CAAC;KAC5C,SAAS,CAAC,qCAAqC,CAAC;KAChD,UAAU,EAAE,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
require("../src/logLevel");
|
|
5
|
+
const sdk_1 = require("@streamr/sdk");
|
|
6
|
+
const command_1 = require("../src/command");
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
(0, command_1.createClientCommand)(async (client, operatorContractAddress, sponsorshipAddress, dataTokenAmount) => {
|
|
9
|
+
const operatorContract = sdk_1._operatorContractUtils.getOperatorContract(operatorContractAddress).connect(await client.getSigner());
|
|
10
|
+
await sdk_1._operatorContractUtils.stake(operatorContract, sponsorshipAddress, (0, ethers_1.parseEther)(dataTokenAmount));
|
|
11
|
+
})
|
|
12
|
+
.description('stake funds to a sponsorship')
|
|
13
|
+
.arguments('<operatorContractAddress> <sponsorshipAddress> <dataTokenAmount>')
|
|
14
|
+
.parseAsync();
|
|
15
|
+
//# sourceMappingURL=streamr-internal-operator-stake.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streamr-internal-operator-stake.js","sourceRoot":"","sources":["../../bin/streamr-internal-operator-stake.ts"],"names":[],"mappings":";;;AACA,2BAAwB;AAExB,sCAAoE;AACpE,4CAAoD;AACpD,mCAAmC;AAEnC,IAAA,6BAAmB,EAAC,KAAK,EAAE,MAAqB,EAAE,uBAA+B,EAAE,kBAA0B,EAAE,eAAuB,EAAE,EAAE;IACtI,MAAM,gBAAgB,GAAG,4BAAsB,CAAC,mBAAmB,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC,MAAM,MAAM,CAAC,SAAS,EAAE,CAAC,CAAA;IAC9H,MAAM,4BAAsB,CAAC,KAAK,CAC9B,gBAAgB,EAChB,kBAAkB,EAClB,IAAA,mBAAU,EAAC,eAAe,CAAC,CAC9B,CAAA;AACL,CAAC,CAAC;KACG,WAAW,CAAC,8BAA8B,CAAC;KAC3C,SAAS,CAAC,kEAAkE,CAAC;KAC7E,UAAU,EAAE,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
require("../src/logLevel");
|
|
5
|
+
const sdk_1 = require("@streamr/sdk");
|
|
6
|
+
const command_1 = require("../src/command");
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
(0, command_1.createClientCommand)(async (client, operatorAddress, dataTokenAmount) => {
|
|
9
|
+
await sdk_1._operatorContractUtils.undelegate(await client.getSigner(), sdk_1._operatorContractUtils.getOperatorContract(operatorAddress), (0, ethers_1.parseEther)(dataTokenAmount));
|
|
10
|
+
})
|
|
11
|
+
.description('undelegate funds from an operator')
|
|
12
|
+
.arguments('<operatorAddress> <dataTokenAmount>')
|
|
13
|
+
.parseAsync();
|
|
14
|
+
//# sourceMappingURL=streamr-internal-operator-undelegate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streamr-internal-operator-undelegate.js","sourceRoot":"","sources":["../../bin/streamr-internal-operator-undelegate.ts"],"names":[],"mappings":";;;AACA,2BAAwB;AAExB,sCAAoE;AACpE,4CAAoD;AACpD,mCAAmC;AAEnC,IAAA,6BAAmB,EAAC,KAAK,EAAE,MAAqB,EAAE,eAAuB,EAAE,eAAuB,EAAE,EAAE;IAClG,MAAM,4BAAsB,CAAC,UAAU,CACnC,MAAM,MAAM,CAAC,SAAS,EAAE,EACxB,4BAAsB,CAAC,mBAAmB,CAAC,eAAe,CAAC,EAC3D,IAAA,mBAAU,EAAC,eAAe,CAAC,CAC9B,CAAA;AACL,CAAC,CAAC;KACG,WAAW,CAAC,mCAAmC,CAAC;KAChD,SAAS,CAAC,qCAAqC,CAAC;KAChD,UAAU,EAAE,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
require("../src/logLevel");
|
|
5
|
+
const sdk_1 = require("@streamr/sdk");
|
|
6
|
+
const command_1 = require("../src/command");
|
|
7
|
+
(0, command_1.createClientCommand)(async (client, operatorContractAddress, sponsorshipAddress) => {
|
|
8
|
+
const operatorContract = sdk_1._operatorContractUtils.getOperatorContract(operatorContractAddress).connect(await client.getSigner());
|
|
9
|
+
await sdk_1._operatorContractUtils.unstake(operatorContract, sponsorshipAddress);
|
|
10
|
+
})
|
|
11
|
+
.arguments('<operatorContractAddress> <sponsorshipAddress>')
|
|
12
|
+
.description('unstake all funds from a sponsorship')
|
|
13
|
+
.parseAsync();
|
|
14
|
+
//# sourceMappingURL=streamr-internal-operator-unstake.js.map
|