@cardano-sdk/e2e 0.35.0 → 0.36.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.
Files changed (110) hide show
  1. package/.env.example +9 -0
  2. package/CHANGELOG.md +30 -0
  3. package/dist/cjs/environment.d.ts +3 -2
  4. package/dist/cjs/environment.d.ts.map +1 -1
  5. package/dist/cjs/environment.js +3 -1
  6. package/dist/cjs/environment.js.map +1 -1
  7. package/dist/cjs/factories.d.ts.map +1 -1
  8. package/dist/cjs/factories.js +15 -6
  9. package/dist/cjs/factories.js.map +1 -1
  10. package/dist/cjs/scripts/is-local-network-ready.js +3 -5
  11. package/dist/cjs/scripts/is-local-network-ready.js.map +1 -1
  12. package/dist/cjs/tsconfig.tsbuildinfo +1 -1
  13. package/dist/cjs/util/createMockKeyAgent.d.ts.map +1 -1
  14. package/dist/cjs/util/createMockKeyAgent.js +3 -1
  15. package/dist/cjs/util/createMockKeyAgent.js.map +1 -1
  16. package/dist/cjs/util/util.d.ts +3 -3
  17. package/dist/cjs/util/util.d.ts.map +1 -1
  18. package/dist/cjs/util/util.js +12 -6
  19. package/dist/cjs/util/util.js.map +1 -1
  20. package/dist/esm/environment.d.ts +3 -2
  21. package/dist/esm/environment.d.ts.map +1 -1
  22. package/dist/esm/environment.js +3 -1
  23. package/dist/esm/environment.js.map +1 -1
  24. package/dist/esm/factories.d.ts.map +1 -1
  25. package/dist/esm/factories.js +16 -7
  26. package/dist/esm/factories.js.map +1 -1
  27. package/dist/esm/index.d.ts +6 -6
  28. package/dist/esm/index.js +6 -6
  29. package/dist/esm/scripts/is-local-network-ready.js +3 -5
  30. package/dist/esm/scripts/is-local-network-ready.js.map +1 -1
  31. package/dist/esm/scripts/mnemonic.js +1 -1
  32. package/dist/esm/tools/multi-delegation-data-gen/index.js +2 -2
  33. package/dist/esm/tools/multi-delegation-data-gen/utils/index.d.ts +4 -4
  34. package/dist/esm/tools/multi-delegation-data-gen/utils/index.js +4 -4
  35. package/dist/esm/tools/multi-delegation-data-gen/utils/utils.d.ts +2 -2
  36. package/dist/esm/tools/multi-delegation-data-gen/utils/utils.js +4 -4
  37. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  38. package/dist/esm/util/createMockKeyAgent.d.ts.map +1 -1
  39. package/dist/esm/util/createMockKeyAgent.js +4 -2
  40. package/dist/esm/util/createMockKeyAgent.js.map +1 -1
  41. package/dist/esm/util/handle-util.js +1 -1
  42. package/dist/esm/util/index.d.ts +4 -4
  43. package/dist/esm/util/index.js +4 -4
  44. package/dist/esm/util/util.d.ts +4 -4
  45. package/dist/esm/util/util.d.ts.map +1 -1
  46. package/dist/esm/util/util.js +15 -9
  47. package/dist/esm/util/util.js.map +1 -1
  48. package/docker-compose.yml +2 -5
  49. package/jest.config.js +3 -2
  50. package/local-network/Dockerfile +8 -10
  51. package/local-network/scripts/clean.sh +1 -3
  52. package/local-network/scripts/install.sh +4 -4
  53. package/local-network/scripts/make-babbage.sh +60 -23
  54. package/local-network/scripts/mint-handles.sh +2 -4
  55. package/local-network/scripts/mint-tokens.sh +1 -2
  56. package/local-network/scripts/plutus-transaction.sh +5 -12
  57. package/local-network/scripts/pools/update-node-sp1.sh +1 -1
  58. package/local-network/scripts/pools/update-node-sp10.sh +1 -1
  59. package/local-network/scripts/pools/update-node-sp11.sh +1 -1
  60. package/local-network/scripts/pools/update-node-sp2.sh +1 -1
  61. package/local-network/scripts/pools/update-node-sp3.sh +1 -1
  62. package/local-network/scripts/pools/update-node-sp4.sh +1 -1
  63. package/local-network/scripts/pools/update-node-sp5.sh +1 -1
  64. package/local-network/scripts/pools/update-node-sp6.sh +1 -1
  65. package/local-network/scripts/pools/update-node-sp7.sh +1 -1
  66. package/local-network/scripts/pools/update-node-sp8.sh +1 -1
  67. package/local-network/scripts/pools/update-node-sp9.sh +1 -1
  68. package/local-network/scripts/pools/update-node-utils.sh +83 -78
  69. package/local-network/scripts/reference-input-transaction.sh +10 -23
  70. package/local-network/scripts/setup-new-delegator-keys.sh +184 -0
  71. package/local-network/scripts/setup-wallets.sh +2 -2
  72. package/local-network/scripts/start.sh +20 -5
  73. package/local-network/scripts/update-stake-pools.sh.sh +13 -0
  74. package/local-network/scripts/wait-local-network-init.sh +11 -0
  75. package/local-network/templates/babbage/byron-configuration.yaml +1 -0
  76. package/local-network/templates/babbage/conway-babbage-test-genesis.json +38 -0
  77. package/local-network/templates/babbage/node-config.json +12 -22
  78. package/local-network/templates/babbage/submit-api-config.json +9 -21
  79. package/package.json +31 -29
  80. package/src/environment.ts +3 -1
  81. package/src/factories.ts +22 -7
  82. package/src/scripts/is-local-network-ready.ts +4 -8
  83. package/src/util/createMockKeyAgent.ts +4 -2
  84. package/src/util/util.ts +19 -8
  85. package/test/local-network/register-pool.test.ts +3 -2
  86. package/test/long-running/multisig-wallet/MultiSigWallet.ts +5 -2
  87. package/test/long-running/shared-wallet-delegation-rewards.test.ts +2 -2
  88. package/test/long-running/simple-delegation-rewards.test.ts +1 -1
  89. package/test/projection/offline-fork.test.ts +2 -1
  90. package/test/{wallet → wallet_epoch_0}/PersonalWallet/byron.test.ts +1 -1
  91. package/test/wallet_epoch_0/PersonalWallet/conwayTransactions.test.ts +470 -0
  92. package/test/{wallet → wallet_epoch_0}/PersonalWallet/handle.test.ts +1 -1
  93. package/test/{wallet → wallet_epoch_0}/PersonalWallet/mint.test.ts +7 -6
  94. package/test/{wallet → wallet_epoch_0}/PersonalWallet/multiAddress.test.ts +1 -1
  95. package/test/{wallet → wallet_epoch_0}/PersonalWallet/multisignature.test.ts +19 -14
  96. package/test/{wallet → wallet_epoch_0}/PersonalWallet/nft.test.ts +1 -1
  97. package/test/{wallet → wallet_epoch_0}/PersonalWallet/phase2validation.test.ts +6 -2
  98. package/test/wallet_epoch_0/PersonalWallet/plutusTest.test.ts +347 -0
  99. package/test/{wallet → wallet_epoch_0}/PersonalWallet/txChainHistory.test.ts +1 -1
  100. package/test/{wallet → wallet_epoch_0}/PersonalWallet/unspendableUtxos.test.ts +2 -2
  101. package/test/{wallet → wallet_epoch_0}/SharedWallet/simpleTx.test.ts +2 -2
  102. package/test/{wallet/SharedWallet/ultils.ts → wallet_epoch_0/SharedWallet/utils.ts} +7 -1
  103. package/test/{wallet → wallet_epoch_3}/PersonalWallet/delegationDistribution.test.ts +11 -11
  104. package/test/{wallet → wallet_epoch_3}/SharedWallet/delegation.test.ts +2 -2
  105. package/test/web-extension/webpack.config.base.js +2 -1
  106. package/local-network/scripts/is-db-synced.sh +0 -24
  107. /package/test/{wallet → wallet_epoch_0}/PersonalWallet/metadata.test.ts +0 -0
  108. /package/test/{wallet → wallet_epoch_0}/PersonalWallet/pouchDbWalletStores.test.ts +0 -0
  109. /package/test/{wallet → wallet_epoch_0}/PersonalWallet/txChaining.test.ts +0 -0
  110. /package/test/{wallet → wallet_epoch_3}/PersonalWallet/delegation.test.ts +0 -0
