Skip to content

Commit f48c3a7

Browse files
committed
Add repo CI and configs
1 parent 219a8da commit f48c3a7

37 files changed

+6286
-1755
lines changed

.circleci/config.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Use the latest 2.1 version of CircleCI pipeline process engine.
2+
# See: https://circleci.com/docs/2.0/configuration-reference
3+
version: 2.1
4+
5+
orbs:
6+
# The Node.js orb contains a set of prepackaged CircleCI configuration you can utilize
7+
# Orbs reduce the amount of configuration required for common tasks.
8+
# See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/node
9+
node: circleci/[email protected]
10+
coveralls: coveralls/[email protected]
11+
12+
jobs:
13+
test:
14+
parameters:
15+
node-version:
16+
type: string
17+
docker:
18+
- image: cimg/node:<< parameters.node-version >>
19+
resource_class: small
20+
steps:
21+
- checkout
22+
- restore_cache:
23+
# See the configuration reference documentation for more details on using restore_cache and save_cache steps
24+
# https://circleci.com/docs/2.0/configuration-reference/?section=reference#save_cache
25+
keys:
26+
- node-deps-v1-{{ .Branch }}-{{checksum "package-lock.json"}}
27+
- run:
28+
name: install packages
29+
command: npm ci
30+
- save_cache:
31+
key: node-deps-v1-{{ .Branch }}-{{checksum "package-lock.json"}}
32+
paths:
33+
- ~/.npm
34+
- run:
35+
name: Run Lint
36+
command: npm run lint:ci
37+
- run:
38+
name: Run Tests
39+
command: npm run test:cov
40+
41+
- run:
42+
name: Run Build
43+
command: npm run build
44+
- run:
45+
name: Run Build CJS
46+
command: npm run build-cjs
47+
- run:
48+
name: Run Build Esnext
49+
command: npm run build-esnext
50+
- run:
51+
name: Run Build Esm
52+
command: npm run build-esm
53+
- coveralls/upload:
54+
path_to_lcov: coverage/lcov.info
55+
verbose: true
56+
57+
workflows:
58+
test-workflow:
59+
jobs:
60+
- test:
61+
matrix:
62+
parameters:
63+
node-version: ['18.12', '16.18', '14.21']

research.md .docs/research.md

+17-14
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# XCM
1+
# XCM SDK Research
22

3-
## 1. Context
3+
## 1. Context
44

