Skip to content

Commit 5af54ba

Browse files
committed
feat: move everything to monorepo
1 parent 4cd0bb5 commit 5af54ba

File tree

147 files changed

+5865
-573
lines changed

Some content is hidden

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

147 files changed

+5865
-573
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
node_modules
22
dist
3-
lib/target
3+
crate/target

.yarn/install-state.gz

458 KB
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

lib/README.md renamed to crate/README.md

Lines changed: 1 addition & 1 deletion
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

package.json

Lines changed: 16 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,12 @@
11
{
2-
"name": "@namada/sdk",
2+
"name": "namada",
33
"version": "1.0.0",
4-
"description": "Namada SDK Package",
5-
"main": "lib/cjs/index.js",
6-
"module": "lib/esm/index.js",
7-
"types": "lib/esm/index.d.ts",
8-
"exports": {
9-
"import": "./lib/esm/index.js",
10-
"require": "./lib/cjs/index.js"
11-
},
12-
"files": [
13-
"lib",
14-
"src"
4+
"private": true,
5+
"workspaces": [
6+
"packages/*"
157
],
16-
"repository": "https://github.com/anoma/namada-sdkjs/",
17-
"author": "Heliax Dev <info@heliax.dev>",
18-
"license": "MIT",
19-
"scriptsComments": {
20-
"prepublish": "We make focused install to make sure that we specified all required dependencies",
21-
"wasm:cp": "We need to copy wasm to the dist folder, so it can be imported correctly"
22-
},
238
"scripts": {
24-
"prepublish": "yarn build",
25-
"prebuild": "rimraf ./dist",
26-
"wasm:cp": "node ./scripts/copy.js",
27-
"build:web": "yarn wasm:build && tspc -p tsconfig.web.json",
28-
"build:ts": "yarn prebuild && node ./scripts/copy.js && tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json",
29-
"build:node": "yarn wasm:build:node && tspc -p tsconfig.node.json",
30-
"build": "yarn prebuild && yarn build:web && yarn build:node && yarn wasm:cp",
31-
"wasm:build:all": "yarn wasm:build && yarn wasm:build:multicore && yarn wasm:build:node && yarn wasm:build:node:multicore",
32-
"wasm:check": "cd ./lib && cargo check && cargo clippy",
9+
"prepare": "husky install",
3310
"wasm:ts:node": "tsc -p tsconfig.lib.node.json",
3411
"wasm:ts:web": "tsc -p tsconfig.lib.web.json",
3512
"wasm:build": "yarn wasm:ts:web && node ./scripts/build.js --release",
@@ -39,49 +16,19 @@
3916
"wasm:build:node": "yarn wasm:ts:node && node ./scripts/build.js --target nodejs --release",
4017
"wasm:build:node:multicore": "yarn wasm:ts:node && node ./scripts/build.js --target nodejs --release --multicore",
4118
"wasm:build:node:dev": "yarn wasm:ts:node && node ./scripts/build.js --target nodejs",
42-
"wasm:build:node:dev:multicore": "yarn wasm:ts:node && node ./scripts/build.js --target nodejs --multicore",
43-
"wasm:clean": "cd lib && cargo clean",
44-
"build:docs": "typedoc --plugin typedoc-plugin-markdown --out docs src/index.ts",
45-
"test": "yarn wasm:build:node:dev && yarn jest",
46-
"test:only": "yarn jest",
47-
"test:cov": "yarn wasm:build:node:dev && yarn jest --coverage",
48-
"test:watch": "yarn wasm:build:node:dev && yarn jest --watchAll=true",
49-
"test-wasm:ci": "yarn wasm:ts:node && cd ./lib && RUSTFLAGS='--cfg getrandom_backend=\"wasm_js\"' wasm-pack test --node -- --features nodejs --no-default-features",
50-
"test:ci": "jest"
51-
},
52-
"dependencies": {
53-
"@cosmjs/encoding": "^0.29.0",
54-
"@dao-xyz/borsh": "^5.1.5",
55-
"@ledgerhq/hw-transport": "^6.31.4",
56-
"@ledgerhq/hw-transport-webusb": "^6.29.4",
57-
"@zondax/ledger-namada": "^2.0.0",
58-
"bignumber.js": "^9.1.1",
59-
"buffer": "^6.0.3",
60-
"semver": "^7.7.2",
61-
"slip44": "^3.0.18"
19+
"wasm:build:node:dev:multicore": "yarn wasm:ts:node && node ./scripts/build.js --target nodejs --multicore"
6220
},
6321
"devDependencies": {
64-
"@babel/core": "^7.23.7",
65-
"@babel/preset-env": "^7.23.8",
66-
"@babel/preset-typescript": "^7.18.6",
67-
"@types/jest": "^29.5.12",
68-
"@types/node": "^20.11.4",
69-
"@types/semver": "^7.7.0",
70-
"@types/w3c-web-usb": "^1.0.10",
71-
"babel-jest": "^29.0.3",
72-
"jest": "^29.7.0",
73-
"rimraf": "^5.0.5",
74-
"ts-jest": "^29.2.5",
75-
"ts-macros": "^2.6.2",
76-
"ts-node": "^10.9.1",
77-
"typedoc": "^0.25.12",
78-
"typedoc-plugin-markdown": "^3.17.1",
22+
"@typescript-eslint/eslint-plugin": "^8.4.0",
23+
"@typescript-eslint/parser": "^8.4.0",
24+
"eslint": "^8.57.0",
25+
"git-commit-msg-linter": "^5.0.6",
26+
"husky": "^8.0.3",
27+
"lint-staged": "^15.2.0",
28+
"prettier": "^3.3.3",
29+
"prettier-plugin-organize-imports": "^3.2.4",
7930
"typescript": "5.5.4",
80-
"typescript-transform-paths": "^3.4.7",
81-
"wasm-pack": "^0.13.0"
31+
"wsrun": "^5.2.4"
8232
},
83-
"publishConfig": {
84-
"registry": "https://registry.npmjs.org",
85-
"access": "public"
86-
}
33+
"packageManager": "yarn@4.6.0"
8734
}

packages/lib/package.json

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
{
2+
"name": "@namada/lib",
3+
"version": "1.0.0",
4+
"description": "Namada SDK JS Library",
5+
"repository": "https://github.com/anoma/namada-interface/",
6+
"author": "Heliax Dev <info@heliax.dev>",
7+
"license": "MIT",
8+
"private": true,
9+
"main": "src/index.js",
10+
"types": "src/index.d.ts",
11+
"scripts": {
12+
"prepublish": "yarn workspaces focus @namada/sdk && yarn build",
13+
"prebuild": "rimraf ./dist",
14+
"wasm:node:cp": "cp -r ../shared/src/shared/*.wasm ./dist/node/shared/src/shared && cp -r ../crypto/src/crypto/*.wasm ./dist/node/crypto/src/crypto",
15+
"wasm:web:cp": "cp -r ../shared/src/shared/*.wasm ./dist && cp -r ../crypto/src/crypto/*.wasm ./dist",
16+
"wasm:web:rename": "mv ./dist/shared_bg.wasm ./dist/shared.namada.wasm && mv ./dist/crypto_bg.wasm ./dist/crypto.namada.wasm",
17+
"build:web": "yarn wasm:build && tspc -p tsconfig.web.json && yarn wasm:web:cp && yarn wasm:web:rename",
18+
"build:node": "yarn wasm:build:node && tspc -p tsconfig.node.json && yarn wasm:node:cp",
19+
"build": "yarn prebuild && yarn build:web && yarn build:node",
20+
"lint": "eslint",
21+
"lint:fix": "yarn lint --fix",
22+
"lint:ci": "yarn lint --max-warnings 0",
23+
"wasm:build": "node ./scripts/build.cjs --release",
24+
"wasm:build:multicore": "node ./scripts/build.cjs --release --multicore",
25+
"wasm:build:dev": "node ./scripts/build.cjs",
26+
"wasm:build:dev:multicore": "node ./scripts/build.cjs --multicore",
27+
"wasm:build:node": "node ./scripts/build.cjs --node --release",
28+
"wasm:build:node:dev": "node ./scripts/build.cjs --node",
29+
"wasm:build:node:dev:multicore": "node ./scripts/build.cjs --node --multicore",
30+
"build:docs": "typedoc --plugin typedoc-plugin-markdown --out docs src/index.ts",
31+
"test": "yarn wasm:build:node:dev && yarn jest",
32+
"test:only": "yarn jest",
33+
"test:cov": "yarn wasm:build:node:dev && yarn jest --coverage",
34+
"test:watch": "yarn wasm:build:node:dev && yarn jest --watchAll=true",
35+
"test:ci": "jest"
36+
},
37+
"dependencies": {
38+
"@cosmjs/encoding": "^0.29.0",
39+
"@dao-xyz/borsh": "^5.1.5",
40+
"@ledgerhq/hw-transport": "^6.31.4",
41+
"@ledgerhq/hw-transport-webusb": "^6.29.4",
42+
"@zondax/ledger-namada": "^2.0.0",
43+
"bignumber.js": "^9.1.1",
44+
"buffer": "^6.0.3",
45+
"semver": "^7.6.3",
46+
"slip44": "^3.0.18"
47+
},
48+
"devDependencies": {
49+
"@babel/cli": "^7.23.9",
50+
"@babel/core": "^7.23.9",
51+
"@babel/plugin-proposal-class-properties": "^7.18.6",
52+
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
53+
"@babel/preset-env": "^7.23.9",
54+
"@babel/preset-typescript": "^7.23.3",
55+
"@types/jest": "^29.5.12",
56+
"@types/node": "^20.11.4",
57+
"@types/semver": "^7.5.8",
58+
"@types/w3c-web-usb": "^1.0.10",
59+
"babel-jest": "^29.0.3",
60+
"eslint": "^8.57.0",
61+
"eslint-config-prettier": "^9.1.0",
62+
"eslint-import-resolver-typescript": "^3.6.3",
63+
"eslint-plugin-import": "^2.30.0",
64+
"eslint-plugin-jsdoc": "^48.2.1",
65+
"eslint-plugin-react": "^7.35.2",
66+
"eslint-plugin-react-hooks": "^4.6.0",
67+
"jest": "^29.7.0",
68+
"jest-create-mock-instance": "^2.0.0",
69+
"jest-mock-server": "^0.1.0",
70+
"jsdoc-babel": "^0.5.0",
71+
"rimraf": "^5.0.5",
72+
"ts-jest": "^29.2.5",
73+
"ts-node": "^10.9.1",
74+
"ts-patch": "^3.1.2",
75+
"tsconfig-paths": "^4.2.0",
76+
"typedoc": "^0.25.12",
77+
"typedoc-plugin-markdown": "^3.17.1",
78+
"typescript": "5.5.4",
79+
"typescript-transform-paths": "^3.4.7",
80+
"webpack": "^5.90.3",
81+
"webpack-cli": "^5.1.4"
82+
}
83+
}

src/crypto/crypto.ts renamed to packages/lib/src/crypto/crypto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
Salt,
88
VecU8Pointer,
99
readVecU8Pointer,
10-
} from "../wasm";
10+
} from "@namada/wasm";
1111
import { Argon2Config, CryptoRecord, EncryptionParams, KdfType } from "./types";
1212

