@streamr/cli-tools 102.0.0-beta.3 → 102.1.0
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/bin/streamr-internal-token-mint.ts +21 -0
- package/bin/streamr-internal.ts +1 -0
- package/bin/streamr-storage-node-register.ts +14 -0
- package/bin/streamr-storage-node-show.ts +13 -0
- package/bin/streamr-storage-node-unregister.ts +11 -0
- package/bin/streamr-storage-node.ts +3 -0
- package/dist/bin/streamr-internal-token-mint.d.ts +2 -0
- package/dist/bin/streamr-internal-token-mint.js +22 -0
- package/dist/bin/streamr-internal-token-mint.js.map +1 -0
- package/dist/bin/streamr-internal.js +1 -0
- package/dist/bin/streamr-internal.js.map +1 -1
- package/dist/bin/streamr-storage-node-register.d.ts +2 -0
- package/dist/bin/streamr-storage-node-register.js +14 -0
- package/dist/bin/streamr-storage-node-register.js.map +1 -0
- package/dist/bin/streamr-storage-node-show.d.ts +2 -0
- package/dist/bin/streamr-storage-node-show.js +13 -0
- package/dist/bin/streamr-storage-node-show.js.map +1 -0
- package/dist/bin/streamr-storage-node-unregister.d.ts +2 -0
- package/dist/bin/streamr-storage-node-unregister.js +11 -0
- package/dist/bin/streamr-storage-node-unregister.js.map +1 -0
- package/dist/bin/streamr-storage-node.js +3 -0
- package/dist/bin/streamr-storage-node.js.map +1 -1
- package/dist/package.json +8 -8
- package/package.json +8 -8
- package/test/internal-operator.test.ts +7 -7
- package/test/internal-sponsorship-sponsor.test.ts +5 -5
- package/test/storage-node.test.ts +33 -4
- package/test/stream-create.test.ts +2 -2
- package/test/stream-permission.test.ts +3 -3
- package/test/stream-publish-subscribe.test.ts +5 -5
- package/test/stream-resend.test.ts +4 -4
- package/test/stream-search.test.ts +2 -2
- package/test/stream-show.test.ts +2 -2
- package/test/utils.ts +2 -1
|
@@ -0,0 +1,21 @@
|
|
|
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()
|
package/bin/streamr-internal.ts
CHANGED
|
@@ -14,4 +14,5 @@ program
|
|
|
14
14
|
.command('operator-undelegate', 'undelegate funds from an operator')
|
|
15
15
|
.command('operator-stake', 'stake operator\'s funds to a sponsorship')
|
|
16
16
|
.command('operator-unstake', 'unstake all operator\'s funds from a sponsorship')
|
|
17
|
+
.command('token-mint', 'mint test tokens')
|
|
17
18
|
.parse()
|
|
@@ -0,0 +1,14 @@
|
|
|
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, urls: string) => {
|
|
8
|
+
await client.setStorageNodeMetadata({
|
|
9
|
+
urls: urls.split(',')
|
|
10
|
+
})
|
|
11
|
+
})
|
|
12
|
+
.arguments('<urls>')
|
|
13
|
+
.description('register the current wallet as a storage node with the provided metadata URLs (comma-separated)')
|
|
14
|
+
.parseAsync()
|
|
@@ -0,0 +1,13 @@
|
|
|
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) => {
|
|
8
|
+
const metadata = await client.getStorageNodeMetadata(storageNodeAddress)
|
|
9
|
+
console.info(JSON.stringify(metadata, null, 2))
|
|
10
|
+
})
|
|
11
|
+
.arguments('<storageNodeAddress>')
|
|
12
|
+
.description('show information about a storage node')
|
|
13
|
+
.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
|
+
await client.setStorageNodeMetadata(undefined)
|
|
9
|
+
})
|
|
10
|
+
.description('unregister the current wallet as a storage node')
|
|
11
|
+
.parseAsync()
|
|
@@ -7,6 +7,9 @@ program
|
|
|
7
7
|
.usage('<command> [<args>]')
|
|
8
8
|
.description('storage node subcommands')
|
|
9
9
|
.command('list', 'list storage nodes')
|
|
10
|
+
.command('show', 'show information about a storage node')
|
|
11
|
+
.command('register', 'register a storage node')
|
|
12
|
+
.command('unregister', 'unregister a storage node')
|
|
10
13
|
.command('add-stream', 'add stream')
|
|
11
14
|
.command('remove-stream', 'remove stream')
|
|
12
15
|
.command('list-streams', 'list stream in a storage node')
|
|
@@ -0,0 +1,22 @@
|
|
|
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 ethers_1 = require("ethers");
|
|
7
|
+
const command_1 = require("../src/command");
|
|
8
|
+
(0, command_1.createCommand)().action(async (targetAddress, dataTokenAmount, gasAmount) => {
|
|
9
|
+
const adminWallet = sdk_1._operatorContractUtils.getTestAdminWallet();
|
|
10
|
+
const token = sdk_1._operatorContractUtils.getTestTokenContract().connect(adminWallet);
|
|
11
|
+
await (await token.mint(targetAddress, (0, ethers_1.parseEther)(dataTokenAmount))).wait();
|
|
12
|
+
if (gasAmount !== undefined) {
|
|
13
|
+
await (await adminWallet.sendTransaction({
|
|
14
|
+
to: targetAddress,
|
|
15
|
+
value: (0, ethers_1.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();
|
|
22
|
+
//# sourceMappingURL=streamr-internal-token-mint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streamr-internal-token-mint.js","sourceRoot":"","sources":["../../bin/streamr-internal-token-mint.ts"],"names":[],"mappings":";;;AACA,2BAAwB;AAExB,sCAAqD;AACrD,mCAAmC;AACnC,4CAA8C;AAE9C,IAAA,uBAAa,GAAE,CAAC,MAAM,CAAC,KAAK,EAAE,aAAqB,EAAE,eAAuB,EAAE,SAAkB,EAAE,EAAE;IAChG,MAAM,WAAW,GAAG,4BAAsB,CAAC,kBAAkB,EAAE,CAAA;IAC/D,MAAM,KAAK,GAAG,4BAAsB,CAAC,oBAAoB,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IAChF,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,IAAA,mBAAU,EAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;IAC3E,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,CAAC,MAAM,WAAW,CAAC,eAAe,CAAC;YACrC,EAAE,EAAE,aAAa;YACjB,KAAK,EAAE,IAAA,mBAAU,EAAC,SAAS,CAAC;SAC/B,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;IACd,CAAC;AACL,CAAC,CAAC;KACG,SAAS,CAAC,+CAA+C,CAAC;KAC1D,WAAW,CAAC,4EAA4E,CAAC;KACzF,UAAU,EAAE,CAAA"}
|
|
@@ -18,5 +18,6 @@ commander_1.program
|
|
|
18
18
|
.command('operator-undelegate', 'undelegate funds from an operator')
|
|
19
19
|
.command('operator-stake', 'stake operator\'s funds to a sponsorship')
|
|
20
20
|
.command('operator-unstake', 'unstake all operator\'s funds from a sponsorship')
|
|
21
|
+
.command('token-mint', 'mint test tokens')
|
|
21
22
|
.parse();
|
|
22
23
|
//# sourceMappingURL=streamr-internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamr-internal.js","sourceRoot":"","sources":["../../bin/streamr-internal.ts"],"names":[],"mappings":";;;;;;AACA,yCAAmC;AACnC,mEAAiC;AAEjC,mBAAO;KACF,OAAO,CAAC,sBAAG,CAAC,OAAO,CAAC;KACpB,KAAK,CAAC,oBAAoB,CAAC;KAC3B,WAAW,CAAC,kEAAkE,CAAC;KAC/E,OAAO,CAAC,WAAW,EAAE,mBAAmB,CAAC;KACzC,OAAO,CAAC,oBAAoB,EAAE,4BAA4B,CAAC;KAC3D,OAAO,CAAC,iBAAiB,EAAE,4CAA4C,CAAC;KACxE,OAAO,CAAC,qBAAqB,EAAE,uBAAuB,CAAC;KACvD,OAAO,CAAC,mBAAmB,EAAE,+BAA+B,CAAC;KAC7D,OAAO,CAAC,qBAAqB,EAAE,mCAAmC,CAAC;KACnE,OAAO,CAAC,gBAAgB,EAAE,0CAA0C,CAAC;KACrE,OAAO,CAAC,kBAAkB,EAAE,kDAAkD,CAAC;KAC/E,KAAK,EAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"streamr-internal.js","sourceRoot":"","sources":["../../bin/streamr-internal.ts"],"names":[],"mappings":";;;;;;AACA,yCAAmC;AACnC,mEAAiC;AAEjC,mBAAO;KACF,OAAO,CAAC,sBAAG,CAAC,OAAO,CAAC;KACpB,KAAK,CAAC,oBAAoB,CAAC;KAC3B,WAAW,CAAC,kEAAkE,CAAC;KAC/E,OAAO,CAAC,WAAW,EAAE,mBAAmB,CAAC;KACzC,OAAO,CAAC,oBAAoB,EAAE,4BAA4B,CAAC;KAC3D,OAAO,CAAC,iBAAiB,EAAE,4CAA4C,CAAC;KACxE,OAAO,CAAC,qBAAqB,EAAE,uBAAuB,CAAC;KACvD,OAAO,CAAC,mBAAmB,EAAE,+BAA+B,CAAC;KAC7D,OAAO,CAAC,qBAAqB,EAAE,mCAAmC,CAAC;KACnE,OAAO,CAAC,gBAAgB,EAAE,0CAA0C,CAAC;KACrE,OAAO,CAAC,kBAAkB,EAAE,kDAAkD,CAAC;KAC/E,OAAO,CAAC,YAAY,EAAE,kBAAkB,CAAC;KACzC,KAAK,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 command_1 = require("../src/command");
|
|
6
|
+
(0, command_1.createClientCommand)(async (client, urls) => {
|
|
7
|
+
await client.setStorageNodeMetadata({
|
|
8
|
+
urls: urls.split(',')
|
|
9
|
+
});
|
|
10
|
+
})
|
|
11
|
+
.arguments('<urls>')
|
|
12
|
+
.description('register the current wallet as a storage node with the provided metadata URLs (comma-separated)')
|
|
13
|
+
.parseAsync();
|
|
14
|
+
//# sourceMappingURL=streamr-storage-node-register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streamr-storage-node-register.js","sourceRoot":"","sources":["../../bin/streamr-storage-node-register.ts"],"names":[],"mappings":";;;AACA,2BAAwB;AAGxB,4CAAoD;AAEpD,IAAA,6BAAmB,EAAC,KAAK,EAAE,MAAqB,EAAE,IAAY,EAAE,EAAE;IAC9D,MAAM,MAAM,CAAC,sBAAsB,CAAC;QAChC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;KACxB,CAAC,CAAA;AACN,CAAC,CAAC;KACG,SAAS,CAAC,QAAQ,CAAC;KACnB,WAAW,CAAC,iGAAiG,CAAC;KAC9G,UAAU,EAAE,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
require("../src/logLevel");
|
|
5
|
+
const command_1 = require("../src/command");
|
|
6
|
+
(0, command_1.createClientCommand)(async (client, storageNodeAddress) => {
|
|
7
|
+
const metadata = await client.getStorageNodeMetadata(storageNodeAddress);
|
|
8
|
+
console.info(JSON.stringify(metadata, null, 2));
|
|
9
|
+
})
|
|
10
|
+
.arguments('<storageNodeAddress>')
|
|
11
|
+
.description('show information about a storage node')
|
|
12
|
+
.parseAsync();
|
|
13
|
+
//# sourceMappingURL=streamr-storage-node-show.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streamr-storage-node-show.js","sourceRoot":"","sources":["../../bin/streamr-storage-node-show.ts"],"names":[],"mappings":";;;AACA,2BAAwB;AAGxB,4CAAoD;AAEpD,IAAA,6BAAmB,EAAC,KAAK,EAAE,MAAqB,EAAE,kBAA0B,EAAE,EAAE;IAC5E,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,kBAAkB,CAAC,CAAA;IACxE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;AACnD,CAAC,CAAC;KACG,SAAS,CAAC,sBAAsB,CAAC;KACjC,WAAW,CAAC,uCAAuC,CAAC;KACpD,UAAU,EAAE,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
require("../src/logLevel");
|
|
5
|
+
const command_1 = require("../src/command");
|
|
6
|
+
(0, command_1.createClientCommand)(async (client) => {
|
|
7
|
+
await client.setStorageNodeMetadata(undefined);
|
|
8
|
+
})
|
|
9
|
+
.description('unregister the current wallet as a storage node')
|
|
10
|
+
.parseAsync();
|
|
11
|
+
//# sourceMappingURL=streamr-storage-node-unregister.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streamr-storage-node-unregister.js","sourceRoot":"","sources":["../../bin/streamr-storage-node-unregister.ts"],"names":[],"mappings":";;;AACA,2BAAwB;AAGxB,4CAAoD;AAEpD,IAAA,6BAAmB,EAAC,KAAK,EAAE,MAAqB,EAAE,EAAE;IAChD,MAAM,MAAM,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAA;AAClD,CAAC,CAAC;KACG,WAAW,CAAC,iDAAiD,CAAC;KAC9D,UAAU,EAAE,CAAA"}
|
|
@@ -11,6 +11,9 @@ commander_1.program
|
|
|
11
11
|
.usage('<command> [<args>]')
|
|
12
12
|
.description('storage node subcommands')
|
|
13
13
|
.command('list', 'list storage nodes')
|
|
14
|
+
.command('show', 'show information about a storage node')
|
|
15
|
+
.command('register', 'register a storage node')
|
|
16
|
+
.command('unregister', 'unregister a storage node')
|
|
14
17
|
.command('add-stream', 'add stream')
|
|
15
18
|
.command('remove-stream', 'remove stream')
|
|
16
19
|
.command('list-streams', 'list stream in a storage node')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamr-storage-node.js","sourceRoot":"","sources":["../../bin/streamr-storage-node.ts"],"names":[],"mappings":";;;;;;AACA,yCAAmC;AACnC,mEAAiC;AAEjC,mBAAO;KACF,OAAO,CAAC,sBAAG,CAAC,OAAO,CAAC;KACpB,KAAK,CAAC,oBAAoB,CAAC;KAC3B,WAAW,CAAC,0BAA0B,CAAC;KACvC,OAAO,CAAC,MAAM,EAAE,oBAAoB,CAAC;KACrC,OAAO,CAAC,YAAY,EAAE,YAAY,CAAC;KACnC,OAAO,CAAC,eAAe,EAAE,eAAe,CAAC;KACzC,OAAO,CAAC,cAAc,EAAE,+BAA+B,CAAC;KACxD,KAAK,EAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"streamr-storage-node.js","sourceRoot":"","sources":["../../bin/streamr-storage-node.ts"],"names":[],"mappings":";;;;;;AACA,yCAAmC;AACnC,mEAAiC;AAEjC,mBAAO;KACF,OAAO,CAAC,sBAAG,CAAC,OAAO,CAAC;KACpB,KAAK,CAAC,oBAAoB,CAAC;KAC3B,WAAW,CAAC,0BAA0B,CAAC;KACvC,OAAO,CAAC,MAAM,EAAE,oBAAoB,CAAC;KACrC,OAAO,CAAC,MAAM,EAAE,uCAAuC,CAAC;KACxD,OAAO,CAAC,UAAU,EAAE,yBAAyB,CAAC;KAC9C,OAAO,CAAC,YAAY,EAAE,2BAA2B,CAAC;KAClD,OAAO,CAAC,YAAY,EAAE,YAAY,CAAC;KACnC,OAAO,CAAC,eAAe,EAAE,eAAe,CAAC;KACzC,OAAO,CAAC,cAAc,EAAE,+BAA+B,CAAC;KACxD,KAAK,EAAE,CAAA"}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamr/cli-tools",
|
|
3
|
-
"version": "102.
|
|
3
|
+
"version": "102.1.0",
|
|
4
4
|
"description": "Command line tools for Streamr",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,21 +26,21 @@
|
|
|
26
26
|
"author": "Streamr Network AG <contact@streamr.com>",
|
|
27
27
|
"license": "AGPL-3.0",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@streamr/dht": "102.
|
|
30
|
-
"@streamr/sdk": "102.
|
|
31
|
-
"@streamr/trackerless-network": "102.
|
|
32
|
-
"@streamr/utils": "102.
|
|
29
|
+
"@streamr/dht": "102.1.0",
|
|
30
|
+
"@streamr/sdk": "102.1.0",
|
|
31
|
+
"@streamr/trackerless-network": "102.1.0",
|
|
32
|
+
"@streamr/utils": "102.1.0",
|
|
33
33
|
"commander": "^13.1.0",
|
|
34
34
|
"easy-table": "^1.1.1",
|
|
35
35
|
"ethers": "^6.13.0",
|
|
36
36
|
"event-stream": "^4.0.1",
|
|
37
37
|
"lodash": "^4.17.21",
|
|
38
|
-
"semver": "^7.
|
|
38
|
+
"semver": "^7.7.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@streamr/test-utils": "102.
|
|
41
|
+
"@streamr/test-utils": "102.1.0",
|
|
42
42
|
"@types/event-stream": "^4.0.5",
|
|
43
|
-
"@types/lodash": "^4.17.
|
|
43
|
+
"@types/lodash": "^4.17.15",
|
|
44
44
|
"@types/merge2": "^1.4.4",
|
|
45
45
|
"@types/semver": "^7.5.8",
|
|
46
46
|
"merge2": "^1.4.1"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamr/cli-tools",
|
|
3
|
-
"version": "102.
|
|
3
|
+
"version": "102.1.0",
|
|
4
4
|
"description": "Command line tools for Streamr",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,21 +26,21 @@
|
|
|
26
26
|
"author": "Streamr Network AG <contact@streamr.com>",
|
|
27
27
|
"license": "AGPL-3.0",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@streamr/dht": "102.
|
|
30
|
-
"@streamr/sdk": "102.
|
|
31
|
-
"@streamr/trackerless-network": "102.
|
|
32
|
-
"@streamr/utils": "102.
|
|
29
|
+
"@streamr/dht": "102.1.0",
|
|
30
|
+
"@streamr/sdk": "102.1.0",
|
|
31
|
+
"@streamr/trackerless-network": "102.1.0",
|
|
32
|
+
"@streamr/utils": "102.1.0",
|
|
33
33
|
"commander": "^13.1.0",
|
|
34
34
|
"easy-table": "^1.1.1",
|
|
35
35
|
"ethers": "^6.13.0",
|
|
36
36
|
"event-stream": "^4.0.1",
|
|
37
37
|
"lodash": "^4.17.21",
|
|
38
|
-
"semver": "^7.
|
|
38
|
+
"semver": "^7.7.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@streamr/test-utils": "102.
|
|
41
|
+
"@streamr/test-utils": "102.1.0",
|
|
42
42
|
"@types/event-stream": "^4.0.5",
|
|
43
|
-
"@types/lodash": "^4.17.
|
|
43
|
+
"@types/lodash": "^4.17.15",
|
|
44
44
|
"@types/merge2": "^1.4.4",
|
|
45
45
|
"@types/semver": "^7.5.8",
|
|
46
46
|
"merge2": "^1.4.1"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { _operatorContractUtils } from '@streamr/sdk'
|
|
2
|
-
import {
|
|
3
|
-
import { createTestClient, runCommand } from './utils'
|
|
4
|
-
import { parseEther, Wallet } from 'ethers'
|
|
2
|
+
import { createTestPrivateKey, createTestWallet } from '@streamr/test-utils'
|
|
5
3
|
import { wait } from '@streamr/utils'
|
|
4
|
+
import { parseEther } from 'ethers'
|
|
5
|
+
import { createTestClient, runCommand } from './utils'
|
|
6
6
|
|
|
7
7
|
const DELEGATION_AMOUNT = '20000'
|
|
8
8
|
const STAKE_AMOUNT = '10000'
|
|
@@ -12,19 +12,19 @@ const MINIMUM_DELEGATION_SECONDS = 1 // the config value defined in StreamrEnvD
|
|
|
12
12
|
describe('operator', () => {
|
|
13
13
|
|
|
14
14
|
it('happy path', async () => {
|
|
15
|
-
const client = createTestClient(await
|
|
15
|
+
const client = createTestClient(await createTestPrivateKey({ gas: true }))
|
|
16
16
|
const stream = await client.createStream('/test')
|
|
17
17
|
const sponsorshipContract = await _operatorContractUtils.deploySponsorshipContract({
|
|
18
18
|
streamId: stream.id,
|
|
19
|
-
deployer:
|
|
19
|
+
deployer: await createTestWallet({ gas: true })
|
|
20
20
|
})
|
|
21
21
|
const sponsorshipAddress: string = await sponsorshipContract.getAddress()
|
|
22
|
-
const operator = await
|
|
22
|
+
const operator = await createTestWallet({ gas: true, tokens: true })
|
|
23
23
|
const operatorContract = await _operatorContractUtils.deployOperatorContract({
|
|
24
24
|
deployer: operator
|
|
25
25
|
})
|
|
26
26
|
await _operatorContractUtils.delegate(operator, await operatorContract.getAddress(), parseEther(SELF_DELEGATION_AMOUNT))
|
|
27
|
-
const delegator = await
|
|
27
|
+
const delegator = await createTestWallet({ gas: true, tokens: true })
|
|
28
28
|
const operatorAddress: string = await operatorContract.getAddress()
|
|
29
29
|
|
|
30
30
|
// delegate
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { _operatorContractUtils } from '@streamr/sdk'
|
|
2
|
-
import {
|
|
2
|
+
import { createTestPrivateKey, createTestWallet } from '@streamr/test-utils'
|
|
3
|
+
import { parseEther } from 'ethers'
|
|
3
4
|
import { createTestClient, runCommand } from './utils'
|
|
4
|
-
import { parseEther, Wallet } from 'ethers'
|
|
5
5
|
|
|
6
6
|
const SPONSOR_AMOUNT = '12345'
|
|
7
7
|
|
|
8
8
|
describe('sponsorship-sponsor', () => {
|
|
9
9
|
|
|
10
10
|
it('happy path', async () => {
|
|
11
|
-
const client = createTestClient(await
|
|
11
|
+
const client = createTestClient(await createTestPrivateKey({ gas: true }))
|
|
12
12
|
const stream = await client.createStream('/test')
|
|
13
13
|
const sponsorshipContract = await _operatorContractUtils.deploySponsorshipContract({
|
|
14
14
|
streamId: stream.id,
|
|
15
|
-
deployer:
|
|
15
|
+
deployer: await createTestWallet({ gas: true })
|
|
16
16
|
})
|
|
17
17
|
|
|
18
|
-
const sponsorer = await
|
|
18
|
+
const sponsorer = await createTestWallet({ gas: true, tokens: true })
|
|
19
19
|
const sponsorshipAddress: string = await sponsorshipContract.getAddress()
|
|
20
20
|
await runCommand(`internal sponsorship-sponsor ${sponsorshipAddress} ${SPONSOR_AMOUNT}`, {
|
|
21
21
|
privateKey: sponsorer.privateKey
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { fetchPrivateKeyWithGas } from '@streamr/test-utils'
|
|
2
|
-
import 'jest-extended'
|
|
3
1
|
import { StreamID } from '@streamr/sdk'
|
|
4
|
-
import {
|
|
2
|
+
import { createTestPrivateKey, createTestWallet } from '@streamr/test-utils'
|
|
5
3
|
import { until } from '@streamr/utils'
|
|
4
|
+
import 'jest-extended'
|
|
5
|
+
import { DOCKER_DEV_STORAGE_NODE, createTestClient, runCommand } from './utils'
|
|
6
6
|
|
|
7
7
|
const isStored = async (streamId: StreamID): Promise<boolean> => {
|
|
8
8
|
const output = await runCommand(`storage-node list-streams ${DOCKER_DEV_STORAGE_NODE}`)
|
|
@@ -12,7 +12,7 @@ const isStored = async (streamId: StreamID): Promise<boolean> => {
|
|
|
12
12
|
describe('storage node', () => {
|
|
13
13
|
|
|
14
14
|
it('add and remove stream', async () => {
|
|
15
|
-
const privateKey = await
|
|
15
|
+
const privateKey = await createTestPrivateKey({ gas: true })
|
|
16
16
|
const client = createTestClient(privateKey)
|
|
17
17
|
const stream = await client.createStream(`/${Date.now()}`)
|
|
18
18
|
await client.destroy()
|
|
@@ -30,4 +30,33 @@ describe('storage node', () => {
|
|
|
30
30
|
const outputLines = await runCommand('storage-node list')
|
|
31
31
|
expect(outputLines.join()).toMatch(DOCKER_DEV_STORAGE_NODE.toLowerCase())
|
|
32
32
|
})
|
|
33
|
+
|
|
34
|
+
it('register storage node, show info, and finally unregister', async () => {
|
|
35
|
+
const { privateKey, address } = await createTestWallet({ gas: true })
|
|
36
|
+
|
|
37
|
+
const urls = 'http://foobar.com,http://foobar.org'
|
|
38
|
+
await runCommand(`storage-node register ${urls}`, {
|
|
39
|
+
privateKey
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
// account for The Graph delay
|
|
43
|
+
await until(async () => {
|
|
44
|
+
const outputLines = await runCommand('storage-node list')
|
|
45
|
+
return outputLines.join().includes(address.toLowerCase())
|
|
46
|
+
}, 10 * 1000, 500)
|
|
47
|
+
|
|
48
|
+
const outputLines = await runCommand(`storage-node show ${address}`)
|
|
49
|
+
expect(outputLines.join()).toContain('http://foobar.com')
|
|
50
|
+
expect(outputLines.join()).toContain('http://foobar.org')
|
|
51
|
+
|
|
52
|
+
await runCommand('storage-node unregister', {
|
|
53
|
+
privateKey
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
// account for The Graph delay
|
|
57
|
+
await until(async () => {
|
|
58
|
+
const outputLines = await runCommand('storage-node list')
|
|
59
|
+
return !outputLines.join().includes(address.toLowerCase())
|
|
60
|
+
}, 10 * 1000, 500)
|
|
61
|
+
}, 80 * 1000)
|
|
33
62
|
})
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { createTestPrivateKey } from '@streamr/test-utils'
|
|
1
2
|
import { Wallet } from 'ethers'
|
|
2
|
-
import { fetchPrivateKeyWithGas } from '@streamr/test-utils'
|
|
3
3
|
import { createTestClient, runCommand } from './utils'
|
|
4
4
|
|
|
5
5
|
describe('create stream', () => {
|
|
6
6
|
|
|
7
7
|
it('happy path', async () => {
|
|
8
|
-
const privateKey = await
|
|
8
|
+
const privateKey = await createTestPrivateKey({ gas: true })
|
|
9
9
|
const address = new Wallet(privateKey).address.toLowerCase()
|
|
10
10
|
const path = `/${Date.now()}`
|
|
11
11
|
const streamId = `${address}${path}`
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { fetchPrivateKeyWithGas, randomUserId } from '@streamr/test-utils'
|
|
2
|
-
import 'jest-extended'
|
|
3
1
|
import { StreamPermission } from '@streamr/sdk'
|
|
2
|
+
import { createTestPrivateKey, randomUserId } from '@streamr/test-utils'
|
|
3
|
+
import 'jest-extended'
|
|
4
4
|
import { createTestClient, runCommand } from './utils'
|
|
5
5
|
|
|
6
6
|
describe('permission', () => {
|
|
7
7
|
|
|
8
8
|
it('grant and revoke', async () => {
|
|
9
|
-
const privateKey = await
|
|
9
|
+
const privateKey = await createTestPrivateKey({ gas: true })
|
|
10
10
|
const client = createTestClient(privateKey)
|
|
11
11
|
const stream = await client.createStream(`/${Date.now()}`)
|
|
12
12
|
const otherUser = randomUserId()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Wallet } from 'ethers'
|
|
2
|
-
import { fetchPrivateKeyWithGas } from '@streamr/test-utils'
|
|
3
|
-
import { collect } from '@streamr/utils'
|
|
4
1
|
import { StreamPermission } from '@streamr/sdk'
|
|
2
|
+
import { createTestPrivateKey } from '@streamr/test-utils'
|
|
3
|
+
import { collect } from '@streamr/utils'
|
|
4
|
+
import { Wallet } from 'ethers'
|
|
5
5
|
import { createTestClient, runCommand, startCommand } from './utils'
|
|
6
6
|
|
|
7
7
|
const TIMEOUT = 30 * 1000
|
|
@@ -13,8 +13,8 @@ describe('publish and subscribe', () => {
|
|
|
13
13
|
let streamId: string
|
|
14
14
|
|
|
15
15
|
beforeAll(async () => {
|
|
16
|
-
publisherPrivateKey = await
|
|
17
|
-
subscriberPrivateKey = await
|
|
16
|
+
publisherPrivateKey = await createTestPrivateKey({ gas: true })
|
|
17
|
+
subscriberPrivateKey = await createTestPrivateKey({ gas: true })
|
|
18
18
|
const client = createTestClient(publisherPrivateKey)
|
|
19
19
|
const stream = await client.createStream(`/${Date.now()}`)
|
|
20
20
|
await stream.grantPermissions({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { fetchPrivateKeyWithGas } from '@streamr/test-utils'
|
|
2
|
-
import range from 'lodash/range'
|
|
3
1
|
import { Message, Stream } from '@streamr/sdk'
|
|
4
|
-
import {
|
|
2
|
+
import { createTestPrivateKey } from '@streamr/test-utils'
|
|
5
3
|
import { wait } from '@streamr/utils'
|
|
4
|
+
import range from 'lodash/range'
|
|
5
|
+
import { DOCKER_DEV_STORAGE_NODE, createTestClient, runCommand } from './utils'
|
|
6
6
|
|
|
7
7
|
const parseJSONs = (lines: string[]): any[] => {
|
|
8
8
|
return lines.map((line) => JSON.parse(line))
|
|
@@ -15,7 +15,7 @@ describe('resend stream', () => {
|
|
|
15
15
|
const messages: Message[] = []
|
|
16
16
|
|
|
17
17
|
beforeAll(async () => {
|
|
18
|
-
privateKey = await
|
|
18
|
+
privateKey = await createTestPrivateKey({ gas: true })
|
|
19
19
|
const client = createTestClient(privateKey)
|
|
20
20
|
stream = await client.createStream(`/${Date.now()}`)
|
|
21
21
|
await stream.addToStorageNode(DOCKER_DEV_STORAGE_NODE, { wait: true })
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createTestPrivateKey } from '@streamr/test-utils'
|
|
2
2
|
import { randomString } from '@streamr/utils'
|
|
3
3
|
import { createTestClient, runCommand, waitForTheGraphToHaveIndexed } from './utils'
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ describe('search streams', () => {
|
|
|
6
6
|
|
|
7
7
|
it('happy path', async () => {
|
|
8
8
|
const testId = randomString(10)
|
|
9
|
-
const client = createTestClient(await
|
|
9
|
+
const client = createTestClient(await createTestPrivateKey({ gas: true }))
|
|
10
10
|
const stream1 = await client.createStream(`/${testId}-1`)
|
|
11
11
|
const stream2 = await client.createStream(`/${testId}-2`)
|
|
12
12
|
await Promise.all([
|
package/test/stream-show.test.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { createTestPrivateKey } from '@streamr/test-utils'
|
|
1
2
|
import { Wallet } from 'ethers'
|
|
2
|
-
import { fetchPrivateKeyWithGas } from '@streamr/test-utils'
|
|
3
3
|
import { createTestClient, runCommand, waitForTheGraphToHaveIndexed } from './utils'
|
|
4
4
|
|
|
5
5
|
describe('show stream', () => {
|
|
6
6
|
|
|
7
7
|
it('happy path', async () => {
|
|
8
|
-
const creatorPrivateKey = await
|
|
8
|
+
const creatorPrivateKey = await createTestPrivateKey({ gas: true })
|
|
9
9
|
const client = createTestClient(creatorPrivateKey)
|
|
10
10
|
const stream = await client.createStream(`/${Date.now()}`)
|
|
11
11
|
await waitForTheGraphToHaveIndexed(stream, client)
|
package/test/utils.ts
CHANGED
|
@@ -18,7 +18,8 @@ export const runCommand = async (commandLine: string, opts?: StartCommandOptions
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export async function* startCommand(commandLine: string, opts?: StartCommandOptions): AsyncGenerator<string> {
|
|
21
|
-
|
|
21
|
+
// TODO: --no-deprecation needed to get around deprecation warning for "punycode" in Node.js 22, remove when warning has gone away (NET-1409)
|
|
22
|
+
const args: string[] = ['--no-deprecation', 'dist/bin/streamr.js']
|
|
22
23
|
args.push(...commandLine.split(' '))
|
|
23
24
|
if (opts?.privateKey !== undefined) {
|
|
24
25
|
args.push('--private-key', opts.privateKey)
|