Skip to content

Commit 7a63ab7

Browse files
Merge pull request #1347 from input-output-hk/chore/master-to-conway-era-merge
master to conway-era merge
2 parents 712616d + 05f7407 commit 7a63ab7

File tree

108 files changed

+1483
-218
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+1483
-218
lines changed

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ module.exports = {
6161
'no-unused-expressions': 'off',
6262
'no-unused-vars': 0,
6363
'no-useless-constructor': 0,
64+
'promise/always-return': 0,
6465
'promise/avoid-new': 0,
6566
quotes: ['error', 'single', { avoidEscape: true }],
6667
'sort-imports': ['warn', { ignoreDeclarationSort: true }],

.github/workflows/std.yml

+16-6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ on:
1313
type: boolean
1414
required: true
1515
default: false
16+
deploy-dev-preprod-resync:
17+
description: Deploy to dev-preprod-resync
18+
type: boolean
19+
required: true
20+
default: false
1621
deploy-staging-preprod:
1722
description: Deploy to staging-preprod
1823
type: boolean
@@ -117,6 +122,9 @@ jobs:
117122
if [ "true" == ${{ inputs.deploy-dev-preprod || false }} ] ; then
118123
echo '{"environment":"dev-preprod", "target":"dev-preprod@us-east-1@v2", "url": "https://dev-preprod.lw.iog.io/"}'
119124
fi
125+
if [ "true" == ${{ inputs.deploy-dev-preprod-resync || false }} ] ; then
126+
echo '{"environment":"dev-preprod-resync", "target":"dev-preprod-resync@us-east-1@v2", "url": "https://dev-preprod-resync.lw.iog.io/"}'
127+
fi
120128
if [ "true" == ${{ inputs.deploy-staging-preprod || false }} ] ; then
121129
echo '{"environment":"staging-preprod", "target":"staging-preprod@us-east-1@v2", "url": "https://staging-preprod.lw.iog.io/"}'
122130
fi
@@ -230,10 +238,10 @@ jobs:
230238
printf "" >pr-comment.md
231239
232240
for target in \
233-
${{ github.base_ref == 'master' && '"dev-preview@us-east-1"' || '' }} \
234-
${{ github.base_ref == 'master' && '"dev-preprod@us-east-1@v2"' || '' }} \
235-
${{ github.base_ref == 'master' && '"dev-mainnet@us-east-1"' || '' }} \
236-
${{ github.base_ref == 'conway-era' && '"dev-sanchonet@us-east-1@v1"' || '' }} \
241+
"dev-preview@us-east-1" \
242+
"dev-preprod@us-east-1@v2" \
243+
"dev-preprod-resync@us-east-1@v2" \
244+
"dev-mainnet@us-east-1" \
237245
; do
238246
git restore .kube
239247
nix run -L ".#cardano-services.${target}.plan" | tee k8s-plan.diff
@@ -269,15 +277,17 @@ jobs:
269277
| jq -r --arg commentMarker "$COMMENT_MARKER" 'first(.[] | select(.body | contains($commentMarker)) | .id)'
270278
)
271279
if [ -z "$existingCommentId" ]; then
272-
gh pr comment "$prNumber" --body "$(cat pr-comment.md) <!-- $COMMENT_MARKER -->"
280+
( cat pr-comment.md && echo "<!-- $COMMENT_MARKER -->" ; ) >gh-pr-comment-data.md
281+
gh pr comment "$prNumber" --body-file gh-pr-comment-data.md
273282
else
283+
jq --null-input --rawfile body pr-comment.md --arg marker "<!-- $COMMENT_MARKER -->" '{body: ($body + $marker)}' >curl-patch-data.json
274284
curl --fail-with-body -sSL \
275285
-X PATCH \
276286
-H "Authorization: Bearer $GH_TOKEN" \
277287
-H "Accept: application/vnd.github+json" \
278288
-H "X-GitHub-Api-Version: 2022-11-28" \
279289
"https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/comments/${existingCommentId}" \
280-
-d "$(jq --null-input --arg body "$(cat pr-comment.md) <!-- $COMMENT_MARKER -->" '{body: $body}')"
290+
-d @curl-patch-data.json
281291
fi
282292
283293
deploy:
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Deployed Environments - SDK E2E Tests
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
environment:
7+
description: 'Environment to run e2e tests against'
8+
type: choice
9+
required: true
10+
default: 'dev-preprod'
11+
options:
12+
- live-preprod
13+
- live-preview
14+
- dev-preprod
15+
- dev-preview
16+
- staging-preprod
17+
18+
env:
19+
TL_DEPTH: ${{ github.event.pull_request.head.repo.fork && '0' || fromJson(vars.TL_DEPTH) }}
20+
TL_LEVEL: ${{ github.event.pull_request.head.repo.fork && 'info' || vars.TL_LEVEL }}
21+
22+
jobs:
23+
build_and_test:
24+
strategy:
25+
matrix:
26+
os: [ubuntu-20.04]
27+
runs-on: ${{ matrix.os }}
28+
steps:
29+
- name: 📥 Checkout repository
30+
uses: actions/checkout@v3
31+
32+
- name: Generate .env file
33+
working-directory: ./packages/e2e/
34+
run: |
35+
if [[ "${{ inputs.environment }}" == *"preprod"* ]]; then networkMagic=1; else networkMagic=2; fi
36+
./src/scripts/generate-dotenv.sh ${{ inputs.environment }}
37+
echo "KEY_MANAGEMENT_PARAMS='$(jq --argjson networkMagic $networkMagic --arg mnemonic "${{ secrets.MNEMONIC }}" <<< '{"bip32Ed25519": "Sodium", "accountIndex": 0, "chainId":{"networkId": 0, "networkMagic": 0}, "passphrase":"some_passphrase","mnemonic":"mnemonics"}' '.mnemonic=$mnemonic | .chainId.networkMagic=$networkMagic')'" >> .env
38+
39+
- name: 🧰 Setup Node.js
40+
uses: actions/setup-node@v3
41+
with:
42+
node-version: 18.12.0
43+
44+
- name: 🔨 Build
45+
run: |
46+
yarn install --immutable --inline-builds --mode=skip-build
47+
yarn build:cjs
48+
docker build --no-cache .
49+
env:
50+
NODE_OPTIONS: '--max_old_space_size=8192'
51+
52+
- name: 🔬 Test - e2e - wallet at epoch 0
53+
run: |
54+
yarn workspace @cardano-sdk/e2e test:wallet