1313
/**
File renamed without changes.

src/crypto/types.ts renamed to packages/lib/src/crypto/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Argon2Params as Argon2ParamsWasm, VecU8Pointer } from "../wasm";
1+
import { Argon2Params as Argon2ParamsWasm, VecU8Pointer } from "@namada/wasm";
22

33
export const Argon2Config = {
44
// Number of memory blocks in kibibytes

src/index.ts renamed to packages/lib/src/index.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,5 @@ export type { Mnemonic } from "./mnemonic";
6464
export type { Signing } from "./signing";
6565
export type { Tx } from "./tx";
6666

67-
// Export SDK initializer and types
68-
export { initSdk } from "./wasm";
69-
export type {
70-
WasmTarget,
71-
SdkBuildOptions,
72-
SdkWasmOptions,
73-
InitProps,
74-
} from "./wasm";
67+
export type { InitProps as SdkWasmOptions } from "./types/sdk";
68+
export type * from "./types";
File renamed without changes.

src/keys/keys.ts renamed to packages/lib/src/keys/keys.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
ExtendedViewingKey,
1010
gen_payment_address,
1111
public_key_to_bech32,
12-
} from "../wasm";
12+
} from "@namada/wasm";
1313
import { Bip44Path, NAMADA_COIN_TYPE as coinType, Zip32Path } from "../types";
1414
import { makeBip44PathArray, makeSaplingPathArray } from "../utils";
1515
import {
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/masp/masp.ts renamed to packages/lib/src/masp/masp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Sdk as SdkWasm } from "../wasm";
1+
import { Sdk as SdkWasm } from "@namada/wasm";
22

33
/**
44
* Class representing utilities related to MASP

src/masp/types.ts renamed to packages/lib/src/masp/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ export {
22
ExtendedViewingKey,
33
ProofGenerationKey,
44
PseudoExtendedKey,
5-
} from "../wasm";
5+
} from "@namada/wasm";

src/mnemonic.ts renamed to packages/lib/src/mnemonic.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
StringPointer,
44
readVecStringPointer,
55
readVecU8Pointer,
6-
} from "./wasm";
6+
} from "@namada/wasm";
77

88
export enum PhraseSize {
99
N12 = 12,
File renamed without changes.

src/rpc/rpc.ts renamed to packages/lib/src/rpc/rpc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
Query as QueryWasm,
66
Sdk as SdkWasm,
77
TransferToEthereum,
8-
} from "../wasm";
8+
} from "@namada/wasm";
99
import {
1010
BroadcastTxError,
1111
DatedViewingKey,
File renamed without changes.

src/sdk.ts renamed to packages/lib/src/sdk.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Transport from "@ledgerhq/hw-transport";
2-
import { Query as QueryWasm, Sdk as SdkWasm } from "./wasm";
2+
import { Query as QueryWasm, Sdk as SdkWasm } from "@namada/wasm";
33
import packageJson from "../package.json";
44
import { Crypto } from "./crypto";
55
import { Keys } from "./keys";
@@ -10,7 +10,7 @@ import { Rpc } from "./rpc";
1010
import { Signing } from "./signing";
1111
import { Tx } from "./tx";
1212

13-
export { ProgressBarNames, SdkEvents } from "./wasm";
13+
export { ProgressBarNames, SdkEvents } from "@namada/wasm";
1414

1515
/**
1616
* API for interacting with Namada SDK

src/signing.ts renamed to packages/lib/src/signing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Sdk as SdkWasm } from "./wasm";
1+
import { Sdk as SdkWasm } from "@namada/wasm";
22
import { Message, TxMsgValue, TxProps } from "./types";
33

44
type Signature = [string, string];
File renamed without changes.
File renamed without changes.

src/tests/initSdk.ts renamed to packages/lib/src/tests/initSdk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Sdk } from "../sdk";
2-
import { initSdk as init } from "../wasm";
2+
import { initSdk as init } from "@namada/wasm";
33

44
import { NATIVE_TOKEN as nativeToken, RPC_URL as rpcUrl } from "./data";
55

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/tx/tx.ts renamed to packages/lib/src/tx/tx.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
TxType,
55
deserialize_tx,
66
get_inner_tx_hashes,
7-
} from "../wasm";
7+
} from "@namada/wasm";
88
import {
99
BondMsgValue,
1010
BondProps,
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

packages/lib/src/types/sdk.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* SDK initialization props
3+
*/
4+
export type InitProps = {
5+
rpcUrl: string;
6+
token: string;
7+
maspIndexerUrl?: string;
8+
dbName?: string;
9+
inline?: boolean;
10+
};
File renamed without changes.
File renamed without changes.

