starknet 0.1.4 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/.babelrc +6 -0
  2. package/.commitlintrc +12 -0
  3. package/.eslintignore +2 -0
  4. package/.eslintrc +20 -0
  5. package/.github/workflows/docs-bot.yml +25 -0
  6. package/.github/workflows/pr.yml +23 -0
  7. package/.github/workflows/release.yml +39 -0
  8. package/.husky/commit-msg +4 -0
  9. package/.husky/pre-commit +4 -0
  10. package/{.prettierrc.json → .prettierrc} +0 -1
  11. package/.releaserc +28 -0
  12. package/CHANGELOG.md +36 -0
  13. package/CONTRIBUTING.md +52 -0
  14. package/README.md +35 -11
  15. package/__mocks__/ArgentAccount.json +92620 -0
  16. package/__tests__/__snapshots__/utils.browser.test.ts.snap +5 -0
  17. package/__tests__/__snapshots__/utils.test.ts.snap +5 -0
  18. package/__tests__/index.test.ts +49 -4
  19. package/__tests__/utils.browser.test.ts +30 -0
  20. package/__tests__/utils.test.ts +35 -0
  21. package/constants.d.ts +3 -0
  22. package/constants.js +9 -0
  23. package/dist/constants.d.ts +3 -0
  24. package/dist/constants.js +6 -0
  25. package/dist/index.d.ts +22 -8
  26. package/dist/index.js +50 -4
  27. package/dist/types.d.ts +89 -0
  28. package/dist/types.js +2 -0
  29. package/dist/utils.d.ts +21 -0
  30. package/dist/utils.js +44 -0
  31. package/index.d.ts +115 -0
  32. package/index.js +261 -0
  33. package/package.json +29 -5
  34. package/src/constants.ts +3 -0
  35. package/src/index.ts +66 -20
  36. package/src/types.ts +95 -0
  37. package/src/utils.ts +44 -0
  38. package/tsconfig.eslint.json +4 -0
  39. package/tsconfig.json +15 -13
  40. package/types.d.ts +94 -0
  41. package/types.js +2 -0
  42. package/utils.d.ts +29 -0
  43. package/utils.js +62 -0
  44. package/.eslintrc.json +0 -26
  45. package/babel.config.js +0 -3
  46. package/dist/__tests__/index.test.d.ts +0 -1
  47. package/dist/__tests__/index.test.js +0 -49
  48. package/docs/Home.md +0 -220
  49. package/docs/_Sidebar.md +0 -3
