@steemit/steem-js 0.0.8

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 (51) hide show
  1. package/README.md +232 -0
  2. package/dist/api/index.d.ts +115 -0
  3. package/dist/api/methods.d.ts +9 -0
  4. package/dist/api/rpc-auth.d.ts +43 -0
  5. package/dist/api/transports/base.d.ts +13 -0
  6. package/dist/api/transports/http.d.ts +9 -0
  7. package/dist/api/transports/index.d.ts +9 -0
  8. package/dist/api/transports/types.d.ts +29 -0
  9. package/dist/api/transports/ws.d.ts +11 -0
  10. package/dist/auth/ecc/index.d.ts +9 -0
  11. package/dist/auth/ecc/src/address.d.ts +13 -0
  12. package/dist/auth/ecc/src/aes.d.ts +16 -0
  13. package/dist/auth/ecc/src/brain_key.d.ts +1 -0
  14. package/dist/auth/ecc/src/ecdsa.d.ts +28 -0
  15. package/dist/auth/ecc/src/ecsignature.d.ts +19 -0
  16. package/dist/auth/ecc/src/enforce_types.d.ts +5 -0
  17. package/dist/auth/ecc/src/hash.d.ts +25 -0
  18. package/dist/auth/ecc/src/index.d.ts +9 -0
  19. package/dist/auth/ecc/src/key_private.d.ts +38 -0
  20. package/dist/auth/ecc/src/key_public.d.ts +41 -0
  21. package/dist/auth/ecc/src/key_utils.d.ts +9 -0
  22. package/dist/auth/ecc/src/signature.d.ts +18 -0
  23. package/dist/auth/ecc.d.ts +3 -0
  24. package/dist/auth/index.d.ts +48 -0
  25. package/dist/auth/key_classes.d.ts +3 -0
  26. package/dist/auth/serializer.d.ts +19 -0
  27. package/dist/broadcast/helpers.d.ts +11 -0
  28. package/dist/broadcast/index.d.ts +43 -0
  29. package/dist/broadcast/operations.d.ts +6 -0
  30. package/dist/config.d.ts +25 -0
  31. package/dist/crypto/index.d.ts +25 -0
  32. package/dist/formatter/index.d.ts +92 -0
  33. package/dist/index.cjs +25766 -0
  34. package/dist/index.cjs.map +1 -0
  35. package/dist/index.d.ts +30 -0
  36. package/dist/index.js +25730 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/index.umd.js +57431 -0
  39. package/dist/index.umd.js.map +1 -0
  40. package/dist/memo/index.d.ts +11 -0
  41. package/dist/operations/index.d.ts +44 -0
  42. package/dist/serializer/convert.d.ts +12 -0
  43. package/dist/serializer/index.d.ts +11 -0
  44. package/dist/serializer/number_utils.d.ts +8 -0
  45. package/dist/serializer/precision.d.ts +5 -0
  46. package/dist/serializer/types.d.ts +36 -0
  47. package/dist/types/index.d.ts +131 -0
  48. package/dist/types.d.ts +28 -0
  49. package/dist/utils/index.d.ts +8 -0
  50. package/dist/utils.d.ts +2 -0
  51. package/package.json +85 -0
