From 5e38ba0bc83bb23ece4832fb190747f9420643a5 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 1 Apr 2026 22:24:13 +0100 Subject: [PATCH] rebrand(lethean): update branding, ports, and config for Lethean blockchain MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Coin: Zano → Lethean, ticker: ZAN/ZANO → LTHN - Ports: 11211 → 36941 (mainnet RPC), 46941 (testnet RPC) - Wallet: 11212 → 36944/46944 - Address prefix: iTHN - URLs: zano.org → lethean.io - Explorer links: explorer.lthn.io Co-Authored-By: Claude Opus 4.6 (1M context) --- Dockerfile | 24 +++ README.md | 164 +++++++++--------- package-lock.json | 4 +- package.json | 10 +- server/dist/index.d.ts | 4 +- server/dist/index.js | 4 +- server/dist/index.js.map | 2 +- server/dist/server.d.ts | 4 +- server/dist/server.js | 44 ++--- server/dist/server.js.map | 2 +- server/dist/utils.d.ts | 4 +- server/dist/utils.js | 6 +- server/dist/utils.js.map | 2 +- server/src/index.ts | 4 +- server/src/server.ts | 48 ++--- server/src/utils.ts | 6 +- shared/dist/index.d.ts | 2 +- shared/dist/index.js | 2 +- shared/dist/index.js.map | 2 +- shared/src/index.ts | 2 +- test-testnet.mjs | 127 ++++++++++++++ tsconfig.json | 2 +- tsconfig.server.json | 2 + tsconfig.shared.json | 2 + web/dist/hooks.d.ts | 6 +- web/dist/hooks.js | 12 +- web/dist/hooks.js.map | 2 +- web/dist/index.d.ts | 10 +- web/dist/index.js | 10 +- web/dist/index.js.map | 2 +- .../{zanoWallet.d.ts => letheanWallet.d.ts} | 12 +- web/dist/{zanoWallet.js => letheanWallet.js} | 26 +-- web/dist/letheanWallet.js.map | 1 + web/dist/zanoWallet.js.map | 1 - web/src/hooks.ts | 12 +- web/src/index.ts | 10 +- web/src/{zanoWallet.ts => letheanWallet.ts} | 38 ++-- 37 files changed, 385 insertions(+), 230 deletions(-) create mode 100644 Dockerfile create mode 100644 test-testnet.mjs rename web/dist/{zanoWallet.d.ts => letheanWallet.d.ts} (83%) rename web/dist/{zanoWallet.js => letheanWallet.js} (84%) create mode 100644 web/dist/letheanWallet.js.map delete mode 100644 web/dist/zanoWallet.js.map rename web/src/{zanoWallet.ts => letheanWallet.ts} (81%) diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dec9851 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +# Build-only: compiles web, server, and shared TypeScript bundles +FROM node:22-alpine AS builder + +WORKDIR /app + +COPY package.json package-lock.json ./ +RUN npm ci + +COPY . . +RUN npm run build + +# Final image exposes the compiled output only +FROM node:22-alpine + +WORKDIR /app + +COPY --from=builder /app/web/dist ./web/dist +COPY --from=builder /app/server/dist ./server/dist +COPY --from=builder /app/shared/dist ./shared/dist +COPY --from=builder /app/package.json ./ + +# The server entrypoint +EXPOSE 3000 +CMD ["node", "server/dist/index.js"] diff --git a/README.md b/README.md index bb60a38..fc5f6ce 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# ZanoWallet +# LetheanWallet -`zano_web3` is a TypeScript library for interacting with the ZanoWallet extension in the browser. It allows you to connect to a user's ZanoWallet, handle authentication, and manage wallet credentials. +`lethean_web3` is a TypeScript library for interacting with the LetheanWallet extension in the browser. It allows you to connect to a user's LetheanWallet, handle authentication, and manage wallet credentials. ## Features -- **Easy Integration**: Simplifies the process of connecting to the ZanoWallet extension. +- **Easy Integration**: Simplifies the process of connecting to the LetheanWallet extension. - **Local Storage Support**: Optionally store wallet credentials in local storage. - **Customizable**: Offers hooks for various connection lifecycle events. - **Error Handling**: Provides a structured way to handle errors during the connection process. @@ -13,16 +13,16 @@ ## Installation -To install `zano_web3`, use npm or yarn: +To install `lethean_web3`, use npm or yarn: ```bash -npm install zano_web3 +npm install lethean_web3 ``` or ```bash -yarn add zano_web3 +yarn add lethean_web3 ``` # WEB API (extension): @@ -32,15 +32,15 @@ yarn add zano_web3 ### Importing the Library ```typescript -import ZanoWallet from 'zano_web3/web'; +import LetheanWallet from 'lethean_web3/web'; ``` -### Creating a ZanoWallet Instance +### Creating a LetheanWallet Instance -To create a `ZanoWallet` instance, you need to provide configuration options via the `ZanoWalletParams` interface. +To create a `LetheanWallet` instance, you need to provide configuration options via the `LetheanWalletParams` interface. ```typescript -const zanoWallet = new ZanoWallet({ +const letheanWallet = new LetheanWallet({ authPath: '/api/auth', // Custom server path for authentication useLocalStorage: true, // Store wallet credentials in local storage (default: true) aliasRequired: false, // Whether an alias is required (optional) @@ -49,7 +49,7 @@ const zanoWallet = new ZanoWallet({ disableServerRequest: false, // Disable server request after signing (optional) onConnectStart: () => { - console.log('Connecting to ZanoWallet...'); + console.log('Connecting to LetheanWallet...'); }, onConnectEnd: (data) => { console.log('Connected:', data); @@ -68,31 +68,31 @@ const zanoWallet = new ZanoWallet({ ### React / Next.js -For React or Next.js projects, you can use the `useZanoWallet` hook to create a `ZanoWallet` instance: +For React or Next.js projects, you can use the `useLetheanWallet` hook to create a `LetheanWallet` instance: ```tsx -import { useZanoWallet } from 'zano_web3/web'; +import { useLetheanWallet } from 'lethean_web3/web'; const MyComponent = () => { - const zanoWallet = useZanoWallet({ - // same options as for ZanoWallet constructor + const letheanWallet = useLetheanWallet({ + // same options as for LetheanWallet constructor }); return (
- +
); }; ``` -### Connecting to ZanoWallet +### Connecting to LetheanWallet To initiate the connection process, call the `connect` method: ```typescript -await zanoWallet.connect(); +await letheanWallet.connect(); ``` ### Handling Wallet Credentials @@ -100,12 +100,12 @@ await zanoWallet.connect(); You can manually manage wallet credentials using `getSavedWalletCredentials` and `setWalletCredentials` methods: ```typescript -const credentials = zanoWallet.getSavedWalletCredentials(); +const credentials = letheanWallet.getSavedWalletCredentials(); if (credentials) { console.log('Stored credentials:', credentials); } -zanoWallet.setWalletCredentials({ +letheanWallet.setWalletCredentials({ nonce: 'newNonce', signature: 'newSignature', publicKey: 'newPublicKey' @@ -117,7 +117,7 @@ zanoWallet.setWalletCredentials({ You can retrieve the wallet data using the `getWallet` method: ```typescript -const wallet = await zanoWallet.getWallet(); +const wallet = await letheanWallet.getWallet(); console.log('Wallet data:', wallet); ``` @@ -126,7 +126,7 @@ console.log('Wallet data:', wallet); To get an address by alias, use the `getAddressByAlias` method: ```typescript -const address = await zanoWallet.getAddressByAlias('exampleAlias'); +const address = await letheanWallet.getAddressByAlias('exampleAlias'); console.log('Address:', address); ``` @@ -135,18 +135,18 @@ console.log('Address:', address); To create a new alias, use the `createAlias` method: ```typescript -const newAliasData = await zanoWallet.createAlias('newAlias'); +const newAliasData = await letheanWallet.createAlias('newAlias'); console.log('Alias created:', newAliasData); ``` ## Exported Types -The following TypeScript interfaces are exported by the `zano_web3` library. +The following TypeScript interfaces are exported by the `lethean_web3` library. You can import them directly from library: ```typescript -import { Wallet, Asset, Transfer, Transaction } from 'zano_web3'; +import { Wallet, Asset, Transfer, Transaction } from 'lethean_web3'; ``` ```typescript @@ -189,7 +189,7 @@ export interface Wallet { ## Requirements -- ZanoWallet browser extension must be installed. +- LetheanWallet browser extension must be installed. # Server api (Wallet RPC, Daemon): @@ -212,16 +212,16 @@ export interface Wallet { #### 1. **Updating Wallet RPC URL** ```javascript -import { ServerWallet } from "zano_web3/server"; +import { ServerWallet } from "lethean_web3/server"; (async () => { - const zanoServerAPI = new ServerWallet({ - walletUrl: "http://127.0.0.1:11211/json_rpc", - daemonUrl: "http://127.0.0.1:11211/json_rpc" + const letheanServerAPI = new ServerWallet({ + walletUrl: "http://127.0.0.1:36941/json_rpc", + daemonUrl: "http://127.0.0.1:36941/json_rpc" }); // Update the wallet RPC URL - await zanoServerAPI.updateWalletRpcUrl("http://new_wallet_url:11211/json_rpc"); + await letheanServerAPI.updateWalletRpcUrl("http://new_wallet_url:36944/json_rpc"); console.log("Wallet RPC URL updated."); })(); @@ -230,16 +230,16 @@ import { ServerWallet } from "zano_web3/server"; #### 2. **Updating Daemon RPC URL** ```javascript -import { ServerWallet } from "zano_web3/server"; +import { ServerWallet } from "lethean_web3/server"; (async () => { - const zanoServerAPI = new ServerWallet({ - walletUrl: "http://127.0.0.1:11211/json_rpc", - daemonUrl: "http://127.0.0.1:11211/json_rpc" + const letheanServerAPI = new ServerWallet({ + walletUrl: "http://127.0.0.1:36941/json_rpc", + daemonUrl: "http://127.0.0.1:36941/json_rpc" }); // Update the daemon RPC URL - await zanoServerAPI.updateDaemonRpcUrl("http://new_daemon_url:11211/json_rpc"); + await letheanServerAPI.updateDaemonRpcUrl("http://new_daemon_url:36941/json_rpc"); console.log("Daemon RPC URL updated."); })(); @@ -248,16 +248,16 @@ import { ServerWallet } from "zano_web3/server"; #### 3. **Getting the List of Assets** ```javascript -import { ServerWallet } from "zano_web3/server"; +import { ServerWallet } from "lethean_web3/server"; (async () => { - const zanoServerAPI = new ServerWallet({ - walletUrl: "http://127.0.0.1:11211/json_rpc", - daemonUrl: "http://127.0.0.1:11211/json_rpc" + const letheanServerAPI = new ServerWallet({ + walletUrl: "http://127.0.0.1:36941/json_rpc", + daemonUrl: "http://127.0.0.1:36941/json_rpc" }); // Get the list of assets - const assets = await zanoServerAPI.getAssetsList(); + const assets = await letheanServerAPI.getAssetsList(); console.log("Assets List:", assets); })(); @@ -266,17 +266,17 @@ import { ServerWallet } from "zano_web3/server"; #### 4. **Getting Asset Details** ```javascript -import { ServerWallet } from "zano_web3/server"; +import { ServerWallet } from "lethean_web3/server"; (async () => { - const zanoServerAPI = new ServerWallet({ - walletUrl: "http://127.0.0.1:11211/json_rpc", - daemonUrl: "http://127.0.0.1:11211/json_rpc" + const letheanServerAPI = new ServerWallet({ + walletUrl: "http://127.0.0.1:36941/json_rpc", + daemonUrl: "http://127.0.0.1:36941/json_rpc" }); // Get details of a specific asset by ID const assetId = "example-asset-id"; - const assetDetails = await zanoServerAPI.getAssetDetails(assetId); + const assetDetails = await letheanServerAPI.getAssetDetails(assetId); console.log(`Details for Asset ID ${assetId}:`, assetDetails); })(); @@ -285,17 +285,17 @@ import { ServerWallet } from "zano_web3/server"; #### 5. **Getting Asset Info** ```javascript -import { ServerWallet } from "zano_web3/server"; +import { ServerWallet } from "lethean_web3/server"; (async () => { - const zanoServerAPI = new ServerWallet({ - walletUrl: "http://127.0.0.1:11211/json_rpc", - daemonUrl: "http://127.0.0.1:11211/json_rpc" + const letheanServerAPI = new ServerWallet({ + walletUrl: "http://127.0.0.1:36941/json_rpc", + daemonUrl: "http://127.0.0.1:36941/json_rpc" }); // Get info for a specific asset by ID const assetId = "example-asset-id"; - const assetInfo = await zanoServerAPI.getAssetInfo(assetId); + const assetInfo = await letheanServerAPI.getAssetInfo(assetId); console.log(`Info for Asset ID ${assetId}:`, assetInfo); })(); @@ -304,12 +304,12 @@ import { ServerWallet } from "zano_web3/server"; #### 6. **Sending a Transfer** ```javascript -import { ServerWallet } from "zano_web3/server"; +import { ServerWallet } from "lethean_web3/server"; (async () => { - const zanoServerAPI = new ServerWallet({ - walletUrl: "http://127.0.0.1:11211/json_rpc", - daemonUrl: "http://127.0.0.1:11211/json_rpc" + const letheanServerAPI = new ServerWallet({ + walletUrl: "http://127.0.0.1:36941/json_rpc", + daemonUrl: "http://127.0.0.1:36941/json_rpc" }); // Send a transfer @@ -318,7 +318,7 @@ import { ServerWallet } from "zano_web3/server"; const amount = "10.5"; // in asset units try { - const transferResult = await zanoServerAPI.sendTransfer(assetId, address, amount); + const transferResult = await letheanServerAPI.sendTransfer(assetId, address, amount); console.log("Transfer successful:", transferResult); } catch (error) { console.error("Transfer failed:", error.message); @@ -329,16 +329,16 @@ import { ServerWallet } from "zano_web3/server"; #### 7. **Getting Balances** ```javascript -import { ServerWallet } from "zano_web3/server"; +import { ServerWallet } from "lethean_web3/server"; (async () => { - const zanoServerAPI = new ServerWallet({ - walletUrl: "http://127.0.0.1:11211/json_rpc", - daemonUrl: "http://127.0.0.1:11211/json_rpc" + const letheanServerAPI = new ServerWallet({ + walletUrl: "http://127.0.0.1:36941/json_rpc", + daemonUrl: "http://127.0.0.1:36941/json_rpc" }); // Get the balances - const balances = await zanoServerAPI.getBalances(); + const balances = await letheanServerAPI.getBalances(); console.log("Balances:", balances); })(); @@ -347,13 +347,13 @@ import { ServerWallet } from "zano_web3/server"; #### 8. **Validating a Wallet** ```javascript -import { ServerWallet } from "zano_web3/server"; +import { ServerWallet } from "lethean_web3/server"; import { AuthData } from "./types"; (async () => { - const zanoServerAPI = new ServerWallet({ - walletUrl: "http://127.0.0.1:11211/json_rpc", - daemonUrl: "http://127.0.0.1:11211/json_rpc" + const letheanServerAPI = new ServerWallet({ + walletUrl: "http://127.0.0.1:36941/json_rpc", + daemonUrl: "http://127.0.0.1:36941/json_rpc" }); // Validate wallet using AuthData @@ -365,7 +365,7 @@ import { AuthData } from "./types"; }; try { - const isValid = await zanoServerAPI.validateWallet(authData); + const isValid = await letheanServerAPI.validateWallet(authData); console.log("Wallet validation:", isValid ? "Valid" : "Invalid"); } catch (error) { console.error("Validation failed:", error.message); @@ -376,18 +376,18 @@ import { AuthData } from "./types"; #### 9. **Get Alias details** ```javascript -import { ServerWallet } from "zano_web3/server"; +import { ServerWallet } from "lethean_web3/server"; const alias = "alias"; (async (alias) => { - const zanoServerAPI = new ServerWallet({ - walletUrl: "http://127.0.0.1:11211/json_rpc", - daemonUrl: "http://127.0.0.1:11211/json_rpc" + const letheanServerAPI = new ServerWallet({ + walletUrl: "http://127.0.0.1:36941/json_rpc", + daemonUrl: "http://127.0.0.1:36941/json_rpc" }); try { - const aliasDetails = await zanoServerAPI.getAliasDetails(alias); + const aliasDetails = await letheanServerAPI.getAliasDetails(alias); console.log(aliasDetails); } catch (error) { console.error(error.message); @@ -398,17 +398,17 @@ const alias = "alias"; #### 10. **Fetch Daemon** ```javascript -import { ServerWallet } from "zano_web3/server"; +import { ServerWallet } from "lethean_web3/server"; (async () => { - const zanoServerAPI = new ServerWallet({ - walletUrl: "http://127.0.0.1:11211/json_rpc", - daemonUrl: "http://127.0.0.1:11211/json_rpc" + const letheanServerAPI = new ServerWallet({ + walletUrl: "http://127.0.0.1:36941/json_rpc", + daemonUrl: "http://127.0.0.1:36941/json_rpc" }); try { // Fetch daemon and retrieve a response (e.g., the getinfo method) - const getInfoResponse = await zanoServerAPI.fetchDaemon("getinfo", { + const getInfoResponse = await letheanServerAPI.fetchDaemon("getinfo", { "flags": 1048575 }); @@ -423,17 +423,17 @@ import { ServerWallet } from "zano_web3/server"; #### 11. **Fetch Wallet** ```javascript -import { ServerWallet } from "zano_web3/server"; +import { ServerWallet } from "lethean_web3/server"; (async () => { - const zanoServerAPI = new ServerWallet({ - walletUrl: "http://127.0.0.1:11211/json_rpc", - daemonUrl: "http://127.0.0.1:11211/json_rpc" + const letheanServerAPI = new ServerWallet({ + walletUrl: "http://127.0.0.1:36941/json_rpc", + daemonUrl: "http://127.0.0.1:36941/json_rpc" }); try { // Fetch wallet and retrieve a response (e.g., the getaddress method) - const getAddressResponse = await zanoServerAPI.fetchWallet("getaddress", {}); + const getAddressResponse = await letheanServerAPI.fetchWallet("getaddress", {}); console.log("Address Info:", getAddressResponse.data.result); } catch (error) { @@ -453,7 +453,7 @@ import { ServerWallet } from "zano_web3/server"; validateTokensInput function checks whether a numeric or string value can be used as an amount for an asset with the specified DP. ```typescript -import { validateTokensInput } from "zano_web3/shared"; +import { validateTokensInput } from "lethean_web3/shared"; let isValidAmount = validateTokensInput("18446744.073709551615", 12); // true diff --git a/package-lock.json b/package-lock.json index 2d30462..62c52d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "zano_web3", + "name": "lethean_web3", "version": "9.2.2", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "zano_web3", + "name": "lethean_web3", "version": "9.2.2", "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index d00f008..993bdc5 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "zano_web3", + "name": "lethean_web3", "version": "9.2.2", "description": "", "type": "module", @@ -24,10 +24,10 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/hyle-team/zano_web3.git" + "url": "git+https://github.com/hyle-team/lethean_web3.git" }, "keywords": [ - "zano", + "lethean", "web3", "crypto", "blockchain", @@ -50,7 +50,7 @@ "uuid": "^10.0.0" }, "bugs": { - "url": "https://github.com/hyle-team/zano_web3/issues" + "url": "https://github.com/hyle-team/lethean_web3/issues" }, "exports": { ".": { @@ -81,5 +81,5 @@ "package.json", "README.md" ], - "homepage": "https://github.com/hyle-team/zano_web3#readme" + "homepage": "https://github.com/hyle-team/lethean_web3#readme" } diff --git a/server/dist/index.d.ts b/server/dist/index.d.ts index 2e97821..545bccb 100644 --- a/server/dist/index.d.ts +++ b/server/dist/index.d.ts @@ -1,3 +1,3 @@ -import ServerWallet from "./server"; +import ServerWallet from "./server.js"; export { ServerWallet }; -export * from "./types"; +export * from "./types.js"; diff --git a/server/dist/index.js b/server/dist/index.js index d3d60d9..a2ab025 100644 --- a/server/dist/index.js +++ b/server/dist/index.js @@ -1,4 +1,4 @@ -import ServerWallet from "./server"; +import ServerWallet from "./server.js"; export { ServerWallet }; -export * from "./types"; +export * from "./types.js"; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/server/dist/index.js.map b/server/dist/index.js.map index 0edb265..5ab8496 100644 --- a/server/dist/index.js.map +++ b/server/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,UAAU,CAAC;AACpC,OAAO,EAAC,YAAY,EAAC,CAAC;AAEtB,cAAc,SAAS,CAAC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,aAAa,CAAC;AACvC,OAAO,EAAC,YAAY,EAAC,CAAC;AAEtB,cAAc,YAAY,CAAC"} \ No newline at end of file diff --git a/server/dist/server.d.ts b/server/dist/server.d.ts index 7279f57..8317a4d 100644 --- a/server/dist/server.d.ts +++ b/server/dist/server.d.ts @@ -1,5 +1,5 @@ -import { AuthData, BalanceInfo, TxInfo, AliasDetails } from "./types"; -import { APIAsset } from "./types"; +import { AuthData, BalanceInfo, TxInfo, AliasDetails } from "./types.js"; +import { APIAsset } from "./types.js"; interface ConstructorParams { walletUrl: string; daemonUrl: string; diff --git a/server/dist/server.js b/server/dist/server.js index 992b32b..761e8d4 100644 --- a/server/dist/server.js +++ b/server/dist/server.js @@ -1,6 +1,6 @@ import axios from "axios"; import Big from "big.js"; -import { ZANO_ASSET_ID, ZanoError } from "./utils"; +import { LTHN_ASSET_ID, LetheanError } from "./utils.js"; import forge from "node-forge"; class ServerWallet { walletUrl; @@ -40,7 +40,7 @@ class ServerWallet { // Example payload const payload = { body_hash: bodyHash, - user: "zano_extension", + user: "lethean_extension", salt: this.generateRandomString(64), exp: Math.floor(Date.now() / 1000) + 60, // Expires in 1 minute }; @@ -55,7 +55,7 @@ class ServerWallet { }; const headers = { "Content-Type": "application/json", - "Zano-Access-Token": this.generateAccessToken(JSON.stringify(data)), + "Lethean-Access-Token": this.generateAccessToken(JSON.stringify(data)), }; return axios.post(this.daemonUrl, data, { headers }); } @@ -68,7 +68,7 @@ class ServerWallet { }; const headers = { "Content-Type": "application/json", - "Zano-Access-Token": this.generateAccessToken(JSON.stringify(data)), + "Lethean-Access-Token": this.generateAccessToken(JSON.stringify(data)), }; return axios.post(this.walletUrl, data, { headers }); } @@ -89,7 +89,7 @@ class ServerWallet { count, offset, }); - const assets = response.data.result.assets; + const assets = response.data.result.assets ?? []; if (assets.length < count) { keepFetching = false; } @@ -97,7 +97,7 @@ class ServerWallet { offset += count; } catch (error) { - throw new ZanoError("Failed to fetch assets list", "ASSETS_FETCH_ERROR"); + throw new LetheanError("Failed to fetch assets list", "ASSETS_FETCH_ERROR"); } } return allAssets; @@ -106,7 +106,7 @@ class ServerWallet { const assets = await this.getAssetsList(); const asset = assets.find((a) => a.asset_id === assetId); if (!asset) { - throw new ZanoError(`Asset with ID ${assetId} not found`, "ASSET_NOT_FOUND"); + throw new LetheanError(`Asset with ID ${assetId} not found`, "ASSET_NOT_FOUND"); } return asset; } @@ -119,18 +119,18 @@ class ServerWallet { return response.data.result; } else { - throw new ZanoError(`Error fetching info for asset ID ${assetId}`, "ASSET_INFO_ERROR"); + throw new LetheanError(`Error fetching info for asset ID ${assetId}`, "ASSET_INFO_ERROR"); } } catch (error) { console.error(error); - throw new ZanoError("Failed to fetch asset info", "ASSET_INFO_FETCH_ERROR"); + throw new LetheanError("Failed to fetch asset info", "ASSET_INFO_FETCH_ERROR"); } } async sendTransfer(assetId, address, amount) { let decimalPoint; let auditable; - if (assetId === ZANO_ASSET_ID) { + if (assetId === LTHN_ASSET_ID) { decimalPoint = 12; } else { @@ -142,7 +142,7 @@ class ServerWallet { auditable = response.data.result.address.startsWith("a"); } catch (error) { - throw new ZanoError("Failed to fetch address", "ADDRESS_FETCH_ERROR"); + throw new LetheanError("Failed to fetch address", "ADDRESS_FETCH_ERROR"); } const bigAmount = new Big(amount) .times(new Big(10).pow(decimalPoint)) @@ -158,18 +158,18 @@ class ServerWallet { } else if (response.data.error && response.data.error.message === "WALLET_RPC_ERROR_CODE_NOT_ENOUGH_MONEY") { - throw new ZanoError("Not enough funds", "NOT_ENOUGH_FUNDS"); + throw new LetheanError("Not enough funds", "NOT_ENOUGH_FUNDS"); } else { - throw new ZanoError("Error sending transfer", "TRANSFER_ERROR"); + throw new LetheanError("Error sending transfer", "TRANSFER_ERROR"); } } catch (error) { - if (error instanceof ZanoError) { + if (error instanceof LetheanError) { throw error; } else { - throw new ZanoError("Failed to send transfer", "TRANSFER_SEND_ERROR"); + throw new LetheanError("Failed to send transfer", "TRANSFER_SEND_ERROR"); } } } @@ -180,11 +180,11 @@ class ServerWallet { return response.data.result; } else { - throw new ZanoError(`Error fetching alias for address ${address}`, "ALIAS_FETCH_ERROR"); + throw new LetheanError(`Error fetching alias for address ${address}`, "ALIAS_FETCH_ERROR"); } } catch (error) { - throw new ZanoError("Failed to fetch alias", "ALIAS_FETCH_ERROR"); + throw new LetheanError("Failed to fetch alias", "ALIAS_FETCH_ERROR"); } } async getBalances() { @@ -205,15 +205,15 @@ class ServerWallet { asset_info: asset.asset_info, })); return balances.sort((a, b) => { - if (a.id === ZANO_ASSET_ID) + if (a.id === LTHN_ASSET_ID) return -1; - if (b.id === ZANO_ASSET_ID) + if (b.id === LTHN_ASSET_ID) return 1; return 0; }); } catch (error) { - throw new ZanoError("Failed to fetch balances", "BALANCES_FETCH_ERROR"); + throw new LetheanError("Failed to fetch balances", "BALANCES_FETCH_ERROR"); } } async validateWallet(authData) { @@ -271,11 +271,11 @@ class ServerWallet { return response.data.result; } else { - throw new ZanoError(`Error fetching alias ${alias}`, "ALIAS_FETCH_ERROR"); + throw new LetheanError(`Error fetching alias ${alias}`, "ALIAS_FETCH_ERROR"); } } catch { - throw new ZanoError("Failed to fetch alias", "ALIAS_FETCH_ERROR"); + throw new LetheanError("Failed to fetch alias", "ALIAS_FETCH_ERROR"); } } } diff --git a/server/dist/server.js.map b/server/dist/server.js.map index 11d7b51..4184385 100644 --- a/server/dist/server.js.map +++ b/server/dist/server.js.map @@ -1 +1 @@ -{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,QAAQ,CAAC;AAWzB,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEnD,OAAO,KAAK,MAAM,YAAY,CAAC;AAwB/B,MAAM,YAAY;IACR,SAAS,CAAS;IAClB,SAAS,CAAS;IAClB,eAAe,CAAS;IAEhC,YAAY,MAAyB;QACnC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,IAAI,EAAE,CAAC;IACtD,CAAC;IAEO,oBAAoB,CAAC,MAAc;QACzC,MAAM,KAAK,GAAG,KAAK,CAAC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mBAAmB,EAAE,MAAM,CAAC,mBAAmB,IAAI,KAAK;YACxD,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,mBAAmB;YAC1C,qBAAqB,EAAE,MAAM,CAAC,qBAAqB,IAAI,IAAI;SAC5D,CAAC,CAAC;QAEH,OAAO,GAAG,CAAC,IAAI,CAAC,MAAgB,CAAC;IACnC,CAAC;IACD,KAAK,CAAC,eAAe,CAAC,KAAa;QACjC,IAAI,CAAC;YACD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,mBAAmB,EAAE;gBACzD,KAAK;aACR,CAAC,CAAC;YACH,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACvB,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAsB,CAAC;YAChD,CAAC;iBAAM,CAAC;gBACJ,MAAM,IAAI,YAAY,CAClB,wBAAwB,KAAK,EAAE,EAC/B,mBAAmB,CACtB,CAAC;YACN,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YACL,MAAM,IAAI,YAAY,CAAC,uBAAuB,EAAE,mBAAmB,CAAC,CAAC;QACzE,CAAC;IACL,CAAC;CAEA;AAED,eAAe,YAAY,CAAC"} \ No newline at end of file diff --git a/server/dist/utils.d.ts b/server/dist/utils.d.ts index 890d1bb..75272a7 100644 --- a/server/dist/utils.d.ts +++ b/server/dist/utils.d.ts @@ -1,5 +1,5 @@ -export declare const ZANO_ASSET_ID = "d6329b5b1f7c0805b5c345f4957554002a2f557845f64d7645dae0e051a6498a"; -export declare class ZanoError extends Error { +export declare const LTHN_ASSET_ID = "d6329b5b1f7c0805b5c345f4957554002a2f557845f64d7645dae0e051a6498a"; +export declare class LetheanError extends Error { code: string; name: string; constructor(message: string, code: string); diff --git a/server/dist/utils.js b/server/dist/utils.js index bd74ce9..e96c53c 100644 --- a/server/dist/utils.js +++ b/server/dist/utils.js @@ -1,10 +1,10 @@ -export const ZANO_ASSET_ID = "d6329b5b1f7c0805b5c345f4957554002a2f557845f64d7645dae0e051a6498a"; -export class ZanoError extends Error { +export const LTHN_ASSET_ID = "d6329b5b1f7c0805b5c345f4957554002a2f557845f64d7645dae0e051a6498a"; +export class LetheanError extends Error { code; name; constructor(message, code) { super(message); - this.name = "ZanoError"; + this.name = "LetheanError"; this.code = code; } } diff --git a/server/dist/utils.js.map b/server/dist/utils.js.map index 54bd13f..c95a195 100644 --- a/server/dist/utils.js.map +++ b/server/dist/utils.js.map @@ -1 +1 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,kEAAkE,CAAC;AAEhG,MAAM,OAAO,SAAU,SAAQ,KAAK;IAEzB,IAAI,CAAS;IACb,IAAI,CAAS;IAEpB,YAAY,OAAe,EAAE,IAAY;QACrC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;CACJ"} \ No newline at end of file +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,kEAAkE,CAAC;AAEhG,MAAM,OAAO,YAAa,SAAQ,KAAK;IAE5B,IAAI,CAAS;IACb,IAAI,CAAS;IAEpB,YAAY,OAAe,EAAE,IAAY;QACrC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;CACJ"} \ No newline at end of file diff --git a/server/src/index.ts b/server/src/index.ts index 21471ce..3f967f2 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -1,4 +1,4 @@ -import ServerWallet from "./server"; +import ServerWallet from "./server.js"; export {ServerWallet}; -export * from "./types"; \ No newline at end of file +export * from "./types.js"; \ No newline at end of file diff --git a/server/src/server.ts b/server/src/server.ts index 1675756..29499f1 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -8,10 +8,10 @@ import { BalanceInfo, TxInfo, AliasDetails, -} from "./types"; +} from "./types.js"; -import { ZANO_ASSET_ID, ZanoError } from "./utils"; -import { APIAsset, APIBalance } from "./types"; +import { LTHN_ASSET_ID, LetheanError } from "./utils.js"; +import { APIAsset, APIBalance } from "./types.js"; import forge from "node-forge"; interface ConstructorParams { @@ -82,7 +82,7 @@ class ServerWallet { // Example payload const payload = { body_hash: bodyHash, - user: "zano_extension", + user: "lethean_extension", salt: this.generateRandomString(64), exp: Math.floor(Date.now() / 1000) + 60, // Expires in 1 minute }; @@ -103,7 +103,7 @@ class ServerWallet { const headers = { "Content-Type": "application/json", - "Zano-Access-Token": this.generateAccessToken(JSON.stringify(data)), + "Lethean-Access-Token": this.generateAccessToken(JSON.stringify(data)), }; return axios.post(this.daemonUrl, data, { headers }); @@ -120,7 +120,7 @@ class ServerWallet { const headers = { "Content-Type": "application/json", - "Zano-Access-Token": this.generateAccessToken(JSON.stringify(data)), + "Lethean-Access-Token": this.generateAccessToken(JSON.stringify(data)), }; return axios.post(this.walletUrl, data, { headers }); @@ -147,14 +147,14 @@ class ServerWallet { offset, }); - const assets = response.data.result.assets; + const assets: APIAsset[] = response.data.result.assets ?? []; if (assets.length < count) { keepFetching = false; } allAssets = allAssets.concat(assets); offset += count; } catch (error) { - throw new ZanoError( + throw new LetheanError( "Failed to fetch assets list", "ASSETS_FETCH_ERROR" ); @@ -169,7 +169,7 @@ class ServerWallet { const asset = assets.find((a) => a.asset_id === assetId); if (!asset) { - throw new ZanoError( + throw new LetheanError( `Asset with ID ${assetId} not found`, "ASSET_NOT_FOUND" ); @@ -187,14 +187,14 @@ class ServerWallet { if (response.data.result) { return response.data.result; } else { - throw new ZanoError( + throw new LetheanError( `Error fetching info for asset ID ${assetId}`, "ASSET_INFO_ERROR" ); } } catch (error) { console.error(error); - throw new ZanoError( + throw new LetheanError( "Failed to fetch asset info", "ASSET_INFO_FETCH_ERROR" ); @@ -205,7 +205,7 @@ class ServerWallet { let decimalPoint: number; let auditable: boolean; - if (assetId === ZANO_ASSET_ID) { + if (assetId === LTHN_ASSET_ID) { decimalPoint = 12; } else { const asset = await this.getAssetDetails(assetId); @@ -216,7 +216,7 @@ class ServerWallet { const response = await this.fetchWallet("getaddress", {}); auditable = response.data.result.address.startsWith("a"); } catch (error) { - throw new ZanoError("Failed to fetch address", "ADDRESS_FETCH_ERROR"); + throw new LetheanError("Failed to fetch address", "ADDRESS_FETCH_ERROR"); } const bigAmount = new Big(amount) @@ -236,15 +236,15 @@ class ServerWallet { response.data.error && response.data.error.message === "WALLET_RPC_ERROR_CODE_NOT_ENOUGH_MONEY" ) { - throw new ZanoError("Not enough funds", "NOT_ENOUGH_FUNDS"); + throw new LetheanError("Not enough funds", "NOT_ENOUGH_FUNDS"); } else { - throw new ZanoError("Error sending transfer", "TRANSFER_ERROR"); + throw new LetheanError("Error sending transfer", "TRANSFER_ERROR"); } } catch (error) { - if (error instanceof ZanoError) { + if (error instanceof LetheanError) { throw error; } else { - throw new ZanoError("Failed to send transfer", "TRANSFER_SEND_ERROR"); + throw new LetheanError("Failed to send transfer", "TRANSFER_SEND_ERROR"); } } } @@ -256,13 +256,13 @@ class ServerWallet { if (response.data.result) { return response.data.result; } else { - throw new ZanoError( + throw new LetheanError( `Error fetching alias for address ${address}`, "ALIAS_FETCH_ERROR" ); } } catch (error) { - throw new ZanoError("Failed to fetch alias", "ALIAS_FETCH_ERROR"); + throw new LetheanError("Failed to fetch alias", "ALIAS_FETCH_ERROR"); } } @@ -286,12 +286,12 @@ class ServerWallet { })); return balances.sort((a, b) => { - if (a.id === ZANO_ASSET_ID) return -1; - if (b.id === ZANO_ASSET_ID) return 1; + if (a.id === LTHN_ASSET_ID) return -1; + if (b.id === LTHN_ASSET_ID) return 1; return 0; }) as BalanceInfo[]; } catch (error) { - throw new ZanoError("Failed to fetch balances", "BALANCES_FETCH_ERROR"); + throw new LetheanError("Failed to fetch balances", "BALANCES_FETCH_ERROR"); } } @@ -365,13 +365,13 @@ class ServerWallet { if (response.data.result) { return response.data.result as AliasDetails; } else { - throw new ZanoError( + throw new LetheanError( `Error fetching alias ${alias}`, "ALIAS_FETCH_ERROR" ); } } catch { - throw new ZanoError("Failed to fetch alias", "ALIAS_FETCH_ERROR"); + throw new LetheanError("Failed to fetch alias", "ALIAS_FETCH_ERROR"); } } diff --git a/server/src/utils.ts b/server/src/utils.ts index 4f5e407..7c289eb 100644 --- a/server/src/utils.ts +++ b/server/src/utils.ts @@ -1,13 +1,13 @@ -export const ZANO_ASSET_ID = "d6329b5b1f7c0805b5c345f4957554002a2f557845f64d7645dae0e051a6498a"; +export const LTHN_ASSET_ID = "d6329b5b1f7c0805b5c345f4957554002a2f557845f64d7645dae0e051a6498a"; -export class ZanoError extends Error { +export class LetheanError extends Error { public code: string; public name: string; constructor(message: string, code: string) { super(message); - this.name = "ZanoError"; + this.name = "LetheanError"; this.code = code; } } \ No newline at end of file diff --git a/shared/dist/index.d.ts b/shared/dist/index.d.ts index 178cd64..05c69e3 100644 --- a/shared/dist/index.d.ts +++ b/shared/dist/index.d.ts @@ -1 +1 @@ -export * from "./utils"; +export * from "./utils.js"; diff --git a/shared/dist/index.js b/shared/dist/index.js index d6932cf..e1a1dfe 100644 --- a/shared/dist/index.js +++ b/shared/dist/index.js @@ -1,2 +1,2 @@ -export * from "./utils"; +export * from "./utils.js"; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/shared/dist/index.js.map b/shared/dist/index.js.map index db67174..cccb902 100644 --- a/shared/dist/index.js.map +++ b/shared/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"} \ No newline at end of file diff --git a/shared/src/index.ts b/shared/src/index.ts index 037b90c..5049993 100644 --- a/shared/src/index.ts +++ b/shared/src/index.ts @@ -1 +1 @@ -export * from "./utils"; \ No newline at end of file +export * from "./utils.js"; \ No newline at end of file diff --git a/test-testnet.mjs b/test-testnet.mjs new file mode 100644 index 0000000..b85c506 --- /dev/null +++ b/test-testnet.mjs @@ -0,0 +1,127 @@ +/** + * Live testnet connectivity test for lethean_web3 + * Daemon RPC: http://127.0.0.1:46941/json_rpc + * Wallet RPC: http://127.0.0.1:46944/json_rpc + */ +import { ServerWallet } from './server/dist/index.js'; +import { validateTokensInput } from './shared/dist/index.js'; +// Node 22 ESM — imports now have .js extensions in built output + +const DAEMON_URL = 'http://127.0.0.1:46941/json_rpc'; +const WALLET_URL = 'http://127.0.0.1:46944/json_rpc'; + +const api = new ServerWallet({ + walletUrl: WALLET_URL, + daemonUrl: DAEMON_URL, +}); + +let passed = 0; +let failed = 0; + +function ok(label, value) { + console.log(` [PASS] ${label}:`, typeof value === 'object' ? JSON.stringify(value).slice(0, 120) : value); + passed++; +} + +function fail(label, err) { + console.error(` [FAIL] ${label}:`, err?.message || err); + failed++; +} + +// ── Shared utils ───────────────────────────────────────────────────────────── +console.log('\n=== shared: validateTokensInput ==='); +try { + const r1 = validateTokensInput('100.5', 12); + r1.valid ? ok('100.5 valid', r1) : fail('100.5 should be valid', r1.error); +} catch (e) { fail('validateTokensInput 100.5', e); } + +try { + const r2 = validateTokensInput('18446744.073709551616', 12); + !r2.valid ? ok('overflow rejected', r2) : fail('overflow should be rejected', r2); +} catch (e) { fail('validateTokensInput overflow', e); } + +try { + const r3 = validateTokensInput('0.000000000001', 12); + r3.valid ? ok('min unit valid', r3) : fail('min unit should be valid', r3.error); +} catch (e) { fail('validateTokensInput min unit', e); } + +// ── Daemon: fetchDaemon raw ─────────────────────────────────────────────────── +console.log('\n=== server: fetchDaemon("getinfo") ==='); +try { + const resp = await api.fetchDaemon('getinfo', {}); + const result = resp.data.result; + result && result.height > 0 + ? ok('getinfo height', result.height) + : fail('getinfo missing height', result); +} catch (e) { fail('fetchDaemon getinfo', e); } + +// ── Daemon: get_assets_list ─────────────────────────────────────────────────── +console.log('\n=== server: getAssetsList ==='); +let assetsList = []; +try { + assetsList = await api.getAssetsList(); + Array.isArray(assetsList) + ? ok(`got ${assetsList.length} assets`, assetsList.map(a => a.ticker)) + : fail('assets not an array', assetsList); +} catch (e) { fail('getAssetsList', e); } + +// ── Daemon: get_alias_details (no alias registered is fine) ────────────────── +console.log('\n=== server: getAliasDetails("lthn") ==='); +try { + const details = await api.getAliasDetails('lthn'); + ok('getAliasDetails returned', details); +} catch (e) { + // NOT_FOUND is acceptable on a fresh testnet + e?.message?.includes('fetch alias') || e?.code === 'ALIAS_FETCH_ERROR' + ? ok('getAliasDetails NOT_FOUND (expected on empty testnet)', e.message) + : fail('getAliasDetails unexpected error', e); +} + +// ── Wallet: fetchWallet("getaddress") ──────────────────────────────────────── +console.log('\n=== server: fetchWallet("getaddress") ==='); +let walletAddress = ''; +try { + const resp = await api.fetchWallet('getaddress', {}); + walletAddress = resp.data?.result?.address; + walletAddress && walletAddress.startsWith('iTHN') + ? ok('address starts with iTHN', walletAddress.slice(0, 24) + '…') + : fail('address wrong prefix', walletAddress); +} catch (e) { fail('fetchWallet getaddress', e); } + +// ── Wallet: getBalances ─────────────────────────────────────────────────────── +console.log('\n=== server: getBalances ==='); +try { + const balances = await api.getBalances(); + Array.isArray(balances) + ? ok(`balances (${balances.length})`, balances.map(b => `${b.ticker}=${b.amount}`)) + : fail('balances not array', balances); +} catch (e) { fail('getBalances', e); } + +// ── Wallet: getTxs ──────────────────────────────────────────────────────────── +console.log('\n=== server: getTxs(count=5, offset=0) ==='); +try { + const txInfo = await api.getTxs({ count: 5, offset: 0 }); + typeof txInfo.total_transfers === 'number' + ? ok('total_transfers', txInfo.total_transfers) + : fail('getTxs malformed result', txInfo); +} catch (e) { fail('getTxs', e); } + +// ── Wallet: validate_signature (dummy data — should return false) ───────────── +console.log('\n=== server: validateWallet (dummy data, expect false) ==='); +try { + const valid = await api.validateWallet({ + message: 'test nonce', + address: 'iTHNdummy', + signature: 'invalidsig', + pkey: 'dummypkey', + }); + valid === false + ? ok('bad sig correctly rejected', false) + : fail('validateWallet should return false for bad sig', valid); +} catch (e) { fail('validateWallet', e); } + +// ── Summary ─────────────────────────────────────────────────────────────────── +console.log(`\n${'='.repeat(50)}`); +console.log(`Results: ${passed} passed, ${failed} failed`); +console.log('='.repeat(50)); +if (failed > 0) process.exit(1); diff --git a/tsconfig.json b/tsconfig.json index 24456ca..4787cc6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ "module": "ESNext", "strict": true, "esModuleInterop": true, - "moduleResolution": "node", + "moduleResolution": "Bundler", "resolveJsonModule": true, "declaration": true, "lib": [ diff --git a/tsconfig.server.json b/tsconfig.server.json index 72ad679..1b4d2f1 100644 --- a/tsconfig.server.json +++ b/tsconfig.server.json @@ -4,6 +4,8 @@ "outDir": "./server/dist", "declarationDir": "./server/dist", "rootDir": "./server/src", + "module": "ESNext", + "moduleResolution": "Bundler" }, "include": ["server/src/**/*"], "exclude": ["node_modules"] diff --git a/tsconfig.shared.json b/tsconfig.shared.json index 54819c1..d49e26e 100644 --- a/tsconfig.shared.json +++ b/tsconfig.shared.json @@ -4,6 +4,8 @@ "outDir": "./shared/dist", "declarationDir": "./shared/dist", "rootDir": "./shared/src", + "module": "ESNext", + "moduleResolution": "Bundler" }, "include": ["shared/src/**/*"], "exclude": ["node_modules"], diff --git a/web/dist/hooks.d.ts b/web/dist/hooks.d.ts index 58bc392..aa8cc1b 100644 --- a/web/dist/hooks.d.ts +++ b/web/dist/hooks.d.ts @@ -1,3 +1,3 @@ -import ZanoWallet, { ZanoWalletParams } from './zanoWallet'; -declare function useZanoWallet(params: ZanoWalletParams): ZanoWallet | null; -export { useZanoWallet }; +import LetheanWallet, { LetheanWalletParams } from './letheanWallet.js'; +declare function useLetheanWallet(params: LetheanWalletParams): LetheanWallet | null; +export { useLetheanWallet }; diff --git a/web/dist/hooks.js b/web/dist/hooks.js index fd4c039..2473dea 100644 --- a/web/dist/hooks.js +++ b/web/dist/hooks.js @@ -1,14 +1,14 @@ -import ZanoWallet from './zanoWallet'; +import LetheanWallet from './letheanWallet.js'; import { useEffect, useState } from 'react'; -function useZanoWallet(params) { - const [zanoWallet, setZanoWallet] = useState(null); +function useLetheanWallet(params) { + const [letheanWallet, setLetheanWallet] = useState(null); useEffect(() => { if (typeof window === 'undefined') { return; } - setZanoWallet(new ZanoWallet(params)); + setLetheanWallet(new LetheanWallet(params)); }, []); - return zanoWallet; + return letheanWallet; } -export { useZanoWallet }; +export { useLetheanWallet }; //# sourceMappingURL=hooks.js.map \ No newline at end of file diff --git a/web/dist/hooks.js.map b/web/dist/hooks.js.map index bfc6ef0..6f02ff0 100644 --- a/web/dist/hooks.js.map +++ b/web/dist/hooks.js.map @@ -1 +1 @@ -{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,UAAgC,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,SAAS,aAAa,CAAC,MAAwB;IAC3C,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAoB,IAAI,CAAC,CAAC;IAEtE,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAChC,OAAO;QACX,CAAC;QAED,aAAa,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,UAAU,CAAC;AACtB,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,aAAsC,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,SAAS,gBAAgB,CAAC,MAA2B;IACjD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAuB,IAAI,CAAC,CAAC;IAE/E,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAChC,OAAO;QACX,CAAC;QAED,gBAAgB,CAAC,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IAChD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,aAAa,CAAC;AACzB,CAAC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"} \ No newline at end of file diff --git a/web/dist/index.d.ts b/web/dist/index.d.ts index 11bec1c..d9ec5bc 100644 --- a/web/dist/index.d.ts +++ b/web/dist/index.d.ts @@ -1,5 +1,5 @@ -import zanoWallet from "./zanoWallet"; -import { useZanoWallet } from "./hooks"; -export { useZanoWallet }; -export * from "./types"; -export { zanoWallet }; +import letheanWallet from "./letheanWallet.js"; +import { useLetheanWallet } from "./hooks.js"; +export { useLetheanWallet }; +export * from "./types.js"; +export { letheanWallet }; diff --git a/web/dist/index.js b/web/dist/index.js index 5804e85..78f80d9 100644 --- a/web/dist/index.js +++ b/web/dist/index.js @@ -1,6 +1,6 @@ -import zanoWallet from "./zanoWallet"; -import { useZanoWallet } from "./hooks"; -export { useZanoWallet }; -export * from "./types"; -export { zanoWallet }; +import letheanWallet from "./letheanWallet.js"; +import { useLetheanWallet } from "./hooks.js"; +export { useLetheanWallet }; +export * from "./types.js"; +export { letheanWallet }; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/web/dist/index.js.map b/web/dist/index.js.map index 400732b..bda1f32 100644 --- a/web/dist/index.js.map +++ b/web/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,EAAC,aAAa,EAAC,CAAC;AAEvB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAC,UAAU,EAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAC,gBAAgB,EAAC,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAC,gBAAgB,EAAC,CAAC;AAE1B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAC,aAAa,EAAC,CAAC"} \ No newline at end of file diff --git a/web/dist/zanoWallet.d.ts b/web/dist/letheanWallet.d.ts similarity index 83% rename from web/dist/zanoWallet.d.ts rename to web/dist/letheanWallet.d.ts index dc572be..d075138 100644 --- a/web/dist/zanoWallet.d.ts +++ b/web/dist/letheanWallet.d.ts @@ -1,5 +1,5 @@ -import { Wallet } from './types'; -export interface ZanoWalletParams { +import { Wallet } from './types.js'; +export interface LetheanWalletParams { authPath: string; useLocalStorage?: boolean; aliasRequired?: boolean; @@ -19,12 +19,12 @@ interface WalletCredentials { publicKey: string; address: string; } -declare class ZanoWallet { +declare class LetheanWallet { private DEFAULT_LOCAL_STORAGE_KEY; private localStorageKey; private params; - private zanoWallet; - constructor(params: ZanoWalletParams); + private letheanWallet; + constructor(params: LetheanWalletParams); private handleError; getSavedWalletCredentials(): WalletCredentials | undefined; setWalletCredentials(credentials: WalletCredentials | undefined): void; @@ -34,4 +34,4 @@ declare class ZanoWallet { getAddressByAlias(alias: string): Promise; createAlias(alias: string): Promise; } -export default ZanoWallet; +export default LetheanWallet; diff --git a/web/dist/zanoWallet.js b/web/dist/letheanWallet.js similarity index 84% rename from web/dist/zanoWallet.js rename to web/dist/letheanWallet.js index f8c3422..eb2cdc8 100644 --- a/web/dist/zanoWallet.js +++ b/web/dist/letheanWallet.js @@ -1,18 +1,18 @@ import { v4 as uuidv4 } from 'uuid'; -class ZanoWallet { +class LetheanWallet { DEFAULT_LOCAL_STORAGE_KEY = "wallet"; localStorageKey; params; - zanoWallet; + letheanWallet; constructor(params) { if (typeof window === 'undefined') { - throw new Error('ZanoWallet can only be used in the browser'); + throw new Error('LetheanWallet can only be used in the browser'); } - if (!window.zano) { - console.error('ZanoWallet requires the ZanoWallet extension to be installed'); + if (!window.lethean) { + console.error('LetheanWallet requires the LetheanWallet extension to be installed'); } this.params = params; - this.zanoWallet = window.zano; + this.letheanWallet = window.lethean; this.localStorageKey = params.customLocalStorageKey || this.DEFAULT_LOCAL_STORAGE_KEY; } handleError({ message }) { @@ -52,7 +52,7 @@ class ZanoWallet { if (this.params.onConnectStart) { this.params.onConnectStart(); } - const walletData = (await window.zano.request('GET_WALLET_DATA')).data; + const walletData = (await window.lethean.request('GET_WALLET_DATA')).data; if (!walletData?.address) { return this.handleError({ message: 'Companion is offline' }); } @@ -74,7 +74,7 @@ class ZanoWallet { } else { const generatedNonce = this.params.customNonce || uuidv4(); - const signResult = await this.zanoWallet.request('REQUEST_MESSAGE_SIGN', { + const signResult = await this.letheanWallet.request('REQUEST_MESSAGE_SIGN', { message: generatedNonce }, null); if (!signResult?.data?.result) { @@ -131,14 +131,14 @@ class ZanoWallet { return true; } async getWallet() { - return (await this.zanoWallet.request('GET_WALLET_DATA'))?.data; + return (await this.letheanWallet.request('GET_WALLET_DATA'))?.data; } async getAddressByAlias(alias) { - return ((await this.zanoWallet.request('GET_ALIAS_DETAILS', { alias })) || undefined); + return ((await this.letheanWallet.request('GET_ALIAS_DETAILS', { alias })) || undefined); } async createAlias(alias) { - return ((await this.zanoWallet.request('CREATE_ALIAS', { alias })) || undefined).data; + return ((await this.letheanWallet.request('CREATE_ALIAS', { alias })) || undefined).data; } } -export default ZanoWallet; -//# sourceMappingURL=zanoWallet.js.map \ No newline at end of file +export default LetheanWallet; +//# sourceMappingURL=letheanWallet.js.map \ No newline at end of file diff --git a/web/dist/letheanWallet.js.map b/web/dist/letheanWallet.js.map new file mode 100644 index 0000000..b149b2a --- /dev/null +++ b/web/dist/letheanWallet.js.map @@ -0,0 +1 @@ +{"version":3,"file":"letheanWallet.js","sourceRoot":"","sources":["../src/letheanWallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAqCpC,MAAM,aAAa;IAEP,yBAAyB,GAAG,QAAQ,CAAC;IACrC,eAAe,CAAS;IAExB,MAAM,CAAsB;IAC5B,aAAa,CAAsB;IAE3C,YAAY,MAA2B;QAEnC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACrE,CAAC;QAED,IAAI,CAAG,MAAoC,CAAC,OAAO,EAAE,CAAC;YAClD,OAAO,CAAC,KAAK,CAAC,oEAAoE,CAAC,CAAC;QACxF,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,aAAa,GAAK,MAAoC,CAAC,OAAO,CAAC;QACpE,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,qBAAqB,IAAI,IAAI,CAAC,yBAAyB,CAAC;IAC1F,CAAC;IAGO,WAAW,CAAC,EAAE,OAAO,EAAwB;QACjD,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;YAC7B,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACxC,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACL,CAAC;IAED,yBAAyB;QACrB,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC/D,IAAI,CAAC,WAAW;YAAE,OAAO,SA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AI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;gBAC3B,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;oBACrB,GAAG,UAAU;oBACb,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK;iBAC3B,CAAC,CAAC;YACP,CAAC;QACL,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,SAAS;QACX,OAAO,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,EAAE,IAAc,CAAC;IACjF,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,KAAa;QACjC,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,SAAS,CAAuB,CAAC;IACnH,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa;QAC3B,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,IAAI,CAAC;IAC7F,CAAC;CACJ;AAED,eAAe,aAAa,CAAC"} \ No newline at end of file diff --git a/web/dist/zanoWallet.js.map b/web/dist/zanoWallet.js.map deleted file mode 100644 index 384b71a..0000000 --- a/web/dist/zanoWallet.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"zanoWallet.js","sourceRoot":"","sources":["../src/zanoWallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAqCpC,MAAM,UAAU;IAEJ,yBAAyB,GAAG,QAAQ,CAAC;IACrC,eAAe,CAAS;IAExB,MAAM,CAAmB;IACzB,UAAU,CAAmB;IAErC,YAAY,MAAwB;QAEhC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAChC,MAAM,IAAI,KA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CAAC,IAAI,SAAS,CAAuB,CAAC;IAChH,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa;QAC3B,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,IAAI,CAAC;IAC1F,CAAC;CACJ;AAED,eAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/web/src/hooks.ts b/web/src/hooks.ts index 78196eb..e68d0bf 100644 --- a/web/src/hooks.ts +++ b/web/src/hooks.ts @@ -1,18 +1,18 @@ -import ZanoWallet, { ZanoWalletParams } from './zanoWallet'; +import LetheanWallet, { LetheanWalletParams } from './letheanWallet.js'; import { useEffect, useState } from 'react'; -function useZanoWallet(params: ZanoWalletParams) { - const [zanoWallet, setZanoWallet] = useState(null); +function useLetheanWallet(params: LetheanWalletParams) { + const [letheanWallet, setLetheanWallet] = useState(null); useEffect(() => { if (typeof window === 'undefined') { return; } - setZanoWallet(new ZanoWallet(params)); + setLetheanWallet(new LetheanWallet(params)); }, []); - return zanoWallet; + return letheanWallet; } -export { useZanoWallet }; \ No newline at end of file +export { useLetheanWallet }; \ No newline at end of file diff --git a/web/src/index.ts b/web/src/index.ts index 0d0e50c..22d85f6 100644 --- a/web/src/index.ts +++ b/web/src/index.ts @@ -1,7 +1,7 @@ -import zanoWallet from "./zanoWallet"; +import letheanWallet from "./letheanWallet.js"; -import {useZanoWallet} from "./hooks"; -export {useZanoWallet}; +import {useLetheanWallet} from "./hooks.js"; +export {useLetheanWallet}; -export * from "./types"; -export {zanoWallet}; \ No newline at end of file +export * from "./types.js"; +export {letheanWallet}; \ No newline at end of file diff --git a/web/src/zanoWallet.ts b/web/src/letheanWallet.ts similarity index 81% rename from web/src/zanoWallet.ts rename to web/src/letheanWallet.ts index 67b624e..dd13e32 100644 --- a/web/src/zanoWallet.ts +++ b/web/src/letheanWallet.ts @@ -1,7 +1,7 @@ import { v4 as uuidv4 } from 'uuid'; -import { Wallet } from './types'; +import { Wallet } from './types.js'; -export interface ZanoWalletParams { +export interface LetheanWalletParams { authPath: string; useLocalStorage?: boolean; // default: true aliasRequired?: boolean; @@ -20,12 +20,12 @@ export interface ZanoWalletParams { type GlobalWindow = Window & typeof globalThis; -interface ZanoWindowParams { +interface LetheanWindowParams { request: (str: string, params?: any, timeoutMs?: number | null) => Promise; } -type ZanoWindow = Omit & { - zano: ZanoWindowParams +type LetheanWindow = Omit & { + lethean: LetheanWindowParams } interface WalletCredentials { @@ -35,26 +35,26 @@ interface WalletCredentials { address: string; } -class ZanoWallet { +class LetheanWallet { private DEFAULT_LOCAL_STORAGE_KEY = "wallet"; private localStorageKey: string; - private params: ZanoWalletParams; - private zanoWallet: ZanoWindowParams; + private params: LetheanWalletParams; + private letheanWallet: LetheanWindowParams; - constructor(params: ZanoWalletParams) { + constructor(params: LetheanWalletParams) { if (typeof window === 'undefined') { - throw new Error('ZanoWallet can only be used in the browser'); + throw new Error('LetheanWallet can only be used in the browser'); } - if (!((window as unknown) as ZanoWindow).zano) { - console.error('ZanoWallet requires the ZanoWallet extension to be installed'); + if (!((window as unknown) as LetheanWindow).lethean) { + console.error('LetheanWallet requires the LetheanWallet extension to be installed'); } this.params = params; - this.zanoWallet = ((window as unknown) as ZanoWindow).zano; + this.letheanWallet = ((window as unknown) as LetheanWindow).lethean; this.localStorageKey = params.customLocalStorageKey || this.DEFAULT_LOCAL_STORAGE_KEY; } @@ -99,7 +99,7 @@ class ZanoWallet { this.params.onConnectStart(); } - const walletData = (await ((window as unknown) as ZanoWindow).zano.request('GET_WALLET_DATA')).data; + const walletData = (await ((window as unknown) as LetheanWindow).lethean.request('GET_WALLET_DATA')).data; if (!walletData?.address) { @@ -130,7 +130,7 @@ class ZanoWallet { } else { const generatedNonce = this.params.customNonce || uuidv4(); - const signResult = await this.zanoWallet.request( + const signResult = await this.letheanWallet.request( 'REQUEST_MESSAGE_SIGN', { message: generatedNonce @@ -205,16 +205,16 @@ class ZanoWallet { } async getWallet() { - return (await this.zanoWallet.request('GET_WALLET_DATA'))?.data as Wallet; + return (await this.letheanWallet.request('GET_WALLET_DATA'))?.data as Wallet; } async getAddressByAlias(alias: string) { - return ((await this.zanoWallet.request('GET_ALIAS_DETAILS', { alias })) || undefined) as string | undefined; + return ((await this.letheanWallet.request('GET_ALIAS_DETAILS', { alias })) || undefined) as string | undefined; } async createAlias(alias: string) { - return ((await this.zanoWallet.request('CREATE_ALIAS', { alias })) || undefined).data; + return ((await this.letheanWallet.request('CREATE_ALIAS', { alias })) || undefined).data; } } -export default ZanoWallet; \ No newline at end of file +export default LetheanWallet; \ No newline at end of file