@substeem/steem-sdk 0.0.0-stage → 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.
- package/LICENSE +21 -0
- package/README.md +95 -2
- package/dist/index.cjs +5412 -0
- package/dist/index.d.cts +1386 -0
- package/dist/index.d.mts +1386 -0
- package/dist/index.mjs +5387 -0
- package/package.json +78 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Substeem
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,96 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @substeem/steem-sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](LICENSE)
|
|
4
|
+
[](https://www.typescriptlang.org/)
|
|
5
|
+
[](https://nodejs.org/)
|
|
6
|
+
|
|
7
|
+
Lightweight and complete modern TypeScript SDK for the **Steem** blockchain, maintained by [Substeem](https://substeem.org) ([@substeem.app](https://steemit.com/@substeem.app)).
|
|
8
|
+
Zero runtime dependencies, ~35 KB gzipped. Works in Node.js, modern browsers, Chrome Manifest V3 extensions, workers, and serverless runtimes.
|
|
9
|
+
|
|
10
|
+
- **Zero Runtime Dependencies**: Noble cryptography (`@noble/curves`, `@noble/hashes`, `@noble/ciphers`) is compiled and inlined.
|
|
11
|
+
- **Native Fetch Transport**: No `axios` overhead or Node polyfills required. Built-in `AbortSignal.timeout` support.
|
|
12
|
+
- **Steem Native**: Configured with Steem Chain ID (`0000...`), `STM` address prefix, and live Steem RPC nodes.
|
|
13
|
+
- **Synchronous & Asynchronous Broadcast**: Native support for `condenser_api.broadcast_transaction_synchronous`.
|
|
14
|
+
- **Steem Keychain Ready**: Drop-in compatible with `steem-keychain-extension`.
|
|
15
|
+
- **Chain Math & Helpers**: Full calculations for STEEM Power (`vestsToSP`), mana, voting value, APR, reputation, and social operations.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @substeem/steem-sdk
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
### 1. Simple RPC Call
|
|
30
|
+
```typescript
|
|
31
|
+
import { call } from '@substeem/steem-sdk'
|
|
32
|
+
|
|
33
|
+
const props = await call('condenser_api.get_dynamic_global_properties')
|
|
34
|
+
console.log('Head block:', props.head_block_number)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 2. Create, Sign & Broadcast a Transaction
|
|
38
|
+
```typescript
|
|
39
|
+
import { Transaction, PrivateKey } from '@substeem/steem-sdk'
|
|
40
|
+
|
|
41
|
+
const tx = new Transaction()
|
|
42
|
+
|
|
43
|
+
// Compatible with both Keychain array syntax:
|
|
44
|
+
await tx.create([
|
|
45
|
+
[
|
|
46
|
+
'vote',
|
|
47
|
+
{
|
|
48
|
+
voter: 'substeem.app',
|
|
49
|
+
author: 'steemit',
|
|
50
|
+
permlink: 'firstpost',
|
|
51
|
+
weight: 10000
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
])
|
|
55
|
+
|
|
56
|
+
// Or fluent addOperation syntax:
|
|
57
|
+
// await tx.addOperation('vote', { ... })
|
|
58
|
+
|
|
59
|
+
// Sign transaction
|
|
60
|
+
const key = PrivateKey.from('5J...')
|
|
61
|
+
tx.sign(key)
|
|
62
|
+
|
|
63
|
+
// Broadcast synchronously to Steem
|
|
64
|
+
const result = await tx.broadcast()
|
|
65
|
+
console.log('Transaction confirmed! ID:', result.tx_id, 'Block:', result.block_num)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 3. Steem Power and Mana Utilities
|
|
69
|
+
```typescript
|
|
70
|
+
import { utils } from '@substeem/steem-sdk'
|
|
71
|
+
|
|
72
|
+
// Convert VESTS to STEEM Power
|
|
73
|
+
const sp = await utils.vestsToSP(1_000_000)
|
|
74
|
+
console.log('SP:', sp)
|
|
75
|
+
|
|
76
|
+
// Calculate Voting Mana
|
|
77
|
+
const mana = await utils.getVotingMana('substeem.app')
|
|
78
|
+
console.log('Voting Power %:', mana.percentage)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Building
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npm install
|
|
87
|
+
npm run build
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Build outputs dual ESM (`dist/index.mjs`) and CommonJS (`dist/index.cjs`) along with full TypeScript declarations (`dist/index.d.mts`, `dist/index.d.cts`).
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
MIT
|