Dockerfile

+3-8
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,11 @@ FROM nodejs-builder as cardano-services-builder
5454
RUN yarn --immutable --inline-builds --mode=skip-build
5555
COPY packages packages
5656
RUN \
57-
echo "export const unused = 'unused';" > packages/e2e/src/index.ts &&\
58-
NODE_OPTIONS=--max_old_space_size=10240 yarn build:cjs
57+
yarn workspace @cardano-sdk/cardano-services build &&\
58+
yarn workspace @cardano-sdk/cardano-services-client build
5959

60-
FROM nodejs-builder as cardano-services-production-deps
60+
FROM nodejs-builder as cardano-services
6161
RUN yarn workspaces focus --all --production
62-
63-
FROM ubuntu-nodejs as cardano-services
64-
COPY --from=cardano-services-production-deps /app/node_modules /app/node_modules
65-
COPY --from=cardano-services-production-deps /app/packages/cardano-services/node_modules /app/packages/cardano-services/node_modules
66-
COPY --from=cardano-services-production-deps /app/packages/core/node_modules /app/packages/core/node_modules
6762
COPY --from=cardano-services-builder /app/scripts /app/scripts
6863
COPY --from=cardano-services-builder /app/packages/cardano-services/dist /app/packages/cardano-services/dist
6964
COPY --from=cardano-services-builder /app/packages/cardano-services/package.json /app/packages/cardano-services/package.json

nix/cardano-services/deployments/default.nix

+41
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,44 @@ in
406406
};
407407
};
408408

