@cardano-sdk/e2e 0.29.1 → 0.31.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/docker-compose.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cardano-sdk/e2e",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
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.
|
|
84
|
-
"@cardano-sdk/cardano-services-client": "~0.16.
|
|
83
|
+
"@cardano-sdk/cardano-services": "~0.25.0",
|
|
84
|
+
"@cardano-sdk/cardano-services-client": "~0.16.6",
|
|
85
85
|
"@cardano-sdk/core": "~0.23.1",
|
|
86
86
|
"@cardano-sdk/crypto": "~0.1.19",
|
|
87
|
-
"@cardano-sdk/hardware-ledger": "~0.8.
|
|
88
|
-
"@cardano-sdk/hardware-trezor": "~0.4.
|
|
89
|
-
"@cardano-sdk/input-selection": "~0.12.
|
|
90
|
-
"@cardano-sdk/key-management": "~0.
|
|
91
|
-
"@cardano-sdk/ogmios": "~0.15.
|
|
92
|
-
"@cardano-sdk/tx-construction": "~0.17.
|
|
87
|
+
"@cardano-sdk/hardware-ledger": "~0.8.6",
|
|
88
|
+
"@cardano-sdk/hardware-trezor": "~0.4.6",
|
|
89
|
+
"@cardano-sdk/input-selection": "~0.12.13",
|
|
90
|
+
"@cardano-sdk/key-management": "~0.19.0",
|
|
91
|
+
"@cardano-sdk/ogmios": "~0.15.8",
|
|
92
|
+
"@cardano-sdk/tx-construction": "~0.17.3",
|
|
93
93
|
"@cardano-sdk/util": "~0.14.5",
|
|
94
|
-
"@cardano-sdk/util-dev": "~0.19.
|
|
95
|
-
"@cardano-sdk/util-rxjs": "~0.6.
|
|
96
|
-
"@cardano-sdk/wallet": "~0.
|
|
94
|
+
"@cardano-sdk/util-dev": "~0.19.6",
|
|
95
|
+
"@cardano-sdk/util-rxjs": "~0.6.9",
|
|
96
|
+
"@cardano-sdk/wallet": "~0.30.0",
|
|
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",
|
|
@@ -124,9 +124,9 @@
|
|
|
124
124
|
"@babel/preset-env": "^7.18.2",
|
|
125
125
|
"@babel/preset-typescript": "^7.17.12",
|
|
126
126
|
"@cardano-sdk/dapp-connector": "~0.12.2",
|
|
127
|
-
"@cardano-sdk/projection": "~0.10.
|
|
128
|
-
"@cardano-sdk/projection-typeorm": "~0.
|
|
129
|
-
"@cardano-sdk/web-extension": "~0.
|
|
127
|
+
"@cardano-sdk/projection": "~0.10.8",
|
|
128
|
+
"@cardano-sdk/projection-typeorm": "~0.8.0",
|
|
129
|
+
"@cardano-sdk/web-extension": "~0.22.0",
|
|
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",
|
|
@@ -179,5 +179,5 @@
|
|
|
179
179
|
"webpack-cli": "^4.9.2",
|
|
180
180
|
"webpack-merge": "^5.8.0"
|
|
181
181
|
},
|
|
182
|
-
"gitHead": "
|
|
182
|
+
"gitHead": "69e4fe9f69a5354208d3f02c9829b4a0feb689b1"
|
|
183
183
|
}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
WalletManagerActivateProps,
|
|
7
7
|
WalletRepository,
|
|
8
8
|
WalletType,
|
|
9
|
-
|
|
9
|
+
consumeSigningCoordinatorApi,
|
|
10
10
|
exposeApi,
|
|
11
11
|
observableWalletProperties,
|
|
12
12
|
repositoryChannel,
|
|
@@ -38,7 +38,7 @@ export interface WalletFactoryDependencies {
|
|
|
38
38
|
* @param accountIndex The account index to get the name from.
|
|
39
39
|
* @private
|
|
40
40
|
*/
|
|
41
|
-
const getWalletName = (wallet: AnyWallet<Metadata>, accountIndex?: number): string => {
|
|
41
|
+
const getWalletName = (wallet: AnyWallet<Metadata, Metadata>, accountIndex?: number): string => {
|
|
42
42
|
let name = '';
|
|
43
43
|
switch (wallet.type) {
|
|
44
44
|
case WalletType.InMemory:
|
|
@@ -68,10 +68,10 @@ const getWalletName = (wallet: AnyWallet<Metadata>, accountIndex?: number): stri
|
|
|
68
68
|
* to construct providers for different networks.
|
|
69
69
|
* Please check its documentation for examples.
|
|
70
70
|
*/
|
|
71
|
-
const walletFactory: WalletFactory<Metadata> = {
|
|
71
|
+
const walletFactory: WalletFactory<Metadata, Metadata> = {
|
|
72
72
|
create: async (
|
|
73
73
|
props: WalletManagerActivateProps,
|
|
74
|
-
wallet: AnyWallet<Metadata>,
|
|
74
|
+
wallet: AnyWallet<Metadata, Metadata>,
|
|
75
75
|
{ witnesser, stores }: WalletFactoryDependencies
|
|
76
76
|
) =>
|
|
77
77
|
(
|
|
@@ -89,20 +89,20 @@ const storesFactory: StoresFactory = {
|
|
|
89
89
|
create: ({ name }) => storage.createPouchDbWalletStores(name, { logger })
|
|
90
90
|
};
|
|
91
91
|
|
|
92
|
-
const walletRepository = new WalletRepository<Metadata>({
|
|
92
|
+
const walletRepository = new WalletRepository<Metadata, Metadata>({
|
|
93
93
|
logger,
|
|
94
94
|
store: new storage.InMemoryCollectionStore()
|
|
95
95
|
});
|
|
96
96
|
|
|
97
|
-
const
|
|
97
|
+
const signingCoordinatorApi = consumeSigningCoordinatorApi({ logger, runtime });
|
|
98
98
|
|
|
99
|
-
const walletManager = new WalletManager<Metadata>(
|
|
99
|
+
const walletManager = new WalletManager<Metadata, Metadata>(
|
|
100
100
|
{ name: walletName },
|
|
101
101
|
{
|
|
102
102
|
logger,
|
|
103
103
|
managerStorage: WebExtensionStorage.local,
|
|
104
104
|
runtime,
|
|
105
|
-
|
|
105
|
+
signingCoordinatorApi,
|
|
106
106
|
storesFactory,
|
|
107
107
|
walletFactory,
|
|
108
108
|
walletRepository
|
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
} from './util';
|
|
10
10
|
import {
|
|
11
11
|
RemoteApiPropertyType,
|
|
12
|
-
|
|
12
|
+
SigningCoordinator,
|
|
13
13
|
WalletType,
|
|
14
14
|
consumeRemoteApi,
|
|
15
15
|
consumeSupplyDistributionTracker,
|
|
16
16
|
createKeyAgentFactory,
|
|
17
17
|
exposeApi,
|
|
18
|
-
|
|
18
|
+
exposeSigningCoordinatorApi,
|
|
19
19
|
observableWalletProperties,
|
|
20
20
|
repositoryChannel,
|
|
21
21
|
walletChannel,
|
|
@@ -32,12 +32,11 @@ import {
|
|
|
32
32
|
CommunicationType,
|
|
33
33
|
InMemoryKeyAgent,
|
|
34
34
|
SerializableInMemoryKeyAgentData,
|
|
35
|
-
emip3encrypt
|
|
36
|
-
util
|
|
35
|
+
emip3encrypt
|
|
37
36
|
} from '@cardano-sdk/key-management';
|
|
38
|
-
import { HexBlob } from '@cardano-sdk/util';
|
|
37
|
+
import { HexBlob, isNotNil } from '@cardano-sdk/util';
|
|
39
38
|
import { SodiumBip32Ed25519 } from '@cardano-sdk/crypto';
|
|
40
|
-
import { combineLatest, firstValueFrom, merge, of } from 'rxjs';
|
|
39
|
+
import { combineLatest, filter, firstValueFrom, merge, of } from 'rxjs';
|
|
41
40
|
import { runtime } from 'webextension-polyfill';
|
|
42
41
|
|
|
43
42
|
const delegationConfig = {
|
|
@@ -168,7 +167,7 @@ const clearWalletValues = (): void => {
|
|
|
168
167
|
|
|
169
168
|
const destroyWallet = async (): Promise<void> => {
|
|
170
169
|
await walletManager.deactivate();
|
|
171
|
-
const activeWalletId = await firstValueFrom(walletManager.activeWalletId
|
|
170
|
+
const activeWalletId = await firstValueFrom(walletManager.activeWalletId$.pipe(filter(isNotNil)));
|
|
172
171
|
await walletManager.destroyData(activeWalletId.walletId, env.KEY_MANAGEMENT_PARAMS.chainId);
|
|
173
172
|
clearWalletValues();
|
|
174
173
|
};
|
|
@@ -211,7 +210,7 @@ const cleanupMultidelegationInfo = (multiDelegationDiv: Element) => {
|
|
|
211
210
|
}
|
|
212
211
|
};
|
|
213
212
|
|
|
214
|
-
const
|
|
213
|
+
const signingCoordinator = new SigningCoordinator(
|
|
215
214
|
{
|
|
216
215
|
hwOptions: {
|
|
217
216
|
communicationType: CommunicationType.Web,
|
|
@@ -232,7 +231,7 @@ const signerManager = new SignerManager(
|
|
|
232
231
|
const passphraseByteArray = Uint8Array.from(
|
|
233
232
|
env.KEY_MANAGEMENT_PARAMS.passphrase.split('').map((letter) => letter.charCodeAt(0))
|
|
234
233
|
);
|
|
235
|
-
merge(
|
|
234
|
+
merge(signingCoordinator.signDataRequest$, signingCoordinator.transactionWitnessRequest$).subscribe((req) => {
|
|
236
235
|
logger.info('Sign request', req);
|
|
237
236
|
if (req.walletType === WalletType.InMemory) {
|
|
238
237
|
void req.sign(new Uint8Array(passphraseByteArray));
|
|
@@ -245,9 +244,9 @@ merge(signerManager.signDataRequest$, signerManager.transactionWitnessRequest$).
|
|
|
245
244
|
// Setup
|
|
246
245
|
|
|
247
246
|
// Expose local objects.
|
|
248
|
-
|
|
247
|
+
exposeSigningCoordinatorApi(
|
|
249
248
|
{
|
|
250
|
-
|
|
249
|
+
signingCoordinator
|
|
251
250
|
},
|
|
252
251
|
{ logger, runtime }
|
|
253
252
|
);
|
|
@@ -297,6 +296,7 @@ const createWalletIfNotExistsAndActivate = async (accountIndex: number) => {
|
|
|
297
296
|
clearWalletValues();
|
|
298
297
|
const bip32Ed25519 = new SodiumBip32Ed25519();
|
|
299
298
|
const mnemonicWords = env.KEY_MANAGEMENT_PARAMS.mnemonic.split(' ');
|
|
299
|
+
const encryptedMnemonic = await emip3encrypt(Buffer.from(env.KEY_MANAGEMENT_PARAMS.mnemonic), passphraseByteArray);
|
|
300
300
|
const passphrase = new Uint8Array(passphraseByteArray);
|
|
301
301
|
const keyAgent = await InMemoryKeyAgent.fromBip39MnemonicWords(
|
|
302
302
|
{
|
|
@@ -310,17 +310,15 @@ const createWalletIfNotExistsAndActivate = async (accountIndex: number) => {
|
|
|
310
310
|
const encryptedRootPrivateKey = (keyAgent.serializableData as SerializableInMemoryKeyAgentData)
|
|
311
311
|
.encryptedRootPrivateKeyBytes;
|
|
312
312
|
|
|
313
|
-
const entropy = Buffer.from(util.mnemonicWordsToEntropy(mnemonicWords), 'hex');
|
|
314
|
-
const encryptedEntropy = await emip3encrypt(entropy, passphraseByteArray);
|
|
315
|
-
|
|
316
313
|
logger.log('adding to repository wallet');
|
|
317
314
|
// Add wallet to the repository.
|
|
318
315
|
walletId = await repository.addWallet({
|
|
319
316
|
encryptedSecrets: {
|
|
320
|
-
|
|
317
|
+
keyMaterial: HexBlob.fromBytes(encryptedMnemonic),
|
|
321
318
|
rootPrivateKeyBytes: HexBlob.fromBytes(new Uint8Array(encryptedRootPrivateKey))
|
|
322
319
|
},
|
|
323
320
|
extendedAccountPublicKey: keyAgent.serializableData.extendedAccountPublicKey,
|
|
321
|
+
metadata: {},
|
|
324
322
|
type: WalletType.InMemory
|
|
325
323
|
});
|
|
326
324
|
await repository.addAccount({
|