@iotexproject/kit 0.2.12 → 0.2.14

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 (2) hide show
  1. package/dist/index.d.ts +349 -140
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  import { RouteConfig } from '@asteasolutions/zod-to-openapi';
4
4
  import { BentoCache, bentostore } from 'bentocache';
5
5
  import DataLoader from 'dataloader';
6
+ import { Dayjs } from 'dayjs';
6
7
  import postgres from 'postgres';
7
8
  import { PickByValue } from 'utility-types';
8
9
  import { z } from 'zod';
@@ -7059,11 +7060,6 @@ declare class Staking {
7059
7060
  getDelegateByName(args: {
7060
7061
  delegateName: string;
7061
7062
  }, ctx?: ConfigContext): Promise<CandidateV4>;
7062
- upsertRewardDistribution(args: {
7063
- foundationRewardPortion: number;
7064
- epochRewardPortion: number;
7065
- blockRewardPortion: number;
7066
- }, ctx?: ConfigContext): Promise<any>;
7067
7063
  getRewardDistribution(args: {
7068
7064
  ownerAddress: `0x${string}` | `io${string}`;
7069
7065
  }, ctx?: ConfigContext): Promise<{
@@ -7114,125 +7110,8 @@ declare class utils {
7114
7110
  ];
7115
7111
  }>>;
7116
7112
  }
7117
- export interface IoTexMarketData {
7118
- id: string;
7119
- symbol: string;
7120
- name: string;
7121
- image: string;
7122
- current_price: number;
7123
- market_cap: number;
7124
- market_cap_rank: number;
7125
- fully_diluted_valuation: number;
7126
- total_volume: number;
7127
- high_24h: number;
7128
- low_24h: number;
7129
- price_change_24h: number;
7130
- price_change_percentage_24h: number;
7131
- market_cap_change_24h: number;
7132
- market_cap_change_percentage_24h: number;
7133
- circulating_supply: number;
7134
- total_supply: number;
7135
- max_supply: number;
7136
- ath: number;
7137
- ath_change_percentage: number;
7138
- ath_date: string;
7139
- atl: number;
7140
- atl_change_percentage: number;
7141
- atl_date: string;
7142
- roi?: any;
7143
- last_updated: string;
7144
- }
7145
- export interface DappCategory {
7146
- id: number;
7147
- name: string;
7148
- order: number;
7149
- }
7150
- export interface Dapp {
7151
- id: string;
7152
- chains: string;
7153
- content: string;
7154
- content_cn: string;
7155
- img_url: string;
7156
- popularity: string;
7157
- source_priority: number;
7158
- tags: string;
7159
- title: string;
7160
- url: string;
7161
- weight: number;
7162
- }
7163
- export interface EcosystemDapp {
7164
- date: string;
7165
- id: string;
7166
- logo: string;
7167
- slug: string;
7168
- status: string;
7169
- tag: string;
7170
- telegram: string;
7171
- title: string;
7172
- twitter: string;
7173
- website: string;
7174
- }
7175
7113
  declare class UseHub {
7176
7114
  constructor();
7177
- rewardSummary(args: {
7178
- address: string;
7179
- start_date?: string;
7180
- end_date?: string;
7181
- }): Promise<{
7182
- RewardRecord_aggregate: {
7183
- aggregate: {
7184
- sum: {
7185
- total_reward_delta: number;
7186
- burndrop_reward_delta: number;
7187
- hermes_reward_delta: number;
7188
- apy: number;
7189
- };
7190
- };
7191
- };
7192
- KV: [
7193
- {
7194
- value: string;
7195
- }
7196
- ];
7197
- }>;
7198
- rewardDistribute(args: {
7199
- address: string;
7200
- start_date?: string;
7201
- end_date?: string;
7202
- }): Promise<{
7203
- RewardRecord: {
7204
- total_reward_delta: number;
7205
- burndrop_reward_delta: number;
7206
- hermes_reward_delta: number;
7207
- date: string;
7208
- }[];
7209
- }>;
7210
- stakingReward(args: {
7211
- address: string;
7212
- start_date?: string;
7213
- end_date?: string;
7214
- }): Promise<{
7215
- stakingRewardHistory: {
7216
- total_reward_delta: string;
7217
- date: string;
7218
- }[];
7219
- stakingRewardSum: number;
7220
- error?: undefined;
7221
- } | {
7222
- error: unknown;
7223
- stakingRewardHistory?: undefined;
7224
- stakingRewardSum?: undefined;
7225
- }>;
7226
- userDashboard({ limit }: {
7227
- limit: number;
7228
- }): Promise<{
7229
- blogs: import("@tryghost/content-api").PostsOrPages;
7230
- marketData: IoTexMarketData;
7231
- }>;
7232
- twitter({ pageNo, pageSize }?: {
7233
- pageNo: number;
7234
- pageSize: number;
7235
- }): Promise<any>;
7236
7115
  assets(): Promise<any[] | {
7237
7116
  error: unknown;
7238
7117
  }>;
@@ -7247,24 +7126,6 @@ declare class UseHub {
7247
7126
  } | {
7248
7127
  error: unknown;
7249
7128
  }>;
7250
- explore(): Promise<{
7251
- dappList: Dapp[];
7252
- dappCategory: DappCategory[];
7253
- } | {
7254
- error: any;
7255
- }>;
7256
- ecosystem(): Promise<{
7257
- dappList: EcosystemDapp[];
7258
- tags: string[];
7259
- } | {
7260
- error: any;
7261
- }>;
7262
- ecosystemv2(): Promise<{
7263
- dappList: EcosystemDapp[];
7264
- tags: string[];
7265
- } | {
7266
- error: any;
7267
- }>;
7268
7129
  }