55
Polkadot.js provides an XCM messages builder. This builder is a web application that allows users to build XCM messages and send them to a parachain.
66
To build the XCM messages, the user needs to know the format of the messages. This format is described in the [Polkadot Wiki](https://wiki.polkadot.network/docs/learn-xcm).
77

88
The first step to create an XCM message is to select the xcmPallet and the function to use.
99

10-
![](/.images/1.png)
10+
![](../.images/1.png)
1111

1212
This comes from Polkadot API:
1313
```typescript
@@ -17,7 +17,7 @@ const { api } = useApi();
1717
api.tx['xcmPallet']
1818
```
1919

20-
![](/.images/2.png)
20+
![](../.images/2.png)
2121

2222
```json
2323
{
@@ -520,46 +520,49 @@ api.tx['xcmPallet']
520520

521521
For example, by selecting xcmPallet > send(destination, message). An extrinsic object is generated:
522522

523-
![](/.images/3.png)
523+
![](../.images/3.png)
524524

525525
## 2. Params
526526

527-
![](/.images/4.png)
527+
![](../.images/4.png)
528528

529529
Transaction Parameters
530530

531-
![](/.images/5.png)
531+
![](../.images/5.png)
532532

533533
Parachain Id
534534

535-
![](/.images/6.png)
535+
![](../.images/6.png)
536536

537537
There are “special components” for each data type, they are displayed dynamically based on the parameters
538538

539-
![](/.images/7.png)
539+
![](../.images/7.png)
540540

541541
Types
542542

543-
![](/.images/8.png)
543+
![](../.images/8.png)
544544

545545
## 3. Extrinsic
546546

547547
When an extrinsic is selected/value changed, it goes through an fn() function of the xcm message, the selected values are passed to this function and this generates the SubmittableExtrinsic
548548

549-
![](/.images/9.png)
549+
![](../.images/9.png)
550550

551551

552552
## 4. Sending Transaction
553553

554554
Data sending to a local parachain
555555

556-
![](/.images/10.png)
556+
![](../.images/10.png)
557557

558558
logs before and after sending transaction:
559559

560-
![](/.images/11.png)
560+
![](../.images/11.png)
561561

562562
explorer log:
563563

564-
![](/.images/12.png)
564+
![](../.images/12.png)
565565

566+
## License
567+
568+
Apache license version 2.0

.editorconfig

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true

.eslintrc.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
parserOptions: {
4+
project: 'tsconfig.json',
5+
sourceType: 'module',
6+
},
7+
plugins: ['@typescript-eslint/eslint-plugin', 'import'],
8+
extends: [
9+
'plugin:@typescript-eslint/recommended',
10+
'plugin:prettier/recommended',
11+
],
12+
root: true,
13+
env: {
14+
node: true,
15+
jest: true,
16+
},
17+
ignorePatterns: ['.eslintrc.js'],
18+
rules: {
19+
'@typescript-eslint/interface-name-prefix': 'off',
20+
'@typescript-eslint/explicit-function-return-type': 'off',
21+
'@typescript-eslint/explicit-module-boundary-types': 'off',
22+
'@typescript-eslint/no-explicit-any': 'off',
23+
'import/order': [
24+
'error',
25+
{
26+
alphabetize: { order: 'asc' },
27+
groups: [
28+
['builtin', 'external'],
29+
['internal', 'parent', 'sibling', 'index'],
30+
],
31+
'newlines-between': 'never',
32+
},
33+
],
34+
},
35+
};

.github/ISSUE_TEMPLATE.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!--
2+
PLEASE HELP US PROCESS GITHUB ISSUES FASTER BY PROVIDING THE FOLLOWING INFORMATION.
3+
4+
ISSUES MISSING IMPORTANT INFORMATION MAY BE CLOSED WITHOUT INVESTIGATION.
5+
-->
6+
7+
## I'm submitting a...
8+
<!--
9+
Please search GitHub for a similar issue or PR before submitting.
10+
Check one of the following options with "x" -->
11+
<pre><code>
12+
[ ] Regression <!--(a behavior that used to work and stopped working in a new release)-->
13+
[ ] Bug report
14+
[ ] Feature request
15+
[ ] Documentation issue or request
16+
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
17+
</code></pre>
18+
19+
## Current behavior
20+
<!-- Describe how the issue manifests. -->
21+
22+
## Expected behavior
23+
<!-- Describe what the desired behavior would be. -->
24+
25+
## Minimal reproduction of the problem with instructions
26+
<!-- Please share a repo, a gist, or step-by-step instructions. -->
27+
28+
## What is the motivation / use case for changing the behavior?
29+
<!-- Describe the motivation or the concrete use case. -->
30+
31+
## Environment
32+
33+
<pre><code>
34+
Harmony RPC endpoint: https://api.harmony.one <!-- `mainnet or testnet` -->
35+
Harmony Marketplace SDK version: X.Y.Z
36+
<!-- Check whether this is still an issue in the most recent version -->
37+
38+
For Tooling issues:
39+
- Node/JS/TS version: XX <!-- run `node --version` -->
40+
- Platform: <!-- Mac, Linux, Windows -->
41+
- Environment: <!-- Browser, Server -->
42+
43+
Others:
44+
<!-- Anything else relevant? Operating system version, IDE, package manager, ... -->
45+
</code></pre>

.github/PULL_REQUEST_TEMPLATE.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## PR Checklist
2+
Please check if your PR fulfills the following requirements:
3+
4+
- [ ] The commit message follows our guidelines: https://github.com/blockcoders/harmony-marketplace-sdk/blob/main/CONTRIBUTING.md
5+
- [ ] Tests for the changes have been added (for bug fixes / features)
6+
- [ ] Docs have been added / updated (for bug fixes / features)
7+
8+
## PR Type
9+
What kind of change does this PR introduce?
10+
11+
<!-- Please check the one that applies to this PR using "x". -->
12+
- [ ] Bugfix
13+
- [ ] Feature
14+
- [ ] Code style update (formatting, local variables)
15+
- [ ] Refactoring (no functional changes, no api changes)
16+
- [ ] Build related changes
17+
- [ ] CI related changes
18+
- [ ] Other... Please describe:
19+
20+
## What is the current behavior?
21+
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
22+
23+
Issue Number: N/A
24+
25+
## What is the new behavior?
26+
<!-- Please describe how the issue was solved. -->
27+
28+
29+
## Does this PR introduce a breaking change?
30+
31+
- [ ] Yes
32+
- [ ] No
33+
34+
<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
35+
36+
## Other information
37+
<!-- Anything else relevant? Operating system version, IDE, package manager, ... -->

.github/workflows/codeql-analysis.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "main" ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ "main" ]
20+
schedule:
21+
- cron: '20 7 * * 0'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'javascript' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v3
42+
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v2
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
52+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53+
# queries: security-extended,security-and-quality
54+
55+
56+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57+
# If this step fails, then you should remove it and run the build manually (see below)
58+
- name: Autobuild
59+
uses: github/codeql-action/autobuild@v2
60+
61+
# ℹ️ Command-line programs to run using the OS shell.
62+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
63+
64+
# If the Autobuild fails above, remove it and uncomment the following three lines.
65+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
66+
67+
# - run: |
68+
# echo "Run, Build Application using script"
69+
# ./location_of_script_within_repo/buildscript.sh
70+
71+
- name: Perform CodeQL Analysis
72+
uses: github/codeql-action/analyze@v2
73+
with:
74+
category: "/language:${{matrix.language}}"

.npmignore

-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,3 @@ tsconfig.json
1818
.env.sample
1919
.env
2020
.vscode/settings.json
21-
.bettercodehub.yml

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lts/hydrogen

.nycrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"**/*.spec.ts",
1616
"src/tests/**/*",
1717
"src/examples/**/*",
18-
"src/interfaces/**/*",
18+
"src/interfaces/index.ts",
1919
"src/index.ts"
2020
],
2121
"sourceMap": true,

.prettierrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"printWidth": 120,
3+
"singleQuote": true,
4+
"semi": false,
5+
"bracketSpacing": true,
6+
"trailingComma": "all"
7+
}

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## 0.0.1
4+
Published by **[blockcoders](https://github.com/blockcoders)** on **2023/01/04**
5+
- Pending

0 commit comments

Comments
 (0)