@@ -0,0 +1,347 @@
1
+ import { BaseWallet } from '@cardano-sdk/wallet';
2
+ import { Cardano, Serialization, UtxoProvider } from '@cardano-sdk/core';
3
+ import { HexBlob, isNotNil } from '@cardano-sdk/util';
4
+ import { Observable, filter, firstValueFrom, interval, map, switchMap, take } from 'rxjs';
5
+ import { createLogger } from '@cardano-sdk/util-dev';
6
+ import { getEnv, getWallet, utxoProviderFactory, walletReady, walletVariables } from '../../../src';
7
+
8
+ const env = getEnv(walletVariables);
9
+ const logger = createLogger();
10
+
11
+ const scriptRedeemer: Cardano.PlutusData = {
12
+ constructor: 0n,
13
+ fields: {
14
+ items: [21n]
15
+ }
16
+ };
17
+
18
+ const scriptDatum: Cardano.PlutusData = {
19
+ constructor: 0n,
20
+ fields: {
21
+ items: [42n]
22
+ }
23
+ };
24
+
25
+ const midnightClaimRedeemer: Cardano.PlutusData = {
26
+ items: [
27
+ // chainCode
28
+ 2n,
29
+ // grantWallet
30
+ new Uint8Array([
31
+ 203, 209, 183, 104, 17, 74, 8, 166, 94, 101, 33, 139, 195, 134, 35, 246, 25, 118, 87, 49, 207, 123, 41, 139, 32,
32
+ 144, 158, 153, 124, 40, 27, 102
33
+ ]),
34
+ // rdmrGrantAmount
35
+ 1n,
36
+ // grantIx
37
+ 115n,
38
+ // rdmrCardanoPubKey
39
+ new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]),
40
+ // rdmrMidnightKey
41
+ new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2]),
42
+ // rdmrPubKey
43
+ new Uint8Array([
44
+ 214, 13, 16, 28, 145, 79, 106, 83, 253, 255, 40, 69, 88, 98, 130, 102, 222, 180, 1, 144, 68, 152, 115, 119, 107,
45
+ 51, 71, 105, 40, 115, 59, 69
46
+ ]),
47
+ // rdmrSignature
48
+ new Uint8Array([
49
+ 219, 89, 171, 195, 164, 168, 115, 84, 103, 158, 18, 134, 24, 127, 183, 137, 19, 50, 155, 210, 247, 198, 162, 186,
50
+ 239, 175, 25, 248, 84, 112, 137, 228, 121, 3, 218, 45, 137, 84, 103, 130, 61, 143, 172, 133, 145, 121, 132, 10,
51
+ 160, 14, 101, 204, 212, 12, 229, 134, 146, 67, 101, 114, 197, 31, 167, 5
52
+ ]),
53
+ // hashes
54
+ new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
55
+ new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
56
+ new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
57
+ new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
58
+ new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
59
+ new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
60
+ new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
61
+ ]
62
+ };
63
+
64
+ const midnightDatum = {
65
+ items: [
66
+ // datumClaimMask
67
+ 340_199_290_171_201_906_221_318_119_490_500_689_920n,
68
+ // datumRootHash
69
+ new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
70
+ ]
71
+ };
72
+
73
+ const fundScript = async (wallet: BaseWallet, receivingAddress: Cardano.PaymentAddress, datum: Cardano.PlutusData) => {
74
+ const tAdaToSend = 10_000_000n;
75
+ // Make sure the wallet has sufficient funds to run this test
76
+ await walletReady(wallet, tAdaToSend);
77
+
78
+ await firstValueFrom(wallet.syncStatus.isSettled$.pipe(filter((isSettled) => isSettled)));
79
+
80
+ const [{ address: sendingAddress }] = await firstValueFrom(wallet.addresses$);
81
+
82
+ logger.info(`Address ${sendingAddress} will send ${tAdaToSend} lovelace to address ${receivingAddress}.`);
83
+
84
+ // Send 10 tADA to the same wallet.
85
+ const txBuilder = wallet.createTxBuilder();
86
+ const txOutput = await txBuilder.buildOutput().address(receivingAddress).coin(tAdaToSend).datum(datum).build();
87
+ const signedTx = (await txBuilder.addOutput(txOutput).build().sign()).tx;
88
+ await wallet.submitTx(signedTx);
89
+
90
+ logger.info(
91
+ `Submitted transaction id: ${signedTx.id}, inputs: ${JSON.stringify(
92
+ signedTx.body.inputs.map((txIn) => [txIn.txId, txIn.index])
93
+ )} and outputs:${JSON.stringify(
94
+ signedTx.body.outputs.map((txOut) => [txOut.address, Number.parseInt(txOut.value.coins.toString())])
95
+ )}.`
96
+ );
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
+ logger.info(`Found transaction id in chain history: ${txFoundInHistory.id}`);
107
+
108
+ // Assert
109
+ expect(txFoundInHistory).toBeDefined();
110
+ expect(txFoundInHistory.id).toEqual(signedTx.id);
111
+ };
112
+
113
+ const createScriptRefInput = async (wallet: BaseWallet, script: Cardano.Script): Promise<Cardano.TxIn> => {
114
+ const tAdaToSend = 25_000_000n;
115
+ // Use dummy address to position the reference script
116
+ const refScriptAddress = Cardano.PaymentAddress(
117
+ 'addr_test1qqt9c69kjqf0wsnlp7hs8xees5l6pm4yxdqa3hknqr0kfe0htmj4e5t8n885zxm4qzpfzwruqx3ey3f5q8kpkr0gt9ms8dcsz6'
118
+ );
119
+
120
+ // Make sure the wallet has sufficient funds to run this test
121
+ await walletReady(wallet, tAdaToSend);
122
+
123
+ await firstValueFrom(wallet.syncStatus.isSettled$.pipe(filter((isSettled) => isSettled)));
124
+
125
+ const [{ address: sendingAddress }] = await firstValueFrom(wallet.addresses$);
126
+
127
+ logger.info(`Address ${sendingAddress} will send ${tAdaToSend} lovelace to address ${refScriptAddress}.`);
128
+
129
+ const txBuilder = wallet.createTxBuilder();
130
+ const txOutput = await txBuilder
131
+ .buildOutput()
132
+ .address(refScriptAddress)
133
+ .coin(tAdaToSend)
134
+ .scriptReference(script)
135
+ .build();
136
+
137
+ const signedTx = (await txBuilder.addOutput(txOutput).build().sign()).tx;
138
+ await wallet.submitTx(signedTx);
139
+
140
+ logger.info(
141
+ `Submitted transaction id: ${signedTx.id}, inputs: ${JSON.stringify(
142
+ signedTx.body.inputs.map((txIn) => [txIn.txId, txIn.index])
143
+ )} and outputs:${JSON.stringify(
144
+ signedTx.body.outputs.map((txOut) => [txOut.address, Number.parseInt(txOut.value.coins.toString())])
145
+ )}.`
146
+ );
147
+
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
+ logger.info(`Found transaction id in chain history: ${txFoundInHistory.id}`);
157
+
158
+ // Assert
159
+ expect(txFoundInHistory).toBeDefined();
160
+ expect(txFoundInHistory.id).toEqual(signedTx.id);
161
+
162
+ const index = signedTx.body.outputs.findIndex((out) => !!out.scriptReference);
163
+
164
+ return { index, txId: signedTx.id };
165
+ };
166
+
167
+ const getScriptUtxoSet = (
168
+ poolingInterval: number,
169
+ utxoProvider: UtxoProvider,
170
+ scriptAddress: Cardano.PaymentAddress
171
+ ): Observable<Cardano.Utxo[]> =>
172
+ interval(poolingInterval).pipe(
173
+ switchMap(
174
+ () =>
175
+ new Observable<Cardano.Utxo[]>((subscriber) => {
176
+ utxoProvider
177
+ .utxoByAddresses({ addresses: [scriptAddress] })
178
+ // eslint-disable-next-line promise/always-return
179
+ .then((utxos) => {
180
+ subscriber.next(utxos);
181
+ })
182
+ .catch((error) => subscriber.error(error));
183
+ })
184
+ )
185
+ );
186
+
187
+ // LW-10693: disable until costModels are fetched from protocolParams
188
+ describe.skip('PersonalWallet/plutus', () => {
189
+ let wallet: BaseWallet;
190
+ afterAll(() => {
191
+ wallet.shutdown();
192
+ });
193
+
194
+ it('can spend balance from a plutus script', async () => {
195
+ wallet = (await getWallet({ env, logger, name: 'Spending Wallet', polling: { interval: 50 } })).wallet;
196
+ // UTXO provider can be use to fetch the UTXO set from the script address.
197
+ const utxoProvider = await utxoProviderFactory.create(env.UTXO_PROVIDER, env.UTXO_PROVIDER_PARAMS, logger);
198
+
199
+ // Plutus script that always returns true.
200
+ const alwaysSucceedsScript: Cardano.PlutusScript = {
201
+ __type: Cardano.ScriptType.Plutus,
202
+ bytes: HexBlob(
203
+ '59079201000033232323232323232323232323232332232323232323232222232325335333006300800530070043333573466E1CD55CEA80124000466442466002006004646464646464646464646464646666AE68CDC39AAB9D500C480008CCCCCCCCCCCC88888888888848CCCCCCCCCCCC00403403002C02802402001C01801401000C008CD4060064D5D0A80619A80C00C9ABA1500B33501801A35742A014666AA038EB9406CD5D0A804999AA80E3AE501B35742A01066A0300466AE85401CCCD54070091D69ABA150063232323333573466E1CD55CEA801240004664424660020060046464646666AE68CDC39AAB9D5002480008CC8848CC00400C008CD40B9D69ABA15002302F357426AE8940088C98C80C8CD5CE01981901809AAB9E5001137540026AE854008C8C8C8CCCD5CD19B8735573AA004900011991091980080180119A8173AD35742A004605E6AE84D5D1280111931901919AB9C033032030135573CA00226EA8004D5D09ABA2500223263202E33573805E05C05826AAE7940044DD50009ABA1500533501875C6AE854010CCD540700808004D5D0A801999AA80E3AE200135742A00460446AE84D5D1280111931901519AB9C02B02A028135744A00226AE8940044D5D1280089ABA25001135744A00226AE8940044D5D1280089ABA25001135744A00226AE8940044D55CF280089BAA00135742A00460246AE84D5D1280111931900E19AB9C01D01C01A101B13263201B3357389201035054350001B135573CA00226EA80054049404448C88C008DD6000990009AA80A911999AAB9F0012500A233500930043574200460066AE880080548C8C8CCCD5CD19B8735573AA004900011991091980080180118061ABA150023005357426AE8940088C98C8054CD5CE00B00A80989AAB9E5001137540024646464646666AE68CDC39AAB9D5004480008CCCC888848CCCC00401401000C008C8C8C8CCCD5CD19B8735573AA0049000119910919800801801180A9ABA1500233500F014357426AE8940088C98C8068CD5CE00D80D00C09AAB9E5001137540026AE854010CCD54021D728039ABA150033232323333573466E1D4005200423212223002004357426AAE79400C8CCCD5CD19B875002480088C84888C004010DD71ABA135573CA00846666AE68CDC3A801A400042444006464C6403866AE700740700680640604D55CEA80089BAA00135742A00466A016EB8D5D09ABA2500223263201633573802E02C02826AE8940044D5D1280089AAB9E500113754002266AA002EB9D6889119118011BAB00132001355012223233335573E0044A010466A00E66442466002006004600C6AAE754008C014D55CF280118021ABA200301313574200222440042442446600200800624464646666AE68CDC3A800A40004642446004006600A6AE84D55CF280191999AB9A3370EA0049001109100091931900899AB9C01201100F00E135573AA00226EA80048C8C8CCCD5CD19B875001480188C848888C010014C01CD5D09AAB9E500323333573466E1D400920042321222230020053009357426AAE7940108CCCD5CD19B875003480088C848888C004014C01CD5D09AAB9E500523333573466E1D40112000232122223003005375C6AE84D55CF280311931900899AB9C01201100F00E00D00C135573AA00226EA80048C8C8CCCD5CD19B8735573AA004900011991091980080180118029ABA15002375A6AE84D5D1280111931900699AB9C00E00D00B135573CA00226EA80048C8CCCD5CD19B8735573AA002900011BAE357426AAE7940088C98C802CCD5CE00600580489BAA001232323232323333573466E1D4005200C21222222200323333573466E1D4009200A21222222200423333573466E1D400D2008233221222222233001009008375C6AE854014DD69ABA135744A00A46666AE68CDC3A8022400C4664424444444660040120106EB8D5D0A8039BAE357426AE89401C8CCCD5CD19B875005480108CC8848888888CC018024020C030D5D0A8049BAE357426AE8940248CCCD5CD19B875006480088C848888888C01C020C034D5D09AAB9E500B23333573466E1D401D2000232122222223005008300E357426AAE7940308C98C8050CD5CE00A80A00900880800780700680609AAB9D5004135573CA00626AAE7940084D55CF280089BAA0012323232323333573466E1D400520022333222122333001005004003375A6AE854010DD69ABA15003375A6AE84D5D1280191999AB9A3370EA0049000119091180100198041ABA135573CA00C464C6401A66AE7003803402C0284D55CEA80189ABA25001135573CA00226EA80048C8C8CCCD5CD19B875001480088C8488C00400CDD71ABA135573CA00646666AE68CDC3A8012400046424460040066EB8D5D09AAB9E500423263200A33573801601401000E26AAE7540044DD500089119191999AB9A3370EA00290021091100091999AB9A3370EA00490011190911180180218031ABA135573CA00846666AE68CDC3A801A400042444004464C6401666AE7003002C02402001C4D55CEA80089BAA0012323333573466E1D40052002212200223333573466E1D40092000212200123263200733573801000E00A00826AAE74DD5000891999AB9A3370E6AAE74DD5000A40004008464C6400866AE700140100092612001490103505431001123230010012233003300200200122212200201'
204
+ ),
205
+ version: Cardano.PlutusLanguageVersion.V2
206
+ };
207
+
208
+ const scriptHash = Serialization.Script.fromCore(alwaysSucceedsScript).hash();
209
+ const scriptAddress = Cardano.EnterpriseAddress.fromCredentials(Cardano.NetworkId.Testnet, {
210
+ hash: scriptHash,
211
+ type: Cardano.CredentialType.ScriptHash
212
+ })
213
+ .toAddress()
214
+ .toBech32() as Cardano.PaymentAddress;
215
+
216
+ await fundScript(wallet, scriptAddress, scriptDatum);
217
+ await walletReady(wallet);
218
+
219
+ const scriptUtxos = await firstValueFrom(getScriptUtxoSet(50, utxoProvider, scriptAddress));
220
+ const bigScriptUtxo = scriptUtxos.find((utxo) => utxo[1].value.coins === 10_000_000n);
221
+ expect(bigScriptUtxo).toBeDefined();
222
+ const [{ address: receivingAddress }] = await firstValueFrom(wallet.addresses$);
223
+
224
+ const txBuilder = wallet.createTxBuilder();
225
+ const txOutput = await txBuilder.buildOutput().address(receivingAddress).coin(10_000_000n).build();
226
+
227
+ const signedTx = (
228
+ await txBuilder
229
+ .addInput(bigScriptUtxo!, {
230
+ datum: scriptDatum,
231
+ redeemer: scriptRedeemer,
232
+ script: alwaysSucceedsScript
233
+ })
234
+ .addOutput(txOutput)
235
+ .setValidityInterval({
236
+ invalidBefore: undefined,
237
+ invalidHereafter: undefined // HACK: setting any valid interval cause an error in the node: Uncomputable slot arithmetic; transaction's validity bounds go beyond the foreseeable end of the current era
238
+ })
239
+ .build()
240
+ .sign()
241
+ ).tx;
242
+
243
+ await wallet.submitTx(signedTx);
244
+
245
+ logger.info(
246
+ `Submitted transaction id: ${signedTx.id}, inputs: ${JSON.stringify(
247
+ signedTx.body.inputs.map((txIn) => [txIn.txId, txIn.index])
248
+ )} and outputs:${JSON.stringify(
249
+ signedTx.body.outputs.map((txOut) => [txOut.address, Number.parseInt(txOut.value.coins.toString())])
250
+ )}.`
251
+ );
252
+
253
+ const txFoundInHistory = await firstValueFrom(
254
+ wallet.transactions.history$.pipe(
255
+ map((txs) => txs.find((tx) => tx.id === signedTx.id)),
256
+ filter(isNotNil),
257
+ take(1)
258
+ )
259
+ );
260
+
261
+ logger.info(`Found transaction id in chain history: ${txFoundInHistory.id}`);
262
+
263
+ // Assert
264
+ expect(txFoundInHistory).toBeDefined();
265
+ expect(txFoundInHistory.id).toEqual(signedTx.id);
266
+ });
267
+
268
+ it('can spend balance from a plutus script using a reference script', async () => {
269
+ wallet = (await getWallet({ env, logger, name: 'Spending Wallet', polling: { interval: 50 } })).wallet;
270
+ // UTXO provider can be use to fetch the UTXO set from the script address.
271
+ const utxoProvider = await utxoProviderFactory.create(env.UTXO_PROVIDER, env.UTXO_PROVIDER_PARAMS, logger);
272
+
273
+ const midnightClaimScript: Cardano.PlutusScript = {
274
+ __type: Cardano.ScriptType.Plutus,
275
+ bytes: HexBlob(
276
+ '59141d0100003333323233223322332232323232323232332232323232323232323232323232323232323232323232323232323232323232323222222223232323232323232323230012222223501422350102232323232533500910471533501522221323001225335500b1304d490101680015335323253350021001105332325335002100110545335014105415335330312350012222330443500422002304e02c500c1304f4910163002213500222225335005153335304b0021305549101640021323253350021001105c33023490101660032325335305c330380020011533533034002001105d105e105d33302301a01900c33304f75ca09c00a6604492101650035533530270011305649010131002215335001130584910131002215335001133064375c0086eb8008884c17124101310022350102253353304b00400213304b003001105e21305649010164002213057491013900532335330312350012222355010222235004223500a2232335005233500425333573466e3c0080045400c418c818c8cd4010818c94ccd5cd19b8f0020011500310631533500321533500221335002233500223305000200122206622233500420662225333573466e1c01800c54ccd5cd19b8700500213304000400110681068106115335001210611061500c153353302b500133702605266e00c0a4cc0b044888d400488cc01400401002120024800841504c13d24010136002213500222225335005153335304b0021305549101370021323253350021001105c3302349010161003303233304f75ca09c00a646460b06607000400264660b660b6466e09200100100133302301a01900c3550132222003330224901013800533532323500222350032232325335002100110623304e0040023303800400233050500901653353027001130564910131002215335001130584910131002215335001133053375a0086eb8008884c171241013100105b101e213056490101370022130574910139001530172222223500d2233553355335007105b1333011300c223500222372466e28cdc519b8a0020014890123003730607e0060020042a666ae68cdc4000a40002a0a2264a666ae68cdc419b860173370490020008008982999b800170011505230300011505121001130564901013500330194910162005335013105213500422323253350021001105535005223253353001489016300133044002372800c2a66a6002911016200133044002372400c2640b06002910101650030430023335734666e54008c01488d400888d402c88cdc519b8a337146e60c0e801401000ccdc500100080082a029882709826a481016a0050041533550041533533022330231122322300200130532253350011003221330060023004001500348008411c4c1192410168001304649101680030502222533500113303a0030082215333573466e1d20003370c008900209998031982400280119b84004480100044ccc018cc120008014cdc2002240080022a66a601c6aa02244444400c426a00244646464a666ae68cdc3a4000004264646666444424666600200a008006004607c6ae8400cccc111d728219aba100230423574200266082eb8d5d09aba2001357440026ae880044c1292401035054310035573c0046aae74004dd5000898222490134001355010222222004153350061046135500f222222350022235002225323335003215333573466e20094c8cdc099b8048008008004c0f400c414c4c00926130014984c005262350042253335002215333573466e2009cc8cdc019b8100248008004c0fc0084c141240101670010541304f4910167001304f49101670050103041225335001150332215350022233532350032235003225333573466e3c0100084ccd5cd19b870030010460451045355009222222333350012304349010133002304349101330023043491013300200113038004130060032223233001330430043300133043003002040040503e225335001103b133573800407426a002446a0044444444444442466666600201a00a01600600c01c646464a666ae68cdc3a4000004266442466002006004646464a666ae68cdc3a40000042646464646464646464646666666666664444444444442466666666666600201a01801601401201000e00c00a008006004660284646464a666ae68cdc3a400000426644246600200600460686ae84004d5d09aba200113046491035054310035573c0046aae74004dd50009aba100b35742014660284646464a666ae68cdc3a4000004264646666444424666600200a00800600460746ae8400cd5d08011aba1001357426ae88004d5d10009aba2001130464901035054310035573c0046aae74004dd50009aba1009357420106ae8401cd5d08031aba10053232325333573466e1d20000021332212330010030023232325333573466e1d20000021332212330010030023303575a6ae84004c0d0d5d09aba2001130484901035054310035573c0046aae74004dd51aba10013232325333573466e1d20000021332212330010030023303575a6ae84004c0d0d5d09aba2001130484901035054310035573c0046aae74004dd51aba1357440022608a921035054310035573c0046aae74004dd51aba10043301475c6ae8400cd5d08011aba1001357426ae88004d5d10009aba2001357440026ae88004d5d10009aba2001357440026ae88004d5d10009aba200113038491035054310035573c0046aae74004dd51aba10013232325333573466e1d2000002132122223003005375c6ae8400454ccd5cd19b87480080084c848888c004014c098d5d08008a999ab9a3370e900200109909111180100298159aba100115333573466e1d20060021321222230040053232325333573466e1d2000002132122222223005008302e357420022a666ae68cdc3a400400426424444444600e010605c6ae8400454ccd5cd19b87480100084cc8848888888cc018024020c0b8d5d08009bae357426ae8800454ccd5cd19b87480180084cc8848888888cc008024020dd71aba1001375c6ae84d5d10008a999ab9a3370e90040010999109111111198008048041bae357420026eb4d5d09aba200115333573466e1d200a00211222222200415333573466e1d200c0021122222220031303b491035054310035573c0046aae74004dd51aba1001130384901035054310035573c0046aae74004dd51aba1357440022606a921035054310035573c0046aae74004dd5002a99a98010028891000910a99a80089819a4901320022153350011303549101320022153350011303749101320022153350011303949101320022153350011303b49101320022153350011303d49101320022153350011303f49101320022132323333222212233330020060050040033304d3304d5333573466e1d20000011488101620015333573466e1d2002001148810165001489016300375c020a666ae68cdc40012400426086920101320010023304d3041003375a0186609a6eb8028dd7004198269bae006375c0086eb4044dd6806299a980080289818249013100221533500113032491013100221533500113302d375a0086eb8008884c0d9241013100300120012322300237580026074446666aae7c00480e48cd40e0c010d5d080118019aba20020323031225333573466e2400520c00115333573466e2400520800115333573466e24005204015333573466e24005202015333573466e24005201015333573466e1d20100011482001054ccd5cd19b8748038004520800215333573466e1d200c0011482000454ccd5cd19b87480280045204015333573466e1d200800114808054ccd5cd19b87480180045201015333573466e1d200400114802054ccd5cd19b87480080045200415333573466e1d20000011480084cdc11919b820010013002337080029002199ab9a3370e900119b86001480112004480084cdc12410008600466e04005201013370490404004180119b81001480804cdc12410101010040600466e0400520401337049040404040404040404002180119b8100148200044cdc12410101010101010101010101010080600466e0400520c0012233323300123007001330012333573466e1d200000102e02d00423232232223300300200130362225335002130050012215335003130080042213500422323500522533533028005002153353300d00400113300c008006103b15335301000413300c00800a13300353353010001103e133503d00703e006303f2225335001103b221350022253353014001133007006003153353302c009002153353301100800113301000c3330462225335002100122133005001335046002003006003103f133007335041004006003303422533500110302213500222533530080011300600310333033225335001102f22135002225335300700113006003103200200122333573466e1c0080040ac0a88cd5400488cdc0240040029000181691299a80088149109a801112999ab9a3370e9000000898030018816111801999a80200a001000981591299a800881491099a8151a8011119818001199a8009180500091199a80480c80100091805800980200089911119191981811299a800880191099a8178011802000980100218029980311a80091911801003981891299a80088169109a80111299a99806001003881809803001801181711299a800881611099a8169a80111191981a0019800804181a11299a80089aa8198019109a80111299a998078010040891119801005002098030019802000981511299a800881411099a8149a80111198178011817000980200091911801000981511299a800881411099299a9803001899a81500180088009802000981411299a800881311099a8139a801111981680118160009802000981391299a800881291099a8131a80111198160011aa815000980200091801199802a4000002046604a4466a00292100225335001100222135325333573466e24005200013302b028006133500900100633706600e00a90021119b96300800230080013024225335001148000884cdc02400460080026604644244a66a00226604c046046442a666ae68cdc3a400400826605066a04800404a00226a66a600c2400266e040112002001223302a3350260040020011200130222225333573466e20005200012335021491012d003330040033370290000010008980219802810800981091299a8008900091099119a8112999ab9a3370e90000020a4901300015333573466e1d20020041490101310015333573466e1d20040041490101320015333573466e1d20060041490101330015333573466e1d20080041490101340015333573466e1d200a0041490101350015333573466e1d200c0041490101360015333573466e1d200e0041490101370015333573466e1d2010004149010138001333573466e1d2012004490101390049010f3c696e76616c69642064696769743e00300200130040013020222325333573466e1d2000001133501f3370a004900a00189980219a80f99b850024805000c004cdc2000a40284646464a666ae68cdc3a400000420382a666ae68cdc3a4004004203a26030921035054310035573c0046aae74004dd5000911919192999ab9a3370e9000001089110010a999ab9a3370e90010010990911180180218029aba100115333573466e1d20040021122200113018491035054310035573c0046aae74004dd500091919192999ab9a3370e90000010999109198008018011919192999ab9a3370e900000109bae3574200226032921035054310035573c0046aae74004dd51aba1001375a6ae84d5d10008980b2481035054310035573c0046aae74004dd5000919a800a400490001119a801119a801119802801000900c119a801100c11980280100091199ab9a3371e00400202c02a4646464a666ae68cdc3a4000004266442466002006004600c6ae84004cc01c014d5d09aba2001130124901035054310035573c0046aae74004dd500091919192999ab9a3370e9000001099091180100198029aba100115333573466e1d2002002132333222122333001005004003375a6ae84008dd69aba1001375a6ae84d5d10009aba2001130114901035054310035573c0046aae74004dd500091919192999ab9a3370e900000109909118010019bae357420022a666ae68cdc3a4004004260146eb8d5d0800898082481035054310035573c0046aae74004dd5000911919192999ab9a3370e90010010a8058a999ab9a3370e90000010980618029aba1001130104901035054310035573c0046aae74004dd500091919192999ab9a3370e9000001089110018a999ab9a3370e9001001099091118008021bae357420022a666ae68cdc3a4008004264244460040086ae840044c0392401035054310035573c0046aae74004dd5000899800bae75a4464460046eac004c05488cccd55cf800900a11919a80a1980c18031aab9d001300535573c00260086ae8800cd5d080100691091980080180110911800801909118010018891000911b9233714004002601a44a66a002201644266a0186eb8008c010004c030894cd40044028884cd402cd400888cc044008cc0248ccd40048cdc0240000024466e000080048cdc0240000020026008002464c66ae70004008480048c88c008004c028894cd40044020884cd4024d400888cc03c008c01c004c010004c020894cd4004401088c84d400c88c00c004c030894cd40044c01800c884d4008894ccd40048ccd5cd19b884800000440304c01c01088ccd5cd19b88002001100d130080052333573466e200052000100c1300700412200212200112200212212233001004003212223003004112122230010042212330010030022323001001223300330020020013335122233333351222333335122002222222123333330010070060050040030022001005006002122002122001200100200300312200212200120014891c5c6dfd90190d6c66547da3debf3d8967340b270feb3f6cf5a5f8cab80048373df7bcbd18ccd54cd4488008448848cc00400c0084480052211cd441227553a0f1a965fee7d60a0f724b368dd1bddbc208730fccebcf004881054e494748540001'
277
+ ),
278
+ version: Cardano.PlutusLanguageVersion.V2
279
+ };
280
+
281
+ // 1.- Create reference script input
282
+ const scriptRefInput = await createScriptRefInput(wallet, midnightClaimScript);
283
+ const scriptHash = Serialization.Script.fromCore(midnightClaimScript).hash();
284
+ const scriptAddress = Cardano.EnterpriseAddress.fromCredentials(Cardano.NetworkId.Testnet, {
285
+ hash: scriptHash,
286
+ type: Cardano.CredentialType.ScriptHash
287
+ })
288
+ .toAddress()
289
+ .toBech32() as Cardano.PaymentAddress;
290
+
291
+ // 2.- Fund script address
292
+ await fundScript(wallet, scriptAddress, midnightDatum);
293
+ await walletReady(wallet);
294
+
295
+ // 3.- Spend the UTXO and lock the value back in to the script.
296
+ const scriptUtxos = await firstValueFrom(getScriptUtxoSet(50, utxoProvider, scriptAddress));
297
+ const bigScriptUtxo = scriptUtxos.find((utxo) => utxo[1].value.coins === 10_000_000n);
298
+ expect(bigScriptUtxo).toBeDefined();
299
+
300
+ const txBuilder = wallet.createTxBuilder();
301
+ const txOutput = await txBuilder
302
+ .buildOutput()
303
+ .address(scriptAddress)
304
+ .datum(midnightDatum)
305
+ .coin(10_000_000n)
306
+ .build();
307
+
308
+ const signedTx = (
309
+ await txBuilder
310
+ .addInput(bigScriptUtxo!, {
311
+ redeemer: midnightClaimRedeemer
312
+ })
313
+ .addReferenceInput(scriptRefInput)
314
+ .addOutput(txOutput)
315
+ .setValidityInterval({
316
+ invalidBefore: undefined,
317
+ invalidHereafter: undefined // HACK: setting any valid interval cause an error in the node: Uncomputable slot arithmetic; transaction's validity bounds go beyond the foreseeable end of the current era
318
+ })
319
+ .build()
320
+ .sign()
321
+ ).tx;
322
+
323
+ await wallet.submitTx(signedTx);
324
+
325
+ logger.info(
326
+ `Submitted transaction id: ${signedTx.id}, inputs: ${JSON.stringify(
327
+ signedTx.body.inputs.map((txIn) => [txIn.txId, txIn.index])
328
+ )} and outputs:${JSON.stringify(
329
+ signedTx.body.outputs.map((txOut) => [txOut.address, Number.parseInt(txOut.value.coins.toString())])
330
+ )}.`
331
+ );
332
+
333
+ const txFoundInHistory = await firstValueFrom(
334
+ wallet.transactions.history$.pipe(
335
+ map((txs) => txs.find((tx) => tx.id === signedTx.id)),
336
+ filter(isNotNil),
337
+ take(1)
338
+ )
339
+ );
340
+
341
+ logger.info(`Found transaction id in chain history: ${txFoundInHistory.id}`);
342
+
343
+ // Assert
344
+ expect(txFoundInHistory).toBeDefined();
345
+ expect(txFoundInHistory.id).toEqual(signedTx.id);
346
+ });
347
+ });
@@ -12,7 +12,7 @@ describe('PersonalWallet/txChainHistory', () => {
12
12
  let signedTx: Cardano.Tx<Cardano.TxBody>;
13
13
 
14
14
  beforeEach(async () => {
15
- ({ wallet } = await getWallet({ env, logger, name: 'Sending Wallet', polling: { interval: 50 } }));
15
+ ({ wallet } = await getWallet({ env, logger, name: 'Sending Wallet' }));
16
16
  const tAdaToSend = 10_000_000n;
17
17
  // Make sure the wallet has sufficient funds to run this test
18
18
  await walletReady(wallet, tAdaToSend);
@@ -21,8 +21,8 @@ describe('PersonalWallet/unspendableUtxos', () => {
21
21
  // eslint-disable-next-line max-statements
22
22
  it.skip('unsets unspendable UTxOs when no longer in the wallets UTxO set', async () => {
23
23
  // Here we will simulate the scenario of collateral consumption by spending it from another wallet instance.
24
- wallet1 = (await getWallet({ env, logger, name: 'Wallet 1', polling: { interval: 50 } })).wallet;
25
- wallet2 = (await getWallet({ env, logger, name: 'Wallet 2', polling: { interval: 50 } })).wallet;
24
+ wallet1 = (await getWallet({ env, logger, name: 'Wallet 1' })).wallet;
25
+ wallet2 = (await getWallet({ env, logger, name: 'Wallet 2' })).wallet;
26
26
 
27
27
  const coins = 5_000_000n;
28
28
  await walletReady(wallet1, coins);
@@ -1,6 +1,6 @@
1
1
  import { BaseWallet } from '@cardano-sdk/wallet';
2
2
  import { Cardano } from '@cardano-sdk/core';
3
- import { buildSharedWallets } from './ultils';
3
+ import { buildSharedWallets } from './utils';
4
4
  import { filter, firstValueFrom, map, take } from 'rxjs';
5
5
  import {
6
6
  getEnv,
@@ -25,7 +25,7 @@ describe('SharedWallet/simpleTx', () => {
25
25
  const initialFunds = 10_000_000n;
26
26
 
27
27
  beforeAll(async () => {
28
- ({ wallet: faucetWallet } = await getWallet({ env, logger, name: 'Sending Wallet', polling: { interval: 50 } }));
28
+ ({ wallet: faucetWallet } = await getWallet({ env, logger, name: 'Sending Wallet' }));
29
29
 
30
30
  // Make sure the wallet has sufficient funds to run this test
31
31
  await walletReady(faucetWallet, initialFunds);
@@ -2,6 +2,7 @@ import * as Crypto from '@cardano-sdk/crypto';
2
2
  import {
3
3
  AccountKeyDerivationPath,
4
4
  KeyAgent,
5
+ KeyPurpose,
5
6
  KeyRole,
6
7
  SignBlobResult,
7
8
  SignDataContext,
@@ -30,7 +31,12 @@ const getKeyAgent = async (
30
31
  genesisParameters: Cardano.CompactGenesis,
31
32
  bip32Ed25519: Crypto.Bip32Ed25519
32
33
  ) => {
33
- const keyAgent = await createStandaloneKeyAgent(mnemonics.split(' '), genesisParameters, bip32Ed25519);
34
+ const keyAgent = await createStandaloneKeyAgent(
35
+ mnemonics.split(' '),
36
+ genesisParameters,
37
+ bip32Ed25519,
38
+ KeyPurpose.MULTI_SIG
39
+ );
34
40
 
35
41
  const pubKey = await keyAgent.derivePublicKey(DERIVATION_PATH);
36
42
 
@@ -25,8 +25,7 @@ const fundWallet = async (wallet: BaseWallet) => {
25
25
  logger.info(
26
26
  `Insufficient funds in wallet account index 1. Missing ${coinDeficit}. Transferring from wallet account index 0`
27
27
  );
28
- const fundingWallet = (await getWallet({ env, idx: 0, logger, name: 'WalletAcct0', polling: { interval: 50 } }))
29
- .wallet;
28
+ const fundingWallet = (await getWallet({ env, idx: 0, logger, name: 'WalletAcct0' })).wallet;
30
29
  await walletReady(fundingWallet);
31
30
  const fundingTxBuilder = fundingWallet.createTxBuilder();
32
31
  const { tx } = await fundingTxBuilder
@@ -106,26 +105,27 @@ const delegateToMultiplePools = async (
106
105
  return { poolIds, portfolio };
107
106
  };
108
107
 
109
- const delegateAllToSinglePool = async (wallet: BaseWallet): Promise<void> => {
108
+ const delegateAllToSinglePool = async (wallet: BaseWallet): Promise<Cardano.StakePool> => {
110
109
  // This is a negative testcase, simulating an HD wallet that has multiple stake keys delegated
111
110
  // to the same stake pool. txBuilder.delegatePortfolio does not support this scenario.
112
- const [{ id: poolId }] = await getPoolIds(wallet);
111
+ const [pool] = await getPoolIds(wallet);
113
112
  const txBuilder = wallet.createTxBuilder();
114
113
  const rewardAccounts = await firstValueFrom(wallet.delegation.rewardAccounts$);
115
114
  txBuilder.partialTxBody.certificates = rewardAccounts.map(({ address }) =>
116
- Cardano.createDelegationCert(address, poolId)
115
+ Cardano.createDelegationCert(address, pool.id)
117
116
  );
118
117
 
119
- logger.debug(`Delegating all stake keys to pool ${poolId}`);
118
+ logger.debug(`Delegating all stake keys to pool ${pool.id}`);
120
119
  const { tx } = await txBuilder.build().sign();
121
120
  await submitAndConfirm(wallet, tx);
121
+ return pool;
122
122
  };
123
123
 
124
124
  describe('PersonalWallet/delegationDistribution', () => {
125
125
  let wallet: BaseWallet;
126
126
 
127
127
  beforeAll(async () => {
128
- wallet = (await getWallet({ env, idx: 3, logger, name: 'Wallet', polling: { interval: 50 } })).wallet;
128
+ wallet = (await getWallet({ env, idx: 3, logger, name: 'Wallet' })).wallet;
129
129
  await fundWallet(wallet);
130
130
  await deregisterAllStakeKeys(wallet);
131
131
  });
@@ -217,11 +217,11 @@ describe('PersonalWallet/delegationDistribution', () => {
217
217
  );
218
218
 
219
219
  // Delegate all reward accounts to the same pool. delegationDistribution$ should have 1 entry with 100% distribution
220
- await delegateAllToSinglePool(wallet);
220
+ const pool = await delegateAllToSinglePool(wallet);
221
221
  simplifiedDelegationDistribution = await firstValueFrom(
222
222
  wallet.delegation.distribution$.pipe(
223
223
  tap((distribution) => {
224
- logger.info('All stake keys are delegated to poolId:', poolIds[0].id);
224
+ logger.info('All stake keys are delegated to poolId:', pool.id);
225
225
  logger.info(distributionMessage, distribution);
226
226
  }),
227
227
  map((distribution) =>
@@ -237,8 +237,8 @@ describe('PersonalWallet/delegationDistribution', () => {
237
237
 
238
238
  expect(simplifiedDelegationDistribution).toEqual([
239
239
  {
240
- id: poolIds[0].id,
241
- name: poolIds[0].metadata?.name,
240
+ id: pool.id,
241
+ name: pool.metadata?.name,
242
242
  percentage: Percent(1),
243
243
  rewardAccounts: rewardAccounts.map(({ address }) => address)
244
244
  }
@@ -12,7 +12,7 @@ import {
12
12
  walletReady,
13
13
  walletVariables
14
14
  } from '../../../src';
15
- import { buildSharedWallets } from './ultils';
15
+ import { buildSharedWallets } from '../../wallet_epoch_0/SharedWallet/utils';
16
16
  import { combineLatest, filter, firstValueFrom, map, take } from 'rxjs';
17
17
  import { logger } from '@cardano-sdk/util-dev';
18
18
 
@@ -70,7 +70,7 @@ describe('SharedWallet/delegation', () => {
70
70
  ({
71
71
  wallet: faucetWallet,
72
72
  providers: { stakePoolProvider }
73
- } = await getWallet({ env, logger, name: 'Sending Wallet', polling: { interval: 50 } }));
73
+ } = await getWallet({ env, logger, name: 'Sending Wallet' }));
74
74
 
75
75
  // Make sure the wallet has sufficient funds to run this test
76
76
  await walletReady(faucetWallet, initialFunds);
@@ -70,7 +70,9 @@ module.exports = {
70
70
  resolve: {
71
71
  extensions: ['.ts', '.js'],
72
72
  fallback: {
73
+ '@cardano-sdk/cardano-services': false,
73
74
  buffer: require.resolve('buffer/'),
75
+ crypto: require.resolve('crypto-browserify'),
74
76
  events: require.resolve('events/'),
75
77
  fs: false,
76
78
  'get-port-please': false,
@@ -79,7 +81,6 @@ module.exports = {
79
81
  os: false,
80
82
  path: false,
81
83
  perf_hooks: false,
82
- crypto: require.resolve('crypto-browserify'),
83
84
  stream: require.resolve('readable-stream'),
84
85
  util: require.resolve('util/')
85
86
  }
@@ -1,24 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -euo pipefail
4
-
5
- here="$(cd "$(dirname "$0")" >/dev/null 2>&1 && pwd)"
6
- root="$(cd "$here/.." && pwd)"
7
-
8
- cd "$root"
9
-
10
- export PATH=$PWD/bin:$PATH
11
-
12
- user=$(cat /run/secrets/postgres_user)
13
- pass=$(cat /run/secrets/postgres_password)
14
- db=$(cat /run/secrets/postgres_db)
15
-
16
- queryResult=$(psql -d postgresql://"$user":"$pass"@"$POSTGRES_HOST":"$POSTGRES_PORT"/"$db" -c 'select epoch.no from epoch order by epoch.no DESC limit 1')
17
- arr=(${queryResult//\\n/ })
18
- epoch="${arr[2]}"
19
-
20
- if [[ $epoch -lt 3 ]]; then
21
- exit 9
22
- fi
23
-
24
- exit 0