409+
"dev-preprod-resync@us-east-1@v2" = final: {
410+
name = "${final.namespace}-cardanojs-v2";
411+
namespace = "dev-preprod-resync";
412+
context = "eks-devs";
413+
network = "preprod";
414+
region = "us-east-1";
415+
416+
providers = {
417+
backend = {
418+
enabled = true;
419+
env.NODE_EXTRA_OPTIONS = "--trace-gc";
420+
};
421+
stake-pool-provider = {
422+
enabled = true;
423+
env.OVERRIDE_FUZZY_OPTIONS = "true";
424+
};
425+
handle-provider.enabled = true;
426+
};
427+
428+
projectors = {
429+
handle.enabled = true;
430+
stake-pool.enabled = true;
431+
};
432+
433+
values = {
434+
stakepool.databaseName = "stakepoolv2";
435+
backend.allowedOrigins = lib.concatStringsSep "," allowedOriginsDev;
436+
backend.hostnames = ["${final.namespace}.${baseUrl}"];
437+
438+
pg-boss-worker.enabled = true;
439+
440+
blockfrost-worker.enabled = true;
441+
cardano-services = {
442+
ingresOrder = 98;
443+
};
444+
};
445+
};
446+
409447
"staging-preprod@us-east-1@v2" = final: {
410448
name = "${final.namespace}-cardanojs-v2";
411449
namespace = "staging-preprod";
@@ -435,6 +473,8 @@ in
435473
stakepool.databaseName = "stakepoolv2";
436474
blockfrost-worker.enabled = true;
437475
pg-boss-worker.enabled = true;
476+
pg-boss-worker.metadata-fetch-mode = "direct";
477+
pg-boss-worker.queues = "pool-metadata,pool-metrics,pool-rewards";
438478
cardano-services = {
439479
ingresOrder = 98;
440480
};
@@ -905,6 +945,7 @@ in
905945
};
906946

