Skip to content

Commit

Permalink
Merge pull request #16 from trustwallet/feat/npm-publish
Browse files Browse the repository at this point in the history
Feat/npm publish
  • Loading branch information
a6-dou authored Mar 28, 2023
2 parents 032749b + e2d3c59 commit 854b8d0
Show file tree
Hide file tree
Showing 14 changed files with 69 additions and 10 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Publish Package to npmjs
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"
- run: yarn install --frozen-lockfile
- run: yarn build
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ build/Release
# Dependency directory
node_modules

lib
21 changes: 17 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
{
"name": "wizard-sdk",
"name": "@trustwallet/wizard-sdk",
"version": "0.0.1",
"description": "typescript sdk to visualize EIP-712 various protocols, simulate and decode transactions",
"main": "index.js",
"main": "lib/index.js",
"repository": "git@github.com:trustwallet/wizard-sdk.git",
"author": "Abdou <118254027+a6-dou@users.noreply.github.com>",
"license": "BSD",
"keywords": [
"web3",
"EIP-712",
"Simulation"
],
"scripts": {
"test": "jest",
"coverage": "jest --coverage"
"coverage": "jest --coverage",
"build": "tsc --project ./tsconfig.build.json"
},
"devDependencies": {
"@types/jest": "^29.5.0",
Expand All @@ -23,5 +29,12 @@
"@typescript-eslint/parser": "^5.55.0",
"eslint": "^8.36.0",
"ethers": "^6.1.0"
}
},
"files": [
"lib/",
"LICENSE",
"README.md",
"node_module",
"package.json"
]
}
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * as visualizer from "./visualizer";
2 changes: 1 addition & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export type Result = {
liveness?: Liveness;
assetIn: AssetInOut[];
assetOut: AssetInOut[];
approval?: Approval[];
approval: Approval[];
};

export type Protocol<T> = {
Expand Down
1 change: 1 addition & 0 deletions src/visualizer/blur-io/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export const visualize = (message: BlurIoOrder, domain: Domain): Result => {
from: Number(message.listingTime) * 1000,
to: Number(message.expirationTime) * 1000,
},
approval: [],
};
};

Expand Down
1 change: 0 additions & 1 deletion src/visualizer/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import { Domain, PermitMessage, Result } from "../types";

import { SeaPortPayload } from "../types/seaport";
Expand Down
1 change: 1 addition & 0 deletions src/visualizer/looksrare/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const visualize = (
from: Number(message.startTime) * 1000,
to: Number(message.endTime) * 1000,
},
approval: [],
};
};

Expand Down
1 change: 1 addition & 0 deletions src/visualizer/seaport/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export const visualize = (message: SeaPortPayload, domain: Domain): Result => {
},
assetIn,
assetOut,
approval: [],
};
};

Expand Down
4 changes: 4 additions & 0 deletions test/visualizer/blur-io/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ describe("blur.io", () => {
amounts: ["1"],
},
],
approval: [],
liveness: { from: 1677736151000, to: 1678340951000 },
});
});
Expand All @@ -66,6 +67,7 @@ describe("blur.io", () => {
amounts: ["800000000000000000"],
},
],
approval: [],
liveness: { from: 1677736151000, to: 1678340951000 },
});
});
Expand All @@ -89,6 +91,7 @@ describe("blur.io", () => {
amounts: ["10000000000000000"],
},
],
approval: [],
liveness: { from: 1678461048000, to: 1709997048000 },
});
});
Expand Down Expand Up @@ -116,6 +119,7 @@ describe("blur.io", () => {
amounts: ["800000000000000000"],
},
],
approval: [],
liveness: { from: 1677736151000, to: 1678340951000 },
});
});
Expand Down
4 changes: 4 additions & 0 deletions test/visualizer/looksrare/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ describe("looksrare", () => {
amounts: ["1"],
},
],
approval: [],
liveness: { from: 1677588653000, to: 1680266940000 },
});
});
Expand All @@ -86,6 +87,7 @@ describe("looksrare", () => {
amounts: ["1000000000000000"],
},
],
approval: [],
liveness: { from: 1677588943000, to: 1677675336000 },
});
});
Expand Down Expand Up @@ -113,6 +115,7 @@ describe("looksrare", () => {
amounts: ["1000000000000000"],
},
],
approval: [],
liveness: { from: 1677588943000, to: 1677675336000 },
});
});
Expand Down Expand Up @@ -144,6 +147,7 @@ describe("looksrare", () => {
amounts: ["1"],
},
],
approval: [],
liveness: { from: 1677588653000, to: 1680266940000 },
});
});
Expand Down
11 changes: 11 additions & 0 deletions test/visualizer/seaport/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ describe("visualizer", () => {
amounts: ["50", "100"],
},
],
approval: [],
});
});

Expand Down Expand Up @@ -95,6 +96,7 @@ describe("visualizer", () => {
amounts: ["50", "100"],
},
],
approval: [],
});
});

Expand Down Expand Up @@ -124,6 +126,7 @@ describe("visualizer", () => {
amounts: ["1"],
},
],
approval: [],
});
});

Expand Down Expand Up @@ -153,6 +156,7 @@ describe("visualizer", () => {
amounts: ["50", "100"],
},
],
approval: [],
});
});

Expand All @@ -177,6 +181,7 @@ describe("visualizer", () => {
amounts: ["4000000000000000"],
},
],
approval: [],
});
});

Expand Down Expand Up @@ -207,6 +212,7 @@ describe("visualizer", () => {
amounts: ["100000000000000000"],
},
],
approval: [],
});
});

Expand Down Expand Up @@ -236,6 +242,7 @@ describe("visualizer", () => {
from: 1677592745000,
to: 1678197528000,
},
approval: [],
});
});

Expand Down Expand Up @@ -269,6 +276,7 @@ describe("visualizer", () => {
from: 1677130860000,
to: 1677303660000,
},
approval: [],
});
});

Expand Down Expand Up @@ -296,6 +304,7 @@ describe("visualizer", () => {
from: 1677130860000,
to: 1677303660000,
},
approval: [],
});
});

Expand Down Expand Up @@ -323,6 +332,7 @@ describe("visualizer", () => {
from: 1677130860000,
to: 1677303660000,
},
approval: [],
});
});

Expand Down Expand Up @@ -350,6 +360,7 @@ describe("visualizer", () => {
from: 1680010140000,
to: 1680269340000,
},
approval: [],
});
});
});
Expand Down
4 changes: 4 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
}
8 changes: 4 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */

/* Emit */
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
"declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
"declarationMap": true /* Create sourcemaps for d.ts files. */,
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
"sourceMap": true /* Create source map files for emitted JavaScript files. */,
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
// "outDir": "./", /* Specify an output folder for all emitted files. */
"outDir": "./lib" /* Specify an output folder for all emitted files. */,
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
Expand Down

0 comments on commit 854b8d0

Please sign in to comment.