dash 3.21.2 → 3.21.7
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/.mocharc.yml +1 -0
- package/build/src/SDK/Client/Platform/createAssetLockTransaction.js +1 -1
- package/build/src/SDK/Client/Platform/methods/names/register.js +1 -1
- package/build/src/SDK/Client/Platform/methods/names/register.js.map +1 -1
- package/build/src/test/mocks/createAndAttachTransportMocksToClient.js +5 -2
- package/build/src/test/mocks/createAndAttachTransportMocksToClient.js.map +1 -1
- package/build/src/utils/createFakeIntantLock.js +2 -0
- package/build/src/utils/createFakeIntantLock.js.map +1 -1
- package/dist/src/SDK/Client/Platform/createAssetLockTransaction.d.ts +1 -1
- package/dist/src/SDK/SDK.d.ts +167 -4
- package/docs/README.md +6 -6
- package/docs/_sidebar.md +8 -8
- package/docs/examples/pay-to-another-address.md +1 -1
- package/docs/examples/publishing-a-new-contract.md +1 -1
- package/docs/examples/receive-money-and-check-balance.md +2 -2
- package/docs/getting-started/core-concepts.md +2 -2
- package/docs/getting-started/dash-platform-applications.md +1 -1
- package/docs/getting-started/quickstart.md +1 -1
- package/docs/platform/contracts/about-contracts.md +1 -1
- package/docs/platform/contracts/broadcast.md +2 -2
- package/docs/platform/contracts/create.md +2 -2
- package/docs/platform/documents/broadcast.md +4 -4
- package/docs/platform/documents/create.md +2 -2
- package/docs/platform/identities/about-identity.md +1 -1
- package/docs/platform/identities/register.md +1 -1
- package/docs/platform/identities/topUp.md +1 -1
- package/docs/platform/names/register.md +1 -1
- package/karma.conf.js +18 -8
- package/package.json +47 -27
- package/src/SDK/Client/Platform/createAssetLockTransaction.ts +1 -1
- package/src/SDK/Client/Platform/methods/names/register.ts +1 -1
- package/src/test/mocks/createAndAttachTransportMocksToClient.ts +25 -21
- package/src/utils/createFakeIntantLock.ts +2 -0
- package/webpack.base.config.js +26 -9
- package/webpack.config.js +4 -13
- package/.editorconfig +0 -2
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -27
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -32
- package/.github/workflows/.env +0 -5
- package/.github/workflows/test_and_release.yml +0 -170
- package/dist/dash.min.js +0 -56
package/package.json
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dash",
|
|
3
|
-
"version": "3.21.
|
|
3
|
+
"version": "3.21.7",
|
|
4
4
|
"description": "Dash library for JavaScript/TypeScript ecosystem (Wallet, DAPI, Primitives, BLS, ...)",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"unpkg": "dist/dash.min.js",
|
|
7
7
|
"types": "dist/src/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"start:dev": "nodemon --exec '
|
|
10
|
-
"build": "
|
|
11
|
-
"build:web": "
|
|
9
|
+
"start:dev": "nodemon --exec 'yarn run build && yarn run test:unit'",
|
|
10
|
+
"build": "yarn run build:ts",
|
|
11
|
+
"build:web": "yarn run build:ts && webpack --stats-error-details",
|
|
12
12
|
"build:ts": "tsc",
|
|
13
|
-
"
|
|
13
|
+
"lint": "",
|
|
14
|
+
"test": "yarn run test:unit && yarn run test:functional && yarn run test:browsers",
|
|
14
15
|
"test:browsers": "karma start ./karma.conf.js --single-run",
|
|
15
|
-
"test:unit": "
|
|
16
|
-
"test:functional": "
|
|
17
|
-
"prepublishOnly": "
|
|
18
|
-
"prepare": "
|
|
16
|
+
"test:unit": "TS_NODE_COMPILER_OPTIONS={\"target\":\"es6\"} ts-mocha \"src/**/*.spec.ts\"",
|
|
17
|
+
"test:functional": "yarn run build && mocha --recursive tests/functional/**/*.js",
|
|
18
|
+
"prepublishOnly": "yarn run build:web",
|
|
19
|
+
"prepare": "yarn run build"
|
|
20
|
+
},
|
|
21
|
+
"ultra": {
|
|
22
|
+
"concurrent": [
|
|
23
|
+
"test"
|
|
24
|
+
]
|
|
19
25
|
},
|
|
20
26
|
"repository": {
|
|
21
27
|
"type": "git",
|
|
@@ -28,13 +34,13 @@
|
|
|
28
34
|
},
|
|
29
35
|
"homepage": "https://github.com/dashevo/DashJS#readme",
|
|
30
36
|
"dependencies": {
|
|
31
|
-
"@dashevo/dapi-client": "~0.21.
|
|
32
|
-
"@dashevo/dashcore-lib": "~0.19.
|
|
33
|
-
"@dashevo/dpp": "~0.21.
|
|
34
|
-
"@dashevo/grpc-common": "~0.
|
|
35
|
-
"@dashevo/wallet-lib": "~7.21.
|
|
37
|
+
"@dashevo/dapi-client": "~0.21.7",
|
|
38
|
+
"@dashevo/dashcore-lib": "~0.19.29",
|
|
39
|
+
"@dashevo/dpp": "~0.21.7",
|
|
40
|
+
"@dashevo/grpc-common": "~0.21.7",
|
|
41
|
+
"@dashevo/wallet-lib": "~7.21.7",
|
|
36
42
|
"bs58": "^4.0.1",
|
|
37
|
-
"node-inspect-extracted": "1.0.
|
|
43
|
+
"node-inspect-extracted": "^1.0.8"
|
|
38
44
|
},
|
|
39
45
|
"devDependencies": {
|
|
40
46
|
"@types/chai": "^4.2.12",
|
|
@@ -44,28 +50,42 @@
|
|
|
44
50
|
"@types/node": "^14.6.0",
|
|
45
51
|
"@types/sinon": "^9.0.4",
|
|
46
52
|
"@types/sinon-chai": "^3.2.4",
|
|
47
|
-
"
|
|
53
|
+
"assert": "^2.0.0",
|
|
54
|
+
"browserify-zlib": "^0.2.0",
|
|
55
|
+
"buffer": "^6.0.3",
|
|
56
|
+
"chai": "^4.3.4",
|
|
48
57
|
"chance": "^1.1.6",
|
|
58
|
+
"crypto-browserify": "^3.12.0",
|
|
49
59
|
"dirty-chai": "^2.0.1",
|
|
50
60
|
"dotenv-safe": "^8.2.0",
|
|
51
|
-
"
|
|
61
|
+
"events": "^3.3.0",
|
|
62
|
+
"https-browserify": "^1.0.0",
|
|
63
|
+
"karma": "^6.3.4",
|
|
52
64
|
"karma-chai": "^0.1.0",
|
|
53
65
|
"karma-chrome-launcher": "^3.1.0",
|
|
54
|
-
"karma-firefox-launcher": "^1.
|
|
66
|
+
"karma-firefox-launcher": "^2.1.1",
|
|
55
67
|
"karma-mocha": "^2.0.1",
|
|
56
68
|
"karma-mocha-reporter": "^2.2.5",
|
|
57
|
-
"karma-webpack": "^
|
|
58
|
-
"mocha": "^
|
|
69
|
+
"karma-webpack": "^5.0.0",
|
|
70
|
+
"mocha": "^9.1.2",
|
|
59
71
|
"nodemon": "^2.0.4",
|
|
72
|
+
"os-browserify": "^0.3.0",
|
|
73
|
+
"path-browserify": "^1.0.1",
|
|
74
|
+
"process": "^0.11.10",
|
|
60
75
|
"rimraf": "^3.0.2",
|
|
61
|
-
"sinon": "^
|
|
62
|
-
"sinon-chai": "^3.
|
|
76
|
+
"sinon": "^11.1.2",
|
|
77
|
+
"sinon-chai": "^3.7.0",
|
|
78
|
+
"stream-browserify": "^3.0.0",
|
|
79
|
+
"stream-http": "^3.2.0",
|
|
80
|
+
"string_decoder": "^1.3.0",
|
|
63
81
|
"ts-loader": "^8.0.2",
|
|
82
|
+
"ts-mocha": "^8.0.0",
|
|
64
83
|
"ts-mock-imports": "^1.3.0",
|
|
65
|
-
"ts-node": "^
|
|
84
|
+
"ts-node": "^10.4.0",
|
|
66
85
|
"typescript": "^3.9.5",
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"webpack
|
|
86
|
+
"url": "^0.11.0",
|
|
87
|
+
"util": "^0.12.4",
|
|
88
|
+
"webpack": "^5.59.1",
|
|
89
|
+
"webpack-cli": "^4.9.1"
|
|
70
90
|
}
|
|
71
|
-
}
|
|
91
|
+
}
|
|
@@ -9,7 +9,7 @@ const ASSET_LOCK_OUTPUT_INDEX = 0;
|
|
|
9
9
|
* Creates a funding transaction for the platform identity and returns one-time key to sign the state transition
|
|
10
10
|
* @param {Platform} platform
|
|
11
11
|
* @param {number} fundingAmount - amount of dash to fund the identity's credits
|
|
12
|
-
* @return {{transaction: Transaction, privateKey: PrivateKey}} - transaction and one time private key
|
|
12
|
+
* @return {Promise<{transaction: Transaction, privateKey: PrivateKey}>} - transaction and one time private key
|
|
13
13
|
* that can be used to sign registration/top-up state transition
|
|
14
14
|
*/
|
|
15
15
|
export default async function createAssetLockTransaction(platform : Platform, fundingAmount): Promise<{ transaction: Transaction, privateKey: PrivateKey, outputIndex: number }> {
|
|
@@ -17,26 +17,30 @@ const TxStreamDataResponseMock = require('@dashevo/wallet-lib/src/test/mocks/TxS
|
|
|
17
17
|
const TransportMock = require('@dashevo/wallet-lib/src/test/mocks/TransportMock');
|
|
18
18
|
|
|
19
19
|
function makeTxStreamEmitISLocksForTransactions(transportMock, txStreamMock) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
)
|
|
39
|
-
|
|
20
|
+
transportMock.sendTransaction.callsFake((txString) => {
|
|
21
|
+
const transaction = new Transaction(txString);
|
|
22
|
+
const isLock = createFakeInstantLock(transaction.hash);
|
|
23
|
+
|
|
24
|
+
setImmediate(() => {
|
|
25
|
+
// Emit IS lock for the transaction
|
|
26
|
+
txStreamMock.emit(
|
|
27
|
+
TxStreamMock.EVENTS.data,
|
|
28
|
+
new TxStreamDataResponseMock(
|
|
29
|
+
{ instantSendLockMessages: [isLock.toBuffer()] }
|
|
30
|
+
)
|
|
31
|
+
);
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
// Emit the same transaction back to the client so it will know about the change transaction
|
|
35
|
+
txStreamMock.emit(
|
|
36
|
+
TxStreamMock.EVENTS.data,
|
|
37
|
+
new TxStreamDataResponseMock(
|
|
38
|
+
{ rawTransactions: [transaction.toBuffer()] }
|
|
39
|
+
)
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
return transaction.hash;
|
|
43
|
+
});
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
/**
|
|
@@ -88,4 +92,4 @@ export async function createAndAttachTransportMocksToClient(client, sinon) {
|
|
|
88
92
|
makeGetIdentityRespondWithIdentity(client, dapiClientMock);
|
|
89
93
|
|
|
90
94
|
return { txStreamMock, transportMock, dapiClientMock };
|
|
91
|
-
}
|
|
95
|
+
}
|
|
@@ -2,8 +2,10 @@ import { InstantLock } from "@dashevo/dashcore-lib";
|
|
|
2
2
|
|
|
3
3
|
export function createFakeInstantLock(transactionHash: string): InstantLock {
|
|
4
4
|
return new InstantLock({
|
|
5
|
+
version: 1,
|
|
5
6
|
txid: transactionHash,
|
|
6
7
|
signature: Buffer.alloc(96).toString('hex'),
|
|
8
|
+
cyclehash: '0dc8d0df62b076a7757ab5ca07dde0f1e2bfaf83f94299fd9a77577e6cc7022e',
|
|
7
9
|
inputs: [
|
|
8
10
|
{
|
|
9
11
|
outpointHash: '6e200d059fb567ba19e92f5c2dcd3dde522fd4e0a50af223752db16158dabb1d',
|
package/webpack.base.config.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
+
const webpack = require('webpack');
|
|
3
|
+
|
|
2
4
|
const baseConfig = {
|
|
3
5
|
entry: './src/index.ts',
|
|
4
6
|
module: {
|
|
@@ -10,18 +12,33 @@ const baseConfig = {
|
|
|
10
12
|
},
|
|
11
13
|
],
|
|
12
14
|
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
resolve: {
|
|
16
|
+
extensions: ['.ts', '.js', '.json'],
|
|
17
|
+
fallback: {
|
|
18
|
+
fs: false,
|
|
19
|
+
util: require.resolve('util/'),
|
|
20
|
+
crypto: require.resolve('crypto-browserify'),
|
|
21
|
+
http: require.resolve('stream-http'),
|
|
22
|
+
https: require.resolve('https-browserify'),
|
|
23
|
+
buffer: require.resolve('buffer/'),
|
|
24
|
+
url: require.resolve('url/'),
|
|
25
|
+
assert: require.resolve('assert/'),
|
|
26
|
+
stream: require.resolve('stream-browserify'),
|
|
27
|
+
path: require.resolve('path-browserify'),
|
|
28
|
+
os: require.resolve('os-browserify/browser'),
|
|
29
|
+
zlib: require.resolve('browserify-zlib'),
|
|
30
|
+
events: require.resolve('events/'),
|
|
31
|
+
string_decoder: require.resolve('string_decoder/'),
|
|
32
|
+
},
|
|
16
33
|
},
|
|
34
|
+
plugins: [
|
|
35
|
+
new webpack.ProvidePlugin({
|
|
36
|
+
Buffer: [require.resolve('buffer/'), 'Buffer'],
|
|
37
|
+
process: require.resolve('process/browser'),
|
|
38
|
+
}),
|
|
39
|
+
],
|
|
17
40
|
output: {
|
|
18
41
|
path: path.resolve(__dirname, 'dist'),
|
|
19
42
|
},
|
|
20
|
-
resolve: {
|
|
21
|
-
extensions: ['.ts', '.js', '.json'],
|
|
22
|
-
alias: {
|
|
23
|
-
'bn.js': path.resolve(__dirname, 'node_modules', 'bn.js')
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
43
|
}
|
|
27
44
|
module.exports = baseConfig;
|
package/webpack.config.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
+
const webpackBaseConfig = require("./webpack.base.config");
|
|
2
3
|
|
|
3
4
|
const webConfig = {
|
|
5
|
+
...webpackBaseConfig,
|
|
4
6
|
entry: './build/src/index.js',
|
|
5
|
-
mode:
|
|
6
|
-
target: 'web',
|
|
7
|
-
node: {
|
|
8
|
-
// Prevent embedded winston to throw error with FS not existing.
|
|
9
|
-
fs: 'empty',
|
|
10
|
-
},
|
|
7
|
+
mode: 'production',
|
|
11
8
|
output: {
|
|
12
9
|
path: path.resolve(__dirname, 'dist'),
|
|
13
10
|
libraryTarget: 'umd',
|
|
@@ -16,12 +13,6 @@ const webConfig = {
|
|
|
16
13
|
// fixes ReferenceError: window is not defined
|
|
17
14
|
globalObject: "(typeof self !== 'undefined' ? self : this)"
|
|
18
15
|
},
|
|
19
|
-
resolve: {
|
|
20
|
-
extensions: ['.js', '.json'],
|
|
21
|
-
alias: {
|
|
22
|
-
'bn.js': path.resolve(__dirname, 'node_modules', 'bn.js')
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
16
|
}
|
|
26
17
|
|
|
27
|
-
module.exports = webConfig;
|
|
18
|
+
module.exports = [webConfig];
|
package/.editorconfig
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Bug report
|
|
3
|
-
about: Create a report to help us improve
|
|
4
|
-
title: ''
|
|
5
|
-
labels: 'bug'
|
|
6
|
-
assignees: ''
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
<!--- Provide a general summary of the issue in the Title above -->
|
|
11
|
-
|
|
12
|
-
## Expected Behavior
|
|
13
|
-
<!--- Tell us what should happen -->
|
|
14
|
-
|
|
15
|
-
## Current Behavior
|
|
16
|
-
<!--- Tell us what happens instead of the expected behavior -->
|
|
17
|
-
|
|
18
|
-
## Possible Solution
|
|
19
|
-
<!--- Not obligatory, but suggest a fix/reason for the bug -->
|
|
20
|
-
|
|
21
|
-
## Steps to Reproduce (for bugs)
|
|
22
|
-
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
|
|
23
|
-
<!--- reproduce this bug. Include code to reproduce, if relevant -->
|
|
24
|
-
1.
|
|
25
|
-
2.
|
|
26
|
-
3.
|
|
27
|
-
4.
|
|
28
|
-
|
|
29
|
-
## Context
|
|
30
|
-
<!--- How has this issue affected you? What are you trying to accomplish? -->
|
|
31
|
-
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
|
|
32
|
-
|
|
33
|
-
## Your Environment
|
|
34
|
-
<!--- Include as many relevant details about the environment you experienced the bug in -->
|
|
35
|
-
* Version used:
|
|
36
|
-
* Environment name and version (e.g. Chrome 39, node.js 5.4):
|
|
37
|
-
* Operating System and version (desktop, server, or mobile):
|
|
38
|
-
* Link to your project:
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Feature request
|
|
3
|
-
about: Suggest an idea for this project
|
|
4
|
-
title: ''
|
|
5
|
-
labels: 'enhancement'
|
|
6
|
-
assignees: ''
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
<!--- Provide a general summary of the feature request in the Title above -->
|
|
11
|
-
|
|
12
|
-
## Expected Behavior
|
|
13
|
-
<!--- A clear and concise description of what you want to happen -->
|
|
14
|
-
|
|
15
|
-
## Current Behavior
|
|
16
|
-
<!--- Explain the difference from current behavior -->
|
|
17
|
-
|
|
18
|
-
## Possible Solution
|
|
19
|
-
<!--- Suggest ideas of how to implement the addition or change -->
|
|
20
|
-
|
|
21
|
-
## Alternatives Considered
|
|
22
|
-
<!--- A clear and concise description of any alternative solutions or features you've considered -->
|
|
23
|
-
|
|
24
|
-
## Additional Context
|
|
25
|
-
<!--- Add any other context or screenshots about the feature request here. -->
|
|
26
|
-
|
|
27
|
-
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
<!--- Provide a general summary of your changes in the Title above -->
|
|
2
|
-
<!--- Pull request titles must use the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) format -->
|
|
3
|
-
|
|
4
|
-
## Issue being fixed or feature implemented
|
|
5
|
-
<!--- Why is this change required? What problem does it solve? -->
|
|
6
|
-
<!--- If it fixes an open issue, please link to the issue here. -->
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## What was done?
|
|
10
|
-
<!--- Describe your changes in detail -->
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## How Has This Been Tested?
|
|
14
|
-
<!--- Please describe in detail how you tested your changes. -->
|
|
15
|
-
<!--- Include details of your testing environment, and the tests you ran to -->
|
|
16
|
-
<!--- see how your change affects other areas of the code, etc. -->
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
## Breaking Changes
|
|
20
|
-
<!--- Please describe any breaking changes your code introduces and verify that -->
|
|
21
|
-
<!--- the title includes "!" following the conventional commit type (e.g. "feat!: ..."-->
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
## Checklist:
|
|
25
|
-
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
|
|
26
|
-
- [ ] I have performed a self-review of my own code
|
|
27
|
-
- [ ] I have commented my code, particularly in hard-to-understand areas
|
|
28
|
-
- [ ] I have added or updated relevant unit/integration/functional/e2e tests
|
|
29
|
-
- [ ] I have made corresponding changes to the documentation
|
|
30
|
-
|
|
31
|
-
**For repository code-owners and collaborators only**
|
|
32
|
-
- [ ] I have assigned this pull request to a milestone
|
package/.github/workflows/.env
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
name: Test and Release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_dispatch:
|
|
5
|
-
schedule:
|
|
6
|
-
- cron: '47 */160 * * *'
|
|
7
|
-
release:
|
|
8
|
-
types: [published]
|
|
9
|
-
pull_request:
|
|
10
|
-
branches:
|
|
11
|
-
- master
|
|
12
|
-
- v[0-9]+.[0-9]+-dev
|
|
13
|
-
|
|
14
|
-
jobs:
|
|
15
|
-
test:
|
|
16
|
-
name: Run SDK tests
|
|
17
|
-
runs-on: ubuntu-20.04
|
|
18
|
-
timeout-minutes: 60
|
|
19
|
-
steps:
|
|
20
|
-
- name: Cancel previous runs
|
|
21
|
-
uses: styfle/cancel-workflow-action@0.9.0
|
|
22
|
-
with:
|
|
23
|
-
access_token: ${{ github.token }}
|
|
24
|
-
|
|
25
|
-
- uses: actions/checkout@v2
|
|
26
|
-
|
|
27
|
-
- uses: actions/setup-node@v2
|
|
28
|
-
with:
|
|
29
|
-
node-version: '16'
|
|
30
|
-
|
|
31
|
-
- name: Set up Docker BuildX
|
|
32
|
-
id: buildx
|
|
33
|
-
uses: docker/setup-buildx-action@v1
|
|
34
|
-
with:
|
|
35
|
-
version: v0.6.1
|
|
36
|
-
install: true
|
|
37
|
-
driver-opts: image=moby/buildkit:buildx-stable-1
|
|
38
|
-
|
|
39
|
-
# Temporary fix until Docker Compose V2 is GA
|
|
40
|
-
- name: Set up Docker Compose V2
|
|
41
|
-
run: |
|
|
42
|
-
curl https://github.com/docker/compose-cli/releases/download/v2.0.0-beta.4/docker-compose-linux-amd64 --location --create-dirs -o $HOME/.docker/cli-plugins/docker-compose
|
|
43
|
-
chmod +x $HOME/.docker/cli-plugins/docker-compose
|
|
44
|
-
docker version
|
|
45
|
-
docker info
|
|
46
|
-
|
|
47
|
-
# Cache for dashmate and test suite
|
|
48
|
-
- name: Enable NPM cache
|
|
49
|
-
uses: actions/cache@v2
|
|
50
|
-
with:
|
|
51
|
-
path: '~/.npm'
|
|
52
|
-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
53
|
-
restore-keys: |
|
|
54
|
-
${{ runner.os }}-node-
|
|
55
|
-
|
|
56
|
-
- name: Enable buildkit cache
|
|
57
|
-
uses: actions/cache@v2
|
|
58
|
-
with:
|
|
59
|
-
path: /tmp/buildkit-cache/buildkit-state.tar
|
|
60
|
-
key: ${{ runner.os }}-buildkit-${{ github.sha }}
|
|
61
|
-
restore-keys: |
|
|
62
|
-
${{ runner.os }}-buildkit-
|
|
63
|
-
|
|
64
|
-
- name: Load buildkit state from cache
|
|
65
|
-
uses: dashevo/gh-action-cache-buildkit-state@v1
|
|
66
|
-
with:
|
|
67
|
-
builder: buildx_buildkit_${{ steps.buildx.outputs.name }}0
|
|
68
|
-
cache-path: /tmp/buildkit-cache
|
|
69
|
-
cache-max-size: 2g
|
|
70
|
-
|
|
71
|
-
- name: Check NPM package lock version is updated
|
|
72
|
-
uses: dashevo/gh-action-check-package-lock@v1
|
|
73
|
-
|
|
74
|
-
- name: Show NPM version
|
|
75
|
-
run: npm --version
|
|
76
|
-
|
|
77
|
-
- name: Install NPM dependencies
|
|
78
|
-
run: npm ci
|
|
79
|
-
|
|
80
|
-
- name: Load workflow dotenv file
|
|
81
|
-
uses: c-py/action-dotenv-to-setenv@v3
|
|
82
|
-
with:
|
|
83
|
-
env-file: .github/workflows/.env
|
|
84
|
-
|
|
85
|
-
- name: Set compatible branches for Platform components
|
|
86
|
-
uses: dashevo/gh-action-platform-branches@v1
|
|
87
|
-
id: platform-branches
|
|
88
|
-
with:
|
|
89
|
-
override-major-version: 0
|
|
90
|
-
override-dashmate-branch: ${{ env.DASHMATE_BRANCH }}
|
|
91
|
-
override-testsuite-branch: ${{ env.TEST_SUITE_BRANCH }}
|
|
92
|
-
|
|
93
|
-
- name: Start Dash local network
|
|
94
|
-
uses: dashevo/gh-action-start-local-network@v1
|
|
95
|
-
id: start-local-network
|
|
96
|
-
with:
|
|
97
|
-
drive-branch: ${{ env.DRIVE_BRANCH }}
|
|
98
|
-
dapi-branch: ${{ env.DAPI_BRANCH }}
|
|
99
|
-
dashmate-branch: ${{ steps.platform-branches.outputs.dashmate-branch }}
|
|
100
|
-
sdk-branch: ${{ steps.platform-branches.outputs.current-branch }}
|
|
101
|
-
|
|
102
|
-
- name: Create dotenv file
|
|
103
|
-
run: |
|
|
104
|
-
echo "DAPI_SEED=127.0.0.1" > .env
|
|
105
|
-
echo "FAUCET_PRIVATE_KEY=${{ steps.start-local-network.outputs.faucet-private-key }}" >> .env
|
|
106
|
-
echo "NETWORK=regtest" >> .env
|
|
107
|
-
echo "DPNS_CONTRACT_ID=${{ steps.start-local-network.outputs.dpns-contract-id }}" >> .env
|
|
108
|
-
|
|
109
|
-
- name: Run SDK tests
|
|
110
|
-
run: npm run test
|
|
111
|
-
|
|
112
|
-
- name: Run Platform Test Suite
|
|
113
|
-
uses: dashevo/gh-action-run-platform-test-suite@v1
|
|
114
|
-
with:
|
|
115
|
-
sdk-branch: ${{ steps.platform-branches.outputs.current-branch }}
|
|
116
|
-
faucet-private-key: ${{ steps.start-local-network.outputs.faucet-private-key }}
|
|
117
|
-
dpns-contract-id: ${{ steps.start-local-network.outputs.dpns-contract-id }}
|
|
118
|
-
dpns-top-level-identity-id: ${{ steps.start-local-network.outputs.dpns-top-level-identity-id }}
|
|
119
|
-
dpns-top-level-identity-private-key: ${{ steps.start-local-network.outputs.dpns-top-level-identity-private-key }}
|
|
120
|
-
feature-flags-identity-id: ${{ steps.start-local-network.outputs.feature-flags-identity-id }}
|
|
121
|
-
feature-flags-contract-id: ${{ steps.start-local-network.outputs.feature-flags-contract-id }}
|
|
122
|
-
platform-test-suite-branch: ${{ steps.platform-branches.outputs.testsuite-branch }}
|
|
123
|
-
|
|
124
|
-
- name: Show Docker logs
|
|
125
|
-
if: ${{ failure() }}
|
|
126
|
-
uses: jwalton/gh-docker-logs@v1
|
|
127
|
-
|
|
128
|
-
release:
|
|
129
|
-
name: Release NPM package
|
|
130
|
-
runs-on: ubuntu-20.04
|
|
131
|
-
needs: test
|
|
132
|
-
if: ${{ github.event_name == 'release' }}
|
|
133
|
-
steps:
|
|
134
|
-
- uses: actions/checkout@v2
|
|
135
|
-
|
|
136
|
-
- uses: actions/setup-node@v2
|
|
137
|
-
with:
|
|
138
|
-
node-version: '16'
|
|
139
|
-
|
|
140
|
-
- name: Check package version matches tag
|
|
141
|
-
uses: geritol/match-tag-to-package-version@0.1.0
|
|
142
|
-
env:
|
|
143
|
-
TAG_PREFIX: refs/tags/v
|
|
144
|
-
|
|
145
|
-
- name: Enable NPM cache
|
|
146
|
-
uses: actions/cache@v2
|
|
147
|
-
with:
|
|
148
|
-
path: '~/.npm'
|
|
149
|
-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
150
|
-
restore-keys: |
|
|
151
|
-
${{ runner.os }}-node-
|
|
152
|
-
|
|
153
|
-
- name: Install NPM dependencies
|
|
154
|
-
run: npm ci
|
|
155
|
-
|
|
156
|
-
- name: Set release tag
|
|
157
|
-
uses: actions/github-script@v3
|
|
158
|
-
id: tag
|
|
159
|
-
with:
|
|
160
|
-
result-encoding: string
|
|
161
|
-
script: |
|
|
162
|
-
const tag = context.payload.release.tag_name;
|
|
163
|
-
const [, major, minor] = tag.match(/^v([0-9]+)\.([0-9]+)/);
|
|
164
|
-
return (tag.includes('dev') ? `${major}.${minor}-dev` : 'latest');
|
|
165
|
-
|
|
166
|
-
- name: Publish NPM package
|
|
167
|
-
uses: JS-DevTools/npm-publish@v1
|
|
168
|
-
with:
|
|
169
|
-
token: ${{ secrets.NPM_TOKEN }}
|
|
170
|
-
tag: ${{ steps.tag.outputs.result }}
|