package/.babelrc ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "presets": [
3
+ ["@babel/preset-env", { "targets": { "node": "current" } }],
4
+ "@babel/preset-typescript"
5
+ ]
6
+ }
package/.commitlintrc ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": [
3
+ "@commitlint/config-conventional"
4
+ ],
5
+ "rules": {
6
+ "body-max-line-length": [
7
+ 0,
8
+ "always",
9
+ 100
10
+ ]
11
+ }
12
+ }
package/.eslintignore ADDED
@@ -0,0 +1,2 @@
1
+ node_modules/
2
+ dist/
package/.eslintrc ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "env": {
3
+ "browser": true,
4
+ "es2021": true,
5
+ "node": true,
6
+ "jest": true
7
+ },
8
+ "extends": ["airbnb-base", "airbnb-typescript/base", "prettier", "plugin:prettier/recommended", ],
9
+ "globals": {
10
+ "Atomics": "readonly",
11
+ "SharedArrayBuffer": "readonly"
12
+ },
13
+ "parser": "@typescript-eslint/parser",
14
+ "parserOptions": {
15
+ "ecmaVersion": 12,
16
+ "sourceType": "module",
17
+ "project": "./tsconfig.eslint.json"
18
+ },
19
+ "plugins": ["@typescript-eslint"]
20
+ }
@@ -0,0 +1,25 @@
1
+ name: Docs Bot
2
+ on:
3
+ push:
4
+ branches-ignore:
5
+ - main
6
+ - develop
7
+ paths:
8
+ - 'src/'
9
+ jobs:
10
+ generate-docs:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - uses: actions/setup-node@v2
15
+ with:
16
+ node-version: 14.x
17
+ - run: npm ci
18
+ - run: npm run docs
19
+ - name: Do git actions
20
+ run: |
21
+ git config user.email "janek@argent.xyz"
22
+ git config user.name "Docs Bot"
23
+ git add --force -- docs/README.md
24
+ git commit -m "docs: add generated docs"
25
+ git push
@@ -0,0 +1,23 @@
1
+ name: PR check
2
+ on:
3
+ pull_request:
4
+ branches:
5
+ - main
6
+ - develop
7
+
8
+ jobs:
9
+ build-and-test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ node-version:
14
+ - 14.x
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - name: Use Node.js ${{ matrix.node-version }}
18
+ uses: actions/setup-node@v2
19
+ with:
20
+ node-version: ${{ matrix.node-version }}
21
+ - run: npm ci
22
+ - run: npm run build --if-present
23
+ - run: npm test
@@ -0,0 +1,39 @@
1
+ name: Release
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ - develop
7
+ jobs:
8
+ build-and-test:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+ - name: Use Node.js 14
13
+ uses: actions/setup-node@v2
14
+ with:
15
+ node-version: lts/*
16
+ - run: npm ci
17
+ - run: npm run build --if-present
18
+ - run: npm test
19
+ - uses: actions/upload-artifact@v2
20
+ with:
21
+ name: build
22
+ path: dist
23
+ release:
24
+ name: Release
25
+ runs-on: ubuntu-latest
26
+ needs: [build-and-test]
27
+ steps:
28
+ - uses: actions/checkout@v2
29
+ - uses: actions/setup-node@v2
30
+ with:
31
+ node-version: lts/*
32
+ - run: npm ci
33
+ - uses: actions/download-artifact@v2
34
+ with:
35
+ name: build
36
+ - env:
37
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
39
+ run: npx semantic-release
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ npx --no-install commitlint --edit "$1"
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ npx lint-staged
@@ -2,6 +2,5 @@
2
2
  "printWidth": 100,
3
3
  "tabWidth": 2,
4
4
  "singleQuote": true,
5
- "jsxBracketSameLine": true,
6
5
  "trailingComma": "es5"
7
6
  }
package/.releaserc ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "branches": [
3
+ "main",
4
+ {
5
+ "name": "develop",
6
+ "channel": "next"
7
+ }
8
+ ],
9
+ "plugins": [
10
+ "@semantic-release/commit-analyzer",
11
+ "@semantic-release/release-notes-generator",
12
+ "@semantic-release/changelog",
13
+ "@semantic-release/npm",
14
+ [
15
+ "@semantic-release/git",
16
+ {
17
+ "assets": [
18
+ "docs/README.md",
19
+ "package.json",
20
+ "CHANGELOG.md"
21
+ ],
22
+ "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
23
+ }
24
+ ],
25
+ "@semantic-release/github"
26
+ ],
27
+ "repositoryUrl": "https://github.com/seanjameshan/starknet.js"
28
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,36 @@
1
+ # [1.1.0](https://github.com/seanjameshan/starknet.js/compare/v1.0.0...v1.1.0) (2021-10-24)
2
+
3
+ ### Bug Fixes
4
+
5
+ - btoa isomorphic ([f3eb0f5](https://github.com/seanjameshan/starknet.js/commit/f3eb0f5aa01647c0994935b72b723bd13f940faa))
6
+ - json formatting and deploy ([0fe7e3d](https://github.com/seanjameshan/starknet.js/commit/0fe7e3d50c4ebcbc64f30611b1888c966452c910))
7
+ - pr review ([457a852](https://github.com/seanjameshan/starknet.js/commit/457a85266de6cd548a15af1dc866671f3664f418))
8
+ - test ([c307390](https://github.com/seanjameshan/starknet.js/commit/c3073902e838bd9e07f783c13e546e298356e16b))
9
+ - test browser and node ([4c23de0](https://github.com/seanjameshan/starknet.js/commit/4c23de0ef510724fa33e1c3cbb00bc638acb54c2))
10
+ - test structure ([b686f04](https://github.com/seanjameshan/starknet.js/commit/b686f04dc5f74e6042cbd30ec56eeb4ef6b9c45b))
11
+ - tests regarding compressing ([21a83f2](https://github.com/seanjameshan/starknet.js/commit/21a83f25bbb88875854ad3d0cb5f7c7fa1ebacd4))
12
+ - update package-lock ([cd373cb](https://github.com/seanjameshan/starknet.js/commit/cd373cbd8df98f3d973e4076f15681927325c9e2))
13
+
14
+ ### Features
15
+
16
+ - add deploy ([509fa84](https://github.com/seanjameshan/starknet.js/commit/509fa84532ab5a1a46863edbe63d7538ddacfbc8))
17
+
18
+ # 1.0.0 (2021-10-21)
19
+
20
+ ### Bug Fixes
21
+
22
+ - badge ([6a0a989](https://github.com/seanjameshan/starknet.js/commit/6a0a9893c1298a815aec21abda20f78ac697a4bf))
23
+ - ci git push ([571b1d5](https://github.com/seanjameshan/starknet.js/commit/571b1d5092ee18b9ed0828f1cbc834f4aece3363))
24
+ - ci job ([31d1b8d](https://github.com/seanjameshan/starknet.js/commit/31d1b8d7717145a5dd7beef606a9c253d1ceb62d))
25
+ - naming pipeline ([f16427f](https://github.com/seanjameshan/starknet.js/commit/f16427f8a33b46a51d37ad7fbe8a3f34edcf344e))
26
+ - pipeline ([f9186de](https://github.com/seanjameshan/starknet.js/commit/f9186de8f72d80d212317d8c823b981b7df31920))
27
+ - pipeline ([c7d56d0](https://github.com/seanjameshan/starknet.js/commit/c7d56d06644108d71e1bea3e73554b5c4178b82e))
28
+ - pipeline ([d46d175](https://github.com/seanjameshan/starknet.js/commit/d46d175aa9d51f283e2dd9aeeac41ab50fa3ac2e))
29
+ - split pipelines ([e862cfb](https://github.com/seanjameshan/starknet.js/commit/e862cfbf13d9e6d3509b609a31f8ebad1a31569a))
30
+ - tests ([6a242ce](https://github.com/seanjameshan/starknet.js/commit/6a242cedc0a261c55a433ee5a82f0acf28cfcdc2))
31
+
32
+ ### Features
33
+
34
+ - change src code ([5fe4630](https://github.com/seanjameshan/starknet.js/commit/5fe4630a53a75c0387854b1cd53e5aa2c6b259eb))
35
+ - project tooling ([eee89aa](https://github.com/seanjameshan/starknet.js/commit/eee89aa92cab7b7df3a9a7ae439c4df7d1e893b0))
36
+ - start adding types ([3760687](https://github.com/seanjameshan/starknet.js/commit/3760687a0c72da7ac8c0fd2427d471fe4bdf7202))
@@ -0,0 +1,52 @@
1
+ # How to contribute
2
+
3
+ We love pull requests. And following this guidelines will make your pull request easier to merge.
4
+
5
+ If you want to contribute but don’t know what to do, take a look at these two labels: [help wanted](https://github.com/seanjameshan/starknet/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) and [good first issue](https://github.com/seanjameshan/starknet/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22).
6
+
7
+ _[Use GitHub interface](https://blog.sapegin.me/all/open-source-for-everyone/) for simple documentation changes, otherwise follow the steps below._
8
+
9
+ ## Prerequisites
10
+
11
+ - If it’s your first pull request, watch [this amazing course](http://makeapullrequest.com/) by [Kent C. Dodds](https://twitter.com/kentcdodds).
12
+ - Fork the repository and clone your fork.
13
+ - Install dependencies: `npm install`.
14
+
15
+ ## Development workflow
16
+
17
+ ALways start from `develop` branch and merge back to `develop` branch.
18
+
19
+ To build you changes run:
20
+
21
+ ```bash
22
+ npm build
23
+ ```
24
+
25
+ Run linters and tests:
26
+
27
+ ```bash
28
+ npm test
29
+ ```
30
+
31
+ Or run tests in watch mode:
32
+
33
+ ```bash
34
+ npm run test --watch
35
+ ```
36
+
37
+ **Don’t forget to add tests and update documentation for your changes.**
38
+ Documentation can be archived by using JSDoc.
39
+
40
+ **Please update npm lock file (`package-lock.json`) if you add or update dependencies.**
41
+
42
+ ## Other notes
43
+
44
+ - If you have commit access to repository and want to make big change or not sure about something, make a new branch and open pull request.
45
+ - We’re using [Prettier](https://github.com/prettier/prettier) to format code, so don’t worry much about code formatting.
46
+ - Use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/), like so: `feat(scope): topic`
47
+ - Don’t commit generated files, like minified JavaScript.
48
+ - Don’t change version number and changelog.
49
+
50
+ ## Need help?
51
+
52
+ If you want to contribute but have any questions, concerns or doubts, feel free to ping maintainers. Ideally create a pull request with `WIP` (Work in progress) in its title and ask questions in the pull request description.
package/README.md CHANGED
@@ -8,21 +8,39 @@
8
8
 
9
9
  <!-- primary badges -->
10
10
  <p align="center">
11
- <img src='https://img.shields.io/github/package-json/v/seanjameshan/starknet.js?label=npm' />
12
- <img src='https://img.shields.io/bundlephobia/minzip/starknet?color=success&label=size' />
13
- <!-- <img src='https://img.shields.io/npm/dt/starknet?color=blueviolet' /> -->
14
- <img src="https://img.shields.io/badge/license-MIT-black">
15
- <img src='https://img.shields.io/github/stars/seanjameshan/starknet.js?color=yellow' />
16
- <img src='https://img.shields.io/github/followers/seanjameshan?color=red' />
17
- <img src="https://img.shields.io/badge/powered_by-StarkWare-navy">
11
+ <a href="https://github.com/seanjameshan/starknet.js/actions">
12
+ <img src="https://img.shields.io/github/workflow/status/seanjameshan/starknet.js/Release">
13
+ </a>
14
+ <a href="https://www.npmjs.com/package/starknet">
15
+ <img src='https://img.shields.io/github/package-json/v/seanjameshan/starknet.js?label=npm' />
16
+ </a>
17
+ <a href="https://bundlephobia.com/package/starknet">
18
+ <img src='https://img.shields.io/bundlephobia/minzip/starknet?color=success&label=size' />
19
+ </a>
20
+ <a href="https://www.npmjs.com/package/starknet">
21
+ <img src='https://img.shields.io/npm/dt/starknet?color=blueviolet' />
22
+ </a>
23
+ <a href="https://github.com/seanjameshan/starknet.js/blob/main/LICENSE/">
24
+ <img src="https://img.shields.io/badge/license-MIT-black">
25
+ </a>
26
+ <a href="https://github.com/seanjameshan/starknet.js/stargazers">
27
+ <img src='https://img.shields.io/github/stars/seanjameshan/starknet.js?color=yellow' />
28
+ </a>
29
+ <a href="https://starkware.co/">
30
+ <img src="https://img.shields.io/badge/powered_by-StarkWare-navy">
31
+ </a>
18
32
  </p>
19
33
 
20
34
  ## 🕹️ Usage
21
- Install the starknet with `npm`
35
+
36
+ Install starknet with `npm`
37
+
22
38
  ```bash
23
39
  $ npm install starknet
24
40
  ```
25
- Import `starknet` and use the [API](https://github.com/seanjameshan/starknet.js/blob/main/docs/Home.md)
41
+
42
+ Import `starknet` and use the [API](docs)
43
+
26
44
  ```javascript
27
45
  import starknet from 'starknet';
28
46
 
@@ -32,9 +50,15 @@ starknet.getContractAddresses().then((data) => {
32
50
  ```
33
51
 
34
52
  ## 🌐 API
35
- [Click Here](https://github.com/seanjameshan/starknet.js/blob/main/docs/Home.md)
53
+
54
+ [Click Here](docs)
55
+
56
+ ## Contributing
57
+
58
+ If you consider to contribute to this project please read [CONTRIBUTING.md](CONTRIBUTING.md) first.
36
59
 
37
60
  ## License
61
+
38
62
  Copyright (c) 2021 Sean James Han
39
63
 
40
- Licensed under the MIT license.
64
+ Licensed under the [MIT license](LICENSE).