907947
"ops-preview-1@us-east-1" = final: {
948+
name = "${final.namespace}-cardanojs-v2";
908949
namespace = "ops-preview-1";
909950
network = "preview";
910951
region = "us-east-1";

nix/cardano-services/packages.nix

+5-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ in {
5656
buildInputs = oldAttrs.buildInputs ++ [nixpkgs.pkg-config nixpkgs.libusb1];
5757
# run actual build
5858
buildPhase = ''
59-
yarn build:cjs
59+
yarn workspace @cardano-sdk/cardano-services run build:cjs
6060
'';
6161
# override installPhase to only install what's necessary
6262
installPhase = ''
@@ -71,12 +71,16 @@ in {
7171
mkdir -p $out/libexec/$sourceRoot/packages/$p
7272
cp -r packages/$p/dist $out/libexec/$sourceRoot/packages/$p/dist
7373
cp -r packages/$p/package.json $out/libexec/$sourceRoot/packages/$p/package.json
74+
ln -s $out/libexec/$sourceRoot/packages/$p/package.json $out/libexec/$sourceRoot/packages/$p/dist/package.json
7475
done
7576
cp -r ${production-deps}/libexec/$sourceRoot/packages/cardano-services/config $out/libexec/$sourceRoot/packages/cardano-services/config
7677
7778
cd "$out/libexec/$sourceRoot"
7879
7980
runHook postInstall
81+
82+
# Test that Node.js loads our code correctly:
83+
$out/bin/cli --version
8084
'';
8185
# add a bin script that should be used to run cardano-services CLI
8286
postInstall = ''

packages/cardano-services-client/CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,24 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [0.19.9](https://github.com/input-output-hk/cardano-js-sdk/compare/@cardano-sdk/[email protected]...@cardano-sdk/[email protected]) (2024-06-20)
7+
8+
**Note:** Version bump only for package @cardano-sdk/cardano-services-client
9+
10+
## [0.19.8](https://github.com/input-output-hk/cardano-js-sdk/compare/@cardano-sdk/[email protected]...@cardano-sdk/[email protected]) (2024-06-18)
11+
12+
### Features
13+
14+
* **cardano-services-client:** allow custom apiVersion for providers ([89f5ff4](https://github.com/input-output-hk/cardano-js-sdk/commit/89f5ff4e717af8adf93f8882c446d68a8569173e))
15+
16+
## [0.19.7](https://github.com/input-output-hk/cardano-js-sdk/compare/@cardano-sdk/[email protected]...@cardano-sdk/[email protected]) (2024-06-17)
17+
18+
**Note:** Version bump only for package @cardano-sdk/cardano-services-client
19+
20+
## [0.19.6](https://github.com/input-output-hk/cardano-js-sdk/compare/@cardano-sdk/[email protected]...@cardano-sdk/[email protected]) (2024-06-14)
21+
22+
**Note:** Version bump only for package @cardano-sdk/cardano-services-client
23+
624
## [0.19.5](https://github.com/input-output-hk/cardano-js-sdk/compare/@cardano-sdk/[email protected]...@cardano-sdk/[email protected]) (2024-06-05)
725

826
**Note:** Version bump only for package @cardano-sdk/cardano-services-client

packages/cardano-services-client/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cardano-sdk/cardano-services-client",
3-
"version": "0.19.5",
3+
"version": "0.19.9",
44
"description": "Cardano Services Client",
55
"engines": {
66
"node": ">=16.20.2"

packages/cardano-services-client/src/AssetInfoProvider/assetInfoHttpProvider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const paths: HttpProviderConfigPaths<AssetProvider> = {
1717
export const assetInfoHttpProvider = (config: CreateHttpProviderConfig<AssetProvider>): AssetProvider =>
1818
createHttpProvider<AssetProvider>({
1919
...config,
20-
apiVersion: apiVersion.assetInfo,
20+
apiVersion: config.apiVersion || apiVersion.assetInfo,
2121
paths,
2222
serviceSlug: 'asset'
2323
});

packages/cardano-services-client/src/ChainHistoryProvider/chainHistoryHttpProvider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const chainHistoryHttpProvider = (
2121
): ChainHistoryProvider =>
2222
createHttpProvider<ChainHistoryProvider>({
2323
...config,
24-
apiVersion: apiVersion.chainHistory,
24+
apiVersion: config.apiVersion || apiVersion.chainHistory,
2525
mapError: (error, method) => {
2626
if (method === 'healthCheck' && !error) {
2727
return { ok: false };

packages/cardano-services-client/src/HandleProvider/handleHttpProvider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { apiVersion } from '../version';
1010
export const handleHttpProvider = (config: CreateHttpProviderConfig<HandleProvider>): HandleProvider =>
1111
createHttpProvider<HandleProvider>({
1212
...config,
13-
apiVersion: apiVersion.handle,
13+
apiVersion: config.apiVersion || apiVersion.handle,
1414
paths: handleProviderPaths,
1515
serviceSlug: 'handle'
1616
});

packages/cardano-services-client/src/HttpProvider.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ export interface HttpProviderConfig<T extends Provider> {
4545
export type CreateHttpProviderConfig<T extends Provider> = Pick<
4646
HttpProviderConfig<T>,
4747
'baseUrl' | 'adapter' | 'logger'
48-
>;
48+
> & {
49+
/** Override the OpenApi version */
50+
apiVersion?: string;
51+
};
4952

5053
/**
5154
* Creates a HTTP client for specified provider type, following some conventions:

packages/cardano-services-client/src/NetworkInfoProvider/networkInfoHttpProvider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const paths: HttpProviderConfigPaths<NetworkInfoProvider> = {
2121
export const networkInfoHttpProvider = (config: CreateHttpProviderConfig<NetworkInfoProvider>): NetworkInfoProvider =>
2222
createHttpProvider<NetworkInfoProvider>({
2323
...config,
24-
apiVersion: apiVersion.networkInfo,
24+
apiVersion: config.apiVersion || apiVersion.networkInfo,
2525
paths,
2626
serviceSlug: 'network-info'
2727
});

packages/cardano-services-client/src/RewardsProvider/rewardsHttpProvider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const paths: HttpProviderConfigPaths<RewardsProvider> = {
1818
export const rewardsHttpProvider = (config: CreateHttpProviderConfig<RewardsProvider>): RewardsProvider =>
1919
createHttpProvider<RewardsProvider>({
2020
...config,
21-
apiVersion: apiVersion.rewards,
21+
apiVersion: config.apiVersion || apiVersion.rewards,
2222
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2323
mapError: (error: any, method) => {
2424
if (method === 'healthCheck') {

packages/cardano-services-client/src/StakePoolProvider/stakePoolHttpProvider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const paths: HttpProviderConfigPaths<StakePoolProvider> = {
1717
export const stakePoolHttpProvider = (config: CreateHttpProviderConfig<StakePoolProvider>): StakePoolProvider =>
1818
createHttpProvider<StakePoolProvider>({
1919
...config,
20-
apiVersion: apiVersion.stakePool,
20+
apiVersion: config.apiVersion || apiVersion.stakePool,
2121
paths,
2222
serviceSlug: 'stake-pool'
2323
});

packages/cardano-services-client/src/TxSubmitProvider/txSubmitHttpProvider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const codeToProviderFailure = (code: GeneralCardanoNodeErrorCode | TxSubmissionE
7070
export const txSubmitHttpProvider = (config: CreateHttpProviderConfig<TxSubmitProvider>): TxSubmitProvider =>
7171
createHttpProvider<TxSubmitProvider>({
7272
...config,
73-
apiVersion: apiVersion.txSubmit,
73+
apiVersion: config.apiVersion || apiVersion.txSubmit,
7474
mapError: (error: any, method) => {
7575
switch (method) {
7676
case 'healthCheck': {

packages/cardano-services-client/src/UtxoProvider/utxoHttpProvider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const paths: HttpProviderConfigPaths<UtxoProvider> = {
1717
export const utxoHttpProvider = (config: CreateHttpProviderConfig<UtxoProvider>): UtxoProvider =>
1818
createHttpProvider<UtxoProvider>({
1919
...config,
20-
apiVersion: apiVersion.utxo,
20+
apiVersion: config.apiVersion || apiVersion.utxo,
2121
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2222
mapError: (error: any, method) => {
2323
if (method === 'healthCheck') {

packages/cardano-services-client/test/ChainHistoryProvider/chainHistoryProvider.test.ts

+11
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ describe('chainHistoryProvider', () => {
3737
const provider = chainHistoryHttpProvider(config);
3838
await expect(provider.healthCheck()).resolves.toEqual({ ok: false });
3939
});
40+
41+
it('uses custom apiVersion', async () => {
42+
axiosMock.onPost().replyOnce(200, { ok: true });
43+
const provider = chainHistoryHttpProvider({ ...config, adapter: axiosMock.adapter(), apiVersion: '100' });
44+
await provider.healthCheck();
45+
expect(axiosMock.history).toEqual(
46+
expect.objectContaining({
47+
post: [expect.objectContaining({ baseURL: `${config.baseUrl}/v100/chain-history` })]
48+
})
49+
);
50+
});
4051
});
4152

4253
describe('blocks', () => {

packages/cardano-services/CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [0.28.9](https://github.com/input-output-hk/cardano-js-sdk/compare/@cardano-sdk/[email protected]...@cardano-sdk/[email protected]) (2024-06-20)
7+
8+
**Note:** Version bump only for package @cardano-sdk/cardano-services
9+
10+
## [0.28.8](https://github.com/input-output-hk/cardano-js-sdk/compare/@cardano-sdk/[email protected]...@cardano-sdk/[email protected]) (2024-06-18)
11+
12+
**Note:** Version bump only for package @cardano-sdk/cardano-services
13+
14+
## [0.28.7](https://github.com/input-output-hk/cardano-js-sdk/compare/@cardano-sdk/[email protected]...@cardano-sdk/[email protected]) (2024-06-17)
15+
16+
**Note:** Version bump only for package @cardano-sdk/cardano-services
17+
18+
## [0.28.6](https://github.com/input-output-hk/cardano-js-sdk/compare/@cardano-sdk/[email protected]...@cardano-sdk/[email protected]) (2024-06-14)
19+
20+
**Note:** Version bump only for package @cardano-sdk/cardano-services
21+
622
## [0.28.5](https://github.com/input-output-hk/cardano-js-sdk/compare/@cardano-sdk/[email protected]...@cardano-sdk/[email protected]) (2024-06-05)
723

824
### Features

0 commit comments

Comments
 (0)