@@ -0,0 +1,11 @@
1
+ import { PrivateKey } from '../auth/ecc/src/key_private';
2
+ import { PublicKey } from '../auth/ecc/src/key_public';
3
+ export interface MemoData {
4
+ from: string;
5
+ to: string;
6
+ nonce: string;
7
+ check: number;
8
+ encrypted: string;
9
+ }
10
+ export declare function encode(private_key: string | PrivateKey | null, public_key: string | PublicKey | null, memo: string, testNonce?: string): string;
11
+ export declare function decode(private_key: string | PrivateKey | null, memo: string): string;
@@ -0,0 +1,44 @@
1
+ export interface TransferOperation {
2
+ 0: 'transfer';
3
+ 1: {
4
+ from: string;
5
+ to: string;
6
+ amount: string;
7
+ memo: string;
8
+ };
9
+ }
10
+ export interface VoteOperation {
11
+ 0: 'vote';
12
+ 1: {
13
+ voter: string;
14
+ author: string;
15
+ permlink: string;
16
+ weight: number;
17
+ };
18
+ }
19
+ export interface CommentOperation {
20
+ 0: 'comment';
21
+ 1: {
22
+ parent_author: string;
23
+ parent_permlink: string;
24
+ author: string;
25
+ permlink: string;
26
+ title: string;
27
+ body: string;
28
+ json_metadata: string;
29
+ };
30
+ }
31
+ export interface CustomJsonOperation {
32
+ 0: 'custom_json';
33
+ 1: {
34
+ required_auths: string[];
35
+ required_posting_auths: string[];
36
+ id: string;
37
+ json: string;
38
+ };
39
+ }
40
+ export type Operation = TransferOperation | VoteOperation | CommentOperation | CustomJsonOperation;
41
+ export declare const createTransfer: (from: string, to: string, amount: string, memo?: string) => TransferOperation;
42
+ export declare const createVote: (voter: string, author: string, permlink: string, weight: number) => VoteOperation;
43
+ export declare const createComment: (parentAuthor: string, parentPermlink: string, author: string, permlink: string, title: string, body: string, jsonMetadata?: string) => CommentOperation;
44
+ export declare const createCustomJson: (requiredAuths: string[], requiredPostingAuths: string[], id: string, json: string) => CustomJsonOperation;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Convert implementation to support serializing types.
3
+ */
4
+ export declare class Convert {
5
+ private type;
6
+ constructor(type: any);
7
+ toHex(value: any): string;
8
+ fromHex(hex: string): any;
9
+ fromObject(obj: any): any;
10
+ toObject(obj: any): any;
11
+ }
12
+ export default function (type: any): Convert;
@@ -0,0 +1,11 @@
1
+ import type { Operation, Transaction } from '../types';
2
+ export declare const serializeTransaction: (transaction: Transaction) => Buffer;
3
+ export declare const serializeOperation: (operation: Operation) => Buffer;
4
+ export declare const getTransactionDigest: (transaction: Transaction) => Buffer;
5
+ export declare const getTransactionId: (transaction: Transaction) => string;
6
+ export declare const serialize: (operation: any) => Buffer;
7
+ export declare const deserialize: (buffer: Buffer) => any;
8
+ export declare const deserializeTransaction: (buffer: Buffer) => any;
9
+ export { default as convert } from './convert';
10
+ export * as types from './types';
11
+ export * as precision from './precision';
@@ -0,0 +1,8 @@
1
+ /**
2
+ Convert 12.34 with a precision of 3 into 12340
3
+ @arg {number|string} number - Use strings for large numbers. This may contain one decimal but no sign
4
+ @arg {number} precision - number of implied decimal places (usually causes right zero padding)
5
+ @return {string} -
6
+ */
7
+ export declare function toImpliedDecimal(number: number | string, precision: number): string;
8
+ export declare function fromImpliedDecimal(number: number | string, precision: number): string;
@@ -0,0 +1,5 @@
1
+ export declare const _internal: {
2
+ decimal_precision_string: (number: string, precision: number) => string;
3
+ };
4
+ export declare const to_bigint64: (number_or_string: string, precision: number) => bigint;
5
+ export declare const to_string64: (input: any, precision: number) => string;
@@ -0,0 +1,36 @@
1
+ export declare const vote_id: {
2
+ fromObject: (id: string) => string;
3
+ toHex: (id: string) => string;
4
+ };
5
+ export declare const set: (_type: any) => {
6
+ fromObject: (arr: any[]) => any[];
7
+ toObject: (set: any[]) => any[];
8
+ toHex: (arr: any[]) => string;
9
+ };
10
+ export declare const map: (_keyType: any, _valueType: any) => {
11
+ fromObject: (arr: [any, any][]) => [any, any][];
12
+ toObject: (map: [any, any][]) => [any, any][];
13
+ toHex: (arr: [any, any][]) => string;
14
+ };
15
+ export declare const bool: {
16
+ toHex: (value: boolean) => string;
17
+ };
18
+ export declare const string: {
19
+ toHex: (value: string) => string;
20
+ };
21
+ export declare const public_key: {
22
+ toHex: (key: string) => string;
23
+ };
24
+ export declare const uint16: {
25
+ toHex: (value: number) => string;
26
+ };
27
+ export declare const _internal: {
28
+ decimal_precision_string: (value: string, precision: number) => string;
29
+ precision_number_long: (value: string, precision: number) => void;
30
+ };
31
+ export declare const type_id: {
32
+ toHex: (value: string) => string;
33
+ };
34
+ export declare const protocol_id_type: (_name: string) => {
35
+ toHex: (value: number) => string;
36
+ };
@@ -0,0 +1,131 @@
1
+ export interface SteemConfig {
2
+ addressPrefix: string;
3
+ chainId: string;
4
+ node?: string;
5
+ nodes?: string[];
6
+ }
7
+ export interface Account {
8
+ id: number;
9
+ name: string;
10
+ owner: Authority;
11
+ active: Authority;
12
+ posting: Authority;
13
+ memo_key: string;
14
+ json_metadata: string;
15
+ proxy: string;
16
+ last_owner_update: string;
17
+ last_account_update: string;
18
+ created: string;
19
+ mined: boolean;
20
+ recovery_account: string;
21
+ reset_account: string;
22
+ last_account_recovery: string;
23
+ comment_count: number;
24
+ lifetime_vote_count: number;
25
+ post_count: number;
26
+ can_vote: boolean;
27
+ voting_power: number;
28
+ last_vote_time: string;
29
+ balance: string;
30
+ savings_balance: string;
31
+ sbd_balance: string;
32
+ sbd_seconds: string;
33
+ sbd_seconds_last_update: string;
34
+ sbd_last_interest_payment: string;
35
+ savings_sbd_balance: string;
36
+ savings_sbd_seconds: string;
37
+ savings_sbd_seconds_last_update: string;
38
+ savings_sbd_last_interest_payment: string;
39
+ savings_withdraw_requests: number;
40
+ reward_sbd_balance: string;
41
+ reward_steem_balance: string;
42
+ reward_vesting_balance: string;
43
+ reward_vesting_steem: string;
44
+ vesting_shares: string;
45
+ delegated_vesting_shares: string;
46
+ received_vesting_shares: string;
47
+ vesting_withdraw_rate: string;
48
+ next_vesting_withdrawal: string;
49
+ withdrawn: string;
50
+ to_withdraw: string;
51
+ withdraw_routes: number;
52
+ curation_rewards: string;
53
+ posting_rewards: string;
54
+ proxied_vsf_votes: number[];
55
+ witnesses_produced: number;
56
+ last_post: string;
57
+ last_root_post: string;
58
+ average_bandwidth: string;
59
+ lifetime_bandwidth: string;
60
+ last_bandwidth_update: string;
61
+ average_market_bandwidth: string;
62
+ lifetime_market_bandwidth: string;
63
+ last_market_bandwidth_update: string;
64
+ vesting_balance: string;
65
+ reputation: string;
66
+ transfer_history: any[];
67
+ market_history: any[];
68
+ post_history: any[];
69
+ vote_history: any[];
70
+ other_history: any[];
71
+ witness_votes: string[];
72
+ tags_usage: any[];
73
+ guest_bloggers: any[];
74
+ blog_category: any;
75
+ }
76
+ export interface Authority {
77
+ weight_threshold: number;
78
+ account_auths: [string, number][];
79
+ key_auths: [string, number][];
80
+ }
81
+ export interface Transaction {
82
+ ref_block_num: number;
83
+ ref_block_prefix: number;
84
+ expiration: string;
85
+ operations: Operation[];
86
+ extensions: any[];
87
+ signatures?: string[];
88
+ }
89
+ export interface SignedTransaction extends Transaction {
90
+ signatures: string[];
91
+ }
92
+ export interface TransferOperation {
93
+ 0: 'transfer';
94
+ 1: {
95
+ from: string;
96
+ to: string;
97
+ amount: string;
98
+ memo: string;
99
+ };
100
+ }
101
+ export interface VoteOperation {
102
+ 0: 'vote';
103
+ 1: {
104
+ voter: string;
105
+ author: string;
106
+ permlink: string;
107
+ weight: number;
108
+ };
109
+ }
110
+ export interface CommentOperation {
111
+ 0: 'comment';
112
+ 1: {
113
+ parent_author: string;
114
+ parent_permlink: string;
115
+ author: string;
116
+ permlink: string;
117
+ title: string;
118
+ body: string;
119
+ json_metadata: string;
120
+ };
121
+ }
122
+ export interface CustomJsonOperation {
123
+ 0: 'custom_json';
124
+ 1: {
125
+ required_auths: string[];
126
+ required_posting_auths: string[];
127
+ id: string;
128
+ json: string;
129
+ };
130
+ }
131
+ export type Operation = TransferOperation | VoteOperation | CommentOperation | CustomJsonOperation;
@@ -0,0 +1,28 @@
1
+ export interface SteemConfig {
2
+ addressPrefix: string;
3
+ chainId: string;
4
+ node: string;
5
+ nodes: string[];
6
+ uri?: string;
7
+ websocket?: string;
8
+ }
9
+ export interface Account {
10
+ name: string;
11
+ }
12
+ export interface Authority {
13
+ weight_threshold: number;
14
+ account_auths: [string, number][];
15
+ key_auths: [string, number][];
16
+ }
17
+ export interface Operation {
18
+ type: string;
19
+ value: any;
20
+ }
21
+ export interface Transaction {
22
+ ref_block_num: number;
23
+ ref_block_prefix: number;
24
+ expiration: string;
25
+ operations: Operation[];
26
+ extensions: any[];
27
+ signatures?: string[];
28
+ }
@@ -0,0 +1,8 @@
1
+ export declare const sleep: (ms: number) => Promise<void>;
2
+ export declare const retry: <T>(fn: () => Promise<T>, retries?: number, delay?: number) => Promise<T>;
3
+ export declare const chunk: <T>(array: T[], size: number) => T[][];
4
+ export declare const unique: <T>(array: T[]) => T[];
5
+ export declare const flatten: <T>(array: T[][]) => T[];
6
+ export declare const isValidAddress: (address: string) => boolean;
7
+ export declare const isValidAmount: (amount: string) => boolean;
8
+ export declare const isValidPermlink: (permlink: string) => boolean;
@@ -0,0 +1,2 @@
1
+ export * from './utils/index';
2
+ export declare const camelCase: (str: string) => string;
package/package.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "@steemit/steem-js",
3
+ "version": "0.0.8",
4
+ "description": "Steem blockchain JavaScript/TypeScript library",
5
+ "type": "module",
6
+ "main": "dist/index.cjs",
7
+ "module": "dist/index.js",
8
+ "browser": "dist/index.umd.js",
9
+ "types": "dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "require": "./dist/index.cjs",
15
+ "browser": "./dist/index.umd.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "unpkg": "dist/index.umd.js",
22
+ "jsdelivr": "dist/index.umd.js",
23
+ "keywords": [
24
+ "steem",
25
+ "blockchain",
26
+ "cryptocurrency"
27
+ ],
28
+ "author": "hightouch",
29
+ "license": "MIT",
30
+ "devDependencies": {
31
+ "@rollup/plugin-alias": "^6.0.0",
32
+ "@rollup/plugin-commonjs": "^25.0.7",
33
+ "@rollup/plugin-json": "^6.1.0",
34
+ "@rollup/plugin-node-resolve": "^15.2.3",
35
+ "@rollup/plugin-typescript": "^11.1.6",
36
+ "@types/bigi": "^1.4.5",
37
+ "@types/bluebird": "^3.5.42",
38
+ "@types/bytebuffer": "^5.0.49",
39
+ "@types/debug": "^4.1.12",
40
+ "@types/ecurve": "^1.0.3",
41
+ "@types/lodash": "^4.17.18",
42
+ "@types/node": "^20.11.24",
43
+ "@types/ws": "^8.18.1",
44
+ "@typescript-eslint/eslint-plugin": "^7.1.0",
45
+ "@typescript-eslint/parser": "^7.1.0",
46
+ "@vitest/coverage-v8": "^3.1.3",
47
+ "assert": "^2.1.0",
48
+ "buffer": "^6.0.3",
49
+ "crypto-browserify": "^3.12.1",
50
+ "eslint": "^8.57.0",
51
+ "events": "^3.3.0",
52
+ "prettier": "^3.2.5",
53
+ "rollup": "^4.12.0",
54
+ "stream-browserify": "^3.0.0",
55
+ "tslib": "^2.6.2",
56
+ "typescript": "^5.3.3",
57
+ "util": "^0.12.5",
58
+ "vitest": "^3.1.3"
59
+ },
60
+ "dependencies": {
61
+ "axios": "^1.6.7",
62
+ "bigi": "^1.4.2",
63
+ "bluebird": "^3.7.2",
64
+ "bs58": "^6.0.0",
65
+ "bytebuffer": "^5.0.1",
66
+ "create-hash": "^1.2.0",
67
+ "create-hmac": "^1.1.7",
68
+ "crypto-js": "^4.2.0",
69
+ "ecurve": "^1.0.6",
70
+ "lodash": "^4.17.21",
71
+ "long": "^5.2.3",
72
+ "retry": "^0.13.1",
73
+ "ws": "^8.18.2"
74
+ },
75
+ "scripts": {
76
+ "build": "rollup -c",
77
+ "dev": "rollup -c -w",
78
+ "test": "vitest run",
79
+ "test:watch": "vitest watch",
80
+ "test:coverage": "vitest run --coverage",
81
+ "typecheck": "tsc --noEmit",
82
+ "lint": "eslint src --ext .ts",
83
+ "format": "prettier --write \"src/**/*.ts\""
84
+ }
85
+ }