@cardano-sdk/e2e 0.26.0 → 0.26.1
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/CHANGELOG.md +4 -0
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/docker-compose.yml +10 -3
- package/local-network/scripts/{cardano-node-ogmios.sh → ogmios-start.sh} +4 -4
- package/package.json +20 -20
- package/test/long-running/projector-ogmios-connection.test.ts +1 -1
- package/test/wallet/PersonalWallet/txChainHistory.test.ts +30 -8
package/docker-compose.yml
CHANGED
|
@@ -39,12 +39,19 @@ services:
|
|
|
39
39
|
test: ['CMD-SHELL', 'wget -O /dev/null http://localhost || exit 1']
|
|
40
40
|
timeout: 10s
|
|
41
41
|
|
|
42
|
-
cardano-node
|
|
43
|
-
entrypoint: ['/tini', '-g', '--', '/scripts/cardano-node-ogmios.sh']
|
|
44
|
-
image: cardanosolutions/cardano-node-ogmios:v${OGMIOS_VERSION:-5.6.0}_${CARDANO_NODE_VERSION:-1.35.5}
|
|
42
|
+
cardano-node:
|
|
45
43
|
depends_on:
|
|
46
44
|
local-testnet:
|
|
47
45
|
condition: service_healthy
|
|
46
|
+
volumes:
|
|
47
|
+
- ./local-network/config/network/cardano-node:/config
|
|
48
|
+
- ./local-network/config/network/genesis:/genesis
|
|
49
|
+
|
|
50
|
+
ogmios:
|
|
51
|
+
depends_on:
|
|
52
|
+
local-testnet:
|
|
53
|
+
condition: service_healthy
|
|
54
|
+
entrypoint: ['bin/sh', '/scripts/ogmios-start.sh']
|
|
48
55
|
volumes:
|
|
49
56
|
- ./local-network/config/network:/config
|
|
50
57
|
- ./local-network/scripts:/scripts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
|
-
# Simple
|
|
4
|
-
#
|
|
3
|
+
# Simple script which overrides will run instead of the `/bin/ogmios` binary in the original
|
|
4
|
+
# ogmios docker image. It delays starting ogmios based on a sentinel file.
|
|
5
5
|
|
|
6
6
|
# Used to support the e2e test to check the projector is able to
|
|
7
7
|
# connect / reconnect to the ogmios server.
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
# If the test set the file, wait for its removal before starting the container
|
|
10
10
|
while [ -f /sdk-ipc/prevent_ogmios ]; do sleep 10; done
|
|
11
11
|
|
|
12
|
-
# Start the
|
|
13
|
-
/
|
|
12
|
+
# Start the ogmios as normal
|
|
13
|
+
/bin/ogmios "$@"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cardano-sdk/e2e",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.1",
|
|
4
4
|
"description": "End to end tests for the cardano-js-sdk packages.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.20.2"
|
|
@@ -80,20 +80,20 @@
|
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@cardano-foundation/ledgerjs-hw-app-cardano": "^6.0.0",
|
|
82
82
|
"@cardano-ogmios/client": "5.6.0",
|
|
83
|
-
"@cardano-sdk/cardano-services": "~0.23.
|
|
84
|
-
"@cardano-sdk/cardano-services-client": "~0.15.
|
|
85
|
-
"@cardano-sdk/core": "~0.22.
|
|
86
|
-
"@cardano-sdk/crypto": "~0.1.
|
|
87
|
-
"@cardano-sdk/hardware-ledger": "~0.7.
|
|
88
|
-
"@cardano-sdk/hardware-trezor": "~0.3.
|
|
89
|
-
"@cardano-sdk/input-selection": "~0.12.
|
|
90
|
-
"@cardano-sdk/key-management": "~0.15.
|
|
91
|
-
"@cardano-sdk/ogmios": "~0.15.
|
|
92
|
-
"@cardano-sdk/tx-construction": "~0.15.
|
|
93
|
-
"@cardano-sdk/util": "~0.14.
|
|
94
|
-
"@cardano-sdk/util-dev": "~0.18.
|
|
95
|
-
"@cardano-sdk/util-rxjs": "~0.6.
|
|
96
|
-
"@cardano-sdk/wallet": "~0.26.
|
|
83
|
+
"@cardano-sdk/cardano-services": "~0.23.1",
|
|
84
|
+
"@cardano-sdk/cardano-services-client": "~0.15.1",
|
|
85
|
+
"@cardano-sdk/core": "~0.22.1",
|
|
86
|
+
"@cardano-sdk/crypto": "~0.1.17",
|
|
87
|
+
"@cardano-sdk/hardware-ledger": "~0.7.1",
|
|
88
|
+
"@cardano-sdk/hardware-trezor": "~0.3.1",
|
|
89
|
+
"@cardano-sdk/input-selection": "~0.12.6",
|
|
90
|
+
"@cardano-sdk/key-management": "~0.15.1",
|
|
91
|
+
"@cardano-sdk/ogmios": "~0.15.1",
|
|
92
|
+
"@cardano-sdk/tx-construction": "~0.15.1",
|
|
93
|
+
"@cardano-sdk/util": "~0.14.4",
|
|
94
|
+
"@cardano-sdk/util-dev": "~0.18.1",
|
|
95
|
+
"@cardano-sdk/util-rxjs": "~0.6.2",
|
|
96
|
+
"@cardano-sdk/wallet": "~0.26.1",
|
|
97
97
|
"@dcspark/cardano-multiplatform-lib-nodejs": "^3.1.1",
|
|
98
98
|
"@vespaiach/axios-fetch-adapter": "^0.3.0",
|
|
99
99
|
"axios": "^0.27.2",
|
|
@@ -123,10 +123,10 @@
|
|
|
123
123
|
"@babel/core": "^7.18.2",
|
|
124
124
|
"@babel/preset-env": "^7.18.2",
|
|
125
125
|
"@babel/preset-typescript": "^7.17.12",
|
|
126
|
-
"@cardano-sdk/dapp-connector": "~0.11.
|
|
127
|
-
"@cardano-sdk/projection": "~0.10.
|
|
128
|
-
"@cardano-sdk/projection-typeorm": "~0.7.
|
|
129
|
-
"@cardano-sdk/web-extension": "~0.16.
|
|
126
|
+
"@cardano-sdk/dapp-connector": "~0.11.3",
|
|
127
|
+
"@cardano-sdk/projection": "~0.10.1",
|
|
128
|
+
"@cardano-sdk/projection-typeorm": "~0.7.1",
|
|
129
|
+
"@cardano-sdk/web-extension": "~0.16.5",
|
|
130
130
|
"@dcspark/cardano-multiplatform-lib-browser": "^3.1.1",
|
|
131
131
|
"@emurgo/cardano-message-signing-asmjs": "^1.0.1",
|
|
132
132
|
"@types/bunyan": "^1.8.8",
|
|
@@ -178,5 +178,5 @@
|
|
|
178
178
|
"webpack-cli": "^4.9.2",
|
|
179
179
|
"webpack-merge": "^5.8.0"
|
|
180
180
|
},
|
|
181
|
-
"gitHead": "
|
|
181
|
+
"gitHead": "8a6db2a251cd1c956f52730a0d35de2b7fc67404"
|
|
182
182
|
}
|
|
@@ -10,7 +10,7 @@ const preventOgmiosStartFile = path.join(__dirname, '..', '..', 'local-network',
|
|
|
10
10
|
|
|
11
11
|
const docker = new Dockerode();
|
|
12
12
|
|
|
13
|
-
const ogmiosContainer = docker.getContainer('local-network-e2e-
|
|
13
|
+
const ogmiosContainer = docker.getContainer('local-network-e2e-ogmios-1');
|
|
14
14
|
const stakePoolProjectorContainer = docker.getContainer('local-network-e2e-stake-pool-projector-1');
|
|
15
15
|
|
|
16
16
|
const createPrevent = async () => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Cardano, CardanoNodeUtil, ProviderError } from '@cardano-sdk/core';
|
|
1
2
|
import { PersonalWallet } from '@cardano-sdk/wallet';
|
|
2
3
|
import { filter, firstValueFrom, map, take } from 'rxjs';
|
|
3
4
|
import { getEnv, getWallet, normalizeTxBody, walletReady, walletVariables } from '../../../src';
|
|
@@ -8,16 +9,10 @@ const env = getEnv(walletVariables);
|
|
|
8
9
|
|
|
9
10
|
describe('PersonalWallet/txChainHistory', () => {
|
|
10
11
|
let wallet: PersonalWallet;
|
|
12
|
+
let signedTx: Cardano.Tx<Cardano.TxBody>;
|
|
11
13
|
|
|
12
14
|
beforeEach(async () => {
|
|
13
15
|
({ wallet } = await getWallet({ env, logger, name: 'Sending Wallet', polling: { interval: 50 } }));
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
afterEach(() => {
|
|
17
|
-
wallet.shutdown();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('submit a transaction and find it in chain history', async () => {
|
|
21
16
|
const tAdaToSend = 10_000_000n;
|
|
22
17
|
// Make sure the wallet has sufficient funds to run this test
|
|
23
18
|
await walletReady(wallet, tAdaToSend);
|
|
@@ -32,7 +27,7 @@ describe('PersonalWallet/txChainHistory', () => {
|
|
|
32
27
|
// Send 10 tADA to the same wallet.
|
|
33
28
|
const txBuilder = wallet.createTxBuilder();
|
|
34
29
|
const txOutput = await txBuilder.buildOutput().address(receivingAddress).coin(tAdaToSend).build();
|
|
35
|
-
|
|
30
|
+
signedTx = (await txBuilder.addOutput(txOutput).build().sign()).tx;
|
|
36
31
|
await wallet.submitTx(signedTx);
|
|
37
32
|
|
|
38
33
|
logger.info(
|
|
@@ -42,7 +37,13 @@ describe('PersonalWallet/txChainHistory', () => {
|
|
|
42
37
|
signedTx.body.outputs.map((txOut) => [txOut.address, Number.parseInt(txOut.value.coins.toString())])
|
|
43
38
|
)}.`
|
|
44
39
|
);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
afterEach(() => {
|
|
43
|
+
wallet.shutdown();
|
|
44
|
+
});
|
|
45
45
|
|
|
46
|
+
it('submit a transaction and find it in chain history', async () => {
|
|
46
47
|
// Search chain history to see if the transaction is there.
|
|
47
48
|
const txFoundInHistory = await firstValueFrom(
|
|
48
49
|
wallet.transactions.history$.pipe(
|
|
@@ -59,4 +60,25 @@ describe('PersonalWallet/txChainHistory', () => {
|
|
|
59
60
|
expect(txFoundInHistory.id).toEqual(signedTx.id);
|
|
60
61
|
expect(normalizeTxBody(txFoundInHistory.body)).toEqual(normalizeTxBody(signedTx.body));
|
|
61
62
|
});
|
|
63
|
+
|
|
64
|
+
it('can detect a ValueNotConserved error', async () => {
|
|
65
|
+
expect.assertions(1);
|
|
66
|
+
// Search chain history to see if the transaction is there.
|
|
67
|
+
await firstValueFrom(
|
|
68
|
+
wallet.transactions.history$.pipe(
|
|
69
|
+
map((txs) => txs.find((tx) => tx.id === signedTx.id)),
|
|
70
|
+
filter(isNotNil),
|
|
71
|
+
take(1)
|
|
72
|
+
)
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
try {
|
|
76
|
+
// Submit the same transaction again.
|
|
77
|
+
await wallet.submitTx(signedTx);
|
|
78
|
+
} catch (error) {
|
|
79
|
+
if (error instanceof ProviderError) {
|
|
80
|
+
expect(CardanoNodeUtil.isValueNotConservedError(error?.innerError)).toBeTruthy();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
62
84
|
});
|