@cardano-sdk/e2e 0.42.2 → 0.43.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/.env.example +10 -0
- package/CHANGELOG.md +14 -0
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/docker-compose.yml +11 -0
- package/local-network/Dockerfile +6 -6
- package/local-network/scripts/install.sh +1 -1
- package/local-network/scripts/make-babbage.sh +3 -1
- package/local-network/scripts/prepare_blockfrost_ryo.sh +13 -0
- package/local-network/scripts/start.sh +1 -0
- package/local-network/templates/blockfrost-ryo/byron_genesis.json +6 -0
- package/local-network/templates/blockfrost-ryo/genesis.json +12 -0
- package/local-network/templates/blockfrost-ryo/local-network.yaml +14 -0
- package/package.json +20 -19
- package/test/k6/scenarios/wallets.test.js +9 -1
- package/test/projection/offline-fork.test.ts +5 -9
- package/test/projection/single-tenant-utxo.test.ts +2 -2
- package/test/wallet_epoch_0/PersonalWallet/byron.test.ts +2 -13
- package/test/wallet_epoch_0/PersonalWallet/metadata.test.ts +3 -11
- package/test/wallet_epoch_0/PersonalWallet/mint.test.ts +2 -12
- package/test/wallet_epoch_0/PersonalWallet/multiAddress.test.ts +4 -22
- package/test/wallet_epoch_0/PersonalWallet/phase2validation.test.ts +4 -22
- package/test/wallet_epoch_0/PersonalWallet/plutusTest.test.ts +7 -39
- package/test/wallet_epoch_0/PersonalWallet/txChainHistory.test.ts +2 -2
- package/test/wallet_epoch_0/PersonalWallet/unspendableUtxos.test.ts +3 -23
- package/test/wallet_epoch_0/SharedWallet/simpleTx.test.ts +2 -1
package/docker-compose.yml
CHANGED
|
@@ -6,6 +6,17 @@ x-logging: &logging
|
|
|
6
6
|
max-file: '10'
|
|
7
7
|
|
|
8
8
|
services:
|
|
9
|
+
|
|
10
|
+
blockfrost-ryo:
|
|
11
|
+
depends_on:
|
|
12
|
+
local-testnet:
|
|
13
|
+
condition: service_healthy
|
|
14
|
+
environment:
|
|
15
|
+
NODE_ENV: local-network
|
|
16
|
+
volumes:
|
|
17
|
+
- ./local-network/config/network/blockfrost-ryo:/app/config
|
|
18
|
+
profiles: [blockfrost-ryo]
|
|
19
|
+
|
|
9
20
|
local-testnet:
|
|
10
21
|
<<: *logging
|
|
11
22
|
build:
|
package/local-network/Dockerfile
CHANGED
|
@@ -5,16 +5,16 @@ FROM ubuntu:${UBUNTU_VERSION} as builder
|
|
|
5
5
|
ENV DEBIAN_FRONTEND=nonintercative
|
|
6
6
|
|
|
7
7
|
WORKDIR /build
|
|
8
|
-
ARG CARDANO_NODE_BUILD_URL=https://github.com/IntersectMBO/cardano-node/releases/download/9.1.
|
|
8
|
+
ARG CARDANO_NODE_BUILD_URL=https://github.com/IntersectMBO/cardano-node/releases/download/9.1.1/cardano-node-9.1.1-linux.tar.gz
|
|
9
9
|
ARG CARDANO_NODE_BUILD_URL_ARM64=https://github.com/input-output-hk/ogmios-tracker/releases/download/0.1.0/cardano-node-9.1.0-aarch64-linux.tar.gz
|
|
10
10
|
|
|
11
11
|
RUN set -x && \
|
|
12
12
|
apt-get update -y && \
|
|
13
13
|
apt-get install -y wget tar curl unzip && \
|
|
14
14
|
if [ "$(uname -m)" = "aarch64" ] ; then \
|
|
15
|
-
curl -fsSL "$CARDANO_NODE_BUILD_URL_ARM64" >cardano-node.tar.gz
|
|
16
|
-
|
|
17
|
-
curl -fsSL "$CARDANO_NODE_BUILD_URL" >cardano-node.tar.gz
|
|
15
|
+
curl -fsSL "$CARDANO_NODE_BUILD_URL_ARM64" >cardano-node.tar.gz ; \
|
|
16
|
+
else \
|
|
17
|
+
curl -fsSL "$CARDANO_NODE_BUILD_URL" >cardano-node.tar.gz ; \
|
|
18
18
|
fi && \
|
|
19
19
|
mkdir -p cardano-node && \
|
|
20
20
|
tar -xzf cardano-node.tar.gz -C cardano-node
|
|
@@ -34,9 +34,9 @@ COPY --from=builder /build/cardano-node /opt/cardano-node
|
|
|
34
34
|
ARG TINI_VERSION=v0.19.0
|
|
35
35
|
RUN mkdir -p ./bin && ln -s /opt/cardano-node/bin/* ./bin/ &&\
|
|
36
36
|
if [ "$(uname -m)" = "aarch64" ] ; then \
|
|
37
|
-
|
|
37
|
+
TINI_VARIANT=static-arm64 ;\
|
|
38
38
|
else \
|
|
39
|
-
|
|
39
|
+
TINI_VARIANT=static-amd64 ;\
|
|
40
40
|
fi &&\
|
|
41
41
|
curl -fsSL >/tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TINI_VARIANT} &&\
|
|
42
42
|
chmod +x /tini
|
|
@@ -303,7 +303,7 @@ for NODE in ${SP_NODES}; do
|
|
|
303
303
|
echo "${ROOT}/${NODE}.sh"
|
|
304
304
|
done
|
|
305
305
|
|
|
306
|
-
echo "Update start time in genesis files"
|
|
306
|
+
echo "Update start time in genesis files with ${timeUnix}"
|
|
307
307
|
sed_i -E "s/\"startTime\": [0-9]+/\"startTime\": ${timeUnix}/" ${ROOT}/genesis/byron/genesis.json
|
|
308
308
|
sed_i -E "s/\"systemStart\": \".*\"/\"systemStart\": \"${timeISO}\"/" ${ROOT}/genesis/shelley/genesis.json
|
|
309
309
|
|
|
@@ -359,6 +359,8 @@ cp "${ROOT}"/genesis/shelley/genesis.conway.json ./config/network/genesis/conway
|
|
|
359
359
|
|
|
360
360
|
mkdir -p "${ROOT}/run"
|
|
361
361
|
|
|
362
|
+
echo "${timeUnix}" > "${ROOT}/run/system_start"
|
|
363
|
+
|
|
362
364
|
echo "#!/usr/bin/env bash" >"${ROOT}/run/all.sh"
|
|
363
365
|
echo "" >>"${ROOT}/run/all.sh"
|
|
364
366
|
echo "" >>"${ROOT}/run/all.sh"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
timeUnix=$(cat network-files/run/system_start)
|
|
4
|
+
|
|
5
|
+
echo "Update start time in blockfrost genesis file with ${timeUnix}"
|
|
6
|
+
|
|
7
|
+
mkdir -p ./config/network/blockfrost-ryo/
|
|
8
|
+
|
|
9
|
+
cp ./templates/blockfrost-ryo/genesis.json ./config/network/blockfrost-ryo/genesis.json
|
|
10
|
+
cp ./templates/blockfrost-ryo/byron_genesis.json ./config/network/blockfrost-ryo/byron_genesis.json
|
|
11
|
+
cp ./templates/blockfrost-ryo/local-network.yaml ./config/network/blockfrost-ryo/local-network.yaml
|
|
12
|
+
|
|
13
|
+
sed -i -E "s/\"system_start\": [0-9]+/\"system_start\": ${timeUnix}/" ./config/network/blockfrost-ryo/genesis.json
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"active_slots_coefficient": 0.05,
|
|
3
|
+
"update_quorum": 5,
|
|
4
|
+
"max_lovelace_supply": "45000000000000000",
|
|
5
|
+
"network_magic": 888,
|
|
6
|
+
"epoch_length": 1000,
|
|
7
|
+
"system_start": 1000000,
|
|
8
|
+
"slots_per_kes_period": 129600,
|
|
9
|
+
"slot_length": 0.2,
|
|
10
|
+
"max_kes_evolutions": 62,
|
|
11
|
+
"security_param": 10
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
server:
|
|
2
|
+
listenAddress: "0.0.0.0"
|
|
3
|
+
port: 3000
|
|
4
|
+
debug: true
|
|
5
|
+
dbSync:
|
|
6
|
+
host: "postgres"
|
|
7
|
+
port: 5432
|
|
8
|
+
database: "cexplorer"
|
|
9
|
+
user: "postgres"
|
|
10
|
+
password: "doNoUseThisSecret!"
|
|
11
|
+
maxConnections: 5
|
|
12
|
+
network: "custom"
|
|
13
|
+
genesisDataFolder: '/app/config'
|
|
14
|
+
tokenRegistryUrl: "https://metadata.cardano-testnet.iohkdev.io"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cardano-sdk/e2e",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.0",
|
|
4
4
|
"description": "End to end tests for the cardano-js-sdk packages.",
|
|
5
5
|
"repository": "https://github.com/input-output-hk/cardano-js-sdk",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -46,8 +46,9 @@
|
|
|
46
46
|
"test:web-extension:watch": "run-s test:web-extension:build test:web-extension:watch:bg",
|
|
47
47
|
"test:web-extension:watch:bg": "run-p test:web-extension:watch:build test:web-extension:watch:run",
|
|
48
48
|
"test:ws": "jest -c jest.config.js --forceExit --selectProjects ws-server --runInBand --verbose",
|
|
49
|
-
"local-network:common": "DISABLE_DB_CACHE=${DISABLE_DB_CACHE:-true} SUBMIT_API_ARGS='--testnet-magic 888' USE_BLOCKFROST=false __FIX_UMASK__=$(chmod -R a+r ../../compose/placeholder-secrets) docker compose --env-file ../cardano-services/environments/.env.local -p local-network-e2e -f docker-compose.yml -f ../../compose/common.yml -f ../../compose/$(uname -m).yml $FILES up",
|
|
49
|
+
"local-network:common": "DISABLE_DB_CACHE=${DISABLE_DB_CACHE:-true} SUBMIT_API_ARGS='--testnet-magic 888' USE_BLOCKFROST=false __FIX_UMASK__=$(chmod -R a+r ../../compose/placeholder-secrets) docker compose --env-file ../cardano-services/environments/.env.local -p local-network-e2e -f docker-compose.yml -f ../../compose/common.yml -f ../../compose/$(uname -m).yml $FILES --profile ${DOCKER_COMPOSE_PROFILE:-none} up",
|
|
50
50
|
"local-network:up": "FILES='' yarn local-network:common",
|
|
51
|
+
"local-network:blockfrost:up": "FILES='' DOCKER_COMPOSE_PROFILE='blockfrost-ryo' yarn local-network:common",
|
|
51
52
|
"local-network:single:up": "FILES='' yarn local-network:common cardano-node file-server local-testnet ogmios postgres",
|
|
52
53
|
"local-network:profile:up": "FILES='-f ../../compose/pg-agent.yml' yarn local-network:common",
|
|
53
54
|
"local-network:down": "docker compose -p local-network-e2e -f docker-compose.yml -f ../../compose/common.yml -f ../../compose/pg-agent.yml down -v --remove-orphans",
|
|
@@ -75,20 +76,20 @@
|
|
|
75
76
|
"dependencies": {
|
|
76
77
|
"@cardano-foundation/ledgerjs-hw-app-cardano": "^7.1.2",
|
|
77
78
|
"@cardano-ogmios/client": "6.5.0",
|
|
78
|
-
"@cardano-sdk/cardano-services": "~0.
|
|
79
|
-
"@cardano-sdk/cardano-services-client": "~0.20.
|
|
80
|
-
"@cardano-sdk/core": "~0.
|
|
79
|
+
"@cardano-sdk/cardano-services": "~0.30.0",
|
|
80
|
+
"@cardano-sdk/cardano-services-client": "~0.20.9",
|
|
81
|
+
"@cardano-sdk/core": "~0.40.0",
|
|
81
82
|
"@cardano-sdk/crypto": "~0.1.30",
|
|
82
|
-
"@cardano-sdk/hardware-ledger": "~0.12.
|
|
83
|
-
"@cardano-sdk/hardware-trezor": "~0.6.
|
|
84
|
-
"@cardano-sdk/input-selection": "~0.13.
|
|
85
|
-
"@cardano-sdk/key-management": "~0.24.
|
|
86
|
-
"@cardano-sdk/ogmios": "~0.
|
|
87
|
-
"@cardano-sdk/tx-construction": "~0.21.
|
|
83
|
+
"@cardano-sdk/hardware-ledger": "~0.12.4",
|
|
84
|
+
"@cardano-sdk/hardware-trezor": "~0.6.4",
|
|
85
|
+
"@cardano-sdk/input-selection": "~0.13.20",
|
|
86
|
+
"@cardano-sdk/key-management": "~0.24.3",
|
|
87
|
+
"@cardano-sdk/ogmios": "~0.18.0",
|
|
88
|
+
"@cardano-sdk/tx-construction": "~0.21.5",
|
|
88
89
|
"@cardano-sdk/util": "~0.15.5",
|
|
89
|
-
"@cardano-sdk/util-dev": "~0.
|
|
90
|
-
"@cardano-sdk/util-rxjs": "~0.7.
|
|
91
|
-
"@cardano-sdk/wallet": "~0.44.
|
|
90
|
+
"@cardano-sdk/util-dev": "~0.23.0",
|
|
91
|
+
"@cardano-sdk/util-rxjs": "~0.7.33",
|
|
92
|
+
"@cardano-sdk/wallet": "~0.44.4",
|
|
92
93
|
"@dcspark/cardano-multiplatform-lib-nodejs": "^3.1.1",
|
|
93
94
|
"@shiroyasha9/axios-fetch-adapter": "1.0.3",
|
|
94
95
|
"axios": "^1.7.4",
|
|
@@ -118,10 +119,10 @@
|
|
|
118
119
|
"@babel/core": "^7.18.2",
|
|
119
120
|
"@babel/preset-env": "^7.18.2",
|
|
120
121
|
"@babel/preset-typescript": "^7.17.12",
|
|
121
|
-
"@cardano-sdk/dapp-connector": "~0.12.
|
|
122
|
-
"@cardano-sdk/projection": "~0.
|
|
123
|
-
"@cardano-sdk/projection-typeorm": "~0.
|
|
124
|
-
"@cardano-sdk/web-extension": "~0.34.
|
|
122
|
+
"@cardano-sdk/dapp-connector": "~0.12.37",
|
|
123
|
+
"@cardano-sdk/projection": "~0.12.0",
|
|
124
|
+
"@cardano-sdk/projection-typeorm": "~0.9.0",
|
|
125
|
+
"@cardano-sdk/web-extension": "~0.34.3",
|
|
125
126
|
"@dcspark/cardano-multiplatform-lib-browser": "^3.1.1",
|
|
126
127
|
"@emurgo/cardano-message-signing-asmjs": "^1.0.1",
|
|
127
128
|
"@types/bunyan": "^1.8.8",
|
|
@@ -181,5 +182,5 @@
|
|
|
181
182
|
"publishConfig": {
|
|
182
183
|
"access": "public"
|
|
183
184
|
},
|
|
184
|
-
"gitHead": "
|
|
185
|
+
"gitHead": "58513e2ae961e81bd0f168e3d65f29b15aa4ff87"
|
|
185
186
|
}
|
|
@@ -161,11 +161,19 @@ export const options = {
|
|
|
161
161
|
}
|
|
162
162
|
},
|
|
163
163
|
thresholds: {
|
|
164
|
+
http_req_failed: [
|
|
165
|
+
{
|
|
166
|
+
// Stop the test if more than 10% of requests fail to avoid using VUh for nothing
|
|
167
|
+
abortOnFail: true,
|
|
168
|
+
// Wait for 2 minutes to get more data. If the error rate is still high, the test will fail
|
|
169
|
+
delayAbortEval: '2m',
|
|
170
|
+
threshold: 'rate<0.1'
|
|
171
|
+
}
|
|
172
|
+
],
|
|
164
173
|
// All wallets should have syncd
|
|
165
174
|
// Use https://k6.io/docs/using-k6/thresholds/ to set more thresholds. E.g.:
|
|
166
175
|
// wallet_sync: ['p(95)<5000'], // 95% of wallets should sync in under 5 seconds
|
|
167
176
|
wallet_sync: [{ delayAbortEval: '5s', threshold: 'p(95) < 30000' }],
|
|
168
|
-
|
|
169
177
|
wallet_sync_count: [`count >= ${MAX_VU}`] // We get a nice graph if we enable thresholds. See this stat on a graph
|
|
170
178
|
}
|
|
171
179
|
};
|
|
@@ -2,8 +2,12 @@ import * as Postgres from '@cardano-sdk/projection-typeorm';
|
|
|
2
2
|
import { BlockDataEntity, BlockEntity, StakeKeyEntity } from '@cardano-sdk/projection-typeorm';
|
|
3
3
|
import {
|
|
4
4
|
Bootstrap,
|
|
5
|
+
ChainSyncEvent,
|
|
6
|
+
ChainSyncEventType,
|
|
7
|
+
ChainSyncRollForward,
|
|
5
8
|
InMemory,
|
|
6
9
|
Mappers,
|
|
10
|
+
ObservableCardanoNode,
|
|
7
11
|
ProjectionEvent,
|
|
8
12
|
ProjectionOperator,
|
|
9
13
|
StabilityWindowBuffer,
|
|
@@ -11,15 +15,7 @@ import {
|
|
|
11
15
|
requestNext,
|
|
12
16
|
withStaticContext
|
|
13
17
|
} from '@cardano-sdk/projection';
|
|
14
|
-
import {
|
|
15
|
-
Cardano,
|
|
16
|
-
ChainSyncEvent,
|
|
17
|
-
ChainSyncEventType,
|
|
18
|
-
ChainSyncRollForward,
|
|
19
|
-
ObservableCardanoNode,
|
|
20
|
-
Point,
|
|
21
|
-
TipOrOrigin
|
|
22
|
-
} from '@cardano-sdk/core';
|
|
18
|
+
import { Cardano, Point, TipOrOrigin } from '@cardano-sdk/core';
|
|
23
19
|
import { ChainSyncDataSet, chainSyncData, logger } from '@cardano-sdk/util-dev';
|
|
24
20
|
import { ConnectionConfig } from '@cardano-ogmios/client';
|
|
25
21
|
import { Observable, filter, firstValueFrom, lastValueFrom, map, of, take, takeWhile, throwError, toArray } from 'rxjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Postgres from '@cardano-sdk/projection-typeorm';
|
|
2
|
-
import { Bootstrap, Mappers, ProjectionEvent, requestNext } from '@cardano-sdk/projection';
|
|
3
|
-
import { Cardano
|
|
2
|
+
import { Bootstrap, Mappers, ObservableCardanoNode, ProjectionEvent, requestNext } from '@cardano-sdk/projection';
|
|
3
|
+
import { Cardano } from '@cardano-sdk/core';
|
|
4
4
|
import { ConnectionConfig } from '@cardano-ogmios/client';
|
|
5
5
|
import { DataSource, QueryRunner } from 'typeorm';
|
|
6
6
|
import { Observable, filter, firstValueFrom, lastValueFrom, of, scan, takeWhile } from 'rxjs';
|
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
import { BaseWallet } from '@cardano-sdk/wallet';
|
|
3
3
|
import { Cardano } from '@cardano-sdk/core';
|
|
4
4
|
import { createLogger } from '@cardano-sdk/util-dev';
|
|
5
|
-
import { filter, firstValueFrom, map, take } from 'rxjs';
|
|
6
5
|
import { getEnv, walletVariables } from '../../../src/environment';
|
|
7
|
-
import { getWallet, normalizeTxBody, walletReady } from '../../../src';
|
|
8
|
-
import { isNotNil } from '@cardano-sdk/util';
|
|
6
|
+
import { getWallet, normalizeTxBody, submitAndConfirm, walletReady } from '../../../src';
|
|
9
7
|
|
|
10
8
|
const env = getEnv(walletVariables);
|
|
11
9
|
const logger = createLogger();
|
|
@@ -33,16 +31,7 @@ describe('PersonalWallet/byron', () => {
|
|
|
33
31
|
.build();
|
|
34
32
|
|
|
35
33
|
const { tx: signedTx } = await txBuilder.addOutput(txOutput).build().sign();
|
|
36
|
-
await wallet
|
|
37
|
-
|
|
38
|
-
// Search chain history to see if the transaction is there.
|
|
39
|
-
const txFoundInHistory = await firstValueFrom(
|
|
40
|
-
wallet.transactions.history$.pipe(
|
|
41
|
-
map((txs) => txs.find((tx) => tx.id === signedTx.id)),
|
|
42
|
-
filter(isNotNil),
|
|
43
|
-
take(1)
|
|
44
|
-
)
|
|
45
|
-
);
|
|
34
|
+
const [, txFoundInHistory] = await submitAndConfirm(wallet, signedTx, 1);
|
|
46
35
|
|
|
47
36
|
// Assert
|
|
48
37
|
expect(txFoundInHistory).toBeDefined();
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { BaseWallet, createWalletUtil } from '@cardano-sdk/wallet';
|
|
2
2
|
import { Cardano } from '@cardano-sdk/core';
|
|
3
|
-
import {
|
|
4
|
-
import { getEnv, getWallet, walletReady, walletVariables } from '../../../src';
|
|
5
|
-
import { isNotNil } from '@cardano-sdk/util';
|
|
3
|
+
import { firstValueFrom } from 'rxjs';
|
|
4
|
+
import { getEnv, getWallet, submitAndConfirm, walletReady, walletVariables } from '../../../src';
|
|
6
5
|
import { logger } from '@cardano-sdk/util-dev';
|
|
7
6
|
|
|
8
7
|
const env = getEnv(walletVariables);
|
|
@@ -35,15 +34,8 @@ describe('PersonalWallet/metadata', () => {
|
|
|
35
34
|
.build()
|
|
36
35
|
.sign();
|
|
37
36
|
|
|
38
|
-
const
|
|
39
|
-
await wallet.submitTx(signedTx);
|
|
37
|
+
const [, loadedTx] = await submitAndConfirm(wallet, signedTx, 1);
|
|
40
38
|
|
|
41
|
-
const loadedTx = await firstValueFrom(
|
|
42
|
-
wallet.transactions.history$.pipe(
|
|
43
|
-
map((txs) => txs.find((tx) => tx.id === outgoingTx.id)),
|
|
44
|
-
filter(isNotNil)
|
|
45
|
-
)
|
|
46
|
-
);
|
|
47
39
|
expect(loadedTx.auxiliaryData?.blob).toEqual(metadata);
|
|
48
40
|
});
|
|
49
41
|
});
|
|
@@ -13,8 +13,7 @@ import {
|
|
|
13
13
|
walletVariables
|
|
14
14
|
} from '../../../src';
|
|
15
15
|
import { createLogger } from '@cardano-sdk/util-dev';
|
|
16
|
-
import { filter, firstValueFrom
|
|
17
|
-
import { isNotNil } from '@cardano-sdk/util';
|
|
16
|
+
import { filter, firstValueFrom } from 'rxjs';
|
|
18
17
|
|
|
19
18
|
const env = getEnv(walletVariables);
|
|
20
19
|
const logger = createLogger();
|
|
@@ -99,16 +98,7 @@ describe('PersonalWallet/mint', () => {
|
|
|
99
98
|
};
|
|
100
99
|
|
|
101
100
|
const signedTx = await wallet.finalizeTx(finalizeProps);
|
|
102
|
-
await submitAndConfirm(wallet, signedTx);
|
|
103
|
-
|
|
104
|
-
// Search chain history to see if the transaction is there.
|
|
105
|
-
const txFoundInHistory = await firstValueFrom(
|
|
106
|
-
wallet.transactions.history$.pipe(
|
|
107
|
-
map((txs) => txs.find((tx) => tx.id === signedTx.id)),
|
|
108
|
-
filter(isNotNil),
|
|
109
|
-
take(1)
|
|
110
|
-
)
|
|
111
|
-
);
|
|
101
|
+
const [, txFoundInHistory] = await submitAndConfirm(wallet, signedTx, 1);
|
|
112
102
|
|
|
113
103
|
expect(txFoundInHistory.id).toEqual(signedTx.id);
|
|
114
104
|
|
|
@@ -9,12 +9,11 @@ import {
|
|
|
9
9
|
firstValueFromTimed,
|
|
10
10
|
getWallet,
|
|
11
11
|
normalizeTxBody,
|
|
12
|
+
submitAndConfirm,
|
|
12
13
|
walletReady
|
|
13
14
|
} from '../../../src';
|
|
14
15
|
import { createLogger } from '@cardano-sdk/util-dev';
|
|
15
|
-
import { filter, map, take } from 'rxjs';
|
|
16
16
|
import { getEnv, walletVariables } from '../../../src/environment';
|
|
17
|
-
import { isNotNil } from '@cardano-sdk/util';
|
|
18
17
|
|
|
19
18
|
const env = getEnv(walletVariables);
|
|
20
19
|
const logger = createLogger();
|
|
@@ -77,16 +76,7 @@ describe('PersonalWallet/multiAddress', () => {
|
|
|
77
76
|
|
|
78
77
|
const { tx: signedTx } = await txBuilder.build().sign();
|
|
79
78
|
|
|
80
|
-
await wallet
|
|
81
|
-
|
|
82
|
-
// Search chain history to see if the transaction is there.
|
|
83
|
-
const txFoundInHistory = await firstValueFromTimed(
|
|
84
|
-
wallet.transactions.history$.pipe(
|
|
85
|
-
map((txs) => txs.find((tx) => tx.id === signedTx.id)),
|
|
86
|
-
filter(isNotNil),
|
|
87
|
-
take(1)
|
|
88
|
-
)
|
|
89
|
-
);
|
|
79
|
+
const [, txFoundInHistory] = await submitAndConfirm(wallet, signedTx, 1);
|
|
90
80
|
|
|
91
81
|
expect(txFoundInHistory.id).toEqual(signedTx.id);
|
|
92
82
|
expect(normalizeTxBody(txFoundInHistory.body)).toEqual(normalizeTxBody(signedTx.body));
|
|
@@ -143,16 +133,8 @@ describe('PersonalWallet/multiAddress', () => {
|
|
|
143
133
|
)
|
|
144
134
|
.build()
|
|
145
135
|
.sign();
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
// Search chain history to see if the transaction is there.
|
|
149
|
-
const returnAdaTxFoundInHistory = await firstValueFromTimed(
|
|
150
|
-
newWallet.wallet.transactions.history$.pipe(
|
|
151
|
-
map((txs) => txs.find((tx) => tx.id === returnAdaSignedTx.id)),
|
|
152
|
-
filter(isNotNil),
|
|
153
|
-
take(1)
|
|
154
|
-
)
|
|
155
|
-
);
|
|
136
|
+
|
|
137
|
+
const [, returnAdaTxFoundInHistory] = await submitAndConfirm(newWallet.wallet, returnAdaSignedTx, 1);
|
|
156
138
|
|
|
157
139
|
expect(returnAdaTxFoundInHistory.id).toEqual(returnAdaSignedTx.id);
|
|
158
140
|
expect(normalizeTxBody(returnAdaTxFoundInHistory.body)).toEqual(normalizeTxBody(returnAdaSignedTx.body));
|
|
@@ -4,7 +4,7 @@ import { HexBlob, isNotNil } from '@cardano-sdk/util';
|
|
|
4
4
|
import { InitializeTxProps, computeScriptDataHash } from '@cardano-sdk/tx-construction';
|
|
5
5
|
import { createLogger } from '@cardano-sdk/util-dev';
|
|
6
6
|
import { filter, firstValueFrom, map, take } from 'rxjs';
|
|
7
|
-
import { firstValueFromTimed, getEnv, getWallet, walletReady, walletVariables } from '../../../src';
|
|
7
|
+
import { firstValueFromTimed, getEnv, getWallet, submitAndConfirm, walletReady, walletVariables } from '../../../src';
|
|
8
8
|
|
|
9
9
|
const env = getEnv(walletVariables);
|
|
10
10
|
const logger = createLogger();
|
|
@@ -37,16 +37,7 @@ const createCollateral = async (
|
|
|
37
37
|
const txOutput = await txBuilder.buildOutput().address(address).coin(5_000_000n).build();
|
|
38
38
|
|
|
39
39
|
const { tx: signedTx } = await txBuilder.addOutput(txOutput).build().sign();
|
|
40
|
-
await wallet
|
|
41
|
-
|
|
42
|
-
// Wait for transaction to be on chain.
|
|
43
|
-
await firstValueFrom(
|
|
44
|
-
wallet.transactions.history$.pipe(
|
|
45
|
-
map((txs) => txs.find((tx) => tx.id === signedTx.id)),
|
|
46
|
-
filter(isNotNil),
|
|
47
|
-
take(1)
|
|
48
|
-
)
|
|
49
|
-
);
|
|
40
|
+
await submitAndConfirm(wallet, signedTx, 1);
|
|
50
41
|
|
|
51
42
|
// Find the collateral UTxO in the UTxO set.
|
|
52
43
|
const utxo = await firstValueFrom(
|
|
@@ -151,17 +142,8 @@ describe('PersonalWallet/phase2validation', () => {
|
|
|
151
142
|
|
|
152
143
|
const signedTx = await wallet.finalizeTx(finalizeProps);
|
|
153
144
|
|
|
154
|
-
const [,
|
|
155
|
-
|
|
156
|
-
firstValueFromTimed(wallet.transactions.outgoing.failed$),
|
|
157
|
-
firstValueFromTimed(
|
|
158
|
-
wallet.transactions.history$.pipe(
|
|
159
|
-
map((txs) => txs.find((tx) => tx.id === signedTx.id)),
|
|
160
|
-
filter(isNotNil),
|
|
161
|
-
take(1)
|
|
162
|
-
)
|
|
163
|
-
)
|
|
164
|
-
]);
|
|
145
|
+
const [, txFoundInHistory] = await submitAndConfirm(wallet, signedTx, 1);
|
|
146
|
+
const failedTx = await firstValueFromTimed(wallet.transactions.outgoing.failed$);
|
|
165
147
|
|
|
166
148
|
// Transaction should be part of the history
|
|
167
149
|
expect(txFoundInHistory).toBeTruthy();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWallet } from '@cardano-sdk/wallet';
|
|
2
2
|
import { Cardano, Serialization, UtxoProvider } from '@cardano-sdk/core';
|
|
3
|
-
import { HexBlob
|
|
4
|
-
import { Observable, filter, firstValueFrom, interval,
|
|
3
|
+
import { HexBlob } from '@cardano-sdk/util';
|
|
4
|
+
import { Observable, filter, firstValueFrom, interval, switchMap } from 'rxjs';
|
|
5
5
|
import { createLogger } from '@cardano-sdk/util-dev';
|
|
6
|
-
import { getEnv, getWallet, utxoProviderFactory, walletReady, walletVariables } from '../../../src';
|
|
6
|
+
import { getEnv, getWallet, submitAndConfirm, utxoProviderFactory, walletReady, walletVariables } from '../../../src';
|
|
7
7
|
|
|
8
8
|
const env = getEnv(walletVariables);
|
|
9
9
|
const logger = createLogger();
|
|
@@ -85,7 +85,7 @@ const fundScript = async (wallet: BaseWallet, receivingAddress: Cardano.PaymentA
|
|
|
85
85
|
const txBuilder = wallet.createTxBuilder();
|
|
86
86
|
const txOutput = await txBuilder.buildOutput().address(receivingAddress).coin(tAdaToSend).datum(datum).build();
|
|
87
87
|
const signedTx = (await txBuilder.addOutput(txOutput).build().sign()).tx;
|
|
88
|
-
await wallet
|
|
88
|
+
const [, txFoundInHistory] = await submitAndConfirm(wallet, signedTx, 1);
|
|
89
89
|
|
|
90
90
|
logger.info(
|
|
91
91
|
`Submitted transaction id: ${signedTx.id}, inputs: ${JSON.stringify(
|
|
@@ -95,14 +95,6 @@ const fundScript = async (wallet: BaseWallet, receivingAddress: Cardano.PaymentA
|
|
|
95
95
|
)}.`
|
|
96
96
|
);
|
|
97
97
|
|
|
98
|
-
const txFoundInHistory = await firstValueFrom(
|
|
99
|
-
wallet.transactions.history$.pipe(
|
|
100
|
-
map((txs) => txs.find((tx) => tx.id === signedTx.id)),
|
|
101
|
-
filter(isNotNil),
|
|
102
|
-
take(1)
|
|
103
|
-
)
|
|
104
|
-
);
|
|
105
|
-
|
|
106
98
|
logger.info(`Found transaction id in chain history: ${txFoundInHistory.id}`);
|
|
107
99
|
|
|
108
100
|
// Assert
|
|
@@ -135,7 +127,7 @@ const createScriptRefInput = async (wallet: BaseWallet, script: Cardano.Script):
|
|
|
135
127
|
.build();
|
|
136
128
|
|
|
137
129
|
const signedTx = (await txBuilder.addOutput(txOutput).build().sign()).tx;
|
|
138
|
-
await wallet
|
|
130
|
+
const [, txFoundInHistory] = await submitAndConfirm(wallet, signedTx, 1);
|
|
139
131
|
|
|
140
132
|
logger.info(
|
|
141
133
|
`Submitted transaction id: ${signedTx.id}, inputs: ${JSON.stringify(
|
|
@@ -145,14 +137,6 @@ const createScriptRefInput = async (wallet: BaseWallet, script: Cardano.Script):
|
|
|
145
137
|
)}.`
|
|
146
138
|
);
|
|
147
139
|
|
|
148
|
-
const txFoundInHistory = await firstValueFrom(
|
|
149
|
-
wallet.transactions.history$.pipe(
|
|
150
|
-
map((txs) => txs.find((tx) => tx.id === signedTx.id)),
|
|
151
|
-
filter(isNotNil),
|
|
152
|
-
take(1)
|
|
153
|
-
)
|
|
154
|
-
);
|
|
155
|
-
|
|
156
140
|
logger.info(`Found transaction id in chain history: ${txFoundInHistory.id}`);
|
|
157
141
|
|
|
158
142
|
// Assert
|
|
@@ -243,7 +227,7 @@ describe.skip('PersonalWallet/plutus', () => {
|
|
|
243
227
|
.sign()
|
|
244
228
|
).tx;
|
|
245
229
|
|
|
246
|
-
await wallet
|
|
230
|
+
const [, txFoundInHistory] = await submitAndConfirm(wallet, signedTx, 1);
|
|
247
231
|
|
|
248
232
|
logger.info(
|
|
249
233
|
`Submitted transaction id: ${signedTx.id}, inputs: ${JSON.stringify(
|
|
@@ -253,14 +237,6 @@ describe.skip('PersonalWallet/plutus', () => {
|
|
|
253
237
|
)}.`
|
|
254
238
|
);
|
|
255
239
|
|
|
256
|
-
const txFoundInHistory = await firstValueFrom(
|
|
257
|
-
wallet.transactions.history$.pipe(
|
|
258
|
-
map((txs) => txs.find((tx) => tx.id === signedTx.id)),
|
|
259
|
-
filter(isNotNil),
|
|
260
|
-
take(1)
|
|
261
|
-
)
|
|
262
|
-
);
|
|
263
|
-
|
|
264
240
|
logger.info(`Found transaction id in chain history: ${txFoundInHistory.id}`);
|
|
265
241
|
|
|
266
242
|
// Assert
|
|
@@ -327,7 +303,7 @@ describe.skip('PersonalWallet/plutus', () => {
|
|
|
327
303
|
.sign()
|
|
328
304
|
).tx;
|
|
329
305
|
|
|
330
|
-
await wallet
|
|
306
|
+
const [, txFoundInHistory] = await submitAndConfirm(wallet, signedTx, 1);
|
|
331
307
|
|
|
332
308
|
logger.info(
|
|
333
309
|
`Submitted transaction id: ${signedTx.id}, inputs: ${JSON.stringify(
|
|
@@ -337,14 +313,6 @@ describe.skip('PersonalWallet/plutus', () => {
|
|
|
337
313
|
)}.`
|
|
338
314
|
);
|
|
339
315
|
|
|
340
|
-
const txFoundInHistory = await firstValueFrom(
|
|
341
|
-
wallet.transactions.history$.pipe(
|
|
342
|
-
map((txs) => txs.find((tx) => tx.id === signedTx.id)),
|
|
343
|
-
filter(isNotNil),
|
|
344
|
-
take(1)
|
|
345
|
-
)
|
|
346
|
-
);
|
|
347
|
-
|
|
348
316
|
logger.info(`Found transaction id in chain history: ${txFoundInHistory.id}`);
|
|
349
317
|
|
|
350
318
|
// Assert
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseWallet } from '@cardano-sdk/wallet';
|
|
2
2
|
import { Cardano, CardanoNodeUtil } from '@cardano-sdk/core';
|
|
3
3
|
import { filter, firstValueFrom, map, take } from 'rxjs';
|
|
4
|
-
import { getEnv, getWallet, normalizeTxBody, walletReady, walletVariables } from '../../../src';
|
|
4
|
+
import { getEnv, getWallet, normalizeTxBody, submitAndConfirm, walletReady, walletVariables } from '../../../src';
|
|
5
5
|
import { isNotNil } from '@cardano-sdk/util';
|
|
6
6
|
import { logger } from '@cardano-sdk/util-dev';
|
|
7
7
|
|
|
@@ -28,7 +28,7 @@ describe('PersonalWallet/txChainHistory', () => {
|
|
|
28
28
|
const txBuilder = wallet.createTxBuilder();
|
|
29
29
|
const txOutput = await txBuilder.buildOutput().address(receivingAddress).coin(tAdaToSend).build();
|
|
30
30
|
signedTx = (await txBuilder.addOutput(txOutput).build().sign()).tx;
|
|
31
|
-
await wallet
|
|
31
|
+
await submitAndConfirm(wallet, signedTx, 1);
|
|
32
32
|
|
|
33
33
|
logger.info(
|
|
34
34
|
`Submitted transaction id: ${signedTx.id}, inputs: ${JSON.stringify(
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { BaseWallet, utxoEquals } from '@cardano-sdk/wallet';
|
|
3
3
|
import { createLogger } from '@cardano-sdk/util-dev';
|
|
4
4
|
import { filter, firstValueFrom, map, take } from 'rxjs';
|
|
5
|
-
import { firstValueFromTimed, getEnv, getWallet, walletReady, walletVariables } from '../../../src';
|
|
5
|
+
import { firstValueFromTimed, getEnv, getWallet, submitAndConfirm, walletReady, walletVariables } from '../../../src';
|
|
6
6
|
import { isNotNil } from '@cardano-sdk/util';
|
|
7
7
|
|
|
8
8
|
const env = getEnv(walletVariables);
|
|
@@ -37,17 +37,7 @@ describe('PersonalWallet/unspendableUtxos', () => {
|
|
|
37
37
|
const txOutput = await txBuilder1.buildOutput().address(address).coin(5_000_000n).build();
|
|
38
38
|
|
|
39
39
|
const { tx: signedTx } = await txBuilder1.addOutput(txOutput).build().sign();
|
|
40
|
-
await wallet1
|
|
41
|
-
|
|
42
|
-
// Search chain history to see if the transaction is there.
|
|
43
|
-
let txFoundInHistory = await firstValueFromTimed(
|
|
44
|
-
wallet1.transactions.history$.pipe(
|
|
45
|
-
map((txs) => txs.find((tx) => tx.id === signedTx.id)),
|
|
46
|
-
filter(isNotNil),
|
|
47
|
-
take(1)
|
|
48
|
-
),
|
|
49
|
-
`Failed to find transaction ${signedTx.id} in src wallet history`
|
|
50
|
-
);
|
|
40
|
+
let [, txFoundInHistory] = await submitAndConfirm(wallet1, signedTx, 1);
|
|
51
41
|
|
|
52
42
|
// Find the UTxO in the UTxO set.
|
|
53
43
|
const utxo = await firstValueFromTimed(
|
|
@@ -97,17 +87,7 @@ describe('PersonalWallet/unspendableUtxos', () => {
|
|
|
97
87
|
.addOutput(await txBuilder2.buildOutput().address(address).value(totalBalance).build())
|
|
98
88
|
.build()
|
|
99
89
|
.sign();
|
|
100
|
-
await wallet2
|
|
101
|
-
|
|
102
|
-
// Search chain history to see if the transaction is there.
|
|
103
|
-
txFoundInHistory = await firstValueFromTimed(
|
|
104
|
-
wallet1.transactions.history$.pipe(
|
|
105
|
-
map((txs) => txs.find((tx) => tx.id === signedMoveAdaTx.id)),
|
|
106
|
-
filter(isNotNil),
|
|
107
|
-
take(1)
|
|
108
|
-
),
|
|
109
|
-
`Failed to find second transaction ${signedMoveAdaTx.id} in dest wallet history`
|
|
110
|
-
);
|
|
90
|
+
[, txFoundInHistory] = await submitAndConfirm(wallet2, signedMoveAdaTx, 1);
|
|
111
91
|
|
|
112
92
|
expect(txFoundInHistory.id).toEqual(signedMoveAdaTx.id);
|
|
113
93
|
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
getEnv,
|
|
7
7
|
getWallet,
|
|
8
8
|
normalizeTxBody,
|
|
9
|
+
submitAndConfirm,
|
|
9
10
|
waitForWalletStateSettle,
|
|
10
11
|
walletReady,
|
|
11
12
|
walletVariables
|
|
@@ -52,7 +53,7 @@ describe('SharedWallet/simpleTx', () => {
|
|
|
52
53
|
const txBuilder = faucetWallet.createTxBuilder();
|
|
53
54
|
const txOutput = await txBuilder.buildOutput().address(receivingAddress).coin(initialFunds).build();
|
|
54
55
|
fundingTx = (await txBuilder.addOutput(txOutput).build().sign()).tx;
|
|
55
|
-
await faucetWallet
|
|
56
|
+
await submitAndConfirm(faucetWallet, fundingTx, 1);
|
|
56
57
|
|
|
57
58
|
logger.info(
|
|
58
59
|
`Submitted transaction id: ${fundingTx.id}, inputs: ${JSON.stringify(
|