From c02d08d67c287296647dfb9ee7c50ffa4aa0bdeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Kihlberg?= Date: Thu, 17 Aug 2023 12:04:18 +0200 Subject: [PATCH 1/3] fix spelling mistake --- packages/legacy-runtime/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/legacy-runtime/package.json b/packages/legacy-runtime/package.json index 3f2930ec..bf7931bc 100644 --- a/packages/legacy-runtime/package.json +++ b/packages/legacy-runtime/package.json @@ -15,7 +15,7 @@ "scripts": { "build": "tsc --build src", "clean": "tsc --build --clean src", - "test": "echo 'The legact runtime doesnt have unit tests'", + "test": "echo 'The legacy runtime doesnt have unit tests'", "test:e2e": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest --config test/jest.e2e.config.mjs", "build:e2e": "tsc --build test" }, From 5c2aa60ae9e7215fbf4a2dfa3c50930949c38928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Kihlberg?= Date: Tue, 22 Aug 2023 16:03:22 +0200 Subject: [PATCH 2/3] first draft --- flake.lock | 6 ++--- package.json | 3 ++- packages/token-metadata-client/Readme.md | 2 ++ packages/token-metadata-client/package.json | 25 +++++++++++++++++++ packages/token-metadata-client/src/index.ts | 14 +++++++++++ .../token-metadata-client/src/tsconfig.json | 8 ++++++ packages/token-metadata-client/typedoc.json | 5 ++++ 7 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 packages/token-metadata-client/Readme.md create mode 100644 packages/token-metadata-client/package.json create mode 100644 packages/token-metadata-client/src/index.ts create mode 100644 packages/token-metadata-client/src/tsconfig.json create mode 100644 packages/token-metadata-client/typedoc.json diff --git a/flake.lock b/flake.lock index 3c3e071d..c88d867b 100644 --- a/flake.lock +++ b/flake.lock @@ -36,11 +36,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1688380630, - "narHash": "sha256-8ilApWVb1mAi4439zS3iFeIT0ODlbrifm/fegWwgHjA=", + "lastModified": 1692523566, + "narHash": "sha256-VDJDihK6jNebVw9y3qKCVD6+6QaC/x8kxZzL4MaIPPY=", "owner": "numtide", "repo": "devshell", - "rev": "f9238ec3d75cefbb2b42a44948c4e8fb1ae9a205", + "rev": "d208c58e2f7afef838add5f18a9936b12a71d695", "type": "github" }, "original": { diff --git a/package.json b/package.json index 10be3192..50ff5ca9 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,8 @@ "workspaces": [ "packages/legacy-adapter", "packages/language/core/v1", - "packages/legacy-runtime" + "packages/legacy-runtime", + "packages/token-metadata-client" ], "devDependencies": { "@blockfrost/blockfrost-js": "5.2.0", diff --git a/packages/token-metadata-client/Readme.md b/packages/token-metadata-client/Readme.md new file mode 100644 index 00000000..caa589da --- /dev/null +++ b/packages/token-metadata-client/Readme.md @@ -0,0 +1,2 @@ +# @marlow/token-metadata-client +TODO \ No newline at end of file diff --git a/packages/token-metadata-client/package.json b/packages/token-metadata-client/package.json new file mode 100644 index 00000000..d7cfeced --- /dev/null +++ b/packages/token-metadata-client/package.json @@ -0,0 +1,25 @@ +{ + "name": "@marlowe/token-metadata-client", + "version": "0.1.0-beta", + "description": "TODO", + "repository": "https://github.com/input-output-hk/marlowe-ts-sdk", + "publishConfig": { + "access": "public" + }, + "contributors": [ + "Nicolas Henin (https://iohk.io)", + "Hernan Rajchert (https://iohk.io)", + "Bjorn Kihlberg (https://iohk.io)" + ], + "license": "Apache-2.0", + "scripts": { + "build": "tsc --build src", + "clean": "tsc --build --clean src", + "test": "echo '@marlowe/token-metadata-client doesnt have unit tests'" + }, + "type": "module", + "exports": { + ".": "./dist/index.js" + }, + "dependencies": {} +} diff --git a/packages/token-metadata-client/src/index.ts b/packages/token-metadata-client/src/index.ts new file mode 100644 index 00000000..60afd182 --- /dev/null +++ b/packages/token-metadata-client/src/index.ts @@ -0,0 +1,14 @@ +export interface TokenMetadata { + precision: number; + symbol: string; + name: string; +} + +export const lookupToken = ( + policyId: string, + tokenName: string +): TokenMetadata | Error => { + if (policyId === "" && tokenName === "") + return { precision: 1e-6, symbol: "₳", name: "Ada" }; + return new Error("not found"); +}; diff --git a/packages/token-metadata-client/src/tsconfig.json b/packages/token-metadata-client/src/tsconfig.json new file mode 100644 index 00000000..1e20b0a7 --- /dev/null +++ b/packages/token-metadata-client/src/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig-base.json", + "compilerOptions": { + "outDir": "../dist", + "paths": {} + }, + "references": [] +} diff --git a/packages/token-metadata-client/typedoc.json b/packages/token-metadata-client/typedoc.json new file mode 100644 index 00000000..103a6fb2 --- /dev/null +++ b/packages/token-metadata-client/typedoc.json @@ -0,0 +1,5 @@ +{ + "entryPointStrategy": "expand", + "entryPoints": ["./src"], + "tsconfig": "./src/tsconfig.json" +} From 344016368dfbd316e437be31d00bc69dd1e8427c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Kihlberg?= Date: Wed, 23 Aug 2023 11:06:58 +0200 Subject: [PATCH 3/3] hardcode network --- packages/token-metadata-client/src/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/token-metadata-client/src/index.ts b/packages/token-metadata-client/src/index.ts index 60afd182..4272a05b 100644 --- a/packages/token-metadata-client/src/index.ts +++ b/packages/token-metadata-client/src/index.ts @@ -2,13 +2,14 @@ export interface TokenMetadata { precision: number; symbol: string; name: string; + network: "mainnet" | "preview" | "preprod"; } export const lookupToken = ( policyId: string, tokenName: string -): TokenMetadata | Error => { +): TokenMetadata => { if (policyId === "" && tokenName === "") - return { precision: 1e-6, symbol: "₳", name: "Ada" }; - return new Error("not found"); + return { precision: 1e-6, symbol: "₳", name: "Ada", network: "mainnet" }; + throw new Error("not found"); };