7269
7130
  declare class Health {
7270
7131
  check(): {
@@ -8760,6 +8621,7 @@ declare class BaseDBModule {
8760
8621
  microServiceCenter: ReturnType<typeof postgres>;
8761
8622
  dao: ReturnType<typeof postgres>;
8762
8623
  nsv3db: ReturnType<typeof postgres>;
8624
+ nsv3dbTest: ReturnType<typeof postgres>;
8763
8625
  cache: ReturnType<typeof bento.namespace>;
8764
8626
  constructor();
8765
8627
  checkAuth(key: string): Promise<{
@@ -8990,6 +8852,17 @@ declare class Staking$1 extends BaseDBModule {
8990
8852
  total: number;
8991
8853
  };
8992
8854
  }>;
8855
+ getStakingHistory({ ownerAddress, page, limit }: {
8856
+ ownerAddress: string;
8857
+ page: number;
8858
+ limit: number;
8859
+ }): Promise<{
8860
+ status: string;
8861
+ data: {
8862
+ data: import("postgres").Row[] & Iterable<import("postgres").Row> & import("postgres").ResultQueryMeta<number, string | number>;
8863
+ total: number;
8864
+ };
8865
+ }>;
8993
8866
  }
8994
8867
  export type ComponentType = "banner-latest" | "token-2049";
8995
8868
  export interface ComponentData {
@@ -9222,6 +9095,7 @@ export type Proposal = {
9222
9095
  title: string;
9223
9096
  content: string;
9224
9097
  status: string;
9098
+ repo_status?: string | null;
9225
9099
  total_vote_weight?: number;
9226
9100
  voter_count?: number;
9227
9101
  yes_vote_count?: number;
@@ -9241,6 +9115,50 @@ export type Proposal = {
9241
9115
  vote_count?: string | null;
9242
9116
  vote_result?: "passed" | "rejected" | "closed" | null;
9243
9117
  };
9118
+ export type ProposalV2 = {
9119
+ id: number;
9120
+ iip_key: string;
9121
+ iip_number: number | null;
9122
+ title: string | null;
9123
+ slug: string;
9124
+ content: string;
9125
+ repo_status: string | null;
9126
+ governance_status: string | null;
9127
+ created_at: string;
9128
+ updated_at: string;
9129
+ created_date: string | null;
9130
+ synced_at: string;
9131
+ authors: string | null;
9132
+ type: string | null;
9133
+ category: string | null;
9134
+ discussions_to: string | null;
9135
+ abstract: string | null;
9136
+ source_url: string;
9137
+ total_vote_weight?: number | null;
9138
+ voter_count?: number | null;
9139
+ yes_vote_count?: number | null;
9140
+ yes_vote_weight?: number | null;
9141
+ no_vote_count?: number | null;
9142
+ no_vote_weight?: number | null;
9143
+ abstain_vote_count?: number | null;
9144
+ abstain_vote_weight?: number | null;
9145
+ start_time?: string | null;
9146
+ end_time?: string | null;
9147
+ votes?: Vote[];
9148
+ currentUser?: CurrentUser;
9149
+ vote_count?: string | null;
9150
+ vote_result?: "passed" | "rejected" | "closed" | null;
9151
+ };
9152
+ export type IipProposalForVote = {
9153
+ id: number;
9154
+ iip_number: number;
9155
+ title: string | null;
9156
+ slug: string;
9157
+ content: string;
9158
+ governance_status: string | null;
9159
+ start_time: string | null;
9160
+ end_time: string | null;
9161
+ };
9244
9162
  export type CurrentUser = {
9245
9163
  voter?: string;
9246
9164
  is_voted: boolean;
@@ -9288,6 +9206,7 @@ declare class Dao extends BaseDBModule {
9288
9206
  message: string;
9289
9207
  signature: string;
9290
9208
  proposal_id?: number;
9209
+ iip_number?: number;
9291
9210
  proposal_title?: string;
9292
9211
  }): Promise<import("postgres").RowList<import("postgres").Row[]>>;
9293
9212
  createProposal(args: {
@@ -9298,6 +9217,81 @@ declare class Dao extends BaseDBModule {
9298
9217
  start_time: string;
9299
9218
  end_time: string;
9300
9219
  }): Promise<import("postgres").RowList<import("postgres").Row[]>>;
9220
+ syncProposal(args?: {
9221
+ payload?: Record<string, any>;
9222
+ deliveryId?: string;
9223
+ eventName?: string;
9224
+ repoOwner?: string;
9225
+ repoName?: string;
9226
+ ref?: string | null;
9227
+ pathCsv?: string | null;
9228
+ paths?: string[];
9229
+ githubToken?: string | null;
9230
+ useAi?: boolean;
9231
+ dryRun?: boolean;
9232
+ }): Promise<{
9233
+ sourceRepo: string;
9234
+ ref: string;
9235
+ processed: number;
9236
+ dryRun: boolean;
9237
+ rows: {
9238
+ path: string;
9239
+ sha: string;
9240
+ iipKey: string;
9241
+ title: string | null;
9242
+ deleted?: boolean;
9243
+ action: "upserted" | "deleted" | "dry_run";
9244
+ }[];
9245
+ } | {
9246
+ sourceRepo: string;
9247
+ ref: any;
9248
+ deliveryId: string | null;
9249
+ changedPaths: string[];
9250
+ deletedPaths: string[];
9251
+ processed: number;
9252
+ fullSyncTriggered: boolean;
9253
+ dryRun: boolean;
9254
+ rows: {
9255
+ path: string;
9256
+ sha: string;
9257
+ iipKey: string;
9258
+ title: string | null;
9259
+ deleted?: boolean;
9260
+ action: "upserted" | "deleted" | "dry_run";
9261
+ }[];
9262
+ }>;
9263
+ getProposalForVoteV2({ iip_number, proposal_title }: {
9264
+ iip_number?: number;
9265
+ proposal_title?: string;
9266
+ }): Promise<IipProposalForVote>;
9267
+ getDraftProposalList(args: {
9268
+ page: number;
9269
+ pageSize: number;
9270
+ }): Promise<{
9271
+ data: ProposalV2[] & Iterable<ProposalV2> & import("postgres").ResultQueryMeta<number, keyof ProposalV2>;
9272
+ total: number;
9273
+ }>;
9274
+ getProposalListV2(args: {
9275
+ governanceStatus?: string;
9276
+ repoStatus?: string;
9277
+ orderBy?: string;
9278
+ order?: string;
9279
+ page?: number;
9280
+ pageSize?: number;
9281
+ }): Promise<{
9282
+ data: ProposalV2[] & Iterable<ProposalV2> & import("postgres").ResultQueryMeta<number, keyof ProposalV2>;
9283
+ total: number;
9284
+ }>;
9285
+ getVotesByProposalIdV2({ proposal_id, iip_number, }: {
9286
+ proposal_id?: number;
9287
+ iip_number?: number;
9288
+ }): Promise<Vote[]>;
9289
+ getProposalV2({ id, iip_number, voter, title }: {
9290
+ id?: number;
9291
+ iip_number?: number;
9292
+ voter?: string;
9293
+ title?: string;
9294
+ }): Promise<ProposalV2>;
9301
9295
  }
9302
9296
  export type ProfileMeta = {
9303
9297
  name: string;
@@ -9386,7 +9380,24 @@ export type MyProfileListItem = {
9386
9380
  name: string;
9387
9381
  owner_address: string;
9388
9382
  };
9383
+ export type DelegateVote = {
9384
+ staker: string;
9385
+ amount: number;
9386
+ votes: number;
9387
+ duration: number;
9388
+ };
9389
+ export type ServerUpTimeHistory = {
9390
+ date: Date;
9391
+ id: number;
9392
+ temp_eth_address: string;
9393
+ online_time: number;
9394
+ };
9395
+ export type DelegateStatistics = {
9396
+ delegate_count: string;
9397
+ total_amount: string;
9398
+ };
9389
9399
  declare class Delegate$1 extends BaseDBModule {
9400
+ private getNsv3Db;
9390
9401
  upsertCandidateProfile(args: ProfileMeta): Promise<{
9391
9402
  status: string;
9392
9403
  data: {
@@ -9506,6 +9517,202 @@ declare class Delegate$1 extends BaseDBModule {
9506
9517
  status: string;
9507
9518
  data: null;
9508
9519
  }>;
9520
+ getDelegateList(): Promise<{
9521
+ status: string;
9522
+ data: any;
9523
+ }>;
9524
+ getDelegateByName({ name }: {
9525
+ name: string;
9526
+ }): Promise<{
9527
+ status: string;
9528
+ data: any;
9529
+ }>;
9530
+ getDelegateByAddress({ address }: {
9531
+ address: string;
9532
+ }): Promise<{
9533
+ status: string;
9534
+ data: any;
9535
+ }>;
9536
+ getReceivedVotesByAddress({ address }: {
9537
+ address: string;
9538
+ }): Promise<{
9539
+ status: string;
9540
+ data: import("postgres").RowList<DelegateVote[]>;
9541
+ }>;
9542
+ getServerUpTimeHistory({ startDate, endDate, delegate }: {
9543
+ startDate?: string;
9544
+ endDate: string;
9545
+ delegate: string;
9546
+ }): Promise<{
9547
+ status: string;
9548
+ data: import("postgres").RowList<ServerUpTimeHistory[]>;
9549
+ }>;
9550
+ getDelegatesStatistics(): Promise<{
9551
+ status: string;
9552
+ data: DelegateStatistics;
9553
+ }>;
9554
+ getCandidateMetaId({ candidate_owner }: {
9555
+ candidate_owner: string;
9556
+ }): Promise<{
9557
+ status: string;
9558
+ data: number | null;
9559
+ }>;
9560
+ }
9561
+ declare class Block extends BaseDBModule {
9562
+ getBlockByTimestamp(dayjs: Dayjs): Promise<any>;
9563
+ getBlocksInfoByBlocksHeight({ blocksHeight }: {
9564
+ blocksHeight: string[];
9565
+ }): Promise<{
9566
+ status: string;
9567
+ data: import("postgres").RowList<{
9568
+ block_height: string;
9569
+ timestamp: Date;
9570
+ }[]>;
9571
+ }>;
9572
+ getBlockHeight(): Promise<{
9573
+ status: string;
9574
+ data: {
9575
+ block_height: string;
9576
+ timestamp: string;
9577
+ };
9578
+ }>;
9579
+ getChainMeta(): Promise<{
9580
+ status: string;
9581
+ data: {
9582
+ block_height: string;
9583
+ epoch_num: string;
9584
+ };
9585
+ }>;
9586
+ }
9587
+ export interface IoTexMarketData {
9588
+ id: string;
9589
+ symbol: string;
9590
+ name: string;
9591
+ image: string;
9592
+ current_price: number;
9593
+ market_cap: number;
9594
+ market_cap_rank: number;
9595
+ fully_diluted_valuation: number;
9596
+ total_volume: number;
9597
+ high_24h: number;
9598
+ low_24h: number;
9599
+ price_change_24h: number;
9600
+ price_change_percentage_24h: number;
9601
+ market_cap_change_24h: number;
9602
+ market_cap_change_percentage_24h: number;
9603
+ circulating_supply: number;
9604
+ total_supply: string;
9605
+ max_supply: number;
9606
+ ath: number;
9607
+ ath_change_percentage: number;
9608
+ ath_date: string;
9609
+ atl: number;
9610
+ atl_change_percentage: number;
9611
+ atl_date: string;
9612
+ roi?: any;
9613
+ last_updated: string;
9614
+ }
9615
+ export interface EcosystemDapp {
9616
+ date: string;
9617
+ id: string;
9618
+ logo: string;
9619
+ slug: string;
9620
+ status: string;
9621
+ tag: string;
9622
+ telegram: string;
9623
+ title: string;
9624
+ twitter: string;
9625
+ website: string;
9626
+ rank: number;
9627
+ }
9628
+ export interface DappCategory {
9629
+ id: number;
9630
+ name: string;
9631
+ order: number;
9632
+ }
9633
+ export interface Dapp {
9634
+ id: string;
9635
+ chains: string;
9636
+ content: string;
9637
+ content_cn: string;
9638
+ img_url: string;
9639
+ popularity: string;
9640
+ source_priority: number;
9641
+ tags: string;
9642
+ title: string;
9643
+ url: string;
9644
+ weight: number;
9645
+ }
9646
+ declare class Hub extends BaseDBModule {
9647
+ userDashboard({ limit }: {
9648
+ limit: number;
9649
+ }): Promise<{
9650
+ blogs: any[];
9651
+ marketData: IoTexMarketData;
9652
+ }>;
9653
+ ecosystem(): Promise<{
9654
+ dappList: EcosystemDapp[];
9655
+ tags: string[];
9656
+ } | {
9657
+ error: any;
9658
+ }>;
9659
+ ecosystemv2(): Promise<{
9660
+ dappList: EcosystemDapp[];
9661
+ tags: string[];
9662
+ } | {
9663
+ error: any;
9664
+ }>;
9665
+ rewardSummary(args: {
9666
+ address: string;
9667
+ start_date?: string;
9668
+ end_date?: string;
9669
+ }): Promise<{
9670
+ total_reward_delta: number;
9671
+ burndrop_reward_delta: number;
9672
+ hermes_reward_delta: number;
9673
+ apy: number;
9674
+ KV: {
9675
+ value: any;
9676
+ }[];
9677
+ }>;
9678
+ rewardDistribute(args: {
9679
+ address: string;
9680
+ start_date?: string;
9681
+ end_date?: string;
9682
+ }): Promise<{
9683
+ RewardRecord: {
9684
+ total_reward_delta: number;
9685
+ burndrop_reward_delta: number;
9686
+ hermes_reward_delta: number;
9687
+ date: string;
9688
+ }[];
9689
+ }>;
9690
+ stakingReward(args: {
9691
+ address: string;
9692
+ start_date?: string;
9693
+ end_date?: string;
9694
+ }): Promise<{
9695
+ stakingRewardHistory: {
9696
+ total_reward_delta: number;
9697
+ date: string;
9698
+ }[];
9699
+ stakingRewardSum: number;
9700
+ error?: undefined;
9701
+ } | {
9702
+ error: unknown;
9703
+ stakingRewardHistory?: undefined;
9704
+ stakingRewardSum?: undefined;
9705
+ }>;
9706
+ explore(): Promise<{
9707
+ dappList: Dapp[];
9708
+ dappCategory: DappCategory[];
9709
+ } | {
9710
+ error: any;
9711
+ }>;
9712
+ twitter({ pageNo, pageSize }?: {
9713
+ pageNo: number;
9714
+ pageSize: number;
9715
+ }): Promise<any[]>;
9509
9716
  }
9510
9717
  declare const modules$1: {
9511
9718
  account: Account;
@@ -9526,6 +9733,8 @@ declare const modules$1: {
9526
9733
  zkpass: Zkpass;
9527
9734
  dao: Dao;
9528
9735
  delegate: Delegate$1;
9736
+ block: Block;
9737
+ hub: Hub;
9529
9738
  };
9530
9739
  export type DBModuleType = typeof modules$1;
9531
9740
  export interface ConfigOptions {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@iotexproject/kit",
3
3
  "module": "index.ts",
4
4
  "type": "module",
5
- "version": "0.2.12",
5
+ "version": "0.2.14",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {