Skip to content

Commit

Permalink
[TS SDK] Initialize sdk_v2 folder structure and basic usage (#9448)
Browse files Browse the repository at this point in the history
initialize sdk_v2
  • Loading branch information
0xmaayan authored Aug 4, 2023
1 parent eb0144a commit d1610e1
Show file tree
Hide file tree
Showing 23 changed files with 7,708 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ecosystem/typescript/sdk_v2/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist/**
**/*.test.ts
36 changes: 36 additions & 0 deletions ecosystem/typescript/sdk_v2/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
ignorePatterns: ["*.js", "examples/*", "src/indexer/generated/**", "scripts/publish_ans_contract.ts"],
extends: ["airbnb-base", "airbnb-typescript/base", "prettier"],
parser: "@typescript-eslint/parser",
parserOptions: {
tsconfigRootDir: __dirname,
project: ["tsconfig.json"],
ecmaVersion: "latest",
sourceType: "module",
},
plugins: ["@typescript-eslint"],
rules: {
quotes: ["error", "double"],
"max-len": ["error", 120],
"import/extensions": ["error", "never"],
"max-classes-per-file": ["error", 10],
"import/prefer-default-export": "off",
"object-curly-newline": "off",
"no-use-before-define": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-use-before-define": ["error", { functions: false, classes: false }],
"@typescript-eslint/no-unused-vars": ["error"],
},
settings: {
"import/resolver": {
node: {
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
},
},
};
17 changes: 17 additions & 0 deletions ecosystem/typescript/sdk_v2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.env
.DS_Store
*/**/.DS_Store
npm-debug.log
.npm/
/coverage
/tmp
node_modules
.idea/
.history/
.vscode/
dist/
.nyc_output/
build/

# Doc generation output
docs/
5 changes: 5 additions & 0 deletions ecosystem/typescript/sdk_v2/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage
node_modules
.aptos
.env
examples/
1 change: 1 addition & 0 deletions ecosystem/typescript/sdk_v2/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v16.14.0n
2 changes: 2 additions & 0 deletions ecosystem/typescript/sdk_v2/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src/generated/*
src/indexer/generated/**
19 changes: 19 additions & 0 deletions ecosystem/typescript/sdk_v2/.versionrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"types": [
{ "type": "feat", "section": "Features" },
{ "type": "fix", "section": "Bug Fixes" },
{ "type": "chore", "hidden": true },
{ "type": "docs", "hidden": true },
{ "type": "style", "hidden": true },
{ "type": "refactor", "hidden": true },
{ "type": "perf", "hidden": true },
{ "type": "test", "hidden": true }
],
"skip": {
"bump": true,
"commit": true,
"tag": true
},
"path": ".",
"header": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nNote: This changelog is generated automatically.\n\n"
}
20 changes: 20 additions & 0 deletions ecosystem/typescript/sdk_v2/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/** @type {import("ts-jest/dist/types").InitialOptionsTsJest} */
module.exports = {
preset: "ts-jest",
moduleNameMapper: {
"^(\\.{1,2}/.*)\\.js$": "$1",
},
testEnvironment: "node",
coveragePathIgnorePatterns: ["./types/*", "./utils/memoize-decorator.ts", "./utils/hd-key.ts"],
testPathIgnorePatterns: ["dist/*"],
collectCoverage: true,
setupFiles: ["dotenv/config"],
coverageThreshold: {
global: {
branches: 50, // 90,
functions: 50, // 95,
lines: 50, // 95,
statements: 50, // 95,
},
},
};
66 changes: 66 additions & 0 deletions ecosystem/typescript/sdk_v2/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"name": "aptos",
"description": "Aptos SDK",
"packageManager": "[email protected]",
"license": "Apache-2.0",
"engines": {
"node": ">=11.0.0"
},
"main": "dist/cjs/index.js",
"module": "dist/esm/index.mjs",
"exports": {
"node": {
"types": "./dist/src/index.d.ts",
"require": "./dist/cjs/index.js",
"import": "./dist/cjs/index.js"
},
"types": "./dist/types/index.d.ts",
"default": "./dist/esm/index.mjs"
},
"scripts": {
"build:clean": "rm -rf dist",
"build": "pnpm build:clean && pnpm run _build:types && pnpm _build:esm && pnpm _build:cjs && pnpm _build:browser",
"_build:browser": "tsup src/index.ts --platform browser --format iife --global-name aptosSDK --minify --out-dir dist/browser",
"_build:esm": "tsup src/index.ts --format esm --dts --out-dir dist/esm",
"_build:cjs": "tsup src/index.ts --format cjs --dts --out-dir dist/cjs",
"_build:types": "tsup src/types/index.ts --dts --out-dir dist/types",
"generate-openapi-response-types": "openapi -i ../../../../api/doc/spec.yaml -o ./src/types/generated --exportCore=false --exportServices=false",
"lint": "eslint \"**/*.ts\""
},
"dependencies": {
"@aptos-labs/aptos-client": "^0.0.2",
"@noble/hashes": "1.1.3",
"@scure/bip39": "1.1.0",
"form-data": "4.0.0",
"tweetnacl": "1.0.3"
},
"devDependencies": {
"@graphql-codegen/cli": "^2.13.5",
"@graphql-codegen/import-types-preset": "^2.2.3",
"@graphql-codegen/typescript": "^2.7.3",
"@graphql-codegen/typescript-graphql-request": "^4.5.8",
"@graphql-codegen/typescript-operations": "^2.5.3",
"@types/jest": "28.1.8",
"@types/node": "18.6.2",
"@typescript-eslint/eslint-plugin": "5.36.2",
"@typescript-eslint/parser": "5.36.2",
"dotenv": "16.0.2",
"eslint": "8.23.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-airbnb-typescript": "17.0.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-import": "2.26.0",
"graphql": "^16.5.0",
"graphql-request": "5.1.0",
"jest": "28.1.3",
"openapi-typescript-codegen": "https://github.com/aptos-labs/openapi-typescript-codegen/releases/download/v0.24.0-p1/openapi-typescript-codegen-v0.24.0-p1.tgz",
"prettier": "2.6.2",
"ts-jest": "28.0.8",
"ts-loader": "9.3.1",
"ts-node": "10.9.1",
"tsup": "6.2.3",
"typedoc": "^0.23.20",
"typescript": "4.8.2"
},
"version": "2.0.0"
}
Loading

0 comments on commit d1610e1

Please sign in to comment.