src/wallet.ts renamed to packages/lib/src/wallet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Sdk as SdkWasm } from "./wasm";
1+
import { Sdk as SdkWasm } from "@namada/wasm";
22

33
/**
44
* Class representing utilities related to Wallet

packages/lib/tsconfig.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"extends": "../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"allowJs": true,
5+
"allowSyntheticDefaultImports": true,
6+
"baseUrl": "./src",
7+
"esModuleInterop": true,
8+
"experimentalDecorators": true,
9+
"forceConsistentCasingInFileNames": true,
10+
"isolatedModules": true,
11+
// "dom" is needed for WebAssembly typings
12+
"lib": ["esnext", "dom"],
13+
"module": "esnext",
14+
"moduleResolution": "bundler",
15+
"noEmit": false,
16+
"noFallthroughCasesInSwitch": true,
17+
"resolveJsonModule": true,
18+
"skipLibCheck": true,
19+
"sourceMap": true,
20+
"strict": true,
21+
"target": "es2015"
22+
},
23+
"include": ["src/**/*.ts"],
24+
"exclude": ["node_modules"],
25+
"typeRoots": ["./node_modules/@types"],
26+
"ts-node": {
27+
"compilerOptions": {
28+
"module": "commonjs"
29+
}
30+
}
31+
}

packages/sdk-multicore/package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "@namada/sdk-multicore",
3+
"version": "1.0.0",
4+
"description": "Namada Web Multicore SDK",
5+
"main": "src/index.js",
6+
"types": "src/index.d.ts",
7+
"repository": "https://github.com/anoma/namada-sdkjs/",
8+
"author": "Heliax Dev <info@heliax.dev>",
9+
"license": "MIT"
10+
}

0 commit comments

Comments
 (0)