@cardano-sdk/e2e 0.39.4 → 0.40.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 +16 -16
- package/CHANGELOG.md +14 -0
- package/README.md +32 -32
- package/dist/cjs/environment.d.ts +18 -18
- package/dist/cjs/environment.d.ts.map +1 -1
- package/dist/cjs/environment.js +32 -32
- package/dist/cjs/environment.js.map +1 -1
- package/dist/cjs/factories.d.ts.map +1 -1
- package/dist/cjs/factories.js +17 -17
- package/dist/cjs/factories.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/cjs/util/util.d.ts.map +1 -1
- package/dist/cjs/util/util.js +3 -2
- package/dist/cjs/util/util.js.map +1 -1
- package/dist/esm/environment.d.ts +18 -18
- package/dist/esm/environment.d.ts.map +1 -1
- package/dist/esm/environment.js +32 -32
- package/dist/esm/environment.js.map +1 -1
- package/dist/esm/factories.d.ts.map +1 -1
- package/dist/esm/factories.js +17 -17
- package/dist/esm/factories.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/util/util.d.ts.map +1 -1
- package/dist/esm/util/util.js +3 -2
- package/dist/esm/util/util.js.map +1 -1
- package/package.json +19 -19
- package/src/environment.ts +32 -32
- package/src/factories.ts +58 -26
- package/src/scripts/generate-dotenv.sh +29 -16
- package/src/util/util.ts +8 -3
- package/test/k6/endpoints/asset/get-assets.test.js +17 -31
- package/test/k6/scenarios/wallets.test.js +44 -103
- package/test/k6/scenarios/web-socket.test.js +5 -9
- package/test/load-test-custom/wallet-init/wallet-init.test.ts +26 -10
- package/test/long-running/multisig-wallet/MultiSigWallet.ts +1 -4
- package/test/ogmios/ogmios-interactions.test.ts +6 -4
- package/test/providers/HandleProvider.test.ts +3 -3
- package/test/wallet_epoch_0/PersonalWallet/plutusTest.test.ts +10 -2
- package/test/wallet_epoch_0/SharedWallet/utils.ts +2 -8
- package/test/web-extension/extension/background/services.ts +2 -2
- package/test/web-extension/extension/background/supplyDistributionTracker.ts +2 -2
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
/* eslint-disable func-style */
|
|
3
|
+
|
|
4
|
+
// K6 scripts use a custom js runtime. I am importing the module like this to avoid
|
|
5
|
+
// introducing a bundler specifically for the K6 tests.
|
|
6
|
+
import * as k6Utils from '../../../../util-dev/dist/cjs/k6-utils.js';
|
|
3
7
|
import { Counter, Trend } from 'k6/metrics';
|
|
4
8
|
import { SharedArray } from 'k6/data';
|
|
5
|
-
import { check, sleep } from 'k6';
|
|
6
9
|
import { apiVersion } from '../../../../cardano-services-client/src/version.ts';
|
|
10
|
+
import { check, sleep } from 'k6';
|
|
7
11
|
import http from 'k6/http';
|
|
8
12
|
|
|
9
13
|
/**
|
|
@@ -30,34 +34,36 @@ import http from 'k6/http';
|
|
|
30
34
|
* - wallet_sync_count: is a custom count metric measuring the number of wallets that were successfully synced.
|
|
31
35
|
*/
|
|
32
36
|
|
|
37
|
+
// eslint-disable-next-line no-undef
|
|
38
|
+
const K6_ENV = __ENV;
|
|
39
|
+
|
|
33
40
|
const RunMode = {
|
|
34
41
|
Onboard: 'Onboard',
|
|
35
42
|
Restore: 'Restore',
|
|
36
43
|
RestoreHD: 'RestoreHD'
|
|
37
44
|
};
|
|
38
45
|
/** Determines run mode: Restore or Onboard */
|
|
39
|
-
const RUN_MODE =
|
|
46
|
+
const RUN_MODE = K6_ENV.RUN_MODE || RunMode.Restore;
|
|
40
47
|
|
|
41
48
|
// eslint-disable-next-line no-undef
|
|
42
|
-
const
|
|
49
|
+
const dut = k6Utils.getDut(K6_ENV, { environments: ['dev'], networks: ['mainnet', 'preprod'] });
|
|
50
|
+
const sdkCom = new k6Utils.SdkCom({ apiVersion, dut, k6Http: http });
|
|
43
51
|
|
|
44
52
|
/** Wallet addresses extracted from the JSON dump file */
|
|
45
|
-
const walletsOrig = new SharedArray('walletsData',
|
|
46
|
-
const
|
|
47
|
-
const fileName = RUN_MODE === RunMode.Onboard ? `no-history-${network}.json` : `${network}.json`;
|
|
53
|
+
const walletsOrig = new SharedArray('walletsData', () => {
|
|
54
|
+
const fileName = RUN_MODE === RunMode.Onboard ? `no-history-${K6_ENV.TARGET_NET}.json` : `${K6_ENV.TARGET_NET}.json`;
|
|
48
55
|
console.log(`Reading wallet addresses from ${fileName}`);
|
|
49
|
-
|
|
50
|
-
return
|
|
56
|
+
// eslint-disable-next-line no-undef
|
|
57
|
+
return JSON.parse(open(`../../dump/addresses/${fileName}`));
|
|
51
58
|
});
|
|
52
59
|
|
|
53
|
-
|
|
54
60
|
/** Stake pool addresses from the JSON dump file */
|
|
55
|
-
const poolAddresses = new SharedArray('poolsData',
|
|
61
|
+
const poolAddresses = new SharedArray('poolsData', () =>
|
|
56
62
|
// There is no dump of preprod pools, but it is ok. Pool address is used only in "Restore" mode
|
|
57
63
|
// and it is used to do a stake pool search call, so any pool will do
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
64
|
+
// eslint-disable-next-line no-undef
|
|
65
|
+
JSON.parse(open('../../dump/pool_addresses/mainnet.json'))
|
|
66
|
+
);
|
|
61
67
|
|
|
62
68
|
/**
|
|
63
69
|
* Define the maximum number of virtual users to simulate
|
|
@@ -65,12 +71,12 @@ const poolAddresses = new SharedArray('poolsData', function () {
|
|
|
65
71
|
* For this reason, it's a good practice to configure MAX_VUs in multiples of 100 in order to maintain the desired distribution.
|
|
66
72
|
* In `RunMode.RestoreHD`, each VU will have multiple addresses.
|
|
67
73
|
*/
|
|
68
|
-
const MAX_VU =
|
|
74
|
+
const MAX_VU = K6_ENV.MAX_VU || 1;
|
|
69
75
|
|
|
70
76
|
/** Time span during which all virtual users are started in a linear fashion */
|
|
71
|
-
const RAMP_UP_DURATION =
|
|
77
|
+
const RAMP_UP_DURATION = K6_ENV.RAMP_UP_DURATION || '1s';
|
|
72
78
|
/** Time span during which synced wallets do tip queries */
|
|
73
|
-
const STEADY_STATE_DURATION =
|
|
79
|
+
const STEADY_STATE_DURATION = K6_ENV.STEADY_STATE_DURATION || '2s';
|
|
74
80
|
|
|
75
81
|
/** Time to sleep between iterations. Simulates polling tip to keep wallet in sync */
|
|
76
82
|
const ITERATION_SLEEP = 5;
|
|
@@ -78,9 +84,9 @@ const ITERATION_SLEEP = 5;
|
|
|
78
84
|
/** HD wallet discovery. Used when RunMode is `RestoreHD` */
|
|
79
85
|
const hdWalletParams = {
|
|
80
86
|
/** HD wallet size. The number of addresses with transaction history per wallet. They are queried at discover time. */
|
|
81
|
-
activeAddrCount:
|
|
87
|
+
activeAddrCount: K6_ENV.HD_ACTIVE_ADDR_COUNT || 1,
|
|
82
88
|
/** Use only addresses with a transaction history up to this value */
|
|
83
|
-
maxTxHistory:
|
|
89
|
+
maxTxHistory: K6_ENV.HD_MAX_TX_HISTORY || 1,
|
|
84
90
|
/** number of payment addresses to search for. It will search both internal and external address, thus multiplied by 2 */
|
|
85
91
|
paymentAddrSearchGap: 20 * 2,
|
|
86
92
|
/** number of stake keys to search for. It will search both internal and external address, thus multiplied by 2 */
|
|
@@ -92,19 +98,6 @@ const walletSyncTrend = new Trend('wallet_sync', true);
|
|
|
92
98
|
/** Custom count statistic to measure how many wallets were successfully syncd */
|
|
93
99
|
const walletSyncCount = new Counter('wallet_sync_count');
|
|
94
100
|
|
|
95
|
-
/** Repetitive endpoints */
|
|
96
|
-
const TIP_URL = 'network-info/ledger-tip';
|
|
97
|
-
|
|
98
|
-
/** equivalent to lodash.chunk */
|
|
99
|
-
const chunkArray = (array, chunkSize) => {
|
|
100
|
-
const arrayCopy = [...array];
|
|
101
|
-
const chunked = [];
|
|
102
|
-
while (arrayCopy.length > 0) {
|
|
103
|
-
chunked.push(arrayCopy.splice(0, chunkSize));
|
|
104
|
-
}
|
|
105
|
-
return chunked;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
101
|
/** Grab the wallets json file to be used by the scenario. Group the addresses per wallet (single address or HD wallets). */
|
|
109
102
|
export function setup() {
|
|
110
103
|
console.log(`Running in ${RUN_MODE} mode`);
|
|
@@ -121,13 +114,13 @@ export function setup() {
|
|
|
121
114
|
console.log(`Wallet addresses configuration file contains ${walletsOrigCount} addresses`);
|
|
122
115
|
|
|
123
116
|
// One wallet, one address
|
|
124
|
-
let wallets = chunkArray(walletsOrig, 1);
|
|
117
|
+
let wallets = k6Utils.chunkArray(walletsOrig, 1);
|
|
125
118
|
if (RUN_MODE === RunMode.RestoreHD) {
|
|
126
119
|
// One wallet, multiple addresses
|
|
127
120
|
// Remove "big transaction history wallets"
|
|
128
121
|
const filteredWallets = walletsOrig.filter(({ tx_count }) => tx_count < hdWalletParams.maxTxHistory);
|
|
129
122
|
// Create chunks of `activeAddrCount` addresses per HD wallet
|
|
130
|
-
wallets = chunkArray(filteredWallets, hdWalletParams.activeAddrCount);
|
|
123
|
+
wallets = k6Utils.chunkArray(filteredWallets, hdWalletParams.activeAddrCount);
|
|
131
124
|
}
|
|
132
125
|
|
|
133
126
|
const requestedAddrCount = RUN_MODE === RunMode.RestoreHD ? MAX_VU * hdWalletParams.activeAddrCount : MAX_VU;
|
|
@@ -177,59 +170,6 @@ export const options = {
|
|
|
177
170
|
}
|
|
178
171
|
};
|
|
179
172
|
|
|
180
|
-
/** Util functions for sending the http post requests to cardano-sdk services */
|
|
181
|
-
const cardanoHttpPost = (url, apiVer, body = {}) => {
|
|
182
|
-
const opts = { headers: { 'content-type': 'application/json' } };
|
|
183
|
-
return http.post(`${PROVIDER_SERVER_URL}/v${apiVer}/${url}`, JSON.stringify(body), opts);
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
*
|
|
188
|
-
* @param addresses Bech32 cardano addresses: `Cardano.Address[]`
|
|
189
|
-
* @param takeOne true: query only the first page; false: query until no more pages
|
|
190
|
-
* @param pageSize Use as request page size. Also, bundle this many addresses on each request.
|
|
191
|
-
*/
|
|
192
|
-
const txsByAddress = (addresses, takeOne = false, pageSize = 25) => {
|
|
193
|
-
const addressChunks = chunkArray(addresses, pageSize);
|
|
194
|
-
for (const chunk of addressChunks) {
|
|
195
|
-
let startAt = 0;
|
|
196
|
-
let txCount = 0;
|
|
197
|
-
|
|
198
|
-
do {
|
|
199
|
-
const resp = cardanoHttpPost('chain-history/txs/by-addresses', apiVersion.chainHistory, {
|
|
200
|
-
addresses: chunk,
|
|
201
|
-
blockRange: { lowerBound: { __type: 'undefined' } },
|
|
202
|
-
pagination: { limit: pageSize, startAt }
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
if (resp.status !== 200) {
|
|
206
|
-
// No point in trying to get the other pages.
|
|
207
|
-
// Should we log this? it will show up as if the restoration was quicker since this wallet did not fetch all the pages
|
|
208
|
-
break;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
const { pageResults } = JSON.parse(resp.body);
|
|
212
|
-
startAt += pageSize;
|
|
213
|
-
txCount = pageResults.length;
|
|
214
|
-
} while (txCount === pageSize && !takeOne);
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
const utxosByAddresses = (addresses) => {
|
|
219
|
-
const addressChunks = chunkArray(addresses, 25);
|
|
220
|
-
for (const chunk of addressChunks) {
|
|
221
|
-
cardanoHttpPost('utxo/utxo-by-addresses', apiVersion.utxo, { addresses: chunk });
|
|
222
|
-
}
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
const rewardsAccBalance = (rewardAccount) =>
|
|
226
|
-
cardanoHttpPost('rewards/account-balance', apiVersion.rewards, { rewardAccount });
|
|
227
|
-
const stakePoolSearch = (poolAddress) =>
|
|
228
|
-
cardanoHttpPost('stake-pool/search', apiVersion.stakePool, {
|
|
229
|
-
filters: { identifier: { values: [{ id: poolAddress }] } },
|
|
230
|
-
pagination: { limit: 1, startAt: 0 }
|
|
231
|
-
});
|
|
232
|
-
|
|
233
173
|
/**
|
|
234
174
|
* Changes the last 3 chars. Checksum will be broken but I assume it is not verified
|
|
235
175
|
* Avoiding to import keyagent here to generate actual addresses as it would be difficult to do it
|
|
@@ -255,21 +195,21 @@ const walletDiscovery = (wallet) => {
|
|
|
255
195
|
console.debug('Discover stake keys on payment #0');
|
|
256
196
|
for (let i = 0; i < hdWalletParams.stakeAddrSearchGap; i++) {
|
|
257
197
|
const addr = getDummyAddr(wallet[0].address, i);
|
|
258
|
-
txsByAddress([addr], true, 1);
|
|
198
|
+
sdkCom.txsByAddress([addr], true, 1);
|
|
259
199
|
}
|
|
260
200
|
|
|
261
201
|
// Discover active payment addresses
|
|
262
202
|
console.debug('Discover payment addresses #1+');
|
|
263
203
|
for (const { address } of wallet) {
|
|
264
204
|
// Even if txByAddresses accepts multiple addresses, discovery does it one by one
|
|
265
|
-
txsByAddress([address], true, 1);
|
|
205
|
+
sdkCom.txsByAddress([address], true, 1);
|
|
266
206
|
}
|
|
267
207
|
|
|
268
208
|
// Discover calls in payment address gap
|
|
269
209
|
console.debug('Discover in search gap');
|
|
270
210
|
for (let i = 0; i < hdWalletParams.paymentAddrSearchGap; i++) {
|
|
271
211
|
const addr = getDummyAddr(wallet[0].address, i, 'hm');
|
|
272
|
-
txsByAddress([addr], true, 1);
|
|
212
|
+
sdkCom.txsByAddress([addr], true, 1);
|
|
273
213
|
}
|
|
274
214
|
};
|
|
275
215
|
|
|
@@ -282,22 +222,22 @@ const syncWallet = ({ wallet, poolAddress }) => {
|
|
|
282
222
|
walletDiscovery(wallet);
|
|
283
223
|
}
|
|
284
224
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
txsByAddress(addresses);
|
|
288
|
-
utxosByAddresses(addresses);
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
225
|
+
sdkCom.eraSummaries();
|
|
226
|
+
sdkCom.tip();
|
|
227
|
+
sdkCom.txsByAddress(addresses);
|
|
228
|
+
sdkCom.utxosByAddresses(addresses);
|
|
229
|
+
sdkCom.eraSummaries();
|
|
230
|
+
sdkCom.genesisParameters();
|
|
231
|
+
sdkCom.protocolParameters();
|
|
292
232
|
// Test restoring HD wallets with a single stake key
|
|
293
|
-
rewardsAccBalance(wallet[0].stake_address);
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
233
|
+
sdkCom.rewardsAccBalance(wallet[0].stake_address);
|
|
234
|
+
sdkCom.tip();
|
|
235
|
+
sdkCom.lovelaceSupply();
|
|
236
|
+
sdkCom.stake();
|
|
297
237
|
if (RUN_MODE === RunMode.Restore) {
|
|
298
|
-
stakePoolSearch(poolAddress);
|
|
238
|
+
sdkCom.stakePoolSearch(poolAddress);
|
|
299
239
|
}
|
|
300
|
-
|
|
240
|
+
sdkCom.stats();
|
|
301
241
|
|
|
302
242
|
// Consider the wallet synced by tracking its first address
|
|
303
243
|
syncedWallets.add(addresses[0]);
|
|
@@ -306,7 +246,7 @@ const syncWallet = ({ wallet, poolAddress }) => {
|
|
|
306
246
|
};
|
|
307
247
|
|
|
308
248
|
/** Simulate keeping wallet in sync For now, just polling the tip */
|
|
309
|
-
const emulateIdleClient = () =>
|
|
249
|
+
const emulateIdleClient = () => sdkCom.tip();
|
|
310
250
|
|
|
311
251
|
/**
|
|
312
252
|
* K6 default VU action function
|
|
@@ -314,6 +254,7 @@ const emulateIdleClient = () => cardanoHttpPost(TIP_URL, apiVersion.networkInfo)
|
|
|
314
254
|
* wallets: {address: Cardano.Address, stake_address: Cardano.RewardAccount, tx_count: number}[][]
|
|
315
255
|
* poolAddresses: Cardano.PoolId[]
|
|
316
256
|
*/
|
|
257
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
317
258
|
export default function ({ wallets, poolAddresses }) {
|
|
318
259
|
// Get the wallet for the current virtual user
|
|
319
260
|
// eslint-disable-next-line no-undef
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as k6Utils from '../../../../util-dev/dist/cjs/k6-utils.js';
|
|
3
2
|
import { Counter, Trend } from 'k6/metrics';
|
|
4
3
|
import { check } from 'k6';
|
|
5
4
|
import ws from 'k6/ws';
|
|
6
5
|
|
|
7
6
|
// eslint-disable-next-line no-undef
|
|
8
|
-
const {
|
|
9
|
-
|
|
7
|
+
const { WALLETS } = Object.assign({ WALLETS: '10000' }, __ENV);
|
|
8
|
+
// eslint-disable-next-line no-undef
|
|
9
|
+
const dut = k6Utils.getDut(__ENV);
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
throw new Error(`Not valid TARGET_ENV: ${TARGET_ENV}`);
|
|
13
|
-
if (TARGET_NET && !['preview', 'preprod', 'sanchonet', 'mainnet'].includes(TARGET_NET))
|
|
14
|
-
throw new Error(`Not valid TARGET_NET: ${TARGET_NET}`);
|
|
15
|
-
if (!(TARGET_ENV && TARGET_NET) && !URL) throw new Error('Please specify both TARGET_ENV and TARGET_NET or URL');
|
|
11
|
+
const url = `wss://${dut}/ws`;
|
|
16
12
|
|
|
17
13
|
export const options = {
|
|
18
14
|
ext: {
|
|
@@ -45,25 +45,41 @@ const measurementUtil = new MeasurementUtil<keyof typeof MeasureTarget>();
|
|
|
45
45
|
|
|
46
46
|
// Utility methods to help setup the test. They could be part of another file
|
|
47
47
|
const getProviders = async () => ({
|
|
48
|
-
assetProvider: await assetProviderFactory.create(
|
|
48
|
+
assetProvider: await assetProviderFactory.create(
|
|
49
|
+
env.TEST_CLIENT_ASSET_PROVIDER,
|
|
50
|
+
env.TEST_CLIENT_ASSET_PROVIDER_PARAMS,
|
|
51
|
+
logger
|
|
52
|
+
),
|
|
49
53
|
chainHistoryProvider: await chainHistoryProviderFactory.create(
|
|
50
|
-
env.
|
|
51
|
-
env.
|
|
54
|
+
env.TEST_CLIENT_CHAIN_HISTORY_PROVIDER,
|
|
55
|
+
env.TEST_CLIENT_CHAIN_HISTORY_PROVIDER_PARAMS,
|
|
52
56
|
logger
|
|
53
57
|
),
|
|
54
58
|
networkInfoProvider: await networkInfoProviderFactory.create(
|
|
55
|
-
env.
|
|
56
|
-
env.
|
|
59
|
+
env.TEST_CLIENT_NETWORK_INFO_PROVIDER,
|
|
60
|
+
env.TEST_CLIENT_NETWORK_INFO_PROVIDER_PARAMS,
|
|
61
|
+
logger
|
|
62
|
+
),
|
|
63
|
+
rewardsProvider: await rewardsProviderFactory.create(
|
|
64
|
+
env.TEST_CLIENT_REWARDS_PROVIDER,
|
|
65
|
+
env.TEST_CLIENT_REWARDS_PROVIDER_PARAMS,
|
|
57
66
|
logger
|
|
58
67
|
),
|
|
59
|
-
rewardsProvider: await rewardsProviderFactory.create(env.REWARDS_PROVIDER, env.REWARDS_PROVIDER_PARAMS, logger),
|
|
60
68
|
stakePoolProvider: await stakePoolProviderFactory.create(
|
|
61
|
-
env.
|
|
62
|
-
env.
|
|
69
|
+
env.TEST_CLIENT_STAKE_POOL_PROVIDER,
|
|
70
|
+
env.TEST_CLIENT_STAKE_POOL_PROVIDER_PARAMS,
|
|
63
71
|
logger
|
|
64
72
|
),
|
|
65
|
-
txSubmitProvider: await txSubmitProviderFactory.create(
|
|
66
|
-
|
|
73
|
+
txSubmitProvider: await txSubmitProviderFactory.create(
|
|
74
|
+
env.TEST_CLIENT_TX_SUBMIT_PROVIDER,
|
|
75
|
+
env.TEST_CLIENT_TX_SUBMIT_PROVIDER_PARAMS,
|
|
76
|
+
logger
|
|
77
|
+
),
|
|
78
|
+
utxoProvider: await utxoProviderFactory.create(
|
|
79
|
+
env.TEST_CLIENT_UTXO_PROVIDER,
|
|
80
|
+
env.TEST_CLIENT_UTXO_PROVIDER_PARAMS,
|
|
81
|
+
logger
|
|
82
|
+
)
|
|
67
83
|
});
|
|
68
84
|
|
|
69
85
|
const getKeyAgent = async (accountIndex: number) => {
|
|
@@ -211,10 +211,7 @@ export class MultiSigWallet {
|
|
|
211
211
|
async sign(multiSigTx: MultiSigTx): Promise<MultiSigTx> {
|
|
212
212
|
const currentSignatures = multiSigTx.getTransaction().witness.signatures;
|
|
213
213
|
const newSignatures = await this.#inMemoryKeyAgent.signTransaction(
|
|
214
|
-
|
|
215
|
-
body: multiSigTx.getTransaction().body,
|
|
216
|
-
hash: multiSigTx.getTransaction().id
|
|
217
|
-
},
|
|
214
|
+
Serialization.TransactionBody.fromCore(multiSigTx.getTransaction().body),
|
|
218
215
|
{ knownAddresses: [this.#address], txInKeyPathMap: {} },
|
|
219
216
|
{ additionalKeyPaths: [DERIVATION_PATH] }
|
|
220
217
|
);
|
|
@@ -167,17 +167,19 @@ describe('interactions with ogmios server', () => {
|
|
|
167
167
|
});
|
|
168
168
|
|
|
169
169
|
it('connection close is correctly handled', async () => {
|
|
170
|
-
const providerEnv = getEnv(['
|
|
170
|
+
const providerEnv = getEnv(['TEST_CLIENT_NETWORK_INFO_PROVIDER', 'TEST_CLIENT_NETWORK_INFO_PROVIDER_PARAMS'], {
|
|
171
171
|
override: {
|
|
172
|
-
|
|
172
|
+
TEST_CLIENT_NETWORK_INFO_PROVIDER_PARAMS: JSON.stringify({
|
|
173
|
+
baseUrl: `http://localhost:${httpPort}/network-info`
|
|
174
|
+
})
|
|
173
175
|
}
|
|
174
176
|
});
|
|
175
177
|
|
|
176
178
|
// This performs an health check behind the scenes, so this is enough
|
|
177
179
|
// to establish and use the WebSocket connection to the ogmios server
|
|
178
180
|
const networkInfoProvider = await networkInfoProviderFactory.create(
|
|
179
|
-
providerEnv.
|
|
180
|
-
providerEnv.
|
|
181
|
+
providerEnv.TEST_CLIENT_NETWORK_INFO_PROVIDER,
|
|
182
|
+
providerEnv.TEST_CLIENT_NETWORK_INFO_PROVIDER_PARAMS,
|
|
181
183
|
logger
|
|
182
184
|
);
|
|
183
185
|
|
|
@@ -13,7 +13,7 @@ describe('HandleProvider', () => {
|
|
|
13
13
|
const policyId = fs.readFileSync(policyPath, 'utf8').toString().trim();
|
|
14
14
|
const handleName = 'hellohandle'; // handle minted in mint-handles.sh
|
|
15
15
|
const handleName2 = 'testhandle';
|
|
16
|
-
const config = { baseUrl: env.
|
|
16
|
+
const config = { baseUrl: env.TEST_CLIENT_HANDLE_PROVIDER_PARAMS.baseUrl, logger };
|
|
17
17
|
const handleProvider = handleHttpProvider(config);
|
|
18
18
|
const handle = await handleProvider.resolveHandles({ handles: [handleName, handleName2] });
|
|
19
19
|
expect(handle.length).toEqual(2);
|
|
@@ -24,14 +24,14 @@ describe('HandleProvider', () => {
|
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
it('resolves non existent handle with null', async () => {
|
|
27
|
-
const config = { baseUrl: env.
|
|
27
|
+
const config = { baseUrl: env.TEST_CLIENT_HANDLE_PROVIDER_PARAMS.baseUrl, logger };
|
|
28
28
|
const handleProvider = handleHttpProvider(config);
|
|
29
29
|
const handle = await handleProvider.resolveHandles({ handles: ['nonexistent'] });
|
|
30
30
|
expect(handle).toEqual([null]);
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
it('allows request an empty list of handles', async () => {
|
|
34
|
-
const config = { baseUrl: env.
|
|
34
|
+
const config = { baseUrl: env.TEST_CLIENT_HANDLE_PROVIDER_PARAMS.baseUrl, logger };
|
|
35
35
|
const handleProvider = handleHttpProvider(config);
|
|
36
36
|
const handle = await handleProvider.resolveHandles({ handles: [] });
|
|
37
37
|
expect(handle.length).toEqual(0);
|
|
@@ -193,7 +193,11 @@ describe.skip('PersonalWallet/plutus', () => {
|
|
|
193
193
|
it('can spend balance from a plutus script', async () => {
|
|
194
194
|
wallet = (await getWallet({ env, logger, name: 'Spending Wallet', polling: { interval: 50 } })).wallet;
|
|
195
195
|
// UTXO provider can be use to fetch the UTXO set from the script address.
|
|
196
|
-
const utxoProvider = await utxoProviderFactory.create(
|
|
196
|
+
const utxoProvider = await utxoProviderFactory.create(
|
|
197
|
+
env.TEST_CLIENT_UTXO_PROVIDER,
|
|
198
|
+
env.TEST_CLIENT_UTXO_PROVIDER_PARAMS,
|
|
199
|
+
logger
|
|
200
|
+
);
|
|
197
201
|
|
|
198
202
|
// Plutus script that always returns true.
|
|
199
203
|
const alwaysSucceedsScript: Cardano.PlutusScript = {
|
|
@@ -267,7 +271,11 @@ describe.skip('PersonalWallet/plutus', () => {
|
|
|
267
271
|
it('can spend balance from a plutus script using a reference script', async () => {
|
|
268
272
|
wallet = (await getWallet({ env, logger, name: 'Spending Wallet', polling: { interval: 50 } })).wallet;
|
|
269
273
|
// UTXO provider can be use to fetch the UTXO set from the script address.
|
|
270
|
-
const utxoProvider = await utxoProviderFactory.create(
|
|
274
|
+
const utxoProvider = await utxoProviderFactory.create(
|
|
275
|
+
env.TEST_CLIENT_UTXO_PROVIDER,
|
|
276
|
+
env.TEST_CLIENT_UTXO_PROVIDER_PARAMS,
|
|
277
|
+
logger
|
|
278
|
+
);
|
|
271
279
|
|
|
272
280
|
const midnightClaimScript: Cardano.PlutusScript = {
|
|
273
281
|
__type: Cardano.ScriptType.Plutus,
|
|
@@ -176,10 +176,7 @@ const createWitnessData = async (
|
|
|
176
176
|
): Promise<Cardano.Witness> => ({
|
|
177
177
|
scripts: [paymentScript, stakingScript],
|
|
178
178
|
signatures: await keyAgent.signTransaction(
|
|
179
|
-
|
|
180
|
-
body: tx.body().toCore(),
|
|
181
|
-
hash: tx.getId()
|
|
182
|
-
},
|
|
179
|
+
tx.body(),
|
|
183
180
|
context,
|
|
184
181
|
{ ...options, additionalKeyPaths: [...(options?.additionalKeyPaths ?? []), DERIVATION_PATH] } // The key agent wont be able to find the right key if we don't provide the derivation path.
|
|
185
182
|
)
|
|
@@ -244,10 +241,7 @@ export class SharedWalletWitnesser implements Witnesser {
|
|
|
244
241
|
const extraSignatures: Cardano.Signatures = new Map();
|
|
245
242
|
if (options?.extraSigners) {
|
|
246
243
|
for (const extraSigner of options?.extraSigners) {
|
|
247
|
-
const extraSignature = await extraSigner.sign(
|
|
248
|
-
body: coreTx.body,
|
|
249
|
-
hash
|
|
250
|
-
});
|
|
244
|
+
const extraSignature = await extraSigner.sign(tx.body());
|
|
251
245
|
extraSignatures.set(extraSignature.pubKey, extraSignature.signature);
|
|
252
246
|
}
|
|
253
247
|
}
|
|
@@ -16,8 +16,8 @@ const priceService: BackgroundServices = {
|
|
|
16
16
|
clearAllowList: authenticator.clear.bind(authenticator),
|
|
17
17
|
getPoolIds: async (count: number): Promise<Cardano.StakePool[]> => {
|
|
18
18
|
const stakePoolProvider = await stakePoolProviderFactory.create(
|
|
19
|
-
env.
|
|
20
|
-
env.
|
|
19
|
+
env.TEST_CLIENT_STAKE_POOL_PROVIDER,
|
|
20
|
+
env.TEST_CLIENT_STAKE_POOL_PROVIDER_PARAMS,
|
|
21
21
|
logger
|
|
22
22
|
);
|
|
23
23
|
|
|
@@ -12,8 +12,8 @@ export const supplyDistributionTrackerReady = (async () =>
|
|
|
12
12
|
{
|
|
13
13
|
logger,
|
|
14
14
|
networkInfoProvider: await networkInfoProviderFactory.create(
|
|
15
|
-
env.
|
|
16
|
-
env.
|
|
15
|
+
env.TEST_CLIENT_NETWORK_INFO_PROVIDER,
|
|
16
|
+
env.TEST_CLIENT_NETWORK_INFO_PROVIDER_PARAMS,
|
|
17
17
|
logger
|
|
18
18
|
),
|
|
19
19
|
stores: storage.createPouchDbSupplyDistributionStores(walletName, { logger })
|