@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
@@ -16,7 +16,7 @@ POOL_COST=390000000
16
16
  POOL_MARGIN=0.15
17
17
  METADATA_URL="" # Leave it empty and the metadata field will be ignore in the TX
18
18
 
19
- source ./scripts/pools/update-node-utils.sh
19
+ source ./scripts/pools/update-node-utils.sh ${SP_NODE_ID}
20
20
 
21
21
  trap clean EXIT
22
22
 
@@ -16,7 +16,7 @@ POOL_COST=390000000
16
16
  POOL_MARGIN=0.15
17
17
  METADATA_URL="http://file-server/SP${SP_NODE_ID}.json"
18
18
 
19
- source ./scripts/pools/update-node-utils.sh
19
+ source ./scripts/pools/update-node-utils.sh ${SP_NODE_ID}
20
20
 
21
21
  trap clean EXIT
22
22
 
@@ -16,7 +16,7 @@ POOL_COST=370000000
16
16
  POOL_MARGIN=0.15
17
17
  METADATA_URL="http://file-server/SP${SP_NODE_ID}.json"
18
18
 
19
- source ./scripts/pools/update-node-utils.sh
19
+ source ./scripts/pools/update-node-utils.sh ${SP_NODE_ID}
20
20
 
21
21
  trap clean EXIT
22
22
 
@@ -16,7 +16,7 @@ POOL_COST=390000000
16
16
  POOL_MARGIN=0.15
17
17
  METADATA_URL="http://file-server/SP${SP_NODE_ID}.json"
18
18
 
19
- source ./scripts/pools/update-node-utils.sh
19
+ source ./scripts/pools/update-node-utils.sh ${SP_NODE_ID}
20
20
 
21
21
  trap clean EXIT
22
22
 
@@ -16,7 +16,7 @@ POOL_COST=400000000
16
16
  POOL_MARGIN=0.15
17
17
  METADATA_URL="http://file-server/SP${SP_NODE_ID}.json"
18
18
 
19
- source ./scripts/pools/update-node-utils.sh
19
+ source ./scripts/pools/update-node-utils.sh ${SP_NODE_ID}
20
20
 
21
21
  trap clean EXIT
22
22
 
@@ -16,7 +16,7 @@ POOL_COST=390000000
16
16
  POOL_MARGIN=0.15
17
17
  METADATA_URL="http://file-server/SP${SP_NODE_ID}.json"
18
18
 
19
- source ./scripts/pools/update-node-utils.sh
19
+ source ./scripts/pools/update-node-utils.sh ${SP_NODE_ID}
20
20
 
21
21
  trap clean EXIT
22
22
 
@@ -17,7 +17,7 @@ POOL_COST=380000000
17
17
  POOL_MARGIN=0.15
18
18
  METADATA_URL="" # Leave it empty and the metadata field will be ignore in the TX
19
19
 
20
- source ./scripts/pools/update-node-utils.sh
20
+ source ./scripts/pools/update-node-utils.sh ${SP_NODE_ID}
21
21
 
22
22
  trap clean EXIT
23
23
 
@@ -17,7 +17,7 @@ POOL_COST=390000000
17
17
  POOL_MARGIN=0.15
18
18
  METADATA_URL="" # Leave it empty and the metadata field will be ignore in the TX
19
19
 
20
- source ./scripts/pools/update-node-utils.sh
20
+ source ./scripts/pools/update-node-utils.sh ${SP_NODE_ID}
21
21
 
22
22
  trap clean EXIT
23
23
 
@@ -9,22 +9,26 @@ cd "$root"
9
9
 
10
10
  export PATH=$PWD/bin:$PATH
11
11
 
12
+ SP_NODE_ID="$1"
13
+
14
+ mkdir ${SP_NODE_ID}
15
+
12
16
  clean() {
13
- rm -rf pool-owner-registration.cert pool-owner-delegation.cert wallets-tx.raw wallets-tx.signed fullUtxo.out balance.out params.json stake.cert pool.cert deleg.cert tx.tmp tx.raw tx.signed
17
+ rm -rf ${SP_NODE_ID}
14
18
  }
15
19
 
