@tech-bureau/mijin-catapult-tools 0.0.6
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.
- package/.env/dev.ts +23 -0
- package/.env/prod.ts +23 -0
- package/.github/workflows/main.yml +37 -0
- package/.prettierrc.json +5 -0
- package/LICENSE +21 -0
- package/README.md +646 -0
- package/bin/mijin-catapult-tools.js +3 -0
- package/dist/main.js +2 -0
- package/jest.config.js +8 -0
- package/package.json +55 -0
- package/src/__tests__/service/AccountServices.spec.ts +63 -0
- package/src/__tests__/service/CertificateServices.spec.ts +20 -0
- package/src/__tests__/service/MessageServices.spec.ts +48 -0
- package/src/__tests__/service/MosaicServices.spec.ts +61 -0
- package/src/cli.ts +18 -0
- package/src/commands/account/account.ts +16 -0
- package/src/commands/account/accountGenerate.ts +19 -0
- package/src/commands/account/accountInfo.ts +16 -0
- package/src/commands/mosaic/mosaic.ts +16 -0
- package/src/commands/mosaic/mosaicCreate.ts +20 -0
- package/src/commands/mosaic/mosaicInfo.ts +13 -0
- package/src/commands/transaction/transaction.ts +18 -0
- package/src/commands/transaction/transactionStatus.ts +13 -0
- package/src/commands/transaction/transfer.ts +16 -0
- package/src/commands/votingkey/votingkey.ts +18 -0
- package/src/commands/votingkey/votingkeyCreate.ts +15 -0
- package/src/commands/votingkey/votingkeyInfo.ts +13 -0
- package/src/commands/votingkey/votingkeyUpdate.ts +15 -0
- package/src/infrastructure/account/accountGenerate.ts +183 -0
- package/src/infrastructure/account/accountInfo.ts +154 -0
- package/src/infrastructure/mosaic/mosaicCreate.ts +149 -0
- package/src/infrastructure/mosaic/mosaicInfo.ts +40 -0
- package/src/infrastructure/transaction/transactionStatus.ts +57 -0
- package/src/infrastructure/transaction/transfer.ts +168 -0
- package/src/infrastructure/voting/votingCreate.ts +88 -0
- package/src/infrastructure/voting/votingInfo.ts +44 -0
- package/src/infrastructure/voting/votingUpdate.ts +94 -0
- package/src/service/AccountServices.ts +68 -0
- package/src/service/CertificateServices.ts +165 -0
- package/src/service/CmdServices.ts +17 -0
- package/src/service/Logger.ts +26 -0
- package/src/service/MessageServices.ts +17 -0
- package/src/service/MosaicServices.ts +62 -0
- package/src/service/RepositoryFactory.ts +107 -0
- package/src/service/TransactionServices.ts +268 -0
- package/src/service/VotingServices.ts +184 -0
- package/src/types/AccountInfo.ts +19 -0
- package/src/types/AccountType.ts +9 -0
- package/src/types/ConfigFile.ts +24 -0
- package/src/types/Environment.ts +5 -0
- package/src/types/IAccountOption.ts +16 -0
- package/src/types/ILinkOption.ts +3 -0
- package/src/types/IMosaicOption.ts +18 -0
- package/src/types/ITransactionOption.ts +5 -0
- package/src/types/ITransferOption.ts +9 -0
- package/src/types/IVotingOption.ts +21 -0
- package/src/types/index.ts +9 -0
- package/src/utils.ts +38 -0
- package/tsconfig.json +24 -0
- package/webpack.config.js +24 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface IMosaicCreateOption {
|
|
2
|
+
owner: string
|
|
3
|
+
url?: string
|
|
4
|
+
supply: string
|
|
5
|
+
divisibility: string
|
|
6
|
+
supplymutable: boolean
|
|
7
|
+
transferable: boolean
|
|
8
|
+
restrictable: boolean
|
|
9
|
+
revokable: boolean
|
|
10
|
+
readfile?: string
|
|
11
|
+
privatekey?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface IMosaicInfoOption {
|
|
15
|
+
url?: string
|
|
16
|
+
readfile?: string
|
|
17
|
+
mosaicrawId?: string
|
|
18
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface IVotingCreateOption {
|
|
2
|
+
url?: string
|
|
3
|
+
readfile?: string
|
|
4
|
+
startepoch: string
|
|
5
|
+
endepoch: string
|
|
6
|
+
savedir: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface IVotingInfoOption {
|
|
10
|
+
url?: string
|
|
11
|
+
readfile?: string
|
|
12
|
+
savedir: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface IVotingUpdateOption {
|
|
16
|
+
url?: string
|
|
17
|
+
readfile?: string
|
|
18
|
+
startepoch: string
|
|
19
|
+
endepoch: string
|
|
20
|
+
savedir: string
|
|
21
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './AccountType'
|
|
2
|
+
export * from './AccountInfo'
|
|
3
|
+
export * from './IAccountOption'
|
|
4
|
+
export * from './ITransactionOption'
|
|
5
|
+
export * from './ITransferOption'
|
|
6
|
+
export * from './ILinkOption'
|
|
7
|
+
export * from './ConfigFile'
|
|
8
|
+
export * from './IVotingOption'
|
|
9
|
+
export * from './IMosaicOption'
|
package/src/utils.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { promises as fs } from 'fs'
|
|
2
|
+
import { ConfigFile } from './types'
|
|
3
|
+
|
|
4
|
+
export const readConfig = async (filename: string): Promise<ConfigFile> => {
|
|
5
|
+
return JSON.parse(await fs.readFile(filename, 'utf-8'))
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const writeConfig = async (filename: string, data: string) => {
|
|
9
|
+
return await fs.writeFile(filename, data, 'utf-8')
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const writeFile = async (filename: string, data: string | Uint8Array) => {
|
|
13
|
+
return await fs.writeFile(filename, data, 'utf-8')
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const readFile = async (filename: string) => {
|
|
17
|
+
return await fs.readFile(filename, 'utf-8')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const checkFile = async (filename: string) => {
|
|
21
|
+
try {
|
|
22
|
+
return !!(await fs.lstat(filename))
|
|
23
|
+
} catch (e) {
|
|
24
|
+
return false
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const checkDir = async (filepath: string) => {
|
|
29
|
+
try {
|
|
30
|
+
return !!(await fs.lstat(filepath))
|
|
31
|
+
} catch (e) {
|
|
32
|
+
return false
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const createDir = async (dirpath: string) => {
|
|
37
|
+
return await fs.mkdir(dirpath, { recursive: true })
|
|
38
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"allowSyntheticDefaultImports": true,
|
|
4
|
+
"target": "es2018",
|
|
5
|
+
"lib": ["dom", "es2018"],
|
|
6
|
+
"strict": true,
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"declarationMap": true,
|
|
10
|
+
"pretty": true,
|
|
11
|
+
"newLine": "lf",
|
|
12
|
+
"sourceMap": true,
|
|
13
|
+
"paths": {
|
|
14
|
+
"userEnv": ["./.env/dev"]
|
|
15
|
+
},
|
|
16
|
+
"esModuleInterop": true,
|
|
17
|
+
"moduleResolution": "node",
|
|
18
|
+
"outDir": "./dist",
|
|
19
|
+
"rootDir": ".",
|
|
20
|
+
"typeRoots": ["node_modules/@types", "src/@types"]
|
|
21
|
+
},
|
|
22
|
+
"include": ["src/*", "src/__tests__/**/*.ts", "jest.config.js", "src/**/*.ts"],
|
|
23
|
+
"exclude": ["node_modules"]
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const environment = process.env.NODE_ENV || 'dev';
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
entry: './src/cli.ts',
|
|
6
|
+
target: 'node',
|
|
7
|
+
node: {
|
|
8
|
+
__dirname: false,
|
|
9
|
+
__filename: false
|
|
10
|
+
},
|
|
11
|
+
module: {
|
|
12
|
+
rules: [{
|
|
13
|
+
test: /\.ts$/,
|
|
14
|
+
use: ['ts-loader'],
|
|
15
|
+
exclude: /node_modules/
|
|
16
|
+
}]
|
|
17
|
+
},
|
|
18
|
+
resolve: {
|
|
19
|
+
extensions: ['.tsx', '.ts', '.js'],
|
|
20
|
+
alias: {
|
|
21
|
+
userEnv$: path.resolve(__dirname, `.env/${environment}.ts`),
|
|
22
|
+
},
|
|
23
|
+
}
|
|
24
|
+
};
|