@substeem/steem-sdk 1.0.0 → 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/dist/index.cjs +66 -0
- package/dist/index.d.cts +188 -6
- package/dist/index.d.mts +188 -6
- package/dist/index.mjs +64 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5322,7 +5322,73 @@ const Memo = {
|
|
|
5322
5322
|
encode,
|
|
5323
5323
|
encodeForAccount
|
|
5324
5324
|
};
|
|
5325
|
+
// src/Client.ts
|
|
5326
|
+
var DatabaseAPI = class {
|
|
5327
|
+
client;
|
|
5328
|
+
constructor(client) {
|
|
5329
|
+
this.client = client;
|
|
5330
|
+
}
|
|
5331
|
+
async getAccounts(names) {
|
|
5332
|
+
return callRPC("condenser_api.get_accounts", [names], this.client.timeout);
|
|
5333
|
+
}
|
|
5334
|
+
async getDynamicGlobalProperties() {
|
|
5335
|
+
return callRPC("condenser_api.get_dynamic_global_properties", [], this.client.timeout);
|
|
5336
|
+
}
|
|
5337
|
+
async getVestingDelegations(account, from = "", limit = 1e3) {
|
|
5338
|
+
return callRPC("condenser_api.get_vesting_delegations", [
|
|
5339
|
+
account,
|
|
5340
|
+
from,
|
|
5341
|
+
limit
|
|
5342
|
+
], this.client.timeout);
|
|
5343
|
+
}
|
|
5344
|
+
async call(method, params = []) {
|
|
5345
|
+
return callRPC(method, params, this.client.timeout);
|
|
5346
|
+
}
|
|
5347
|
+
};
|
|
5348
|
+
var BroadcastAPI = class {
|
|
5349
|
+
client;
|
|
5350
|
+
constructor(client) {
|
|
5351
|
+
this.client = client;
|
|
5352
|
+
}
|
|
5353
|
+
async sendOperations(operations, key) {
|
|
5354
|
+
const tx = new Transaction();
|
|
5355
|
+
await tx.create(operations);
|
|
5356
|
+
const keys = Array.isArray(key) ? key : [key];
|
|
5357
|
+
for (const k of keys) tx.sign(k);
|
|
5358
|
+
return tx.broadcast();
|
|
5359
|
+
}
|
|
5360
|
+
sign(transaction, key) {
|
|
5361
|
+
const tx = new Transaction(transaction);
|
|
5362
|
+
const keys = Array.isArray(key) ? key : [key];
|
|
5363
|
+
for (const k of keys) tx.sign(k);
|
|
5364
|
+
return tx.transaction;
|
|
5365
|
+
}
|
|
5366
|
+
};
|
|
5367
|
+
var Client = class {
|
|
5368
|
+
database;
|
|
5369
|
+
broadcast;
|
|
5370
|
+
timeout;
|
|
5371
|
+
constructor(address, options = {}) {
|
|
5372
|
+
if (address) {
|
|
5373
|
+
if (Array.isArray(address)) config.nodes = address;
|
|
5374
|
+
else config.nodes = [address];
|
|
5375
|
+
}
|
|
5376
|
+
if (options.timeout) this.timeout = options.timeout;
|
|
5377
|
+
else this.timeout = config.timeout;
|
|
5378
|
+
if (options.chainId) config.chain_id = options.chainId;
|
|
5379
|
+
if (options.addressPrefix) config.address_prefix = options.addressPrefix;
|
|
5380
|
+
this.database = new DatabaseAPI(this);
|
|
5381
|
+
this.broadcast = new BroadcastAPI(this);
|
|
5382
|
+
}
|
|
5383
|
+
async call(api, method, params = []) {
|
|
5384
|
+
const fullMethod = api ? `${api}.${method}` : method;
|
|
5385
|
+
return callRPC(fullMethod, params, this.timeout);
|
|
5386
|
+
}
|
|
5387
|
+
};
|
|
5325
5388
|
exports.Asset = Asset;
|
|
5389
|
+
exports.BroadcastAPI = BroadcastAPI;
|
|
5390
|
+
exports.Client = Client;
|
|
5391
|
+
exports.DatabaseAPI = DatabaseAPI;
|
|
5326
5392
|
exports.Memo = Memo;
|
|
5327
5393
|
exports.PrivateKey = PrivateKey;
|
|
5328
5394
|
exports.PublicKey = PublicKey;
|
package/dist/index.d.cts
CHANGED
|
@@ -228,6 +228,7 @@ export interface Authority {
|
|
|
228
228
|
account_auths: Array<[string, number]>;
|
|
229
229
|
key_auths: Array<[string | PublicKey, number]>;
|
|
230
230
|
}
|
|
231
|
+
export type AuthorityType = Authority;
|
|
231
232
|
export interface Beneficiary {
|
|
232
233
|
account: string;
|
|
233
234
|
weight: number;
|
|
@@ -236,6 +237,10 @@ export interface Price {
|
|
|
236
237
|
base: Asset | string;
|
|
237
238
|
quote: Asset | string;
|
|
238
239
|
}
|
|
240
|
+
export type PriceType = Price | {
|
|
241
|
+
base: string | Asset;
|
|
242
|
+
quote: string | Asset;
|
|
243
|
+
};
|
|
239
244
|
export interface ChainProperties {
|
|
240
245
|
account_creation_fee: Asset | string;
|
|
241
246
|
maximum_block_size: number;
|
|
@@ -591,6 +596,132 @@ export interface TransactionType {
|
|
|
591
596
|
ref_block_prefix: number;
|
|
592
597
|
signatures: string[];
|
|
593
598
|
}
|
|
599
|
+
export type SignedTransaction = TransactionType;
|
|
600
|
+
export interface Manabar {
|
|
601
|
+
current_mana: string | number;
|
|
602
|
+
last_update_time: number;
|
|
603
|
+
}
|
|
604
|
+
export interface Account {
|
|
605
|
+
id: number;
|
|
606
|
+
name: string;
|
|
607
|
+
owner: Authority;
|
|
608
|
+
active: Authority;
|
|
609
|
+
posting: Authority;
|
|
610
|
+
memo_key: string;
|
|
611
|
+
json_metadata: string;
|
|
612
|
+
posting_json_metadata?: string;
|
|
613
|
+
proxy: string;
|
|
614
|
+
last_owner_update: string;
|
|
615
|
+
last_account_update: string;
|
|
616
|
+
created: string;
|
|
617
|
+
mined: boolean;
|
|
618
|
+
recovery_account: string;
|
|
619
|
+
reset_account: string;
|
|
620
|
+
last_account_recovery: string;
|
|
621
|
+
comment_count: number;
|
|
622
|
+
lifetime_vote_count: number;
|
|
623
|
+
post_count: number;
|
|
624
|
+
can_vote: boolean;
|
|
625
|
+
voting_power: number;
|
|
626
|
+
last_vote_time: string;
|
|
627
|
+
voting_manabar: Manabar;
|
|
628
|
+
downvote_manabar?: Manabar;
|
|
629
|
+
balance: Asset | string;
|
|
630
|
+
savings_balance: Asset | string;
|
|
631
|
+
sbd_balance: Asset | string;
|
|
632
|
+
sbd_seconds: string;
|
|
633
|
+
sbd_seconds_last_update: string;
|
|
634
|
+
sbd_last_interest_payment: string;
|
|
635
|
+
savings_sbd_balance: Asset | string;
|
|
636
|
+
savings_sbd_seconds: string;
|
|
637
|
+
savings_sbd_seconds_last_update: string;
|
|
638
|
+
savings_sbd_last_interest_payment: string;
|
|
639
|
+
savings_withdraw_requests: number;
|
|
640
|
+
reward_sbd_balance: Asset | string;
|
|
641
|
+
reward_steem_balance: Asset | string;
|
|
642
|
+
reward_vesting_balance: Asset | string;
|
|
643
|
+
reward_vesting_steem: Asset | string;
|
|
644
|
+
curation_rewards: number | string;
|
|
645
|
+
posting_rewards: number | string;
|
|
646
|
+
vesting_shares: Asset | string;
|
|
647
|
+
delegated_vesting_shares: Asset | string;
|
|
648
|
+
received_vesting_shares: Asset | string;
|
|
649
|
+
vesting_withdraw_rate: Asset | string;
|
|
650
|
+
next_vesting_withdrawal: string;
|
|
651
|
+
withdrawn: number | string;
|
|
652
|
+
to_withdraw: number | string;
|
|
653
|
+
withdraw_routes: number;
|
|
654
|
+
proxied_vsf_votes: number[];
|
|
655
|
+
witnesses_voted_for: number;
|
|
656
|
+
last_post: string;
|
|
657
|
+
last_root_post: string;
|
|
658
|
+
pending_claimed_accounts?: number;
|
|
659
|
+
}
|
|
660
|
+
export interface ExtendedAccount extends Account {
|
|
661
|
+
vesting_balance: Asset | string;
|
|
662
|
+
reputation: string | number;
|
|
663
|
+
transfer_history: any[];
|
|
664
|
+
market_history: any[];
|
|
665
|
+
post_history: any[];
|
|
666
|
+
vote_history: any[];
|
|
667
|
+
other_history: any[];
|
|
668
|
+
witness_votes: string[];
|
|
669
|
+
tags_usage: string[];
|
|
670
|
+
guest_bloggers: string[];
|
|
671
|
+
open_orders?: any[];
|
|
672
|
+
comments?: any[];
|
|
673
|
+
blog?: any[];
|
|
674
|
+
feed?: any[];
|
|
675
|
+
recent_replies?: any[];
|
|
676
|
+
recommended?: any[];
|
|
677
|
+
}
|
|
678
|
+
export interface DynamicGlobalProperties {
|
|
679
|
+
head_block_number: number;
|
|
680
|
+
head_block_id: string;
|
|
681
|
+
time: string;
|
|
682
|
+
current_witness: string;
|
|
683
|
+
total_pow: number;
|
|
684
|
+
num_pow_witnesses: number;
|
|
685
|
+
virtual_supply: Asset | string;
|
|
686
|
+
current_supply: Asset | string;
|
|
687
|
+
confidential_supply: Asset | string;
|
|
688
|
+
current_sbd_supply: Asset | string;
|
|
689
|
+
confidential_sbd_supply: Asset | string;
|
|
690
|
+
total_vesting_fund_steem: Asset | string;
|
|
691
|
+
total_vesting_shares: Asset | string;
|
|
692
|
+
total_reward_fund_steem: Asset | string;
|
|
693
|
+
total_reward_shares2: string;
|
|
694
|
+
pending_rewarded_vesting_shares: Asset | string;
|
|
695
|
+
pending_rewarded_vesting_steem: Asset | string;
|
|
696
|
+
sbd_interest_rate: number;
|
|
697
|
+
sbd_print_rate: number;
|
|
698
|
+
maximum_block_size: number;
|
|
699
|
+
required_actions_partition_percent: number;
|
|
700
|
+
current_aslot: number;
|
|
701
|
+
recent_slots_filled: string;
|
|
702
|
+
participation_count: number;
|
|
703
|
+
last_irreversible_block_num: number;
|
|
704
|
+
vote_power_reserve_rate: number;
|
|
705
|
+
delegation_return_period: number;
|
|
706
|
+
reverse_auction_seconds: number;
|
|
707
|
+
available_account_subsidies: number;
|
|
708
|
+
sbd_stop_percent: number;
|
|
709
|
+
sbd_start_percent: number;
|
|
710
|
+
next_maintenance_time: string;
|
|
711
|
+
last_budget_time: string;
|
|
712
|
+
content_reward_percent: number;
|
|
713
|
+
vesting_reward_percent: number;
|
|
714
|
+
sps_fund_percent: number;
|
|
715
|
+
sps_interval_ledger: Asset | string;
|
|
716
|
+
downvote_pool_percent: number;
|
|
717
|
+
}
|
|
718
|
+
export interface VestingDelegation {
|
|
719
|
+
id: number;
|
|
720
|
+
delegator: string;
|
|
721
|
+
delegatee: string;
|
|
722
|
+
vesting_shares: Asset | string;
|
|
723
|
+
min_delegation_time: string;
|
|
724
|
+
}
|
|
594
725
|
export interface BlockTransaction extends TransactionType {
|
|
595
726
|
operations: Operation[];
|
|
596
727
|
transaction_id: string;
|
|
@@ -968,7 +1099,7 @@ interface WalletAccount extends StakeAccount {
|
|
|
968
1099
|
type AccountInput = string | StakeAccount;
|
|
969
1100
|
/** Account name, or an object from `rc_api.find_rc_accounts` */
|
|
970
1101
|
type RCAccountInput = string | RCAccount;
|
|
971
|
-
interface Manabar {
|
|
1102
|
+
interface Manabar$1 {
|
|
972
1103
|
/** Current mana, regenerated to now */
|
|
973
1104
|
current: number;
|
|
974
1105
|
max: number;
|
|
@@ -996,11 +1127,11 @@ declare const spToVests: (sp: number | AssetInput) => Promise<number>;
|
|
|
996
1127
|
*/
|
|
997
1128
|
declare const getEffectiveVests: (account: AccountInput) => Promise<number>;
|
|
998
1129
|
/** Upvote mana ("voting power") of an account at `now` (ms) */
|
|
999
|
-
declare const getVotingMana: (account: AccountInput, now?: number) => Promise<Manabar>;
|
|
1130
|
+
declare const getVotingMana: (account: AccountInput, now?: number) => Promise<Manabar$1>;
|
|
1000
1131
|
/** Downvote mana of an account at `now` (ms) */
|
|
1001
|
-
declare const getDownvoteMana: (account: AccountInput, now?: number) => Promise<Manabar>;
|
|
1132
|
+
declare const getDownvoteMana: (account: AccountInput, now?: number) => Promise<Manabar$1>;
|
|
1002
1133
|
/** Resource credits of an account at `now` (ms) */
|
|
1003
|
-
declare const getRCMana: (account: RCAccountInput, now?: number) => Promise<Manabar>;
|
|
1134
|
+
declare const getRCMana: (account: RCAccountInput, now?: number) => Promise<Manabar$1>;
|
|
1004
1135
|
/**
|
|
1005
1136
|
* rshares a vote adds to a post. `weight` is -10000 to 10000 (-100% to 100%).
|
|
1006
1137
|
*/
|
|
@@ -1072,7 +1203,7 @@ declare const subscribe: (account: string, community: string) => CustomJson;
|
|
|
1072
1203
|
/** `account` unsubscribes from a community */
|
|
1073
1204
|
declare const unsubscribe: (account: string, community: string) => CustomJson;
|
|
1074
1205
|
declare namespace utils_d_exports {
|
|
1075
|
-
export { AccountInput, AssetInput, Manabar, ManabarInput, RCAccount, RCAccountInput, StakeAccount, WalletAccount, WitnessProps$1 as WitnessProps, blacklist, buildWitnessSetProperties, createPassword, createPermlink, equalBytes, estimateAccountValue, follow, followBlacklist, followMuted, formatReputation, generateKeys, getDownvoteMana, getEffectiveVests, getRCMana, getSbdApr, getSpApr, getVoteRShares, getVoteValue, getVotingMana, isValidPublicKey, isValidWif, makeBitMaskFilter, mute, operations, parseAsset, reblog, rsharesToSBD, sbdToSteem, spToVests, steemToSbd, subscribe, unblacklist, unfollow, unfollowBlacklist, unfollowMuted, unmute, unsubscribe, validateUsername, vestsToSP };
|
|
1206
|
+
export { AccountInput, AssetInput, Manabar$1 as Manabar, ManabarInput, RCAccount, RCAccountInput, StakeAccount, WalletAccount, WitnessProps$1 as WitnessProps, blacklist, buildWitnessSetProperties, createPassword, createPermlink, equalBytes, estimateAccountValue, follow, followBlacklist, followMuted, formatReputation, generateKeys, getDownvoteMana, getEffectiveVests, getRCMana, getSbdApr, getSpApr, getVoteRShares, getVoteValue, getVotingMana, isValidPublicKey, isValidWif, makeBitMaskFilter, mute, operations, parseAsset, reblog, rsharesToSBD, sbdToSteem, spToVests, steemToSbd, subscribe, unblacklist, unfollow, unfollowBlacklist, unfollowMuted, unmute, unsubscribe, validateUsername, vestsToSP };
|
|
1076
1207
|
}
|
|
1077
1208
|
/** Constant-time comparison of two Uint8Arrays to prevent timing attacks */
|
|
1078
1209
|
declare const equalBytes: (a: Uint8Array, b: Uint8Array) => boolean;
|
|
@@ -1201,4 +1332,55 @@ declare const buildWitnessSetProperties: (owner: string, props: WitnessProps$1)
|
|
|
1201
1332
|
* Without a title (e.g. for replies), returns only the random part.
|
|
1202
1333
|
*/
|
|
1203
1334
|
declare const createPermlink: (title?: string) => string;
|
|
1204
|
-
|
|
1335
|
+
interface ClientOptions {
|
|
1336
|
+
timeout?: number;
|
|
1337
|
+
retry?: number;
|
|
1338
|
+
chainId?: string;
|
|
1339
|
+
addressPrefix?: string;
|
|
1340
|
+
}
|
|
1341
|
+
export declare class DatabaseAPI {
|
|
1342
|
+
private client;
|
|
1343
|
+
constructor(client: Client);
|
|
1344
|
+
/**
|
|
1345
|
+
* Return extended accounts by username list.
|
|
1346
|
+
*/
|
|
1347
|
+
getAccounts(names: string[]): Promise<ExtendedAccount[]>;
|
|
1348
|
+
/**
|
|
1349
|
+
* Return dynamic global properties.
|
|
1350
|
+
*/
|
|
1351
|
+
getDynamicGlobalProperties(): Promise<DynamicGlobalProperties>;
|
|
1352
|
+
/**
|
|
1353
|
+
* Return active vesting delegations from an account.
|
|
1354
|
+
*/
|
|
1355
|
+
getVestingDelegations(account: string, from?: string, limit?: number): Promise<VestingDelegation[]>;
|
|
1356
|
+
/**
|
|
1357
|
+
* Generic database/condenser_api call.
|
|
1358
|
+
*/
|
|
1359
|
+
call<T = any>(method: string, params?: any[] | object): Promise<T>;
|
|
1360
|
+
}
|
|
1361
|
+
export declare class BroadcastAPI {
|
|
1362
|
+
private client;
|
|
1363
|
+
constructor(client: Client);
|
|
1364
|
+
/**
|
|
1365
|
+
* Sign and broadcast a list of operations with private key(s).
|
|
1366
|
+
*/
|
|
1367
|
+
sendOperations(operations: Operation[], key: PrivateKey | PrivateKey[]): Promise<BroadcastResult>;
|
|
1368
|
+
/**
|
|
1369
|
+
* Sign a transaction object with private key (compatibility wrapper).
|
|
1370
|
+
*/
|
|
1371
|
+
sign(transaction: any, key: PrivateKey | PrivateKey[]): any;
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* High-level Steem RPC client providing familiar database and broadcast namespaces.
|
|
1375
|
+
*/
|
|
1376
|
+
export declare class Client {
|
|
1377
|
+
readonly database: DatabaseAPI;
|
|
1378
|
+
readonly broadcast: BroadcastAPI;
|
|
1379
|
+
timeout: number;
|
|
1380
|
+
constructor(address?: string | string[], options?: ClientOptions);
|
|
1381
|
+
/**
|
|
1382
|
+
* Call any API method directly (e.g. client.call('condenser_api', 'get_accounts', [['steemit']]))
|
|
1383
|
+
*/
|
|
1384
|
+
call<T = any>(api: string, method: string, params?: any[] | object): Promise<T>;
|
|
1385
|
+
}
|
|
1386
|
+
export { type ClientOptions, type TransactionOptions, utils_d_exports as utils };
|
package/dist/index.d.mts
CHANGED
|
@@ -228,6 +228,7 @@ export interface Authority {
|
|
|
228
228
|
account_auths: Array<[string, number]>;
|
|
229
229
|
key_auths: Array<[string | PublicKey, number]>;
|
|
230
230
|
}
|
|
231
|
+
export type AuthorityType = Authority;
|
|
231
232
|
export interface Beneficiary {
|
|
232
233
|
account: string;
|
|
233
234
|
weight: number;
|
|
@@ -236,6 +237,10 @@ export interface Price {
|
|
|
236
237
|
base: Asset | string;
|
|
237
238
|
quote: Asset | string;
|
|
238
239
|
}
|
|
240
|
+
export type PriceType = Price | {
|
|
241
|
+
base: string | Asset;
|
|
242
|
+
quote: string | Asset;
|
|
243
|
+
};
|
|
239
244
|
export interface ChainProperties {
|
|
240
245
|
account_creation_fee: Asset | string;
|
|
241
246
|
maximum_block_size: number;
|
|
@@ -591,6 +596,132 @@ export interface TransactionType {
|
|
|
591
596
|
ref_block_prefix: number;
|
|
592
597
|
signatures: string[];
|
|
593
598
|
}
|
|
599
|
+
export type SignedTransaction = TransactionType;
|
|
600
|
+
export interface Manabar {
|
|
601
|
+
current_mana: string | number;
|
|
602
|
+
last_update_time: number;
|
|
603
|
+
}
|
|
604
|
+
export interface Account {
|
|
605
|
+
id: number;
|
|
606
|
+
name: string;
|
|
607
|
+
owner: Authority;
|
|
608
|
+
active: Authority;
|
|
609
|
+
posting: Authority;
|
|
610
|
+
memo_key: string;
|
|
611
|
+
json_metadata: string;
|
|
612
|
+
posting_json_metadata?: string;
|
|
613
|
+
proxy: string;
|
|
614
|
+
last_owner_update: string;
|
|
615
|
+
last_account_update: string;
|
|
616
|
+
created: string;
|
|
617
|
+
mined: boolean;
|
|
618
|
+
recovery_account: string;
|
|
619
|
+
reset_account: string;
|
|
620
|
+
last_account_recovery: string;
|
|
621
|
+
comment_count: number;
|
|
622
|
+
lifetime_vote_count: number;
|
|
623
|
+
post_count: number;
|
|
624
|
+
can_vote: boolean;
|
|
625
|
+
voting_power: number;
|
|
626
|
+
last_vote_time: string;
|
|
627
|
+
voting_manabar: Manabar;
|
|
628
|
+
downvote_manabar?: Manabar;
|
|
629
|
+
balance: Asset | string;
|
|
630
|
+
savings_balance: Asset | string;
|
|
631
|
+
sbd_balance: Asset | string;
|
|
632
|
+
sbd_seconds: string;
|
|
633
|
+
sbd_seconds_last_update: string;
|
|
634
|
+
sbd_last_interest_payment: string;
|
|
635
|
+
savings_sbd_balance: Asset | string;
|
|
636
|
+
savings_sbd_seconds: string;
|
|
637
|
+
savings_sbd_seconds_last_update: string;
|
|
638
|
+
savings_sbd_last_interest_payment: string;
|
|
639
|
+
savings_withdraw_requests: number;
|
|
640
|
+
reward_sbd_balance: Asset | string;
|
|
641
|
+
reward_steem_balance: Asset | string;
|
|
642
|
+
reward_vesting_balance: Asset | string;
|
|
643
|
+
reward_vesting_steem: Asset | string;
|
|
644
|
+
curation_rewards: number | string;
|
|
645
|
+
posting_rewards: number | string;
|
|
646
|
+
vesting_shares: Asset | string;
|
|
647
|
+
delegated_vesting_shares: Asset | string;
|
|
648
|
+
received_vesting_shares: Asset | string;
|
|
649
|
+
vesting_withdraw_rate: Asset | string;
|
|
650
|
+
next_vesting_withdrawal: string;
|
|
651
|
+
withdrawn: number | string;
|
|
652
|
+
to_withdraw: number | string;
|
|
653
|
+
withdraw_routes: number;
|
|
654
|
+
proxied_vsf_votes: number[];
|
|
655
|
+
witnesses_voted_for: number;
|
|
656
|
+
last_post: string;
|
|
657
|
+
last_root_post: string;
|
|
658
|
+
pending_claimed_accounts?: number;
|
|
659
|
+
}
|
|
660
|
+
export interface ExtendedAccount extends Account {
|
|
661
|
+
vesting_balance: Asset | string;
|
|
662
|
+
reputation: string | number;
|
|
663
|
+
transfer_history: any[];
|
|
664
|
+
market_history: any[];
|
|
665
|
+
post_history: any[];
|
|
666
|
+
vote_history: any[];
|
|
667
|
+
other_history: any[];
|
|
668
|
+
witness_votes: string[];
|
|
669
|
+
tags_usage: string[];
|
|
670
|
+
guest_bloggers: string[];
|
|
671
|
+
open_orders?: any[];
|
|
672
|
+
comments?: any[];
|
|
673
|
+
blog?: any[];
|
|
674
|
+
feed?: any[];
|
|
675
|
+
recent_replies?: any[];
|
|
676
|
+
recommended?: any[];
|
|
677
|
+
}
|
|
678
|
+
export interface DynamicGlobalProperties {
|
|
679
|
+
head_block_number: number;
|
|
680
|
+
head_block_id: string;
|
|
681
|
+
time: string;
|
|
682
|
+
current_witness: string;
|
|
683
|
+
total_pow: number;
|
|
684
|
+
num_pow_witnesses: number;
|
|
685
|
+
virtual_supply: Asset | string;
|
|
686
|
+
current_supply: Asset | string;
|
|
687
|
+
confidential_supply: Asset | string;
|
|
688
|
+
current_sbd_supply: Asset | string;
|
|
689
|
+
confidential_sbd_supply: Asset | string;
|
|
690
|
+
total_vesting_fund_steem: Asset | string;
|
|
691
|
+
total_vesting_shares: Asset | string;
|
|
692
|
+
total_reward_fund_steem: Asset | string;
|
|
693
|
+
total_reward_shares2: string;
|
|
694
|
+
pending_rewarded_vesting_shares: Asset | string;
|
|
695
|
+
pending_rewarded_vesting_steem: Asset | string;
|
|
696
|
+
sbd_interest_rate: number;
|
|
697
|
+
sbd_print_rate: number;
|
|
698
|
+
maximum_block_size: number;
|
|
699
|
+
required_actions_partition_percent: number;
|
|
700
|
+
current_aslot: number;
|
|
701
|
+
recent_slots_filled: string;
|
|
702
|
+
participation_count: number;
|
|
703
|
+
last_irreversible_block_num: number;
|
|
704
|
+
vote_power_reserve_rate: number;
|
|
705
|
+
delegation_return_period: number;
|
|
706
|
+
reverse_auction_seconds: number;
|
|
707
|
+
available_account_subsidies: number;
|
|
708
|
+
sbd_stop_percent: number;
|
|
709
|
+
sbd_start_percent: number;
|
|
710
|
+
next_maintenance_time: string;
|
|
711
|
+
last_budget_time: string;
|
|
712
|
+
content_reward_percent: number;
|
|
713
|
+
vesting_reward_percent: number;
|
|
714
|
+
sps_fund_percent: number;
|
|
715
|
+
sps_interval_ledger: Asset | string;
|
|
716
|
+
downvote_pool_percent: number;
|
|
717
|
+
}
|
|
718
|
+
export interface VestingDelegation {
|
|
719
|
+
id: number;
|
|
720
|
+
delegator: string;
|
|
721
|
+
delegatee: string;
|
|
722
|
+
vesting_shares: Asset | string;
|
|
723
|
+
min_delegation_time: string;
|
|
724
|
+
}
|
|
594
725
|
export interface BlockTransaction extends TransactionType {
|
|
595
726
|
operations: Operation[];
|
|
596
727
|
transaction_id: string;
|
|
@@ -968,7 +1099,7 @@ interface WalletAccount extends StakeAccount {
|
|
|
968
1099
|
type AccountInput = string | StakeAccount;
|
|
969
1100
|
/** Account name, or an object from `rc_api.find_rc_accounts` */
|
|
970
1101
|
type RCAccountInput = string | RCAccount;
|
|
971
|
-
interface Manabar {
|
|
1102
|
+
interface Manabar$1 {
|
|
972
1103
|
/** Current mana, regenerated to now */
|
|
973
1104
|
current: number;
|
|
974
1105
|
max: number;
|
|
@@ -996,11 +1127,11 @@ declare const spToVests: (sp: number | AssetInput) => Promise<number>;
|
|
|
996
1127
|
*/
|
|
997
1128
|
declare const getEffectiveVests: (account: AccountInput) => Promise<number>;
|
|
998
1129
|
/** Upvote mana ("voting power") of an account at `now` (ms) */
|
|
999
|
-
declare const getVotingMana: (account: AccountInput, now?: number) => Promise<Manabar>;
|
|
1130
|
+
declare const getVotingMana: (account: AccountInput, now?: number) => Promise<Manabar$1>;
|
|
1000
1131
|
/** Downvote mana of an account at `now` (ms) */
|
|
1001
|
-
declare const getDownvoteMana: (account: AccountInput, now?: number) => Promise<Manabar>;
|
|
1132
|
+
declare const getDownvoteMana: (account: AccountInput, now?: number) => Promise<Manabar$1>;
|
|
1002
1133
|
/** Resource credits of an account at `now` (ms) */
|
|
1003
|
-
declare const getRCMana: (account: RCAccountInput, now?: number) => Promise<Manabar>;
|
|
1134
|
+
declare const getRCMana: (account: RCAccountInput, now?: number) => Promise<Manabar$1>;
|
|
1004
1135
|
/**
|
|
1005
1136
|
* rshares a vote adds to a post. `weight` is -10000 to 10000 (-100% to 100%).
|
|
1006
1137
|
*/
|
|
@@ -1072,7 +1203,7 @@ declare const subscribe: (account: string, community: string) => CustomJson;
|
|
|
1072
1203
|
/** `account` unsubscribes from a community */
|
|
1073
1204
|
declare const unsubscribe: (account: string, community: string) => CustomJson;
|
|
1074
1205
|
declare namespace utils_d_exports {
|
|
1075
|
-
export { AccountInput, AssetInput, Manabar, ManabarInput, RCAccount, RCAccountInput, StakeAccount, WalletAccount, WitnessProps$1 as WitnessProps, blacklist, buildWitnessSetProperties, createPassword, createPermlink, equalBytes, estimateAccountValue, follow, followBlacklist, followMuted, formatReputation, generateKeys, getDownvoteMana, getEffectiveVests, getRCMana, getSbdApr, getSpApr, getVoteRShares, getVoteValue, getVotingMana, isValidPublicKey, isValidWif, makeBitMaskFilter, mute, operations, parseAsset, reblog, rsharesToSBD, sbdToSteem, spToVests, steemToSbd, subscribe, unblacklist, unfollow, unfollowBlacklist, unfollowMuted, unmute, unsubscribe, validateUsername, vestsToSP };
|
|
1206
|
+
export { AccountInput, AssetInput, Manabar$1 as Manabar, ManabarInput, RCAccount, RCAccountInput, StakeAccount, WalletAccount, WitnessProps$1 as WitnessProps, blacklist, buildWitnessSetProperties, createPassword, createPermlink, equalBytes, estimateAccountValue, follow, followBlacklist, followMuted, formatReputation, generateKeys, getDownvoteMana, getEffectiveVests, getRCMana, getSbdApr, getSpApr, getVoteRShares, getVoteValue, getVotingMana, isValidPublicKey, isValidWif, makeBitMaskFilter, mute, operations, parseAsset, reblog, rsharesToSBD, sbdToSteem, spToVests, steemToSbd, subscribe, unblacklist, unfollow, unfollowBlacklist, unfollowMuted, unmute, unsubscribe, validateUsername, vestsToSP };
|
|
1076
1207
|
}
|
|
1077
1208
|
/** Constant-time comparison of two Uint8Arrays to prevent timing attacks */
|
|
1078
1209
|
declare const equalBytes: (a: Uint8Array, b: Uint8Array) => boolean;
|
|
@@ -1201,4 +1332,55 @@ declare const buildWitnessSetProperties: (owner: string, props: WitnessProps$1)
|
|
|
1201
1332
|
* Without a title (e.g. for replies), returns only the random part.
|
|
1202
1333
|
*/
|
|
1203
1334
|
declare const createPermlink: (title?: string) => string;
|
|
1204
|
-
|
|
1335
|
+
interface ClientOptions {
|
|
1336
|
+
timeout?: number;
|
|
1337
|
+
retry?: number;
|
|
1338
|
+
chainId?: string;
|
|
1339
|
+
addressPrefix?: string;
|
|
1340
|
+
}
|
|
1341
|
+
export declare class DatabaseAPI {
|
|
1342
|
+
private client;
|
|
1343
|
+
constructor(client: Client);
|
|
1344
|
+
/**
|
|
1345
|
+
* Return extended accounts by username list.
|
|
1346
|
+
*/
|
|
1347
|
+
getAccounts(names: string[]): Promise<ExtendedAccount[]>;
|
|
1348
|
+
/**
|
|
1349
|
+
* Return dynamic global properties.
|
|
1350
|
+
*/
|
|
1351
|
+
getDynamicGlobalProperties(): Promise<DynamicGlobalProperties>;
|
|
1352
|
+
/**
|
|
1353
|
+
* Return active vesting delegations from an account.
|
|
1354
|
+
*/
|
|
1355
|
+
getVestingDelegations(account: string, from?: string, limit?: number): Promise<VestingDelegation[]>;
|
|
1356
|
+
/**
|
|
1357
|
+
* Generic database/condenser_api call.
|
|
1358
|
+
*/
|
|
1359
|
+
call<T = any>(method: string, params?: any[] | object): Promise<T>;
|
|
1360
|
+
}
|
|
1361
|
+
export declare class BroadcastAPI {
|
|
1362
|
+
private client;
|
|
1363
|
+
constructor(client: Client);
|
|
1364
|
+
/**
|
|
1365
|
+
* Sign and broadcast a list of operations with private key(s).
|
|
1366
|
+
*/
|
|
1367
|
+
sendOperations(operations: Operation[], key: PrivateKey | PrivateKey[]): Promise<BroadcastResult>;
|
|
1368
|
+
/**
|
|
1369
|
+
* Sign a transaction object with private key (compatibility wrapper).
|
|
1370
|
+
*/
|
|
1371
|
+
sign(transaction: any, key: PrivateKey | PrivateKey[]): any;
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* High-level Steem RPC client providing familiar database and broadcast namespaces.
|
|
1375
|
+
*/
|
|
1376
|
+
export declare class Client {
|
|
1377
|
+
readonly database: DatabaseAPI;
|
|
1378
|
+
readonly broadcast: BroadcastAPI;
|
|
1379
|
+
timeout: number;
|
|
1380
|
+
constructor(address?: string | string[], options?: ClientOptions);
|
|
1381
|
+
/**
|
|
1382
|
+
* Call any API method directly (e.g. client.call('condenser_api', 'get_accounts', [['steemit']]))
|
|
1383
|
+
*/
|
|
1384
|
+
call<T = any>(api: string, method: string, params?: any[] | object): Promise<T>;
|
|
1385
|
+
}
|
|
1386
|
+
export { type ClientOptions, type TransactionOptions, utils_d_exports as utils };
|
package/dist/index.mjs
CHANGED
|
@@ -5321,4 +5321,67 @@ const Memo = {
|
|
|
5321
5321
|
encode,
|
|
5322
5322
|
encodeForAccount
|
|
5323
5323
|
};
|
|
5324
|
-
|
|
5324
|
+
// src/Client.ts
|
|
5325
|
+
var DatabaseAPI = class {
|
|
5326
|
+
client;
|
|
5327
|
+
constructor(client) {
|
|
5328
|
+
this.client = client;
|
|
5329
|
+
}
|
|
5330
|
+
async getAccounts(names) {
|
|
5331
|
+
return callRPC("condenser_api.get_accounts", [names], this.client.timeout);
|
|
5332
|
+
}
|
|
5333
|
+
async getDynamicGlobalProperties() {
|
|
5334
|
+
return callRPC("condenser_api.get_dynamic_global_properties", [], this.client.timeout);
|
|
5335
|
+
}
|
|
5336
|
+
async getVestingDelegations(account, from = "", limit = 1e3) {
|
|
5337
|
+
return callRPC("condenser_api.get_vesting_delegations", [
|
|
5338
|
+
account,
|
|
5339
|
+
from,
|
|
5340
|
+
limit
|
|
5341
|
+
], this.client.timeout);
|
|
5342
|
+
}
|
|
5343
|
+
async call(method, params = []) {
|
|
5344
|
+
return callRPC(method, params, this.client.timeout);
|
|
5345
|
+
}
|
|
5346
|
+
};
|
|
5347
|
+
var BroadcastAPI = class {
|
|
5348
|
+
client;
|
|
5349
|
+
constructor(client) {
|
|
5350
|
+
this.client = client;
|
|
5351
|
+
}
|
|
5352
|
+
async sendOperations(operations, key) {
|
|
5353
|
+
const tx = new Transaction();
|
|
5354
|
+
await tx.create(operations);
|
|
5355
|
+
const keys = Array.isArray(key) ? key : [key];
|
|
5356
|
+
for (const k of keys) tx.sign(k);
|
|
5357
|
+
return tx.broadcast();
|
|
5358
|
+
}
|
|
5359
|
+
sign(transaction, key) {
|
|
5360
|
+
const tx = new Transaction(transaction);
|
|
5361
|
+
const keys = Array.isArray(key) ? key : [key];
|
|
5362
|
+
for (const k of keys) tx.sign(k);
|
|
5363
|
+
return tx.transaction;
|
|
5364
|
+
}
|
|
5365
|
+
};
|
|
5366
|
+
var Client = class {
|
|
5367
|
+
database;
|
|
5368
|
+
broadcast;
|
|
5369
|
+
timeout;
|
|
5370
|
+
constructor(address, options = {}) {
|
|
5371
|
+
if (address) {
|
|
5372
|
+
if (Array.isArray(address)) config.nodes = address;
|
|
5373
|
+
else config.nodes = [address];
|
|
5374
|
+
}
|
|
5375
|
+
if (options.timeout) this.timeout = options.timeout;
|
|
5376
|
+
else this.timeout = config.timeout;
|
|
5377
|
+
if (options.chainId) config.chain_id = options.chainId;
|
|
5378
|
+
if (options.addressPrefix) config.address_prefix = options.addressPrefix;
|
|
5379
|
+
this.database = new DatabaseAPI(this);
|
|
5380
|
+
this.broadcast = new BroadcastAPI(this);
|
|
5381
|
+
}
|
|
5382
|
+
async call(api, method, params = []) {
|
|
5383
|
+
const fullMethod = api ? `${api}.${method}` : method;
|
|
5384
|
+
return callRPC(fullMethod, params, this.timeout);
|
|
5385
|
+
}
|
|
5386
|
+
};
|
|
5387
|
+
export { Asset, BroadcastAPI, Client, DatabaseAPI, Memo, PrivateKey, PublicKey, RPCError, Signature, Transaction, call, callREST, callRPC, callRPCBatch, callWithQuorum, config, streamBlockNumbers, streamBlocks, streamOperations, utils_exports as utils };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@substeem/steem-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Lightweight and complete TypeScript SDK for Steem blockchain operations. Create, sign, and broadcast transactions with full type safety, cryptographic utilities, and serialization support.",
|
|
5
5
|
"author": "Substeem",
|
|
6
6
|
"license": "MIT",
|