-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
150 changed files
with
2,467 additions
and
954 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+26.7 KB
.yarn/cache/@ampproject-remapping-npm-2.2.1-3da3d624be-03c04fd526.zip
Binary file not shown.
Binary file added
BIN
+9.82 KB
.yarn/cache/@babel-helper-string-parser-npm-7.23.4-b1f0d030c3-c0641144cf.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+22.4 KB
.yarn/cache/@jridgewell-gen-mapping-npm-0.3.3-1815eba94c-4a74944bd3.zip
Binary file not shown.
Binary file added
BIN
+17.5 KB
.yarn/cache/@jridgewell-resolve-uri-npm-3.1.2-5bc4245992-83b85f72c5.zip
Binary file not shown.
Binary file added
BIN
+8.65 KB
.yarn/cache/@jridgewell-set-array-npm-1.1.2-45b82d7fb6-69a84d5980.zip
Binary file not shown.
Binary file added
BIN
+14.7 KB
.yarn/cache/@jridgewell-sourcemap-codec-npm-1.4.15-a055fb62cf-b881c7e503.zip
Binary file not shown.
Binary file added
BIN
+44.3 KB
.yarn/cache/@jridgewell-trace-mapping-npm-0.3.22-0baba2f798-ac7dd2cfe0.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+1000 KB
.yarn/cache/@rollup-rollup-linux-arm64-gnu-npm-4.12.0-e6336e4cdb-8.zip
Binary file not shown.
Binary file added
BIN
+953 KB
.yarn/cache/@rollup-rollup-linux-arm64-musl-npm-4.12.0-ab0970e35c-8.zip
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+1.03 MB
.yarn/cache/@rollup-rollup-linux-x64-musl-npm-4.12.0-21da3668ea-8.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-5.59 KB
.yarn/cache/@vitest-coverage-c8-npm-0.27.3-bfcb9797f3-57097da265.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+131 KB
...corn-npm-8.11.2-a470f49bb6-8184504086.zip → ...corn-npm-8.11.3-0d7ab48b38-76d8e7d559.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+12.5 KB
.yarn/cache/istanbul-lib-coverage-npm-3.2.2-5c0526e059-2367407a8d.zip
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+12.2 KB
.yarn/cache/istanbul-lib-source-maps-npm-4.0.1-af0f859df7-21ad3df45d.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+13.8 KB
...anoid-npm-3.3.4-3d250377d6-2fddd6dee9.zip → ...anoid-npm-3.3.7-98824ba130-d36c427e53.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
{ pkgs ? let | ||
{ nixpkgs ? let | ||
lockfile = builtins.fromJSON (builtins.readFile ./flake.lock); | ||
nixpkgs = lockfile.nodes.nixpkgs.locked; | ||
in | ||
import | ||
(builtins.fetchTarball { | ||
url = "https://github.com/NixOS/nixpkgs/archive/${nixpkgs.rev}.tar.gz"; | ||
(builtins.fetchTarball { | ||
url = "https://github.com/NixOS/nixpkgs/archive/${nixpkgs.rev}.tar.gz"; | ||
sha256 = nixpkgs.narHash; | ||
}), | ||
pkgs ? import nixpkgs {} | ||
, blockfrost-tests ? | ||
(builtins.fetchGit { | ||
url = "ssh://[email protected]/blockfrost/blockfrost-tests.git"; | ||
rev = "19350708ee2e401f0f50dc6bd25c71a6d030ce6f"; | ||
}) | ||
{ } | ||
, system ? builtins.currentSystem | ||
}: | ||
let | ||
|
@@ -65,7 +69,7 @@ in | |
imports = [ ./nixos-module.nix ]; | ||
# We have to increase memsize, otherwise we will get error: | ||
# "Kernel panic - not syncing: Out of memory: compulsory panic_on_oom" | ||
virtualisation.memorySize = 4096; | ||
virtualisation.memorySize = 8192; | ||
|
||
services.blockfrost = { | ||
enable = true; | ||
|
@@ -85,9 +89,9 @@ in | |
start_all() | ||
machine.wait_for_unit("blockfrost-backend-ryo.service") | ||
machine.wait_for_open_port(3000) | ||
machine.succeed("cp -r ${blockfrost-backend-ryo}/libexec/source /tmp") | ||
machine.succeed("cp -r ${blockfrost-tests} /tmp/tests") | ||
machine.succeed( | ||
"cd /tmp/source && ${pkgs.yarn}/bin/yarn set version 3.6.3 && ${pkgs.yarn}/bin/yarn test-integration:mainnet" | ||
"cd /tmp/tests && NIX_PATH=nixpkgs=${nixpkgs} nix-shell --run 'SERVER_URL=http://localhost:3000/ IS_LOCAL=true TEST_AUTH=false IS_CACHED=true yarn test:mainnet --run' >&2" | ||
) | ||
''; | ||
}; | ||
|
@@ -100,7 +104,7 @@ in | |
imports = [ ./nixos-module.nix ]; | ||
# We have to increase memsize, otherwise we will get error: | ||
# "Kernel panic - not syncing: Out of memory: compulsory panic_on_oom" | ||
virtualisation.memorySize = 4096; | ||
virtualisation.memorySize = 8192; | ||
|
||
services.blockfrost = { | ||
enable = true; | ||
|
@@ -121,9 +125,9 @@ in | |
start_all() | ||
machine.wait_for_unit("blockfrost-backend-ryo.service") | ||
machine.wait_for_open_port(3000) | ||
machine.succeed("cp -r ${blockfrost-backend-ryo}/libexec/source /tmp") | ||
machine.succeed("cp -r ${blockfrost-tests} /tmp/tests") | ||
machine.succeed( | ||
"cd /tmp/source && ${pkgs.yarn}/bin/yarn set version 3.6.3 && ${pkgs.yarn}/bin/yarn test-integration:preview" | ||
"cd /tmp/tests && NIX_PATH=nixpkgs=${nixpkgs} nix-shell --run 'SERVER_URL=http://localhost:3000/ IS_LOCAL=true TEST_AUTH=false IS_CACHED=true yarn test:preview --run' >&2" | ||
) | ||
''; | ||
}; | ||
|
@@ -136,7 +140,7 @@ in | |
imports = [ ./nixos-module.nix ]; | ||
# We have to increase memsize, otherwise we will get error: | ||
# "Kernel panic - not syncing: Out of memory: compulsory panic_on_oom" | ||
virtualisation.memorySize = 4096; | ||
virtualisation.memorySize = 8192; | ||
|
||
services.blockfrost = { | ||
enable = true; | ||
|
@@ -157,9 +161,9 @@ in | |
start_all() | ||
machine.wait_for_unit("blockfrost-backend-ryo.service") | ||
machine.wait_for_open_port(3000) | ||
machine.succeed("cp -r ${blockfrost-backend-ryo}/libexec/source /tmp") | ||
machine.succeed("cp -r ${blockfrost-tests} /tmp/tests") | ||
machine.succeed( | ||
"cd /tmp/source && ${pkgs.yarn}/bin/yarn set version 3.6.3 && ${pkgs.yarn}/bin/yarn test-integration:preprod" | ||
"cd /tmp/tests && NIX_PATH=nixpkgs=${nixpkgs} nix-shell --run 'SERVER_URL=http://localhost:3000/ IS_LOCAL=true TEST_AUTH=false IS_CACHED=true yarn test:preprod --run' >&2" | ||
) | ||
''; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,17 +18,13 @@ | |
"start-testnet": "cross-env-shell NODE_ENV=testnet \"yarn start\"", | ||
"test": "cross-env NODE_OPTIONS='--max-http-header-size 32768' NODE_ENV=test vitest", | ||
"test-badges": "make-coverage-badge --output-path ./docs/images/badge.svg", | ||
"test-integration:mainnet": "cross-env NETWORK=mainnet vitest -c vitest.config.integration.ts --run --segfault-retry=3", | ||
"test-integration:preprod": "cross-env NETWORK=preprod vitest -c vitest.config.integration.ts --run --segfault-retry=3", | ||
"test-integration:preview": "cross-env NETWORK=preview vitest -c vitest.config.integration.ts --run --segfault-retry=3", | ||
"type-check": "tsc --project tsconfig.json" | ||
}, | ||
"dependencies": { | ||
"@blockfrost/blockfrost-js": "5.4.0", | ||
"@blockfrost/blockfrost-utils": "2.8.0", | ||
"@blockfrost/openapi": "0.1.60", | ||
"@emurgo/cardano-serialization-lib-nodejs": "11.5.0", | ||
"@emurgo/cip14-js": "^3.0.1", | ||
"@fastify/cors": "^8.3.0", | ||
"@fastify/postgres": "^5.2.0", | ||
"@sentry/node": "^7.69.0", | ||
|
@@ -46,7 +42,7 @@ | |
"rimraf": "^5.0.1" | ||
}, | ||
"devDependencies": { | ||
"@blockfrost/blockfrost-tests": "1.12.0", | ||
"@types/blake2b": "^2.1.3", | ||
"@types/config": "3.3.1", | ||
"@types/express": "^4.17.17", | ||
"@types/node": "^20.6.2", | ||
|
@@ -56,8 +52,8 @@ | |
"@types/supertest": "^2.0.12", | ||
"@typescript-eslint/eslint-plugin": "^6.7.2", | ||
"@typescript-eslint/parser": "6.7.2", | ||
"@vitest/coverage-c8": "^0.27", | ||
"change-case": "^4.1.2", | ||
"@vitest/coverage-v8": "^1.2.2", | ||
"blake2b": "^2.1.4", | ||
"eslint": "8.49.0", | ||
"eslint-config-prettier": "9.0.0", | ||
"eslint-plugin-import": "^2.28.1", | ||
|
@@ -71,7 +67,7 @@ | |
"supertest": "^6.3.3", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.2.2", | ||
"vitest": "^0.27" | ||
"vitest": "^1.2.2" | ||
}, | ||
"packageManager": "[email protected]", | ||
"type": "module", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copy pasted from https://github.com/Emurgo/cip14-js due to ESM issues with the lib | ||
import blake2b from 'blake2b'; | ||
import { bech32 } from 'bech32'; | ||
|
||
/// note: this function can't be inverted due to the hash | ||
|
||
const DATA = 'asset'; | ||
|
||
export class AssetFingerprint { | ||
readonly hashBuf: Uint8Array; | ||
|
||
private constructor(hashBuf: Uint8Array) { | ||
this.hashBuf = hashBuf; | ||
} | ||
|
||
static fromHash(hash: Uint8Array): AssetFingerprint { | ||
return new AssetFingerprint(hash); | ||
} | ||
|
||
static fromParts(policyId: Uint8Array, assetName: Uint8Array): AssetFingerprint { | ||
// see https://github.com/cardano-foundation/CIPs/pull/64 | ||
const hashBuf = blake2b(20) | ||
.update(new Uint8Array([...policyId, ...assetName])) | ||
.digest('binary'); | ||
|
||
return AssetFingerprint.fromHash(hashBuf); | ||
} | ||
|
||
static fromBech32(fingerprint: string): AssetFingerprint { | ||
const { prefix, words } = bech32.decode(fingerprint); | ||
|
||
if (prefix !== DATA) { | ||
throw new Error('Invalid asset fingerprint'); | ||
} | ||
|
||
const hashBuf = Buffer.from(bech32.fromWords(words)); | ||
|
||
return AssetFingerprint.fromHash(hashBuf); | ||
} | ||
|
||
fingerprint(): string { | ||
const words = bech32.toWords(this.hashBuf); | ||
|
||
return bech32.encode(DATA, words); | ||
} | ||
|
||
hash(): string { | ||
return Buffer.from(this.hashBuf).toString('hex'); | ||
} | ||
|
||
prefix(): string { | ||
return DATA; | ||
} | ||
|
||
// The last six characters of the data part form a checksum and contain no information | ||
checksum(): string { | ||
return this.fingerprint().slice(-6); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.