16
20
  getAddressBalance() {
17
21
  cardano-cli query utxo \
18
22
  --address "$1" \
19
- --testnet-magic 888 >fullUtxo.out
23
+ --testnet-magic 888 > ${SP_NODE_ID}/fullUtxo.out
20
24
 
21
- tail -n +3 fullUtxo.out | sort -k3 -nr >balance.out
25
+ tail -n +3 ${SP_NODE_ID}/fullUtxo.out | sort -k3 -nr > ${SP_NODE_ID}/balance.out
22
26
 
23
27
  total_balance=0
24
28
  while read -r utxo; do
25
29
  utxo_balance=$(awk '{ print $3 }' <<<"${utxo}")
26
30
  total_balance=$(("$total_balance" + "$utxo_balance"))
27
- done <balance.out
31
+ done < ${SP_NODE_ID}/balance.out
28
32
 
29
33
  echo ${total_balance}
30
34
  }
@@ -53,10 +57,10 @@ updatePool() {
53
57
  fi
54
58
 
55
59
  # get the protocol parameters
56
- cardano-cli query protocol-parameters --testnet-magic 888 --out-file params.json
60
+ cardano-cli query protocol-parameters --testnet-magic 888 --out-file ${SP_NODE_ID}/params.json
57
61
 
58
- genesisVKey=network-files/utxo-keys/utxo3.vkey
59
- genesisSKey=network-files/utxo-keys/utxo3.skey
62
+ genesisVKey=network-files/utxo-keys/utxo${SP_NODE_ID}.vkey
63
+ genesisSKey=network-files/utxo-keys/utxo${SP_NODE_ID}.skey
60
64
  genesisAddr=$(cardano-cli address build --payment-verification-key-file "$genesisVKey" --testnet-magic 888)
61
65
 
62
66
  stakeVKey=network-files/pools/staking-reward"${SP_NODE_ID}".vkey
@@ -69,6 +73,8 @@ updatePool() {
69
73
  delegatorPaymentSKey=network-files/stake-delegator-keys/payment"${SP_NODE_ID}".skey
70
74
  delegatorStakeSKey=network-files/stake-delegator-keys/staking"${SP_NODE_ID}".skey
71
75
 
76
+ keyDeposit=2000000
77
+
72
78
  POOL_ID=$(cardano-cli stake-pool id --cold-verification-key-file "$coldVKey" --output-format "hex")
73
79
 
74
80
  # funding pool owner stake address
@@ -76,21 +82,20 @@ updatePool() {
76
82
  currentBalance=$(getAddressBalance "$stakeAddr")
77
83
  utxo=$(cardano-cli query utxo --address "$genesisAddr" --testnet-magic 888 | awk 'NR == 3 {printf("%s#%s", $1, $2)}')
78
84
 
79
- cardano-cli transaction build \
80
- --babbage-era \
85
+ cardano-cli conway transaction build \
81
86
  --change-address "$genesisAddr" \
82
87
  --tx-in "$utxo" \
83
88
  --tx-out "$stakeAddr"+"$POOL_OWNER_STAKE" \
84
89
  --testnet-magic 888 \
85
- --out-file wallets-tx.raw 2>&1
90
+ --out-file ${SP_NODE_ID}/wallets-tx.raw 2>&1
86
91
 
87
92
  cardano-cli transaction sign \
88
- --tx-body-file wallets-tx.raw \
93
+ --tx-body-file ${SP_NODE_ID}/wallets-tx.raw \
89
94
  --signing-key-file "$genesisSKey" \
90
95
  --testnet-magic 888 \
91
- --out-file wallets-tx.signed 2>&1
96
+ --out-file ${SP_NODE_ID}/wallets-tx.signed 2>&1
92
97
 
93
- cardano-cli transaction submit --testnet-magic 888 --tx-file wallets-tx.signed 2>&1
98
+ cardano-cli transaction submit --testnet-magic 888 --tx-file ${SP_NODE_ID}/wallets-tx.signed 2>&1
94
99
 
95
100
  updatedBalance=$(getAddressBalance "$stakeAddr")
96
101
 
@@ -103,7 +108,7 @@ updatePool() {
103
108
  currentBalance=$(getAddressBalance "$genesisAddr")
104
109
  cardano-cli stake-address registration-certificate \
105
110
  --stake-verification-key-file "$stakeVKey" \
106
- --out-file pool-owner-registration.cert
111
+ --out-file ${SP_NODE_ID}/pool-owner-registration.cert
107
112
 
108
113
  utxo=$(cardano-cli query utxo --address "$genesisAddr" --testnet-magic 888 | awk 'NR == 3 {printf("%s#%s", $1, $2)}')
109
114
 
@@ -112,38 +117,38 @@ updatePool() {
112
117
  --tx-out "$genesisAddr"+0 \
113
118
  --invalid-hereafter 5000000 \
114
119
  --fee 0 \
115
- --out-file tx.tmp \
116
- --certificate pool-owner-registration.cert
120
+ --out-file ${SP_NODE_ID}/tx.tmp \
121
+ --certificate ${SP_NODE_ID}/pool-owner-registration.cert
117
122
 
118
123
  fee=$(cardano-cli transaction calculate-min-fee \
119
- --tx-body-file tx.tmp \
124
+ --tx-body-file ${SP_NODE_ID}/tx.tmp \
120
125
  --tx-in-count 1 \
121
126
  --tx-out-count 1 \
122
127
  --testnet-magic 888 \
123
128
  --witness-count 2 \
124
129
  --byron-witness-count 0 \
125
- --protocol-params-file ./params.json | awk '{ print $1 }')
130
+ --protocol-params-file ${SP_NODE_ID}/params.json | awk '{ print $1 }')
126
131
 
127
132
  initialBalance=$(getAddressBalance "$genesisAddr")
128
- txOut=$((initialBalance - fee))
133
+ txOut=$((initialBalance - fee - keyDeposit))
129
134
 
130
135
  cardano-cli transaction build-raw \
131
136
  --tx-in "$utxo" \
132
137
  --tx-out "$genesisAddr"+"$txOut" \
133
138
  --invalid-hereafter 5000000 \
134
139
  --fee "$fee" \
135
- --certificate pool-owner-registration.cert \
136
- --out-file tx.raw
140
+ --certificate ${SP_NODE_ID}/pool-owner-registration.cert \
141
+ --out-file ${SP_NODE_ID}/tx.raw
137
142
 
138
143
  cardano-cli transaction sign \
139
- --tx-body-file tx.raw \
144
+ --tx-body-file ${SP_NODE_ID}/tx.raw \
140
145
  --signing-key-file "$genesisSKey" \
141
146
  --signing-key-file "$stakeKey" \
142
147
  --testnet-magic 888 \
143
- --out-file tx.signed
148
+ --out-file ${SP_NODE_ID}/tx.signed
144
149
 
145
150
  cardano-cli transaction submit \
146
- --tx-file tx.signed \
151
+ --tx-file ${SP_NODE_ID}/tx.signed \
147
152
  --testnet-magic 888
148
153
 
149
154
  updatedBalance=$(getAddressBalance "$genesisAddr")
@@ -158,7 +163,7 @@ updatePool() {
158
163
  cardano-cli stake-address delegation-certificate \
159
164
  --stake-verification-key-file "$stakeVKey" \
160
165
  --cold-verification-key-file "$coldVKey" \
161
- --out-file pool-owner-delegation.cert
166
+ --out-file ${SP_NODE_ID}/pool-owner-delegation.cert
162
167
 
163
168
  utxo=$(cardano-cli query utxo --address "$genesisAddr" --testnet-magic 888 | awk 'NR == 3 {printf("%s#%s", $1, $2)}')
164
169
 
@@ -167,17 +172,17 @@ updatePool() {
167
172
  --tx-out "$genesisAddr"+0 \
168
173
  --invalid-hereafter 5000000 \
169
174
  --fee 0 \
170
- --out-file tx.tmp \
171
- --certificate pool-owner-delegation.cert
175
+ --out-file ${SP_NODE_ID}/tx.tmp \
176
+ --certificate ${SP_NODE_ID}/pool-owner-delegation.cert
172
177
 
173
178
  fee=$(cardano-cli transaction calculate-min-fee \
174
- --tx-body-file tx.tmp \
179
+ --tx-body-file ${SP_NODE_ID}/tx.tmp \
175
180
  --tx-in-count 1 \
176
181
  --tx-out-count 1 \
177
182
  --testnet-magic 888 \
178
183
  --witness-count 2 \
179
184
  --byron-witness-count 0 \
180
- --protocol-params-file ./params.json | awk '{ print $1 }')
185
+ --protocol-params-file ${SP_NODE_ID}/params.json | awk '{ print $1 }')
181
186
 
182
187
  initialBalance=$(getAddressBalance "$genesisAddr")
183
188
  txOut=$((initialBalance - fee))
@@ -187,18 +192,18 @@ updatePool() {
187
192
  --tx-out "$genesisAddr"+"$txOut" \
188
193
  --invalid-hereafter 5000000 \
189
194
  --fee "$fee" \
190
- --certificate pool-owner-delegation.cert \
191
- --out-file tx.raw
195
+ --certificate ${SP_NODE_ID}/pool-owner-delegation.cert \
196
+ --out-file ${SP_NODE_ID}/tx.raw
192
197
 
193
198
  cardano-cli transaction sign \
194
- --tx-body-file tx.raw \
199
+ --tx-body-file ${SP_NODE_ID}/tx.raw \
195
200
  --signing-key-file "$genesisSKey" \
196
201
  --signing-key-file "$stakeKey" \
197
202
  --testnet-magic 888 \
198
- --out-file tx.signed
203
+ --out-file ${SP_NODE_ID}/tx.signed
199
204
 
200
205
  cardano-cli transaction submit \
201
- --tx-file tx.signed \
206
+ --tx-file ${SP_NODE_ID}/tx.signed \
202
207
  --testnet-magic 888
203
208
 
204
209
  updatedBalance=$(getAddressBalance "$genesisAddr")
@@ -218,7 +223,7 @@ updatePool() {
218
223
  cardano-cli stake-address delegation-certificate \
219
224
  --stake-verification-key-file "$delegatorStakeKey" \
220
225
  --stake-pool-id "$POOL_ID" \
221
- --out-file deleg.cert
226
+ --out-file ${SP_NODE_ID}/deleg.cert
222
227
 
223
228
  utxo=$(cardano-cli query utxo --address "$paymentAddr" --testnet-magic 888 | awk 'NR == 3 {printf("%s#%s", $1, $2)}')
224
229
 
@@ -227,17 +232,17 @@ updatePool() {
227
232
  --tx-out "$paymentAddr"+0 \
228
233
  --invalid-hereafter 5000000 \
229
234
  --fee 0 \
230
- --out-file tx.tmp \
231
- --certificate deleg.cert
235
+ --out-file ${SP_NODE_ID}/tx.tmp \
236
+ --certificate ${SP_NODE_ID}/deleg.cert
232
237
 
233
238
  fee=$(cardano-cli transaction calculate-min-fee \
234
- --tx-body-file tx.tmp \
239
+ --tx-body-file ${SP_NODE_ID}/tx.tmp \
235
240
  --tx-in-count 1 \
236
241
  --tx-out-count 1 \
237
242
  --testnet-magic 888 \
238
243
  --witness-count 2 \
239
244
  --byron-witness-count 0 \
240
- --protocol-params-file ./params.json | awk '{ print $1 }')
245
+ --protocol-params-file ${SP_NODE_ID}/params.json | awk '{ print $1 }')
241
246
 
242
247
  initialBalance=$(getAddressBalance "$paymentAddr")
243
248
  txOut=$((initialBalance - fee))
@@ -247,18 +252,18 @@ updatePool() {
247
252
  --tx-out "$paymentAddr"+"$txOut" \
248
253
  --invalid-hereafter 5000000 \
249
254
  --fee "$fee" \
250
- --certificate-file deleg.cert \
251
- --out-file tx.raw
255
+ --certificate-file ${SP_NODE_ID}/deleg.cert \
256
+ --out-file ${SP_NODE_ID}/tx.raw
252
257
 
253
258
  cardano-cli transaction sign \
254
- --tx-body-file tx.raw \
259
+ --tx-body-file ${SP_NODE_ID}/tx.raw \
255
260
  --signing-key-file "$delegatorPaymentSKey" \
256
261
  --signing-key-file "$delegatorStakeSKey" \
257
262
  --testnet-magic 888 \
258
- --out-file tx.signed
263
+ --out-file ${SP_NODE_ID}/tx.signed
259
264
 
260
265
  cardano-cli transaction submit \
261
- --tx-file tx.signed \
266
+ --tx-file ${SP_NODE_ID}/tx.signed \
262
267
  --testnet-magic 888
263
268
 
264
269
  updatedBalance=$(getAddressBalance "$paymentAddr")
@@ -287,7 +292,7 @@ updatePool() {
287
292
  --pool-relay-port 300"$SP_NODE_ID" \
288
293
  --metadata-url "${METADATA_URL}" \
289
294
  --metadata-hash "${METADATA_HASH}" \
290
- --out-file pool.cert
295
+ --out-file ${SP_NODE_ID}/pool.cert
291
296
  else
292
297
  cardano-cli stake-pool registration-certificate \
293
298
  --cold-verification-key-file "$coldVKey" \
@@ -300,7 +305,7 @@ updatePool() {
300
305
  --testnet-magic 888 \
301
306
  --pool-relay-ipv4 127.0.0.1 \
302
307
  --pool-relay-port 300"$SP_NODE_ID" \
303
- --out-file pool.cert
308
+ --out-file ${SP_NODE_ID}/pool.cert
304
309
  fi
305
310
 
306
311
  utxo=$(cardano-cli query utxo --address "$paymentAddr" --testnet-magic 888 | awk 'NR == 3 {printf("%s#%s", $1, $2)}')
@@ -310,17 +315,17 @@ updatePool() {
310
315
  --tx-out "$paymentAddr"+"$txOut" \
311
316
  --invalid-hereafter 500000 \
312
317
  --fee 0 \
313
- --certificate-file pool.cert \
314
- --out-file tx.tmp
318
+ --certificate-file ${SP_NODE_ID}/pool.cert \
319
+ --out-file ${SP_NODE_ID}/tx.tmp
315
320
 
316
321
  fee=$(cardano-cli transaction calculate-min-fee \
317
- --tx-body-file tx.tmp \
322
+ --tx-body-file ${SP_NODE_ID}/tx.tmp \
318
323
  --tx-in-count 1 \
319
324
  --tx-out-count 1 \
320
325
  --testnet-magic 888 \
321
326
  --witness-count 3 \
322
327
  --byron-witness-count 0 \
323
- --protocol-params-file ./params.json | awk '{ print $1 }')
328
+ --protocol-params-file ${SP_NODE_ID}/params.json | awk '{ print $1 }')
324
329
 
325
330
  initialBalance=$(getAddressBalance "$paymentAddr")
326
331
  txOut=$((initialBalance - fee))
@@ -330,19 +335,19 @@ updatePool() {
330
335
  --tx-out "$paymentAddr"+"$txOut" \
331
336
  --invalid-hereafter 500000 \
332
337
  --fee "$fee" \
333
- --certificate-file pool.cert \
334
- --out-file tx.raw
338
+ --certificate-file ${SP_NODE_ID}/pool.cert \
339
+ --out-file ${SP_NODE_ID}/tx.raw
335
340
 
336
341
  cardano-cli transaction sign \
337
- --tx-body-file tx.raw \
342
+ --tx-body-file ${SP_NODE_ID}/tx.raw \
338
343
  --signing-key-file "$delegatorPaymentSKey" \
339
344
  --signing-key-file "$coldKey" \
340
345
  --signing-key-file "$stakeKey" \
341
346
  --testnet-magic 888 \
342
- --out-file tx.signed
347
+ --out-file ${SP_NODE_ID}/tx.signed
343
348
 
344
349
  cardano-cli transaction submit \
345
- --tx-file tx.signed \
350
+ --tx-file ${SP_NODE_ID}/tx.signed \
346
351
  --testnet-magic 888
347
352
 
348
353
  updatedBalance=$(getAddressBalance "$paymentAddr")
@@ -366,10 +371,10 @@ deregisterPool() {
366
371
  done
367
372
 
368
373
  # get the protocol parameters
369
- cardano-cli query protocol-parameters --testnet-magic 888 --out-file params.json
374
+ cardano-cli query protocol-parameters --testnet-magic 888 --out-file ${SP_NODE_ID}/params.json
370
375
 
371
- genesisVKey=network-files/utxo-keys/utxo3.vkey
372
- genesisSKey=network-files/utxo-keys/utxo3.skey
376
+ genesisVKey=network-files/utxo-keys/utxo${SP_NODE_ID}.vkey
377
+ genesisSKey=network-files/utxo-keys/utxo${SP_NODE_ID}.skey
373
378
  genesisAddr=$(cardano-cli address build --payment-verification-key-file "$genesisVKey" --testnet-magic 888)
374
379
  stakeKey=network-files/pools/staking-reward"${SP_NODE_ID}".skey
375
380
  coldVKey=network-files/pools/cold"${SP_NODE_ID}".vkey
@@ -391,7 +396,7 @@ deregisterPool() {
391
396
  cardano-cli stake-address delegation-certificate \
392
397
  --stake-verification-key-file "$delegatorStakeKey" \
393
398
  --stake-pool-id "$POOL_ID" \
394
- --out-file deleg.cert
399
+ --out-file ${SP_NODE_ID}/deleg.cert
395
400
 
396
401
  utxo=$(cardano-cli query utxo --address "$paymentAddr" --testnet-magic 888 | awk 'NR == 3 {printf("%s#%s", $1, $2)}')
397
402
 
@@ -400,17 +405,17 @@ deregisterPool() {
400
405
  --tx-out "$paymentAddr"+0 \
401
406
  --invalid-hereafter 5000000 \
402
407
  --fee 0 \
403
- --out-file tx.tmp \
404
- --certificate deleg.cert
408
+ --out-file ${SP_NODE_ID}/tx.tmp \
409
+ --certificate ${SP_NODE_ID}/deleg.cert
405
410
 
406
411
  fee=$(cardano-cli transaction calculate-min-fee \
407
- --tx-body-file tx.tmp \
412
+ --tx-body-file ${SP_NODE_ID}/tx.tmp \
408
413
  --tx-in-count 1 \
409
414
  --tx-out-count 1 \
410
415
  --testnet-magic 888 \
411
416
  --witness-count 2 \
412
417
  --byron-witness-count 0 \
413
- --protocol-params-file ./params.json | awk '{ print $1 }')
418
+ --protocol-params-file ${SP_NODE_ID}/params.json | awk '{ print $1 }')
414
419
 
415
420
  initialBalance=$(getAddressBalance "$paymentAddr")
416
421
  txOut=$((initialBalance - fee))
@@ -420,18 +425,18 @@ deregisterPool() {
420
425
  --tx-out "$paymentAddr"+"$txOut" \
421
426
  --invalid-hereafter 5000000 \
422
427
  --fee "$fee" \
423
- --certificate-file deleg.cert \
424
- --out-file tx.raw
428
+ --certificate-file ${SP_NODE_ID}/deleg.cert \
429
+ --out-file ${SP_NODE_ID}/tx.raw
425
430
 
426
431
  cardano-cli transaction sign \
427
- --tx-body-file tx.raw \
432
+ --tx-body-file ${SP_NODE_ID}/tx.raw \
428
433
  --signing-key-file "$delegatorPaymentSKey" \
429
434
  --signing-key-file "$delegatorStakeSKey" \
430
435
  --testnet-magic 888 \
431
- --out-file tx.signed
436
+ --out-file ${SP_NODE_ID}/tx.signed
432
437
 
433
438
  cardano-cli transaction submit \
434
- --tx-file tx.signed \
439
+ --tx-file ${SP_NODE_ID}/tx.signed \
435
440
  --testnet-magic 888
436
441
 
437
442
  updatedBalance=$(getAddressBalance "$paymentAddr")
@@ -448,7 +453,7 @@ deregisterPool() {
448
453
  cardano-cli stake-pool deregistration-certificate \
449
454
  --cold-verification-key-file "$coldVKey" \
450
455
  --epoch "$RETIRING_EPOCH" \
451
- --out-file pool.dereg
456
+ --out-file ${SP_NODE_ID}/pool.dereg
452
457
 
453
458
  utxo=$(cardano-cli query utxo --address "$genesisAddr" --testnet-magic 888 | awk 'NR == 3 {printf("%s#%s", $1, $2)}')
454
459
 
@@ -457,17 +462,17 @@ deregisterPool() {
457
462
  --tx-out "$genesisAddr"+0 \
458
463
  --invalid-hereafter 500000 \
459
464
  --fee 0 \
460
- --certificate-file pool.dereg \
461
- --out-file tx.tmp
465
+ --certificate-file ${SP_NODE_ID}/pool.dereg \
466
+ --out-file ${SP_NODE_ID}/tx.tmp
462
467
 
463
468
  fee=$(cardano-cli transaction calculate-min-fee \
464
- --tx-body-file tx.tmp \
469
+ --tx-body-file ${SP_NODE_ID}/tx.tmp \
465
470
  --tx-in-count 1 \
466
471
  --tx-out-count 1 \
467
472
  --testnet-magic 888 \
468
473
  --witness-count 3 \
469
474
  --byron-witness-count 0 \
470
- --protocol-params-file ./params.json | awk '{ print $1 }')
475
+ --protocol-params-file ${SP_NODE_ID}/params.json | awk '{ print $1 }')
471
476
 
472
477
  initialBalance=$(getAddressBalance "$genesisAddr")
473
478
  txOut=$((initialBalance - fee))
@@ -477,19 +482,19 @@ deregisterPool() {
477
482
  --tx-out "$genesisAddr"+"$txOut" \
478
483
  --invalid-hereafter 500000 \
479
484
  --fee "$fee" \
480
- --certificate-file pool.dereg \
481
- --out-file tx.raw
485
+ --certificate-file ${SP_NODE_ID}/pool.dereg \
486
+ --out-file ${SP_NODE_ID}/tx.raw
482
487
 
483
488
  cardano-cli transaction sign \
484
- --tx-body-file tx.raw \
489
+ --tx-body-file ${SP_NODE_ID}/tx.raw \
485
490
  --signing-key-file "$genesisSKey" \
486
491
  --signing-key-file "$coldKey" \
487
492
  --signing-key-file "$stakeKey" \
488
493
  --testnet-magic 888 \
489
- --out-file tx.signed
494
+ --out-file ${SP_NODE_ID}/tx.signed
490
495
 
491
496
  cardano-cli transaction submit \
492
- --tx-file tx.signed \
497
+ --tx-file ${SP_NODE_ID}/tx.signed \
493
498
  --testnet-magic 888
494
499
 
495
500
  updatedBalance=$(getAddressBalance "$genesisAddr")
@@ -5,6 +5,7 @@
5
5
 
6
6
  set -euo pipefail
7
7
 
8
+ SCRIPT_NAME=$(basename "$0")
8
9
  here="$(cd "$(dirname "$0")" >/dev/null 2>&1 && pwd)"
9
10
  root="$(cd "$here/.." && pwd)"
10
11
  cd "$root"
@@ -16,7 +17,7 @@ REFERENCE_INPUT_ADDR='addr_test1wqnp362vmvr8jtc946d3a3utqgclfdl5y9d3kn849e359hst
16
17
  REFERENCE_SCRIPT_ADDR='addr_test1wz3937ykmlcaqxkf4z7stxpsfwfn4re7ncy48yu8vutcpxgnj28k0'
17
18
 
18
19
  clean() {
19
- rm pparams.json tx-script.build tx-script.signed test-babbage.tx test-babbage.signed test-babbage2.tx test-babbage2.signed balance.out fullUtxo.out
20
+ rm -f pparams.json tx-script.build tx-script.signed test-babbage.tx test-babbage.signed test-babbage2.tx test-babbage2.signed balance.out fullUtxo.out
20
21
  }
21
22
 
22
23
  getAddressBalance() {
@@ -59,7 +60,7 @@ getBiggestUtxo() {
59
60
  trap clean EXIT
60
61
 
61
62
  while [ ! -S "$CARDANO_NODE_SOCKET_PATH" ]; do
62
- echo "plutus-transaction.sh: CARDANO_NODE_SOCKET_PATH: $CARDANO_NODE_SOCKET_PATH file doesn't exist, waiting..."
63
+ echo "$SCRIPT_NAME: CARDANO_NODE_SOCKET_PATH: $CARDANO_NODE_SOCKET_PATH file doesn't exist, waiting..."
63
64
  sleep 2
64
65
  done
65
66
 
@@ -74,14 +75,12 @@ cardano-cli query protocol-parameters \
74
75
  --testnet-magic 888 \
75
76
  --out-file pparams.json
76
77
 
77
- cardano-cli transaction build \
78
- --babbage-era \
78
+ cardano-cli conway transaction build \
79
79
  --testnet-magic 888 \
80
80
  --change-address "$genesisAddr" \
81
81
  --tx-in "$utxo" \
82
82
  --tx-out "$REFERENCE_INPUT_ADDR"+"$AMOUNT" \
83
83
  --tx-out-inline-datum-value 42 \
84
- --protocol-params-file pparams.json \
85
84
  --out-file tx-script.build
86
85
 
87
86
  cardano-cli transaction sign \
@@ -108,14 +107,12 @@ currentBalance=$(getAddressBalance "$REFERENCE_SCRIPT_ADDR")
108
107
 
109
108
  echo "Locking reference script UTXO (Multisignature)..."
110
109
 
111
- cardano-cli transaction build \
112
- --babbage-era \
110
+ cardano-cli conway transaction build \
113
111
  --testnet-magic 888 \
114
112
  --change-address "$genesisAddr" \
115
113
  --tx-in "$utxo" \
116
114
  --tx-out "$REFERENCE_SCRIPT_ADDR"+"$AMOUNT" \
117
115
  --tx-out-reference-script-file scripts/contracts/multisignature.json \
118
- --protocol-params-file pparams.json \
119
116
  --out-file tx-script.build
120
117
 
121
118
  cardano-cli transaction sign \
@@ -140,14 +137,12 @@ currentBalance=$(getAddressBalance "$REFERENCE_SCRIPT_ADDR")
140
137
 
141
138
  echo "Locking reference script UTXO (Timelock)..."
142
139
 
143
- cardano-cli transaction build \
144
- --babbage-era \
140
+ cardano-cli conway transaction build \
145
141
  --testnet-magic 888 \
146
142
  --change-address "$genesisAddr" \
147
143
  --tx-in "$utxo" \
148
144
  --tx-out "$REFERENCE_SCRIPT_ADDR"+"$AMOUNT" \
149
145
  --tx-out-reference-script-file scripts/contracts/timelock.json \
150
- --protocol-params-file pparams.json \
151
146
  --out-file tx-script.build
152
147
 
153
148
  cardano-cli transaction sign \
@@ -172,14 +167,12 @@ currentBalance=$(getAddressBalance "$REFERENCE_SCRIPT_ADDR")
172
167
 
173
168
  echo "Locking reference script UTXO (Plutus V1)..."
174
169
 
175
- cardano-cli transaction build \
176
- --babbage-era \
170
+ cardano-cli conway transaction build \
177
171
  --testnet-magic 888 \
178
172
  --change-address "$genesisAddr" \
179
173
  --tx-in "$utxo" \
180
174
  --tx-out "$REFERENCE_SCRIPT_ADDR"+"$AMOUNT" \
181
175
  --tx-out-reference-script-file scripts/contracts/alwayssucceeds.plutus \
182
- --protocol-params-file pparams.json \
183
176
  --out-file tx-script.build
184
177
 
185
178
  cardano-cli transaction sign \
@@ -204,14 +197,12 @@ currentBalance=$(getAddressBalance "$REFERENCE_SCRIPT_ADDR")
204
197
 
205
198
  echo "Locking reference script UTXO (Plutus V2)..."
206
199
 
207
- cardano-cli transaction build \
208
- --babbage-era \
200
+ cardano-cli conway transaction build \
209
201
  --testnet-magic 888 \
210
202
  --change-address "$genesisAddr" \
211
203
  --tx-in "$utxo" \
212
204
  --tx-out "$REFERENCE_SCRIPT_ADDR"+"$AMOUNT" \
213
205
  --tx-out-reference-script-file scripts/contracts/reference-input.plutus \
214
- --protocol-params-file pparams.json \
215
206
  --out-file tx-script.build
216
207
 
217
208
  cardano-cli transaction sign \
@@ -235,14 +226,12 @@ echo "Locking funds in script..."
235
226
  utxo=$(awk '{printf("%s", $1)}' <<<"$(getBiggestUtxo "$genesisAddr")")
236
227
  currentBalance=$(getAddressBalance "$REFERENCE_INPUT_SCRIPT_ADDR")
237
228
 
238
- cardano-cli transaction build \
239
- --babbage-era \
229
+ cardano-cli conway transaction build \
240
230
  --testnet-magic 888 \
241
231
  --tx-in "$utxo" \
242
232
  --tx-out "$REFERENCE_INPUT_SCRIPT_ADDR"+"$AMOUNT" \
243
233
  --tx-out-inline-datum-file scripts/contracts/unit.json \
244
234
  --change-address "$genesisAddr" \
245
- --protocol-params-file pparams.json \
246
235
  --out-file test-babbage.tx
247
236
 
248
237
  cardano-cli transaction sign \
@@ -270,8 +259,7 @@ scriptUtxo=$(awk '{printf("%s", $1)}' <<<"$(getBiggestUtxo "$REFERENCE_INPUT_SCR
270
259
  currentBalance=$(getAddressBalance "$REFERENCE_INPUT_SCRIPT_ADDR")
271
260
  returnCollateralVal=$(("$utxoVal" - 1450000))
272
261
 
273
- cardano-cli transaction build \
274
- --babbage-era \
262
+ cardano-cli conway transaction build \
275
263
  --testnet-magic 888 \
276
264
  --tx-in-collateral "$utxo" \
277
265
  --tx-in "$utxo" \
@@ -281,7 +269,6 @@ cardano-cli transaction build \
281
269
  --tx-in-redeemer-value 42 \
282
270
  --read-only-tx-in-reference "$referenceInputUtxo" \
283
271
  --change-address "$genesisAddr" \
284
- --protocol-params-file pparams.json \
285
272
  --tx-out-return-collateral "$REFERENCE_INPUT_ADDR"+"$returnCollateralVal" \
286
273
  --tx-total-collateral 1450000 \
287
274
  --out-file test-babbage2.tx